Exam 4 Flashcards
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?
Terraform Cloud Buisness
The terraform apply -refresh-only
command is used to reconcile
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.
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?
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"
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?
Use environment variables
Directly in provider block by hard coding or using varibles
Integrated service such as AWS IAM or Azure Identity
A provider alias is used for what purpose in a Terraform configuration file?
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.
Based on the Terraform code below, what block type is used to define the VPC?
` vpc_id = aws_vpc.main.id`
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
When Terraform the data block is executed, what value is the data source returning?
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.