Tech & DevOps HubEspace Tech & DevOps

Explorez le monde du Dev, du Cloud et des outils DevOps à travers nos articles et discussions Explore the world of development, the cloud and DevOps tools
 FR      EN
Terraform
Général
Import existing resource
terraform import aws_instance.myvm i-123456

Links an existing resource to Terraform state.
Initialize project
terraform init

Prepares directory, downloads plugins and providers.
List providers
terraform providers

Displays active providers for the project.
Update modules
terraform get -update

Fetches and updates used modules.
Validate syntax
terraform validate

Checks structure and configuration consistency.
Apply
Apply configuration
terraform apply

Executes changes: create/modify/destroy.
Destroy infrastructure
terraform destroy

Deletes entire managed infrastructure.
Refresh state only
terraform apply -refresh-only

Updates state without changes.
Lock state
terraform apply -lock=true

Prevents concurrent modifications of state.
Plan
Show plan outputs
terraform show tfplan

Reads plan and displays outputs and changes.
Generate binary plan
terraform plan -out mon_plan.tfplan

Creates executable plan file.
Full destroy plan
terraform plan -destroy

Previews complete infrastructure destruction.
Show planned changes
terraform plan

Displays detailed planned modifications.
State
List all state resources
terraform state list

Lists all resources tracked in state.
Remove resource from state
terraform state rm aws_instance.old

Detaches resource without destroying it.
Show resource in state
terraform state show aws_instance.myvm

Displays detailed resource state information.