I'm working with Terraform, launching an ECS cluster.
I'm using a script that was written by someone else. I understand most of the launch configuration script, other than this one point:
I'm trying to find the link between the autoscaling group and the ECS cluster.
I have an aws_autoscaling_group
which uses an aws_launch_configuration
(see below).
The aws_launch_configuration
has a user_data
parameter. This is the only link between the autoscaling group and the cluster that I can find.
Looking at the links (bottom) to the documentation, it's not giving a very good explanation of 'what' user_data
is. Can someone please help me understand "how" the user_data
links the autoscaling group with the cluster, and if at all possible give some example or link to what it's normally used for and how it's normally used.
...
resource "aws_launch_configuration" "ecs_host" {
...
user_data = <<EOF
#!/bin/bash
echo ECS_CLUSTER=${var.cluster_name} >> /etc/ecs/ecs.config
EOF
}
...
terraform apply outputs:
...
+ aws_launch_configuration.ecs_host
...
user_data: "4e27e8feea0896af43ada0c647877da3766f5dcb"
...
https://www.terraform.io/docs/providers/aws/r/instance.html#user_data https://www.terraform.io/docs/providers/aws/r/launch_configuration.html#user_data