Terraform: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 20: | Line 20: | ||
<syntaxhighlight lang="text"> | <syntaxhighlight lang="text"> | ||
sdlc/ | sdlc/ | ||
├─ main.tf | ├─ main.tf # Main Terraform config file | ||
├─ variables.tf | ├─ variables.tf # Variable declarations | ||
├─ terraform.tfvars | ├─ terraform.tfvars # Variable assigned | ||
├─ outputs.tf | ├─ outputs.tf # Output definitions | ||
├─ provider.tf | ├─ provider.tf # Provider-specific config | ||
├─ terraform.tfstate | ├─ terraform.tfstate # Terraform state file | ||
├─ terraform.auto.tfvars # User Sensitive Data | ├─ terraform.tfstate.backup # Terraform state backup file | ||
├─ dev.tf | ├─ terraform.auto.tfvars # User Sensitive Data | ||
├─ prod.tf | ├─ dev.tf # Dev Env config for development | ||
├─ modules/ | ├─ prod.tf # Prod Env config for production | ||
│ ├─ module1/ | ├─ modules/ # Directory for custom modules | ||
│ │ ├─ main.tf | │ ├─ module1/ # Custom module 1 | ||
│ │ ├─ variables.tf | │ │ ├─ main.tf # Module-specific Terraform config | ||
│ │ └─ outputs.tf | │ │ ├─ variables.tf # Module-specific variables | ||
│ └─ module2/ | │ │ └─ outputs.tf # Module-specific outputs | ||
│ └─ module2/ # Custom module 2 | |||
│ ├─ main.tf | │ ├─ main.tf | ||
│ ├─ variables.tf | │ ├─ variables.tf | ||
│ └─ outputs.tf | │ └─ outputs.tf | ||
├─ environments/ | ├─ environments/ # Directory for env | ||
│ ├─ dev/ | │ ├─ dev/ # Development env | ||
│ │ ├─ main.tf | │ │ ├─ main.tf # Env specific Terraform config | ||
│ │ ├─ variables.tf | │ │ ├─ variables.tf | ||
│ │ └─ outputs.tf | │ │ └─ outputs.tf | ||
│ └─ prod/ | │ └─ prod/ # Production env | ||
│ ├─ main.tf | │ ├─ main.tf | ||
│ ├─ variables.tf | │ ├─ variables.tf | ||
│ └─ outputs.tf | │ └─ outputs.tf | ||
├─ scripts/ | ├─ scripts/ # Scripts or utility for IaC | ||
└── README.md | └── README.md | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 18:04, 19 October 2024
curl -fsSL https://apt.releases.hashicorp.com/gpg\
| sudo tee /etc/apt/keyrings/hashicorp.asc >/dev/null
DISTRIBUTION=$(. /etc/os-release && echo "${VERSION_CODENAME}")
cat << SRC | sudo tee /etc/apt/sources.list.d/hashicorp.list >/dev/null
deb [arch=$(dpkg --print-architecture)\
signed-by=/etc/apt/keyrings/hashicorp.asc]\
https://apt.releases.hashicorp.com ${DISTRIBUTION} main
SRC
sudo apt update && sudo apt list --upgradeable
sudo apt upgrade && sudo apt install terraform
terraform version
Structure
sdlc/
├─ main.tf # Main Terraform config file
├─ variables.tf # Variable declarations
├─ terraform.tfvars # Variable assigned
├─ outputs.tf # Output definitions
├─ provider.tf # Provider-specific config
├─ terraform.tfstate # Terraform state file
├─ terraform.tfstate.backup # Terraform state backup file
├─ terraform.auto.tfvars # User Sensitive Data
├─ dev.tf # Dev Env config for development
├─ prod.tf # Prod Env config for production
├─ modules/ # Directory for custom modules
│ ├─ module1/ # Custom module 1
│ │ ├─ main.tf # Module-specific Terraform config
│ │ ├─ variables.tf # Module-specific variables
│ │ └─ outputs.tf # Module-specific outputs
│ └─ module2/ # Custom module 2
│ ├─ main.tf
│ ├─ variables.tf
│ └─ outputs.tf
├─ environments/ # Directory for env
│ ├─ dev/ # Development env
│ │ ├─ main.tf # Env specific Terraform config
│ │ ├─ variables.tf
│ │ └─ outputs.tf
│ └─ prod/ # Production env
│ ├─ main.tf
│ ├─ variables.tf
│ └─ outputs.tf
├─ scripts/ # Scripts or utility for IaC
└── README.md
Summary
Backend » HTTP
Playground
References |