0
0
Terraformcloud~10 mins

Terraform apply -replace flag - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to force replacement of a resource named 'aws_instance.example'.

Terraform
terraform apply [1]aws_instance.example
Drag options to blanks, or click blank then click option'
A-replace=
B-auto-approve
C-refresh
D-destroy
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-destroy' instead of '-replace'.
Forgetting to specify the resource name after the flag.
2fill in blank
medium

Complete the command to replace two resources: 'aws_instance.web' and 'aws_s3_bucket.data'.

Terraform
terraform apply [1]aws_instance.web [2]aws_s3_bucket.data
Drag options to blanks, or click blank then click option'
A-replace=
B-refresh
C-auto-approve
D-destroy
Attempts:
3 left
💡 Hint
Common Mistakes
Using only one '-replace' flag for multiple resources.
Omitting the equals sign '=' after '-replace'.
3fill in blank
hard

Fix the error in this command to replace the resource 'aws_db_instance.main'.

Terraform
terraform apply [1]aws_db_instance.main
Drag options to blanks, or click blank then click option'
A-refresh
B-replace=
C-auto-approve
D-destroy
Attempts:
3 left
💡 Hint
Common Mistakes
Missing '=' after '-replace'.
Using '-replace' without specifying the resource.
4fill in blank
hard

Fill both blanks to correctly replace 'aws_lambda_function.func' and approve automatically.

Terraform
terraform apply [1]aws_lambda_function.func [2]
Drag options to blanks, or click blank then click option'
A-replace=
B-auto-approve
C-refresh
D-destroy
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting '-auto-approve' causes Terraform to wait for confirmation.
Missing '=' after '-replace' causes syntax errors.
5fill in blank
hard

Fill all three blanks to replace 'aws_security_group.sg', refresh state, and auto-approve.

Terraform
terraform apply [1]aws_security_group.sg [2] [3]
Drag options to blanks, or click blank then click option'
A-replace=
B-refresh
C-auto-approve
D-destroy
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-destroy' instead of '-replace'.
Omitting '-auto-approve' causes manual confirmation.
Missing '=' after '-replace'.