Skip to content

Instantly share code, notes, and snippets.

@claydanford
Created June 5, 2019 20:54
Show Gist options
  • Save claydanford/425b0df108663679d93a876e618a2f78 to your computer and use it in GitHub Desktop.
Save claydanford/425b0df108663679d93a876e618a2f78 to your computer and use it in GitHub Desktop.
How to generate external user-data and pass it into the terrform module.
module "jenkins_ha_agents" {
source = "neiman-marcus/jenkins-ha-agents/aws"
snipped for brevity…
extra_agent_userdata = "${data.template_file.extra_agent_userdata.rendered}"
extra_agent_userdata_merge = "list(append)+dict(recurse_array)+str()"
extra_master_userdata = "${data.template_file.extra_master_userdata.rendered}"
extra_master_userdata_merge = "list(append)+dict(recurse_array)+str()"
}
data "template_file" "extra_agent_userdata" {
vars {
foo = "bar"
}
template = <<EOF
---
runcmd:
- echo 'foo = ${foo}'
EOF
}
data "template_file" "extra_master_userdata" {
vars {
foo = "bar"
}
template = <<EOF
---
runcmd:
- echo 'foo = ${foo}'
EOF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment