copyright | lastupdated | keywords | subcollection | ||
---|---|---|---|---|---|
|
2025-01-15 |
secure-infrastructure-vpc |
{{site.data.keyword.attribute-definition-list}}
{: #user-data}
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. {: shortdesc}
To set user data for the VSIs, you need to pass a map to the optional user_data
input variable.
{: #user-data-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.