Terraform: Difference between revisions
Jump to navigation
Jump to search
Line 196: | Line 196: | ||
* [https://spacelift.io/blog/gitlab-terraform-state Terraform » TFState » Sapcelift » GitLab] | * [https://spacelift.io/blog/gitlab-terraform-state Terraform » TFState » Sapcelift » GitLab] | ||
* [https://spacelift.io/blog/terraform-gitignore Terraform » Sapcelift » <code>.gitignore</code>] | * [https://spacelift.io/blog/terraform-gitignore Terraform » Sapcelift » <code>.gitignore</code>] | ||
* [https:// | * [https://github.com/gruberdev/tf-free/blob/main/.terraformignore Terraform » <code>.terraformignore</code>] | ||
* [https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html Terraform » TFState » GitLab] | * [https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html Terraform » TFState » GitLab] | ||
* [https://developer.hashicorp.com/terraform/cli/commands/force-unlock Terraform » <code>force-unlock</code>] | * [https://developer.hashicorp.com/terraform/cli/commands/force-unlock Terraform » <code>force-unlock</code>] | ||
Line 212: | Line 212: | ||
* [https://support.hashicorp.com/hc/en-us/articles/4409321668499-How-to-identify-issues-with-the-terraformignore-file-configuration Terraform » <code>.terraformignore</code> » Issues] | * [https://support.hashicorp.com/hc/en-us/articles/4409321668499-How-to-identify-issues-with-the-terraformignore-file-configuration Terraform » <code>.terraformignore</code> » Issues] | ||
* [https://developer.hashicorp.com/terraform/language/settings/backends/configuration Terraform » Backend » Configuration] | * [https://developer.hashicorp.com/terraform/language/settings/backends/configuration Terraform » Backend » Configuration] | ||
* [https://developer.hashicorp.com/terraform/language/settings/backends/remote Terraform » Backend » Remote] | * [https://developer.hashicorp.com/terraform/language/settings/backends/remote Terraform » Backend » Remote] | ||
| valign="top" | | |||
| valign="top" | | |||
|- | |||
| colspan="3" | | |||
---- | |||
|- | |||
| valign="top" | | |||
* [https://registry.terraform.io/providers/hashicorp/azurerm/latest Terraform » Provider » azurerm] | |||
* [https://registry.terraform.io/providers/hashicorp/azuread/latest Terraform » Provider » azuread] | * [https://registry.terraform.io/providers/hashicorp/azuread/latest Terraform » Provider » azuread] | ||
* [https://registry.terraform.io/providers/hashicorp/google/latest Terraform » Provider » google] | * [https://registry.terraform.io/providers/hashicorp/google/latest Terraform » Provider » google] |
Revision as of 03:48, 19 July 2024
curl -fsSL https://apt.releases.hashicorp.com/gpg\
| sudo tee /etc/apt/keyrings/hashicorp.asc >/dev/null
cat << EOF | 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 $(lsb_release -cs) main
EOF
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
├─ 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
Playground
References |