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

Terraform erroneously plans to remove routes with origin EnableVgwRoutePropagation. #722

Closed
ojongerius opened this issue Dec 31, 2014 · 1 comment · Fixed by #726
Closed

Comments

@ojongerius
Copy link
Contributor

Context: enabling route propagation from Virtual Gateways is a feature not yet supported by Terraform, that we currently enable, together with some other features, via other scripts.

Ignoring routes with an origin of EnableVgwRoutePropagation in resourceAwsRouteTableRead restores normality.

Test config:

resource "aws_route_table" "foo" {
    vpc_id = "${var.vpc.id}"
    route = {
        cidr_block = "0.0.0.0/0"
        instance_id = "${aws_instance.bar.id}"
    }
}

Running in planning mode without patching resourceAwsRouteTableRead for a route table
consisting of a default route set by Terraform and 3 routes propagated via Virtual Private Gateway vgw-baz.

~ aws_route_table.foo
    route.#:             "4" => "1"
    route.0.cidr_block:  "0.0.0.0/0" => "0.0.0.0/0"
    route.0.gateway_id:  "" => ""
    route.0.instance_id: "i-bar" => "i-bar"
    route.1.cidr_block:  "172.16.0.0/12" => ""
    route.1.gateway_id:  "vgw-baz" => ""
    route.1.instance_id: "" => ""
    route.2.cidr_block:  "192.168.0.0/16" => ""
    route.2.gateway_id:  "vgw-baz" => ""
    route.2.instance_id: "" => ""
    route.3.cidr_block:  "10.0.0.0/8" => ""
    route.3.gateway_id:  "vgw-baz" => ""
    route.3.instance_id: "" => ""

Terraform correctly reports there are no changes after applying the following patch (git diff v0.3.5..ignore_propagated_routes):

diff --git a/builtin/providers/aws/resource_aws_route_table.go b/builtin/providers/aws/resource_aws_route_table.go
index 841e456..71c1cc0 100644
--- a/builtin/providers/aws/resource_aws_route_table.go
+++ b/builtin/providers/aws/resource_aws_route_table.go
@@ -114,6 +114,10 @@ func resourceAwsRouteTableRead(d *schema.ResourceData, meta interface{}) error {
                        continue
                }

+               if r.Origin == "EnableVgwRoutePropagation" {
+                       continue
+               }
+
                m := make(map[string]interface{})
                m["cidr_block"] = r.DestinationCidrBlock
@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.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant