Adding user data to your VSI on VPC landing zone deployable architecture
You can specify optional user data that automatically performs common configuration tasks or runs scripts on your VSI on VPC landing zone deployable architecture. For more information, see docs.
To set user data for the VSIs, you need to pass a map to the optional user_data
input variable.
Example
When using the user_data
variable in your configuration, it's essential to provide the content in the correct format for it to be properly recongnized by the terraform.
The user_data
variable should contain data formatted as follows:
{
management = {
user_data = <<-EOT
#cloud-config
# vim: syntax=yaml
write_files:
- content: |
# This is management
path: /etc/sysconfig/management
EOT
}
workload = {
user_data = <<-EOT
#cloud-config
# vim: syntax=yaml
write_files:
- content: |
# This is workload
path: /etc/sysconfig/workload
EOT
}
}
- Keys to the map should be the same as the vpc names.
- Value for the
user_data
parameter in the object should follow YAML formatting. - Use
<<-EOT
andEOT
to enclose youruser_data
content to ensure it's passed as multi-line string.