-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
37 lines (30 loc) · 786 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
provider "aws" {
region = var.aws_region
access_key = var.access_key
secret_key = var.secret_key
}
data "aws_ami" "ubuntu" {
most_recent = true
filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-20220131"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
owners = ["099720109477"] # Canonical
}
data "template_file" "deploy" {
template = file("cloudinit.yml")
}
resource "aws_instance" "tig_prod" {
ami = data.aws_ami.ubuntu.id
instance_type = "t2.micro"
key_name = var.key_name
vpc_security_group_ids = [aws_security_group.tig_prod.id]
user_data = data.template_file.deploy.rendered
tags = {
Name = "tig-prod"
}
}