From a1999adf2d871876e8dbe1b77d4d1de175fa3a04 Mon Sep 17 00:00:00 2001 From: Edward Viaene Date: Thu, 21 Jun 2018 08:10:50 +0000 Subject: [PATCH] updates to sh script and output --- jenkins-packer-demo/output.tf | 4 ++-- .../scripts/configure-remote-state.sh | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/jenkins-packer-demo/output.tf b/jenkins-packer-demo/output.tf index e90f4dc..4c9668a 100644 --- a/jenkins-packer-demo/output.tf +++ b/jenkins-packer-demo/output.tf @@ -1,6 +1,6 @@ output "jenkins-ip" { - value = "${aws_instance.jenkins-instance.public_ip}" + value = "${aws_instance.jenkins-instance.*.public_ip}" } output "app-ip" { - value = "${aws_instance.app-instance.public_ip}" + value = "${aws_instance.app-instance.*.public_ip}" } diff --git a/jenkins-packer-demo/scripts/configure-remote-state.sh b/jenkins-packer-demo/scripts/configure-remote-state.sh index 6616232..041f70e 100755 --- a/jenkins-packer-demo/scripts/configure-remote-state.sh +++ b/jenkins-packer-demo/scripts/configure-remote-state.sh @@ -1,5 +1,14 @@ -#!/bin/sh -# not necessary anymore in newer terraform versions, you can use a backend.tf file -if [ "`terraform --version |head -n1`" == "Terraform v0.7.7" ] ; then - terraform remote config -backend=s3 -backend-config="bucket=terraform-state-a2b621f" -backend-config="key=terraform/terraform.tfstate" -backend-config="region=eu-west-1" -fi +#!/bin/bash + +echo "Newer terraform versions have a new way of defining a backend. Copy paste the following code in a backend.tf file, modify the region/s3 bucket, and execute 'terraform init' to initialize the backend. You'll be asked to copy the data from the local backend to the s3 backend, which you can answer yes. +" +echo 'backend.tf +========== +terraform { + backend "s3" { + bucket = "terraform-state-a3c731f" + key = "terraform.tfstate" + region = "eu-west-1" + } +} +'