Skip to content

Commit

Permalink
Look up AMI to use for dumpdb/restoredb (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
nb1701 authored Jun 17, 2024
1 parent ea088fc commit 4658106
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
16 changes: 15 additions & 1 deletion cloud/aws/modules/dbaccess/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,22 @@ resource "aws_key_pair" "dbaccess_key_pair" {
}
}

data "aws_ami" "ubuntu" {
most_recent = true
owners = ["099720109477"] # Canonical official

filter {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
}

filter {
name = "virtualization-type"
values = ["hvm"]
}
}
resource "aws_instance" "dbaccess_host" {
ami = var.host_ami
ami = data.aws_ami.ubuntu.image_id
instance_type = var.host_type
key_name = aws_key_pair.dbaccess_key_pair.key_name
security_groups = [aws_security_group.dbaccess_security_group.id]
Expand Down
5 changes: 0 additions & 5 deletions cloud/aws/modules/dbaccess/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ variable "public_subnet" {
type = string
description = "ID of the public subnet to deploy the dbaccess instance in"
}
variable "host_ami" {
type = string
description = "AMI ID to use for the dbaccess instance"
default = "ami-080e1f13689e07408"
}
variable "host_type" {
type = string
description = "Instance type to use for the dbaccess instance"
Expand Down

0 comments on commit 4658106

Please sign in to comment.