A practitioner writes a new configuration that declares an aws_s3_bucket resource but never adds a required_providers entry or a provider block for AWS. They run terraform init in the empty working directory. What does Terraform do about the AWS provider?
resource "aws_s3_bucket" "assets" {
bucket = "example-assets-bucket"
}- AIt infers the provider from the resource type prefix and downloads the hashicorp/aws plugin from the registry during init. Correct
- BIt fails init immediately because every provider must be pinned in a required_providers block before any plugin can be installed.
- CIt skips provider installation entirely and defers downloading the plugin until the first terraform apply is run.
- DIt prompts the practitioner to type the provider source address interactively before continuing the initialisation.
Why A is correct: Terraform maps the aws_ prefix to the aws provider, resolves it to the default hashicorp namespace, and installs the plugin during init even without an explicit required_providers entry.
Why B is wrong: Pinning in required_providers is best practice for version control, but its absence does not stop init; Terraform can still infer and install the provider, so this overstates the requirement.
Why C is wrong: Plugin installation is the job of init, not apply; deferring it to apply would leave the working directory uninitialised, so this misplaces when the download happens.
Why D is wrong: Terraform init is non-interactive for provider resolution and infers the source automatically, so it never pauses to ask the user to type a source address.