Skip to content

Commit

Permalink
Pin AMI to prevent destroy and re-create
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Jul 26, 2024
1 parent a909d76 commit 8405528
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
9 changes: 3 additions & 6 deletions tf/modules/ansible_controller/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
data "aws_ssm_parameter" "ubuntu_22_ami" {
name = "/aws/service/canonical/ubuntu/server/22.04/stable/current/amd64/hvm/ebs-gp2/ami-id"
}

resource "aws_security_group" "ansible_ctrl_sg" {
description = "security group for ansible controller"
name_prefix = "ooni-ansible-ctrl"
Expand Down Expand Up @@ -40,7 +36,8 @@ resource "aws_security_group" "ansible_ctrl_sg" {
}

resource "aws_instance" "ansible_controller" {
ami = data.aws_ssm_parameter.ubuntu_22_ami.value
# Ubuntu 22.04
ami = "ami-07652eda1fbad7432"
instance_type = var.instance_type
key_name = var.key_name

Expand All @@ -60,7 +57,7 @@ resource "aws_instance" "ansible_controller" {

vpc_security_group_ids = [aws_security_group.ansible_ctrl_sg.id]

tags = var.tags
tags = merge(var.tags, { Name = "ansible-controller" })
}

resource "aws_route53_record" "oonith_service_alias" {
Expand Down
24 changes: 2 additions & 22 deletions tf/modules/cloudhsm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,9 @@ resource "aws_security_group" "hsm" {
}
}

data "aws_ami" "amazon_linux" {
most_recent = true
owners = ["amazon"]

filter {
name = "name"
values = ["al2023-ami-*"]
}

filter {
name = "architecture"
values = ["x86_64"]
}

filter {
name = "virtualization-type"
values = ["hvm"]
}

}

resource "aws_instance" "codesign_box" {
ami = data.aws_ami.amazon_linux.id
# Amazon linux
ami = "ami-03bb61bfa8e4d149e"

key_name = var.key_name
instance_type = "t3.micro"
Expand Down

0 comments on commit 8405528

Please sign in to comment.