From f67b4b0e12ff50bb57cc6ef5dab4b9c1a037ff60 Mon Sep 17 00:00:00 2001 From: Edward Viaene Date: Fri, 14 Oct 2016 08:59:23 +0000 Subject: [PATCH] removed deprecated lines --- demo-10/cloudinit.tf | 15 +++++++++------ demo-10/instance.tf | 2 +- demo-10/scripts/volumes.sh | 2 -- demo-10/vars.tf | 3 +++ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/demo-10/cloudinit.tf b/demo-10/cloudinit.tf index b84e137..553e9a5 100644 --- a/demo-10/cloudinit.tf +++ b/demo-10/cloudinit.tf @@ -1,15 +1,18 @@ provider "cloudinit" {} -resource "template_file" "init-script" { +data "template_file" "init-script" { template = "${file("scripts/init.cfg")}" vars { - region = "${var.AWS_REGION}" + REGION = "${var.AWS_REGION}" } } -resource "template_file" "shell-script" { +data "template_file" "shell-script" { template = "${file("scripts/volumes.sh")}" + vars { + DEVICE = "${var.INSTANCE_DEVICE_NAME}" + } } -resource "template_cloudinit_config" "cloudinit-example" { +data "template_cloudinit_config" "cloudinit-example" { gzip = false base64_encode = false @@ -17,12 +20,12 @@ resource "template_cloudinit_config" "cloudinit-example" { part { filename = "init.cfg" content_type = "text/cloud-config" - content = "${template_file.init-script.rendered}" + content = "${data.template_file.init-script.rendered}" } part { content_type = "text/x-shellscript" - content = "${template_file.shell-script.rendered}" + content = "${data.template_file.shell-script.rendered}" } } diff --git a/demo-10/instance.tf b/demo-10/instance.tf index e615b01..a7b4e1d 100644 --- a/demo-10/instance.tf +++ b/demo-10/instance.tf @@ -22,7 +22,7 @@ resource "aws_ebs_volume" "ebs-volume-1" { } resource "aws_volume_attachment" "ebs-volume-1-attachment" { - device_name = "/dev/xvdh" + device_name = "${var.INSTANCE_DEVICE_NAME}" volume_id = "${aws_ebs_volume.ebs-volume-1.id}" instance_id = "${aws_instance.example.id}" } diff --git a/demo-10/scripts/volumes.sh b/demo-10/scripts/volumes.sh index 60a59db..f0f6861 100644 --- a/demo-10/scripts/volumes.sh +++ b/demo-10/scripts/volumes.sh @@ -2,8 +2,6 @@ vgchange -ay -DEVICE="/dev/xvdh" - DEVICE_FS=`blkid -o value -s TYPE ${DEVICE}` exit 0 pvcreate ${DEVICE} diff --git a/demo-10/vars.tf b/demo-10/vars.tf index d880ef6..179eca7 100644 --- a/demo-10/vars.tf +++ b/demo-10/vars.tf @@ -15,3 +15,6 @@ variable "AMIS" { eu-west-1 = "ami-844e0bf7" } } +variable "INSTANCE_DEVICE_NAME" { + default = "/dev/xvdh" +}