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

provider/aws: aws_main_route_table_association #918

Merged
merged 2 commits into from
Feb 3, 2015

Conversation

phinze
Copy link
Contributor

@phinze phinze commented Feb 3, 2015

This resource allows an existing Route Table to be assigned as the
"main" Route Table of a VPC. This means that the Route Table will be
used for any subnets within the VPC without an explicit Route Table
assigned [1].

This is particularly useful in getting an Internet Gateway in place as
the default for a VPC, since the automatically created Main Route Table
does not have one [2].

Note that this resource is an abstraction over an association and does not
map directly to a CRUD-able object in AWS. In order to retain a coherent
"Delete" operation for this resource, we remember the ID of the AWS-created
Route Table and reset the VPC's main Route Table to it when this
resource is deleted.

refs #843, #748

[1] http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html#RouteTableDetails
[2] http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Internet_Gateway.html#Add_IGW_Routing

This resource allows an existing Route Table to be assigned as the
"main" Route Table of a VPC. This means that the Route Table will be
used for any subnets within the VPC without an explicit Route Table
assigned [1].

This is particularly useful in getting an Internet Gateway in place as
the default for a VPC, since the automatically created Main Route Table
does not have one [2].

Note that this resource is an abstraction over an association and does not
map directly to a CRUD-able object in AWS. In order to retain a coherent
"Delete" operation for this resource, we remember the ID of the AWS-created
Route Table and reset the VPC's main Route Table to it when this
resource is deleted.

refs #843, #748

[1] http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html#RouteTableDetails
[2] http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Internet_Gateway.html#Add_IGW_Routing
@phinze
Copy link
Contributor Author

phinze commented Feb 3, 2015

Ok paging @mitchellh for review. Happy to walk you through it synchronously if that would be helpful.

Working on docs now.

@phinze phinze force-pushed the f-aws-main-route-table-association branch from 33dbc87 to f852a01 Compare February 3, 2015 21:13
cidr_block = "10.0.0.0/8"
gateway_id = "${aws_internet_gateway.foo.id}"
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mitchellh ^^ this limitation of the current terraform graph is worth noting. AFAICT there's currently no way of expressing the required order of operations to make this possible

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this relates back to that same issue of implicit deps...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep exactly. Will be an interesting problem to solve! 💭

@mitchellh
Copy link
Contributor

This is actually perfect. Great job 👍 MERGE.

@phinze
Copy link
Contributor Author

phinze commented Feb 3, 2015

phinze added a commit that referenced this pull request Feb 3, 2015
…tion

provider/aws: aws_main_route_table_association
@phinze phinze merged commit 80c5971 into master Feb 3, 2015
@phinze phinze deleted the f-aws-main-route-table-association branch February 3, 2015 22:42
@ptrkdy
Copy link

ptrkdy commented Apr 4, 2017

I was stuck on topic this and found the solution in this PR before I found the documentation (which is my own fault admittedly), but I would like to leave a bread crumb for the next person who might be searching for this.

https://www.terraform.io/docs/providers/aws/r/main_route_table_assoc.html
together with
https://www.terraform.io/docs/providers/aws/r/route_table.html

Yields something along the lines of the below (as of version 0.9.2):


resource "aws_route_table" "main_dev" {
vpc_id = "${aws_vpc.main.id}"
route {
cidr_block = "0.0.0.0/0"
gateway_id = "${aws_internet_gateway.dev_igw.id}"
}
tags {
Name = "main"
}
}

resource "aws_main_route_table_association" "main_dev" {
vpc_id = "${aws_vpc.main.id}"
route_table_id = "${aws_route_table.main_dev.id}"
}


When the main route column in the AWS console updated to 'Yes' it gave me a smile!

@ghost
Copy link

ghost commented Apr 14, 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 Apr 14, 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 this pull request may close these issues.

3 participants