Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASG run command on boot #1643

Closed
mzupan opened this issue Apr 23, 2015 · 2 comments
Closed

ASG run command on boot #1643

mzupan opened this issue Apr 23, 2015 · 2 comments

Comments

@mzupan
Copy link
Contributor

mzupan commented Apr 23, 2015

In cloud formation we do something like

"UserData" : {
          "Fn::Base64" : {
            "Fn::Join" : ["",[
              "#!/bin/bash -ex","\n",
              "NAME=1-api-batch-01","\n",
              "ROLE=role[api-batch]","\n",
              "aws s3 cp s3://", {"Fn::FindInMap":["EnvMap", {"Ref":"Environment"}, "ChefBucketName"] }, "/chef/chef_bootstrap.sh /tmp/chef_bootstrap.sh","\n",
              "chmod 700 /tmp/chef_bootstrap.sh","\n",
              "/tmp/chef_bootstrap.sh $NAME $ROLE","\n",
              "rm /tmp/chef_bootstrap.sh","\n",
              ""
              ] ]
          }
        }

I'm wondering if there is a way to do something in terraform to create an autoscale group that will run a set of commands once the instance starts up.

Or just have to bake it into the loaded AMI?

@radeksimko
Copy link
Member

User-data is an AWS-specific feature and you should be able to pass any user-data via aws_launch_configuration.*.user_data

See docs: https://www.terraform.io/docs/providers/aws/r/launch_config.html#user_data

@mzupan mzupan closed this as completed Apr 23, 2015
@ghost
Copy link

ghost commented May 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@hashicorp hashicorp locked and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants