hcl Flashcards

1
Q

terraform

A

required_providers {
aws = {
source =
“hashicorp/aws”
version = “~> 3.0”
}
}

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

provider

A

region = “us-west-2”

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

aws_vpc

A

cidr_block = var.vpc_cidr

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

aws_subnet

A

vpc_id = aws_vpc.main.id
availability_zone = var.az
map_public_ip_on_launch = true
cidr_block = var.subnet_cidr
tags = {
Name = “${var.env}-subnet” }

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

aws_internet_gateway

A

vpc_id = aws_vpc.main.id

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

aws_default_route_table

A

default_route_table_id = aws_vpc.main.default_route_table_id
route {
cidr_block = “0.0.0.0/0”
gateway_id =
aws_internet_gateway.main_gw.id
}
tags = {
Name = “${var.env}-default-rt”
}

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

aws_default_security_group

A

vpc_id = aws_vpc.main.id
egress {
from_port = 0
to_port = 0
protocol = “-1”
cidr_blocks = [“0.0.0.0/0”]
}
ingress {
from_port = 0
to_port = 0
protocol = “-1”
cidr_blocks = [“0.0.0.0/0”]
}

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

aws_key_pair

A

key_name = “my_key”
public_key = file(var.public_key)

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

data “aws_ami”

A

most_recent = true
owners = [“amazon”]
filter {
name = “name”
values = [var.ami_image]
}

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

var.ami_image

A

amzn2-ami-kernel-*-x86_64-gp2

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

aws_instance

A

ami = data.aws_ami.ubuntu_ami.id
instance_type = “t2.micro”
key_name = aws_key_pair.my_key_pair.key_name
vpc_security_group_ids = [aws_default_security_group.my_security_group.id]
subnet_id = aws_subnet.my_subnet.id
associate_public_ip_address = true
tags = {
Name = “my_instance”
}

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