Writing Terraform Templates
Installation
- Windows
- Terminal Setup
- Git For Windows
- chocolatey or winget
- Visual Studio Code
- Terraform
- AWS CLI
- Azure CLI
- Mac
- Homebrew
- Git
brew install git - Visual Studio Code
brew install --cask visual-studio-code - Terraform
brew tap hashicorp/tap && brew install hashicorp/tap/terraform - awscli
brew install awscli - azure cli
brew install azure-cli
Writing templates
- create a new folder
- open this in visual studio code (Ensure Terraform extension is installed)
- create a new file called as main.tf
- Terraform uses Hashicorp Configuration language, Resources, Providers are Blocks
<block-type> <name> .. {
}
provider <name> {
arg1 = value
..
..
argn = value
}
resource <type> <name> {
arg1 = value
..
..
argn = value
}
- When we pass arguments terraform has the following data types
