TF-003 Use Terraform outside the core workflow • Complete Question Bank
Complete TF-003 Use Terraform outside the core workflow question bank — all 0 questions with answers and detailed explanations.
Refer to the exhibit.
```
$ terraform plan
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
~ update in-place
- destroy
Terraform will perform the following actions:
# aws_instance.web will be created
+ resource "aws_instance" "web" {
+ ami = "ami-0c55b159cbfafe1f0"
+ instance_type = "t2.micro"
+ tags = {
+ "Name" = "WebServer"
}
}
# aws_security_group.web_sg will be updated in-place
~ resource "aws_security_group" "web_sg" {
id = "sg-12345678"
~ name = "web_sg_old" -> "web_sg_new"
~ tags = {
"Name" = "Web SG"
}
}
# aws_eip.web_eip will be destroyed
- resource "aws_eip" "web_eip" {
id = "eipalloc-12345678"
domain = "vpc"
}
Plan: 1 to add, 1 to change, 1 to destroy.
```Refer to the exhibit. ``` Error: Failed to query available provider packages Could not retrieve the list of available versions for provider hashicorp/aws: could not connect to the registry: the request failed after 2 attempts, please check your internet connection ```
You are a platform engineer at a large e-commerce company that uses Terraform Enterprise to manage thousands of infrastructure resources across multiple teams. The company has a central 'networking' workspace that provisions shared VPCs and subnets, and several application workspaces that consume these networking resources via remote state data sources. Recently, the networking team changed the CIDR block of a shared subnet from '10.0.1.0/24' to '10.0.2.0/24' and applied the change successfully. However, the application teams are now reporting that their Terraform runs are failing with errors indicating that the subnet ID they reference does not exist. The application workspaces use the following configuration to consume the subnet:
```hcl data "terraform_remote_state" "networking" { backend = "remote" config = { organization = "mycompany" workspaces = { name = "networking"
} } }
resource "aws_instance" "app" { subnet_id = data.terraform_remote_state.networking.outputs.subnet_id ...
}
```
The application workspaces have not been modified recently. The networking workspace output 'subnet_id' now contains the ID of the updated subnet. What is the most likely cause of the failures?
Refer to the exhibit.
```
# backend.tf
terraform {
backend "remote" {
organization = "myorg"
workspaces {
name = "example-workspace"
}
}
}
# main.tf
resource "null_resource" "example" {
triggers = {
always = timestamp()
}
provisioner "local-exec" {
command = "echo '${self.id}'"
}
}
```
When running `terraform plan` locally, the user receives the error: "Error: Backend initialization required: please run 'terraform init'".Drag steps to the numbered slots on the right, or tap a step then tap a slot.
Drag a concept onto its matching description — or click a concept then click the description.
Create multiple instances from one resource block
Create multiple instances from a map or set of strings
Explicitly specify hidden resource dependencies
Control resource creation/destruction behavior
Select a non-default provider configuration
Error: Error acquiring the state lock on <empty> line 0: (source code not available) ConditionalCheckFailedException: The conditional request failed
resource "aws_instance" "web" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
provisioner "local-exec" {
command = "echo ${aws_instance.web.private_ip} > /tmp/ip.txt"
}
}Sentinel policy "restrict-instance-types" evaluation resulted in "failure". Description: Instance types must be t2.micro or t2.small.
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
}Error: Error acquiring the state lock ... Lock Info: ID: abc123 Path: terraform.tfstate Operation: OperationTypeInvalid Who: user@host Version: 0.12.0 Created: 2019-10-17 12:00:00 Info:
Initializing modules... Downloading registry.terraform.io/hashicorp/consul/aws 0.1.0... - consul in modules/consul
Terraform will perform the following actions:
# aws_instance.web will be updated in-place
~ resource "aws_instance" "web" {
~ ami = "ami-abc123" -> "ami-def456"
id = "i-1234567890abcdef0"
~ instance_type = "t2.micro" -> "t2.small"
tags = {
"Name" = "web-server"
}
}
Plan: 0 to add, 1 to change, 0 to destroy.