Exam 4 Flashcards

1
Q

Terraform Cloud Agents are a feature that allows Terraform Cloud to communicate with private infrastructure, such as VMware hosts running on-premises. Which version of Terraform Cloud supports this feature?

A

Terraform Cloud Buisness

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The terraform apply -refresh-only command is used to reconcile

A

the state Terraform knows about (via its state file) with the real-world infrastructure. This can be used to detect any drift from the last-known state, and to update the state file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

You are deploying a new application and want to deploy it to multiple AWS regions within the same configuration file. Which features will allow you to configure this?

A

mulitple provider blocks using an alias

provider "aws" {
  region = "us-east-1"
}
provider "aws" {
  **alias  = "west"**
  region = "us-west-2"
}
resource "aws_instance" "vault" {
**  provider                    = aws.west**
  ami                         = data.aws_ami.amzlinux2.id
  instance_type               = "t3.micro"
  key_name                    = "ec2_key"
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When using a Terraform provider, it’s common that Terraform needs credentials to access the API for the underlying platform, such as VMware, AWS, or Google Cloud. While there are many ways to accomplish this, what are three options that you can provide these credentials?

A

Use environment variables
Directly in provider block by hard coding or using varibles
Integrated service such as AWS IAM or Azure Identity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A provider alias is used for what purpose in a Terraform configuration file?

A

for using the same provider with different configurations for different resources

To create multiple configurations for a given provider, include multiple provider blocks with the same provider name. For each additional non-default configuration, use the alias meta-argument to provide an extra name segment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Based on the Terraform code below, what block type is used to define the VPC?

` vpc_id = aws_vpc.main.id`

A

The VPC is defined in a resource block,

resource "aws_vpc" "main" {
  cidr_block = var.base_cidr_block
}

If it were locals or data block the resource would be referred to as local.aws_vpc or data.aws_vpc.i.main.id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When Terraform the data block is executed, what value is the data source returning?

A

Terraform will retrieve all of the available data for that particular resource. It is then up to you to reference a specific attribute that can be exported from that data source.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly