Terraform with AWS Contd..
-
We have created the vpc with six subnets
-
We need to add internet gateway to the aws and attach internet gateway to vpc
-
Lets look at manual steps
-
Now navigate to terraform aws provider documentation Refer Here and search for internet gateway
-
For the documentation of internet gateway Refer Here
-
Make changes in the template to accomodate creation of internet gateway Refer Here for the changes
-
The current architecture looks as shown below
-
Now we need to create route table called as public route table and connect it to web1 and web2 subnet
-
Manual steps
-
Now search for route table resource. Refer Here for the documentation
-
To associate route table with subnets Refer Here
-
Lets make changes Refer Here for the changes
-
Now lets create a private subnet and associate app1, app2, db1 and db2 subnets Refer Here for the changeset
-
In our template we have written the following to create private route table associations, which sounds like a hack
-
It would be better if we use each kind of syntax
colors = ['red', 'green', 'blue']
for color in colors:
print color
- So to refactor our template to look something like above, we need to have an option to query the aws to retrieve subnet ids and then use for each
