From a704077d02c30d10bc52f419b4d46b0ac530bb43 Mon Sep 17 00:00:00 2001 From: Emmanuel Ferdman Date: Tue, 17 Feb 2026 04:33:55 +0200 Subject: [PATCH] terraform-init, terraform-apply: add page (#21119) Signed-off-by: Emmanuel Ferdman --- pages/common/terraform-apply.md | 36 +++++++++++++++++++++++++++++++++ pages/common/terraform-init.md | 36 +++++++++++++++++++++++++++++++++ pages/common/terraform-plan.md | 2 +- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 pages/common/terraform-apply.md create mode 100644 pages/common/terraform-init.md diff --git a/pages/common/terraform-apply.md b/pages/common/terraform-apply.md new file mode 100644 index 0000000000..03b80b555c --- /dev/null +++ b/pages/common/terraform-apply.md @@ -0,0 +1,36 @@ +# terraform apply + +> Create or update infrastructure according to Terraform configuration files. +> More information: . + +- Create or update infrastructure: + +`terraform apply` + +- Create or update infrastructure, skipping interactive approval: + +`terraform apply -auto-approve` + +- Apply a plan file: + +`terraform apply {{path/to/file.tfplan}}` + +- Specify values for input variables: + +`terraform apply -var '{{name1}}={{value1}}' -var '{{name2}}={{value2}}'` + +- Specify values for input variables from a file: + +`terraform apply -var-file {{path/to/file.tfvars}}` + +- Apply changes to a specific resource: + +`terraform apply -target {{resource_type.resource_name[instance index]}}` + +- Replace a specific resource: + +`terraform apply -replace {{resource_type.resource_name[instance index]}}` + +- Destroy Terraform-managed infrastructure: + +`terraform apply -destroy` diff --git a/pages/common/terraform-init.md b/pages/common/terraform-init.md new file mode 100644 index 0000000000..10e4152d3b --- /dev/null +++ b/pages/common/terraform-init.md @@ -0,0 +1,36 @@ +# terraform init + +> Initialize a new or existing Terraform working directory. +> More information: . + +- Initialize the current working directory: + +`terraform init` + +- Initialize and upgrade modules and providers to the latest allowed versions: + +`terraform init -upgrade` + +- Initialize and reconfigure the backend, ignoring any saved configuration: + +`terraform init -reconfigure` + +- Initialize and reconfigure the backend, attempting to migrate any existing state: + +`terraform init -migrate-state` + +- Initialize with additional backend configuration: + +`terraform init -backend-config '{{key}}={{value}}'` + +- Initialize without backend or HCP Terraform initialization: + +`terraform init -backend=false` + +- Initialize without interactive prompts (useful for automation): + +`terraform init -input=false` + +- Initialize with the dependency lockfile mode set to readonly: + +`terraform init -lockfile readonly` diff --git a/pages/common/terraform-plan.md b/pages/common/terraform-plan.md index 5d584e1f61..52a2ba2047 100644 --- a/pages/common/terraform-plan.md +++ b/pages/common/terraform-plan.md @@ -3,7 +3,7 @@ > Generate and show Terraform execution plans. > More information: . -- Generate and show the execution plan in the currently directory: +- Generate and show the execution plan in the current directory: `terraform plan`