Skip to content

[~] - update ami to amazon linux 2 #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ data "aws_vpc" "vpc" {
data "aws_region" "current" {
}

data "aws_ami_ids" "ami" {
owners = ["amazon"]
data "aws_ami" "amazon-linux-2" {
owners = ["amazon"]
most_recent = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
most_recent = true

This isn't an valid attribute, https://www.terraform.io/docs/providers/aws/d/ami_ids.html#sort_ascending is probably what you were thinking of but that defaults to descending which is what we want.


filter {
name = "owner-alias"
values = ["amazon"]
}

filter {
name = "name"
values = ["amzn-ami-hvm-2017*-gp2"]
values = ["amzn2-ami-hvm-*-x86_64-gp2"]
}
}

Expand Down Expand Up @@ -152,7 +158,7 @@ resource "aws_security_group" "rabbitmq_nodes" {

resource "aws_launch_configuration" "rabbitmq" {
name = local.cluster_name
image_id = data.aws_ami_ids.ami.ids[0]
image_id = data.aws_ami.amazon-linux-2.id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
image_id = data.aws_ami.amazon-linux-2.id
image_id = data.aws_ami_ids.amazon-linux-2.ids[0]

instance_type = var.instance_type
key_name = var.ssh_key_name
security_groups = concat([aws_security_group.rabbitmq_nodes.id], var.nodes_additional_security_group_ids)
Expand Down