Courseiva

CCNA Provider Management Questions

32 questions · Provider Management · All types, answers revealed

1
MCQmedium

When defining a provider in Terraform, what does the 'alias' meta-argument signify?

A.It links to a different provider type.
B.It defines the provider's short name.
C.It allows using multiple configurations of the same provider.
D.The provider is deprecated.
AnswerC

This is the core purpose of aliases.

Why this answer

An alias allows you to create multiple instances of a provider with different configurations (e.g., regions).

2
MCQmedium

Which meta-argument is used to explicitly associate a resource with a non-default provider instance?

A.configuration
B.alias
C.provider
D.instance
AnswerC

The provider meta-argument selects the configuration.

Why this answer

The 'provider' meta-argument allows you to select a specific aliased provider configuration.

3
MCQhard

How do you pass a provider instance from a root module into a child module?

A.Use a module output.
B.Use a variable.
C.Use the 'providers' map in the module block.
D.You cannot pass providers.
AnswerC

This is the correct way to pass aliased providers.

Why this answer

You use the 'providers' map in the module block to map the child module's provider requirements to a specific instance in the root module.

4
MCQmedium

What is the primary function of the 'source' attribute in the 'required_providers' block?

A.To define the local path of the provider code.
B.To define the AWS region.
C.To specify the registry address.
D.To enable debugging.
AnswerC

Source provides the namespace and provider name.

Why this answer

It specifies the registry address where the provider binary can be downloaded.

5
MCQeasy

What is the purpose of the 'terraform providers lock' command?

A.To secure the provider versions and checksums.
B.To encrypt the state file.
C.To prevent others from running init.
D.To download all providers.
AnswerA

It ensures consistent provider versions across environments via checksums.

Why this answer

It updates the .terraform.lock.hcl file to include all necessary provider checksums for the current configuration.

6
MCQeasy

A team wants to ensure their Terraform configuration uses a specific major version of the AWS provider to prevent breaking changes. Which block should they use?

A.terraform { required_providers { aws = { source = "hashicorp/aws", version = "~> 4.0" } } }
B.provider "aws" { version = "~> 4.0" }
C.terraform { version = "~> 4.0" }
D.provider_version = "4.0"
AnswerA

This is the correct syntax for pinning provider versions.

Why this answer

The required_providers block within the terraform block is the standard way to constrain provider versions.

7
Multi-Selectmedium

What are the ways to configure provider credentials? (Select THREE)

Select 3 answers
A.Shared credentials file (~/.aws/credentials).
B.Directly in the provider block.
C.Environment variables (e.g., AWS_ACCESS_KEY_ID).
D.In the .terraform.lock.hcl file.
E.Via the terraform output command.
AnswersA, B, C

Standard method.

Why this answer

Environment variables, shared credentials files, and hardcoded provider blocks are all common ways to supply credentials.

8
MCQeasy

What is the correct way to specify a version constraint for a provider that must be at least 3.0 but less than 4.0?

A.version = ">= 3.0"
B.version = "3.0"
C.version = "> 3.0, < 4.0"
D.version = "~> 3.0"
AnswerD

~> 3.0 allows any 3.x version.

Why this answer

The ~> operator (pessimistic constraint) with 3.0 allows for updates within the 3.x minor range.

9
Multi-Selecteasy

Which of the following are valid provider version constraint operators? (Select TWO)

Select 2 answers
A.||
B.&&
C.=
D.~>
E.!!
AnswersC, D

Used for exact version.

Why this answer

= and ~> are both standard operators for version constraints.

10
MCQhard

What happens if you have a provider version conflict in your module dependencies?

A.Terraform will pick the newest version.
B.Terraform will fail to initialize.
C.Terraform will ignore the constraints.
D.Terraform will pick the oldest version.
AnswerB

Dependency resolution failure prevents initialization.

Why this answer

Terraform will stop and return an error because it cannot satisfy the conflicting version constraints.

11
MCQhard

How does Terraform resolve the version of a provider if the version is defined in both 'terraform' block and the 'provider' block?

A.The highest version wins.
B.The terraform block takes precedence.
C.The provider block takes precedence.
D.It causes a syntax error.
AnswerB

Required_providers in the terraform block is the correct place for versions.

Why this answer

The 'required_providers' block in 'terraform' is the authoritative source for version constraints; the 'provider' block configuration does not dictate versions.

12
MCQhard

If you want to use a provider that is not published in the Terraform Registry, how do you install it?

A.Use a filesystem mirror in the .terraformrc file.
B.You cannot use private providers.
C.Rename the file to provider.tf.
D.Copy it to the root of the project.
AnswerA

Filesystem mirrors allow local development or air-gapped installation.

Why this answer

Local provider mirrors can be configured by placing the binary in specific directory structures and using a CLI configuration file.

13
MCQmedium

You need to manage resources in two different AWS regions using the same provider configuration. How do you achieve this?

A.Define the region twice in a single provider block.
B.Define two separate aws providers in the same file without aliases.
C.Create two separate Terraform projects.
D.Use an alias in the provider block and reference it in the resource using the provider meta-argument.
AnswerD

The provider meta-argument links a resource to a specific aliased provider instance.

Why this answer

Using alias in the provider block allows you to define multiple configurations for the same provider.

14
Multi-Selecthard

Which are characteristics of the Terraform Plugin SDK? (Select TWO)

Select 2 answers
A.It replaces the Terraform CLI.
B.It manages the Terraform state lock.
C.It compiles HCL to Go code.
D.It provides a way to define schema for resources.
E.It handles resource lifecycle methods (Create, Read, Update, Delete).
AnswersD, E

Core function of the SDK.

Why this answer

It handles the communication between Terraform and the provider binary, and it provides helper functions to define resources.

15
MCQhard

When writing a custom provider, what is the 'Schema' used for?

A.To define the attributes of resources.
B.To define the cloud service billing.
C.To define the provider's icon.
D.To store state.
AnswerA

Schemas define the fields, types, and requirements.

Why this answer

The schema defines the data structure, types, and constraints for resources and data sources.

16
MCQeasy

Which file is automatically generated to lock provider versions and their checksums?

A.terraform.tfstate
B.terraform.tfvars
C..terraform.lock.hcl
D.provider.tf
AnswerC

This is the lock file for providers.

Why this answer

.terraform.lock.hcl is the dependency lock file.

17
Multi-Selecteasy

Which of the following are valid ways to specify provider versions? (Select TWO)

Select 2 answers
A.In the required_providers block.
B.In the resource block.
C.In the backend block.
D.In the provider block using the 'version' argument (deprecated).
E.In the output block.
AnswersA, D

This is the primary way.

Why this answer

Version constraints can be specified in the required_providers block and through CLI variables (though the latter is less common).

18
Multi-Selectmedium

When debugging provider issues, which commands are most useful? (Select THREE)

Select 3 answers
A.terraform providers
B.TF_LOG=DEBUG
C.terraform fmt
D.terraform taint
E.terraform init
AnswersA, B, E

Shows provider dependencies.

Why this answer

terraform providers, terraform init, and TF_LOG are the standard ways to troubleshoot provider issues.

19
MCQmedium

If a resource is not specified with a provider meta-argument, which provider instance does it use?

A.The first one defined.
B.The provider configuration without an alias.
C.The one with the latest version.
D.It causes an error.
AnswerB

Resources implicitly use the default provider configuration.

Why this answer

It defaults to the instance of that provider without an alias.

20
MCQmedium

When using multiple provider instances with different regions, what must be defined in the provider configuration?

A.A unique alias identifier.
B.A unique project ID.
C.A credentials object.
D.A version constraint in each block.
AnswerA

Alias is required to distinguish multiple instances of the same provider.

Why this answer

You must provide an alias for every provider instance except for the default one.

21
MCQeasy

Where are providers physically stored by default when running 'terraform init'?

A.The root module directory
B.~/.terraformrc
C..terraform/providers/
D./usr/local/bin/terraform
AnswerC

This is the default local cache directory.

Why this answer

Terraform downloads providers into the .terraform/providers directory within your project working directory.

22
MCQeasy

Which command helps verify if the providers are properly initialized?

A.terraform validate
B.terraform show
C.terraform plan
D.terraform providers
AnswerD

This command lists the initialized providers.

Why this answer

'terraform providers' lists all providers required by the configuration, confirming they are initialized.

23
Multi-Selecteasy

Which of these are required components when defining a provider in 'required_providers'? (Select TWO)

Select 2 answers
A.profile
B.version
C.source
D.region
E.alias
AnswersB, C

Version is the standard requirement.

Why this answer

The source address and the version are the two standard components for defining a provider requirement.

24
MCQeasy

Which block is used to configure provider-level settings like region or profile?

A.module {}
B.provider "aws" {}
C.terraform {}
D.resource "aws_instance" {}
AnswerB

This is the block for provider-specific settings.

Why this answer

The 'provider' block is used to configure the provider itself.

25
MCQhard

A provider binary is not found in the local Terraform registry cache. What command should you run to force Terraform to download the provider again?

A.terraform plan -refresh-only
B.terraform init -upgrade
C.terraform providers install
D.terraform refresh
AnswerB

The -upgrade flag forces the re-download of providers based on constraints.

Why this answer

terraform init -upgrade forces Terraform to re-evaluate and download the latest allowed versions of providers.

26
MCQhard

If a developer wants to use a provider that is not in the public registry, can they still use it?

A.Yes, by using a local registry or filesystem mirror.
B.No, only registry providers are supported.
C.Yes, by setting the env var TF_IN_AUTOMATION.
D.Yes, by recompiling Terraform binary.
AnswerA

These are standard ways to handle private providers.

Why this answer

Yes, by using a custom provider installation method like the filesystem mirror.

27
MCQmedium

What is the effect of running 'terraform init -upgrade' on the '.terraform.lock.hcl' file?

A.It deletes the file.
B.It makes the file read-only.
C.It hides the file.
D.It updates the file to reflect new provider versions.
AnswerD

This is the correct function of the upgrade flag.

Why this answer

The -upgrade flag causes Terraform to ignore existing lock file constraints and update to the latest compatible versions, updating the lock file accordingly.

28
MCQmedium

If a user omits the 'version' in 'required_providers', what version does Terraform use?

A.It will fail to initialize.
B.The latest available version.
C.Version 1.0.0.
D.The oldest available version.
AnswerB

Without a constraint, the latest is pulled.

Why this answer

Terraform will attempt to use the latest version available in the registry if no constraint is provided.

29
Multi-Selectmedium

What are common reasons to use multiple provider instances? (Select TWO)

Select 2 answers
A.Increasing performance of the Terraform CLI.
B.Installing multiple versions of the same provider.
C.Bypassing the need for a state file.
D.Using different credentials for different resources.
E.Deploying resources to multiple AWS regions.
AnswersD, E

This is a standard use case.

Why this answer

Multiple instances are primarily used for multi-region or multi-account deployments.

30
Multi-Selecthard

Which of the following are true regarding the .terraform.lock.hcl file? (Select TWO)

Select 2 answers
A.It is automatically generated by terraform init.
B.It is used to store the state file.
C.It can only be edited manually.
D.It stores secret credentials.
E.It should be committed to version control.
AnswersA, E

Yes, it is generated when providers are initialized.

Why this answer

It stores checksums for providers to ensure consistency and security across different environments.

31
MCQmedium

You are creating a custom provider. What is the standard language used to write Terraform providers?

A.Python
B.Ruby
C.HCL
D.Go
AnswerD

Terraform providers are built using Go.

Why this answer

Terraform providers are written in Go (Golang) using the Terraform Plugin SDK.

32
Multi-Selecthard

What are requirements for a custom provider to be recognized by Terraform? (Select THREE)

Select 3 answers
A.Must be uploaded to the registry.
B.Must be signed by HashiCorp.
C.Must be a compiled binary.
D.Must follow a specific directory naming convention.
E.Must be written in Go.
AnswersC, D, E

Providers must be executable binaries.

Why this answer

Custom providers need a specific binary name, a specific directory structure, and possibly a configuration in .terraformrc or CLI config.

Ready to test yourself?

Try a timed practice session using only Provider Management questions.