remote-exec provisioner not executing

2,222 views
Skip to first unread message

Ryan B

unread,
Jun 1, 2015, 9:23:23 PM6/1/15
to terrafo...@googlegroups.com
I have a template that launches 4 ec2 instance resources where the last instance is dep. on the first 3.  For some reason since I upgraded terraform from 0.2.x the remote-exec provisioner where i launch consul is skipped.  logs show the ephemeral-disks.sh script is executed but the inline block remote-exec is no where to be seen.  i checked the instance and the tmp shell script for the inline block is in /tmp.   I also see a terraform log entry that says the script exited with 0 status even though no actual log of the consul commands are present. 

I'm not sure what I'm missing... I'm hoping someone can point it out!

Here's a resource block for node3:

resource "aws_instance" "node3" {
    ami = "${lookup(var.aws_amis, var.region)}"
    instance_type = "${var.instance_type}"
    security_groups = ["${var.aws_security_group}"]
    subnet_id = "${var.aws_subnet_id}"
    key_name = "${var.key_name}"
    tags {
        Name = "${var.FCID}-node3"
    }
    connection {
        user = "root"
        host = "${aws_instance.node3.private_ip}"
        key_file = "${var.key_file}"
    }
    provisioner "remote-exec" {
        inline = [
        "consul agent -server -data-dir /tmp/consul -node=node3 -bind=${aws_instance.node3.private_ip} &",
        "sleep 1"
        ]
    }
    provisioner "remote-exec" {
        script = "${var.home}/code/terraform-config/scripts/ephemeral-disks.sh"
    }
}

Thanks!

--ryan

Sander van Harmelen

unread,
Jun 2, 2015, 1:36:06 AM6/2/15
to Ryan B, terrafo...@googlegroups.com
Hi Ryan,

What version are you currently using? Could you test it again with version v0.5.3 released yesterday?

And if it's still not working with the latest version, then please add the steps and/or config to reproduce the issue.

Additionally it would be great if you could 'export TF_LOG=1' run it again and send the logs.

Think that with all that we should be able to help you find the problem or bug.

Thanks!

Sander
--
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To post to this group, send email to terrafo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/475c7d8a-5592-4171-9adb-4428f63b12e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan B

unread,
Jun 4, 2015, 7:46:39 PM6/4/15
to terrafo...@googlegroups.com, weeb...@gmail.com
 Hi Sander,

I'm sorry for replying so late.  I had more pressing issues to take care of the last couple of days unfortunately.  I was finally able to do as you suggested.  I was running terraform 0.5.2 and have upped it to 0.5.3.  The results were still the same.

 You'll see below that terraform connected to the first 3 nodes and have started to run the remote-exec provisioners.  The remote-exec script that runs the consul service for one of the nodes is: /tmp/terraform_1298498081.sh

You'll see that it completes the run with an exit 0 but there are no log entries of its actions.  As if it ran an empty script.  You'll also see that the next remote-exec which launches the ephemeral_disks.sh script also completes but unlike the the inline one before it, it has log entries of it's activities.

All 3 nodes behaved the same so when the node1 fired up (depends on node2-4) remote-exec for consul and join commands it errored out because there were no consul server agents running on the 3 nodes that it was attempting to join.  This in turn caused terraform to error out.

The remote-exec with the inline comands: /tmp/terraform_1298498081.sh has the following inside i( I Xed out the IP):
# cat /tmp/terraform_1298498081.sh
#!/bin/sh
consul agent -server -data-dir /tmp/consul -node=node2 -bind=xxx.xxx.xxx.xxx &
sleep 1

I'm sparing you all the other log entries prior to the first ssh connections to the nodes.. :) :
aws_instance.node2 (remote-exec): Connected!
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 opening new ssh session
aws_instance.node3 (remote-exec): Connected!
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 opening new ssh session
aws_instance.node4 (remote-exec): Connected!
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 opening new ssh session
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Starting remote scp process:  scp -vt /tmp
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Started SCP session, beginning transfers...
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Copying input data into temporary file so we can read the length
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Beginning file upload...
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Starting remote scp process:  scp -vt /tmp
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Started SCP session, beginning transfers...
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Copying input data into temporary file so we can read the length
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Starting remote scp process:  scp -vt /tmp
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Beginning file upload...
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Started SCP session, beginning transfers...
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Copying input data into temporary file so we can read the length
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Beginning file upload...
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 SCP session complete, closing stdin pipe.
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 Waiting for SSH session to complete.
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 scp stderr (length 39): Sink: C0644 94 terraform_1298498081.sh
2015/06/04 12:52:21 terraform-provisioner-remote-exec: 2015/06/04 12:52:21 opening new ssh session
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 starting remote command: chmod 0777 /tmp/terraform_1298498081.sh
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 SCP session complete, closing stdin pipe.
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 Waiting for SSH session to complete.
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 SCP session complete, closing stdin pipe.
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 Waiting for SSH session to complete.
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 scp stderr (length 39): Sink: C0644 94 terraform_2019727887.sh
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 opening new ssh session
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 scp stderr (length 39): Sink: C0644 94 terraform_1427131847.sh
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 opening new ssh session
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 starting remote command: chmod 0777 /tmp/terraform_1427131847.sh
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 starting remote command: chmod 0777 /tmp/terraform_2019727887.sh
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 remote command exited with '0': chmod 0777 /tmp/terraform_1298498081.sh
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 opening new ssh session
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 starting remote command: /tmp/terraform_1298498081.sh
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 remote command exited with '0': chmod 0777 /tmp/terraform_2019727887.sh
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 opening new ssh session
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 remote command exited with '0': chmod 0777 /tmp/terraform_1427131847.sh
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 opening new ssh session
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 starting remote command: /tmp/terraform_2019727887.sh
2015/06/04 12:52:22 terraform-provisioner-remote-exec: 2015/06/04 12:52:22 starting remote command: /tmp/terraform_1427131847.sh
2015/06/04 12:52:23 terraform-provisioner-remote-exec: 2015/06/04 12:52:23 remote command exited with '0': /tmp/terraform_1298498081.sh
aws_instance.node2: Provisioning with 'remote-exec'...
2015/06/04 12:52:23 terraform-provisioner-remote-exec: 2015/06/04 12:52:23 remote command exited with '0': /tmp/terraform_2019727887.sh
aws_instance.node3: Provisioning with 'remote-exec'...
2015/06/04 12:52:23 terraform-provisioner-remote-exec: 2015/06/04 12:52:23 remote command exited with '0': /tmp/terraform_1427131847.sh
aws_instance.node4: Provisioning with 'remote-exec'...
aws_instance.node2 (remote-exec): Connecting to remote host via SSH...
aws_instance.node2 (remote-exec):   Host: 172.30.2.255
aws_instance.node2 (remote-exec):   User: root
aws_instance.node2 (remote-exec):   Password: false
aws_instance.node2 (remote-exec):   Private key: true
aws_instance.node2 (remote-exec):   SSH Agent: false
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 connecting to TCP connection for SSH
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 handshaking with SSH
aws_instance.node3 (remote-exec): Connecting to remote host via SSH...
aws_instance.node3 (remote-exec):   Host: 172.30.2.252
aws_instance.node3 (remote-exec):   User: root
aws_instance.node3 (remote-exec):   Password: false
aws_instance.node3 (remote-exec):   Private key: true
aws_instance.node3 (remote-exec):   SSH Agent: false
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 connecting to TCP connection for SSH
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 handshaking with SSH
aws_instance.node4 (remote-exec): Connecting to remote host via SSH...
aws_instance.node4 (remote-exec):   Host: 172.30.3.156
aws_instance.node4 (remote-exec):   User: root
aws_instance.node4 (remote-exec):   Password: false
aws_instance.node4 (remote-exec):   Private key: true
aws_instance.node4 (remote-exec):   SSH Agent: false
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 connecting to TCP connection for SSH
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 handshaking with SSH
aws_instance.node2 (remote-exec): Connected!
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 opening new ssh session
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Starting remote scp process:  scp -vt /tmp
aws_instance.node3 (remote-exec): Connected!
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 opening new ssh session
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Started SCP session, beginning transfers...
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Copying input data into temporary file so we can read the length
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Beginning file upload...
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 SCP session complete, closing stdin pipe.
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Waiting for SSH session to complete.
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 scp stderr (length 39): Sink: C0644 482 terraform_939984059.sh
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 opening new ssh session
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 opening new ssh session
aws_instance.node4 (remote-exec): Connected!
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Starting remote scp process:  scp -vt /tmp
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 starting remote command: chmod 0777 /tmp/terraform_939984059.sh
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Started SCP session, beginning transfers...
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Copying input data into temporary file so we can read the length
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Beginning file upload...
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 remote command exited with '0': chmod 0777 /tmp/terraform_939984059.sh
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 opening new ssh session
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 SCP session complete, closing stdin pipe.
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Waiting for SSH session to complete.
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 scp stderr (length 39): Sink: C0644 482 terraform_911902081.sh
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 opening new ssh session
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 starting remote command: /tmp/terraform_939984059.sh
2015/06/04 12:52:24 terraform-provisioner-remote-exec: 2015/06/04 12:52:24 Starting remote scp process:  scp -vt /tmp
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 starting remote command: chmod 0777 /tmp/terraform_911902081.sh
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 Started SCP session, beginning transfers...
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 Copying input data into temporary file so we can read the length
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 Beginning file upload...
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 remote command exited with '0': chmod 0777 /tmp/terraform_911902081.sh
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 opening new ssh session
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 SCP session complete, closing stdin pipe.
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 Waiting for SSH session to complete.
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 scp stderr (length 40): Sink: C0644 482 terraform_1474941318.sh
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 opening new ssh session
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 starting remote command: /tmp/terraform_911902081.sh
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 starting remote command: chmod 0777 /tmp/terraform_1474941318.sh
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 remote command exited with '0': chmod 0777 /tmp/terraform_1474941318.sh
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 opening new ssh session
2015/06/04 12:52:25 terraform-provisioner-remote-exec: 2015/06/04 12:52:25 starting remote command: /tmp/terraform_1474941318.sh
aws_instance.node3 (remote-exec): Model: Xen Virtual Block Device (xvd)
aws_instance.node3 (remote-exec): Disk /dev/xvdb: 16.4GB
aws_instance.node3 (remote-exec): Sector size (logical/physical): 512B/512B
aws_instance.node3 (remote-exec): Partition Table: msdos

aws_instance.node3 (remote-exec): Number  Start   End     Size    Type     File system  Flags
aws_instance.node3 (remote-exec):  1      1049kB  16.4GB  16.4GB  primary

aws_instance.node2 (remote-exec): Model: Xen Virtual Block Device (xvd)
aws_instance.node2 (remote-exec): Disk /dev/xvdb: 16.4GB
aws_instance.node2 (remote-exec): Sector size (logical/physical): 512B/512B
aws_instance.node2 (remote-exec): Partition Table: msdos

aws_instance.node2 (remote-exec): Number  Start   End     Size    Type     File system  Flags
aws_instance.node2 (remote-exec):  1      1049kB  16.4GB  16.4GB  primary

aws_instance.node3 (remote-exec): Model: Xen Virtual Block Device (xvd)
aws_instance.node3 (remote-exec): Disk /dev/xvdc: 16.4GB
aws_instance.node3 (remote-exec): Sector size (logical/physical): 512B/512B
aws_instance.node3 (remote-exec): Partition Table: msdos

aws_instance.node3 (remote-exec): Number  Start   End     Size    Type     File system  Flags
aws_instance.node3 (remote-exec):  1      1049kB  16.4GB  16.4GB  primary

aws_instance.node2 (remote-exec): Model: Xen Virtual Block Device (xvd)
aws_instance.node2 (remote-exec): Disk /dev/xvdc: 16.4GB
aws_instance.node2 (remote-exec): Sector size (logical/physical): 512B/512B
aws_instance.node2 (remote-exec): Partition Table: msdos

aws_instance.node4 (remote-exec): Model: Xen Virtual Block Device (xvd)
aws_instance.node2 (remote-exec): Number  Start   End     Size    Type     File system  Flags
aws_instance.node4 (remote-exec): Disk /dev/xvdb: 16.4GB
aws_instance.node2 (remote-exec):  1      1049kB  16.4GB  16.4GB  primary
aws_instance.node4 (remote-exec): Sector size (logical/physical): 512B/512B

aws_instance.node4 (remote-exec): Partition Table: msdos

aws_instance.node4 (remote-exec): Number  Start   End     Size    Type     File system  Flags
aws_instance.node4 (remote-exec):  1      1049kB  16.4GB  16.4GB  primary

aws_instance.node4 (remote-exec): Model: Xen Virtual Block Device (xvd)
aws_instance.node4 (remote-exec): Disk /dev/xvdc: 16.4GB
aws_instance.node4 (remote-exec): Sector size (logical/physical): 512B/512B
aws_instance.node4 (remote-exec): Partition Table: msdos

aws_instance.node4 (remote-exec): Number  Start   End     Size    Type     File system  Flags
aws_instance.node4 (remote-exec):  1      1049kB  16.4GB  16.4GB  primary

aws_instance.node2 (remote-exec): mdadm: Defaulting to version 1.2 metadata
aws_instance.node3 (remote-exec): mdadm: Defaulting to version 1.2 metadata
aws_instance.node3 (remote-exec): mdadm: array /dev/md0 started.
aws_instance.node2 (remote-exec): mdadm: array /dev/md0 started.
aws_instance.node3 (remote-exec): meta-data=/dev/md0               isize=256    agcount=16, agsize=499520 blks
aws_instance.node3 (remote-exec):          =                       sectsz=512   attr=2, projid32bit=0
aws_instance.node3 (remote-exec): data     =                       bsize=4096   blocks=7992320, imaxpct=25
aws_instance.node3 (remote-exec):          =                       sunit=64     swidth=128 blks
aws_instance.node3 (remote-exec): naming   =version 2              bsize=4096   ascii-ci=0
aws_instance.node3 (remote-exec): log      =internal log           bsize=4096   blocks=3904, version=2
aws_instance.node3 (remote-exec):          =                       sectsz=512   sunit=64 blks, lazy-count=1
aws_instance.node3 (remote-exec): realtime =none                   extsz=4096   blocks=0, rtextents=0
aws_instance.node2 (remote-exec): meta-data=/dev/md0               isize=256    agcount=16, agsize=499520 blks
aws_instance.node2 (remote-exec):          =                       sectsz=512   attr=2, projid32bit=0
aws_instance.node2 (remote-exec): data     =                       bsize=4096   blocks=7992320, imaxpct=25
aws_instance.node2 (remote-exec):          =                       sunit=64     swidth=128 blks
aws_instance.node2 (remote-exec): naming   =version 2              bsize=4096   ascii-ci=0
aws_instance.node2 (remote-exec): log      =internal log           bsize=4096   blocks=3904, version=2
aws_instance.node2 (remote-exec):          =                       sectsz=512   sunit=64 blks, lazy-count=1
aws_instance.node2 (remote-exec): realtime =none                   extsz=4096   blocks=0, rtextents=0
aws_instance.node4 (remote-exec): mdadm: Defaulting to version 1.2 metadata
aws_instance.node4 (remote-exec): mdadm: array /dev/md0 started.
aws_instance.node4 (remote-exec): meta-data=/dev/md0               isize=256    agcount=16, agsize=499520 blks
aws_instance.node4 (remote-exec):          =                       sectsz=512   attr=2, projid32bit=0
aws_instance.node4 (remote-exec): data     =                       bsize=4096   blocks=7992320, imaxpct=25
aws_instance.node4 (remote-exec):          =                       sunit=64     swidth=128 blks
aws_instance.node4 (remote-exec): naming   =version 2              bsize=4096   ascii-ci=0
aws_instance.node4 (remote-exec): log      =internal log           bsize=4096   blocks=3904, version=2
aws_instance.node4 (remote-exec):          =                       sectsz=512   sunit=64 blks, lazy-count=1
aws_instance.node4 (remote-exec): realtime =none                   extsz=4096   blocks=0, rtextents=0
2015/06/04 12:52:26 terraform-provisioner-remote-exec: 2015/06/04 12:52:26 remote command exited with '0': /tmp/terraform_911902081.sh
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalIf
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalWriteDiff
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalIf
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalWriteState
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalApplyPost
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalUpdateStateHook
aws_instance.node3: Creation complete
2015/06/04 12:52:26 terraform-provisioner-remote-exec: 2015/06/04 12:52:26 remote command exited with '0': /tmp/terraform_939984059.sh
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalIf
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalWriteDiff
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalIf
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalWriteState
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalApplyPost
2015/06/04 12:52:26 [DEBUG] root: eval: *terraform.EvalUpdateStateHook
aws_instance.node2: Creation complete
2015/06/04 12:52:27 terraform-provisioner-remote-exec: 2015/06/04 12:52:27 remote command exited with '0': /tmp/terraform_1474941318.sh
2015/06/04 12:52:27 [DEBUG] root: eval: *terraform.EvalIf
2015/06/04 12:52:27 [DEBUG] root: eval: *terraform.EvalWriteDiff
2015/06/04 12:52:27 [DEBUG] root: eval: *terraform.EvalIf
2015/06/04 12:52:27 [DEBUG] root: eval: *terraform.EvalWriteState
2015/06/04 12:52:27 [DEBUG] root: eval: *terraform.EvalApplyPost
2015/06/04 12:52:27 [DEBUG] root: eval: *terraform.EvalUpdateStateHook
aws_instance.node4: Creation complete

Ryan B

unread,
Jun 8, 2015, 6:34:07 PM6/8/15
to terrafo...@googlegroups.com
OK.. so I was able to get it to work.  It turns out it had to do with the way I was backgrounding the consul process through the remote-exec ssh session.  I wasn't redirecting all the output!  ssh doesn't like letting go of the session unless all output is redirected apparently.  I made things worse by attempting to fork (tee) the output to a log file while allowing it out to output console so I can see it in the DEBUG mode of terraform.  Well this doesn't work very well if you want to keep the service running.  I removed the tee and just redirected all output to a log file.  Also used 2>&1 to get STDERR as well.  It finally works but i did lose real time visibility in to consul's output while terraform is executing in DEBUG mode.

Sander van Harmelen

unread,
Jun 9, 2015, 2:48:02 AM6/9/15
to Ryan B, terrafo...@googlegroups.com
Hi Ryan,

Sorry for not responding earlier, just didn’t find the time to test with this myself… So great that you found a solution and thanks for sharing it!

Sander
 

On 9 Jun 2015, at 00:34:06, Ryan B <weeb...@gmail.com> wrote:

OK.. so I was able to get it to work.  It turns out it had to do with the way I was backgrounding the consul process through the remote-exec ssh session.  I wasn't redirecting all the output!  ssh doesn't like letting go of the session unless all output is redirected apparently.  I made things worse by attempting to fork (tee) the output to a log file while allowing it out to output console so I can see it in the DEBUG mode of terraform.  Well this doesn't work very well if you want to keep the service running.  I removed the tee and just redirected all output to a log file.  Also used 2>&1 to get STDERR as well.  It finally works but i did lose real time visibility in to consul's output while terraform is executing in DEBUG mode.

--
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To post to this group, send email to terrafo...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages