Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux_wiki:terraform [2018/06/14 22:33] billdozor [File Contents: Site Module Files] |
linux_wiki:terraform [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 5: | Line 5: | ||
" | " | ||
- | Site | + | Sites |
* Official Site: https:// | * Official Site: https:// | ||
* Downloads: https:// | * Downloads: https:// | ||
* Getting started: https:// | * Getting started: https:// | ||
+ | * AWS Provider Reference Doc: https:// | ||
+ | \\ | ||
**Checklist** | **Checklist** | ||
* AWS Account | * AWS Account | ||
Line 45: | Line 47: | ||
====== Terraform Example: 2 Tier VPC ====== | ====== Terraform Example: 2 Tier VPC ====== | ||
+ | **Pre-Req**: | ||
+ | |||
+ | \\ | ||
Creating a 2-tier VPC (public and private subnets), utilizing 3 availability zones in US-West (Oregon). | Creating a 2-tier VPC (public and private subnets), utilizing 3 availability zones in US-West (Oregon). | ||
Line 87: | Line 92: | ||
provider " | provider " | ||
region = " | region = " | ||
+ | # Name of profile to use from ~/ | ||
profile = " | profile = " | ||
} | } | ||
Line 170: | Line 176: | ||
}</ | }</ | ||
- | <code bash outputs.tf> | + | <code bash outputs.tf> |
# Description: | # Description: | ||
+ | # If terraform apply is run within this directory, these variables | ||
+ | # are displayed at the end of the run. | ||
# Pull the VPC ID from the site module | # Pull the VPC ID from the site module | ||
Line 177: | Line 185: | ||
value = " | value = " | ||
}</ | }</ | ||
+ | |||
+ | ---- | ||
==== File Contents: Site Module Files ==== | ==== File Contents: Site Module Files ==== | ||
Line 182: | Line 192: | ||
Files in the site/ module directory. Ordered in a way that is easier to follow. | Files in the site/ module directory. Ordered in a way that is easier to follow. | ||
- | <code bash variables.tf># | + | <code bash variables.tf># |
- | # Description: | + | # Description: |
+ | # Unset variables | ||
- | # Availability Zones: | + | # Availability Zones: |
variable " | variable " | ||
- | # VPC CIDR: Pass in from main variables | + | # VPC CIDR: Inherit |
variable " | variable " | ||
- | # Public Subnets (with IGW): Pass in from main | + | # Public Subnets (with IGW): Inherit |
variable " | variable " | ||
variable " | variable " | ||
variable " | variable " | ||
- | # Private Subnets (no IGW): Pass in from main | + | # Private Subnets (no IGW): Inherit |
variable " | variable " | ||
variable " | variable " | ||
variable " | variable " | ||
- | <code bash vpc.tf># Title: vpc.tf | + | <code bash vpc.tf># Title: |
# Description: | # Description: | ||
Line 223: | Line 234: | ||
}</ | }</ | ||
- | <code bash subnets.tf># | + | <code bash subnets.tf># |
# Description: | # Description: | ||
Line 288: | Line 299: | ||
}</ | }</ | ||
- | <code bash nat_gateway.tf># | + | <code bash nat_gateway.tf># |
# Description: | # Description: | ||
Line 338: | Line 349: | ||
# Route to the NAT Gateway provided elsewhere (in private route table)</ | # Route to the NAT Gateway provided elsewhere (in private route table)</ | ||
- | <code bash routes.tf># | + | <code bash routes.tf># |
# Description: | # Description: | ||
Line 437: | Line 448: | ||
}</ | }</ | ||
- | <code bash security_groups.tf># | + | <code bash security_groups.tf># |
# Description: | # Description: | ||
Line 500: | Line 511: | ||
}</ | }</ | ||
- | <code bash outputs.tf># | + | <code bash outputs.tf># |
# Description: | # Description: | ||
+ | # Accessible via " | ||
- | # Store the VPC ID - pulled from here in main's output.tf | + | # Set output variable from resource format |
+ | # output " | ||
+ | # value = " | ||
+ | # } | ||
+ | |||
+ | # Store the VPC ID | ||
output " | output " | ||
value = " | value = " | ||
+ | } | ||
+ | |||
+ | # Store the Public Subnet ID | ||
+ | output " | ||
+ | value = " | ||
+ | } | ||
+ | |||
+ | # Store the Public Security Group ID | ||
+ | output " | ||
+ | value = " | ||
}</ | }</ | ||
---- | ---- | ||