Archives for Terraform Basics
Retrieving Resource IDs in Terraform – The Terraform Data Block
Also read - Terraform external data querying The Terraform Data Block - Retrieving a Project Id for a GCP project data "google_project" "project" { } output "project_number" { value =…
tfvars versus variables.tf
Prompting a user for Input in Terraform To me, the primary use case is that I want to prompt a user to provide the value for the input variable. In…
Using -out with terraform plan – terraform plan -out
This is a short post - always use the -out option. This saves the current plan - and will execute it exactly as saved (once you pass in the saved…
Data Block External Data – Querying External Resources in Terraform
Retrieving External data Use either the data block or the terraform_remote_state block to retrieve external data. However, there are scenarios where the data block does not exist in the provider or terraform_remote_state cannot be used, such as…
Referencing outputs from one terraform file in another terraform file
Split Configuration across multiple files You can (and should) split resources across multiple files (even folders, if you so desire). The entire deployment will have a single state file managing…
Terraform Basics
How do you apply to just a single resource? tf apply target How do you destroy without being prompted? terraform destroy --approval-true flag When would you use a null resource…