Skip to content

Commit

Permalink
use not first but most recent ami (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
zystem authored and scholzj committed Apr 18, 2018
1 parent 93e459e commit 281a942
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ resource "aws_key_pair" "keypair" {
# AMI image
#####

data "aws_ami_ids" "centos7" {
data "aws_ami" "centos7" {
most_recent = true
owners = ["aws-marketplace"]

filter {
Expand Down Expand Up @@ -279,7 +280,7 @@ resource "aws_eip" "master" {
resource "aws_instance" "master" {
instance_type = "${var.master_instance_type}"

ami = "${data.aws_ami_ids.centos7.ids[0]}"
ami = "${data.aws_ami.centos7.id}"

key_name = "${aws_key_pair.keypair.key_name}"

Expand Down Expand Up @@ -323,7 +324,7 @@ resource "aws_eip_association" "master_assoc" {

resource "aws_launch_configuration" "nodes" {
name = "${var.cluster_name}-nodes"
image_id = "${data.aws_ami_ids.centos7.ids[0]}"
image_id = "${data.aws_ami.centos7.id}"
instance_type = "${var.worker_instance_type}"
key_name = "${aws_key_pair.keypair.key_name}"
iam_instance_profile = "${aws_iam_instance_profile.node_profile.name}"
Expand Down

0 comments on commit 281a942

Please sign in to comment.