Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update of a route table clears entries #927

Closed
bitglue opened this issue Feb 4, 2015 · 3 comments · Fixed by #990
Closed

update of a route table clears entries #927

bitglue opened this issue Feb 4, 2015 · 3 comments · Fixed by #990
Assignees

Comments

@bitglue
Copy link

bitglue commented Feb 4, 2015

Given this configuration:

variable "cidr_block" {
    description = "Address range for the VPC in CIDR notation"
}

variable "name" {
    description = "Tag the VPC with this name"
}

variable "description" {
    description = "Tag the VPC with this description"
}

variable "region" {
    description = "AWS region to create in"
    default = "us-east-1"
}

output "vpc_id" {
    value = "${aws_vpc.vpc.id}"
}

output "route_table_id" {
    value = "${aws_route_table.public.id}"
}

provider "aws" {
    region = "${var.region}"
}

resource "aws_vpc" "vpc" {
    cidr_block = "${var.cidr_block}"
    tags {
        Name = "${var.name}"
        Description = "${var.description}"
    }
}

resource "aws_internet_gateway" "gateway" {
    vpc_id = "${aws_vpc.vpc.id}"
}

resource "aws_route_table" "public" {
    vpc_id = "${aws_vpc.vpc.id}"

    route {
        cidr_block = "0.0.0.0/0"
        gateway_id = "${aws_internet_gateway.gateway.id}"
    }

    tags {
        Name = "${var.name}"
    }
}

The first time this is applied, the VPC and route table are created as expected. If var.name is changed, the plan will show each resource being updated in place.

~ aws_route_table.public
    tags.Name: "external-dev" => "public-dev"

~ aws_vpc.vpc
    tags.Name: "external-dev" => "public-dev"

After this update plan is applied, terraform.tfstate will show the route table as having no entries, and terraform plan invoked again (with no variables changed) will show them being re-created:

~ aws_route_table.public
    route.#:                      "0" => "1"
    route.1446131475.cidr_block:  "" => "0.0.0.0/0"
    route.1446131475.gateway_id:  "" => "igw-ebad178e"
    route.1446131475.instance_id: "" => ""

Which it does, but I would not expect the first update to clear the route table's entries.

@mitchellh
Copy link
Contributor

Reproduced. Thanks. Taking a look.

@mitchellh
Copy link
Contributor

Fixed by #990 once it is merged!

@ghost
Copy link

ghost commented May 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators May 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants