To deploy resources into two different cloud regions in the same Terraform configuration, you declare multiple provider configurations. What meta-argument do you need to configure in a resource block to deploy the resource to the us-west-2 AWS region?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

To deploy resources into two different cloud regions in the same Terraform configuration, you declare multiple provider configurations. What meta-argument do you need to configure in a resource block to deploy the resource to the us-west-2 AWS region?

Explanation:
When you want to deploy to multiple regions in one configuration, you create separate provider configurations each with its own alias and then tell each resource which provider to use. The resource needs a reference to the specific provider configuration, not just a plain alias. By writing provider = aws.west, you’re selecting the AWS provider instance named west (which would be configured with region = us-west-2). This is how Terraform routes that resource to the correct region. Why the other forms aren’t correct: simply writing alias = west isn’t a valid resource argument; it’s a provider-level setting. Using provider = west isn’t valid syntax because the value must reference a full provider configuration (like aws.west), not just the alias. Similarly, alias = aws.west isn’t a valid resource parameter.

When you want to deploy to multiple regions in one configuration, you create separate provider configurations each with its own alias and then tell each resource which provider to use. The resource needs a reference to the specific provider configuration, not just a plain alias. By writing provider = aws.west, you’re selecting the AWS provider instance named west (which would be configured with region = us-west-2). This is how Terraform routes that resource to the correct region.

Why the other forms aren’t correct: simply writing alias = west isn’t a valid resource argument; it’s a provider-level setting. Using provider = west isn’t valid syntax because the value must reference a full provider configuration (like aws.west), not just the alias. Similarly, alias = aws.west isn’t a valid resource parameter.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy