Question 1 · choose 1
A configuration uses version 6 of the AWS provider and has a single provider block: provider "aws" { region = "us-east-1" } One replica bucket must be created in eu-west-1, while every other resource stays in us-east-1. The team does not want to add a second provider configuration. What should it do?
- AChange region in the provider block to eu-west-1 for the apply that creates the bucket
- BPut the bucket in a separate configuration, since one configuration can use only one region per provider
- CSet the bucket resource's own region argument to "eu-west-1"
- DAdd an aws provider block with alias = "eu" and set provider = aws.eu on the bucket
Show the answer and why
AChange region in the provider block to eu-west-1 for the apply that creates the bucket
Incorrect
The provider block sets the region for every resource that uses it, so the whole configuration would be planned against eu-west-1, not just the bucket.
BPut the bucket in a separate configuration, since one configuration can use only one region per provider
Incorrect
There is no such limit, and with version 6 of the AWS provider a single provider configuration can manage resources in several regions.
CSet the bucket resource's own region argument to "eu-west-1"
Correct
Version 6.0.0 of the AWS provider adds a top-level region argument to most resources; it overrides the provider's region for that resource only, without an additional provider block.
DAdd an aws provider block with alias = "eu" and set provider = aws.eu on the bucket
Incorrect
That works, but it is exactly the second provider configuration the team wants to avoid.
Before version 6.0.0 of the AWS provider, every extra region needed its own provider configuration. Now most resources take a region argument that defaults to the provider's region, and changing it on an existing resource forces replacement.
HashiCorp documentation