Open
Description
First of all, thanks for a great helper tools - really useful and simple.
Recently I integrated ssm-run
into Terraform, basically replacing SSH-based bootstrapping with Session Manager. This allows also to bootstrap completely private instances, without public IP or any jump host.
I am passing instance ID and bootstrap script to the ssm-init script:
provisioner "local-exec" {
command = "${path.module}/bootstrap/ssm-init.sh ${self.id} ${var.bootstrap_script_path}"
}
And the ssm-init.sh
script (not - totally not perfect, just a first version, but it works):
#!/bin/bash
instance=$1
script=$2
while true :
do
result=$(ssm-run -i $instance -file $script -log-level 1 | grep "1 SUCCESS")
if [ $? == 0 ]; then
echo "Instance provisioned!"
break
fi
echo 'SSM Sessions are not available yet. Sleeping for 5 seconds.'
sleep 5
done
As ssm-helpers are written in Go, it should be possible to integrate it as a provisioner in AWS provider for Terraform. Just an idea I thought I shall share here.
Metadata
Metadata
Assignees
Labels
No labels