0
0
Terraformcloud~20 mins

State replace-provider in Terraform - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Terraform State Replace-Provider Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What does the Terraform command 'state replace-provider' do?
Choose the correct description of the effect of running 'terraform state replace-provider'.
AIt deletes the provider configuration from the Terraform state and forces reinitialization.
BIt updates the provider references in the Terraform state from an old provider source to a new one without changing resources.
CIt replaces all resources managed by a provider with new resources from a different provider.
DIt upgrades the provider version in the Terraform configuration files automatically.
Attempts:
2 left
💡 Hint
Think about how Terraform manages provider references in the state file.
Configuration
intermediate
2:00remaining
Identify the correct syntax to replace a provider source in Terraform state
Given you want to replace the provider source 'registry.terraform.io/hashicorp/aws' with 'registry.terraform.io/custom/aws', which command is correct?
Aterraform state replace-provider registry.terraform.io/hashicorp/aws registry.terraform.io/custom/aws
Bterraform state replace-provider registry.terraform.io/hashicorp/aws:aws registry.terraform.io/custom/aws:aws
Cterraform state replace-provider registry.terraform.io/custom/aws registry.terraform.io/hashicorp/aws
Dterraform state replace-provider registry.terraform.io/hashicorp/aws:aws registry.terraform.io/custom/aws
Attempts:
2 left
💡 Hint
Provider source addresses are in the form 'registry.terraform.io/namespace/type', using slashes not colons.
Architecture
advanced
2:00remaining
What is the impact on resource management after running 'terraform state replace-provider'?
After replacing the provider source in the Terraform state, what happens when you run 'terraform plan'?
ATerraform throws an error due to provider mismatch and halts the plan.
BTerraform destroys all resources managed by the old provider and creates new ones with the new provider.
CTerraform recognizes resources as managed by the new provider and plans no changes if configurations match.
DTerraform ignores the state changes and continues using the old provider references.
Attempts:
2 left
💡 Hint
Consider how Terraform matches resources in state with provider configurations.
security
advanced
2:00remaining
Which security risk is most relevant when using 'terraform state replace-provider'?
What is a potential security concern when replacing a provider source in Terraform state?
AReplacing with a malicious or untrusted provider could lead to unauthorized resource changes.
BThe command exposes provider credentials in plaintext in the state file.
CIt automatically grants admin permissions to the new provider without user consent.
DIt disables encryption of the Terraform state file during the operation.
Attempts:
2 left
💡 Hint
Think about trust boundaries and provider code origin.
service_behavior
expert
2:00remaining
What happens if you run 'terraform state replace-provider' with a provider source that does not exist in the state?
If you execute 'terraform state replace-provider old_provider new_provider' but 'old_provider' is not referenced in the current state, what is the result?
ATerraform replaces all providers in the state with the new provider regardless.
BTerraform deletes the entire state file to prevent inconsistencies.
CTerraform returns an error indicating the old provider source was not found in the state.
DTerraform completes successfully but makes no changes to the state.
Attempts:
2 left
💡 Hint
Consider how Terraform validates the presence of the old provider source in state.