Terraform: Using user data in Launch configuration

TerraformUser data is commonly used in launch configuration to run scripts during instance initialization. Launch configuration is usually used along with auto scaling groups to launch instances with similar instance settings. Userdata can be templatized in terraform. Templatizing helps in adding dynamic values to the user data scripts. In the userdata template file refer template variables using ${variable_name} . These variable values can be populated in the resource “template_file” vars option.


Template file example: app_install.tpl

Resource Template file

Launch configuration