Terraform contd
Scenario 1: Creating a network with subnets in AWS
- To write terraform templates we need to understand HCL (Hashicorp configuration language)
-
Datatypes
- string
- number
- boolean
- list
- set
- object/map
Manual Creating a network in AWS
- Prompt
You are an expert in AWS
I want to understand how to create a vpc in AWS
Explain the inputs which we need to provide
Guide me to create vpc using console
Working with terraform
- we will be following google style guide for terraform
- create a new folder
vpc_aws - Create a new file
main.tf - Terraform block: using this block we can restrict
- which version of terraform is required to run this template
- which version of providers needs to be used
- For version restrictions we have expression in terraform
version constraint syntax - After writing template try to format
- terraform fmt
- If terraform extension in vscode is installed, you can use format
-
We need to create vpc resource, to find any resource
-
google
terraform <provider> <resource>=>terraform aws vpc
- Use provider docs (watch classroom recording)
- Terraform resource block
- Type =>
<provider>_<service|functionality> - For every resource we can pass arguments, not all arguments are required
- Now lets fmt and then validate

-
google
- Refer Here for the changes done
