In Terraform, when you configure multiple provider blocks with aliases, what is the main purpose of using the alias attribute?
Think about scenarios where you need to connect to different accounts or regions using the same provider.
The alias attribute lets you define multiple configurations of the same provider, such as connecting to different cloud accounts or regions, so you can use them separately in your resources.
Which of the following Terraform provider blocks is correctly configured to use AWS provider version 4.0 with region us-west-2?
Check the correct attribute name for specifying provider version inside the provider block.
The version attribute inside the provider block is deprecated. The correct way to specify provider version constraints is in the required_providers block inside the Terraform block. The required_version attribute is used to specify Terraform CLI version constraints, not provider versions.
You want to deploy resources in two AWS regions: us-east-1 and eu-central-1, using Terraform. Which provider configuration setup allows you to manage resources in both regions within the same Terraform project?
Think about how Terraform distinguishes between multiple provider configurations of the same type.
Using aliases allows you to define multiple provider configurations for different regions and explicitly assign resources to use the correct provider configuration.
Which of the following is the best practice for managing sensitive credentials in a Terraform provider configuration?
Consider security risks of exposing credentials in code repositories.
Using environment variables or secret management tools keeps credentials out of code and version control, reducing risk of accidental exposure.
What happens if you define an AWS resource in Terraform but do not include any AWS provider block in your configuration?
Think about how Terraform knows which provider to use for resources.
Terraform requires explicit provider configuration to know how to connect to the cloud service. Without it, it cannot proceed and raises an error.