Challenge - 5 Problems
Terraform State Replace-Provider Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
What does the Terraform command 'state replace-provider' do?
Choose the correct description of the effect of running 'terraform state replace-provider'.
Attempts:
2 left
💡 Hint
Think about how Terraform manages provider references in the state file.
✗ Incorrect
The 'terraform state replace-provider' command updates the provider source address in the state file, allowing Terraform to recognize resources as managed by a new provider without recreating them.
❓ Configuration
intermediate2: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?
Attempts:
2 left
💡 Hint
Provider source addresses are in the form 'registry.terraform.io/namespace/type', using slashes not colons.
✗ Incorrect
The correct syntax uses the full provider source addresses, e.g., 'registry.terraform.io/hashicorp/aws' to 'registry.terraform.io/custom/aws'.
❓ Architecture
advanced2: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'?
Attempts:
2 left
💡 Hint
Consider how Terraform matches resources in state with provider configurations.
✗ Incorrect
Replacing the provider source updates the state so Terraform treats resources as managed by the new provider, avoiding resource recreation if configurations are consistent.
❓ security
advanced2: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?
Attempts:
2 left
💡 Hint
Think about trust boundaries and provider code origin.
✗ Incorrect
Replacing the provider source with an untrusted provider risks unauthorized or malicious resource management actions.
❓ service_behavior
expert2: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?
Attempts:
2 left
💡 Hint
Consider how Terraform validates the presence of the old provider source in state.
✗ Incorrect
If the old provider source is not present in the state, Terraform completes successfully but makes no changes, typically informing that no matching provider was found.