You are creating a Terraform configuration which needs to make use of multiple providers, one for AWS and one for Datadog.
Which of the following provider blocks would allow you to do this?
A.
B.
C.
You are creating a Terraform configuration which needs to make use of multiple providers, one for AWS and one for Datadog.
Which of the following provider blocks would allow you to do this?
A.
B.
C.
The correct provider block configuration in this context is option B. Terraform allows you to specify multiple providers within the same configuration file. The correct syntax for declaring a provider block is by using the 'provider' keyword followed by the name of the provider in quotes. Option B correctly declares the AWS and Datadog providers using this syntax. Option A is incorrect because it does not use the provider keyword, and C is incorrect because it incorrectly nests the provider blocks inside a 'terraform' block.
I think B is correct as you are configuring the provider not declaring it terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 4.0" } } } # Configure the AWS Provider provider "aws" { region = "us-east-1" }
B is correct https://www.terraform.io/language/providers/configuration
*CREATING* then it should be C as you need the root terraform block
Provider block doesnt belong inside the terraform block :D
The question seems to hinge on the word "needs" ... if it was asking for "required_providers" then they would need to nested inside a terraform block however none of the examples show the correct syntax for a required_providers block terraform { required_providers { mycloud = { source = "mycorp/mycloud" version = "~> 1.0" } } } I'm going with B.
Question says "you are creating" your configuration, not configuring. It should be C
well paying more attention in the alternatives, I think none is correct
https://developer.hashicorp.com/terraform/language/providers/requirements