amazon ec2 - Terraform template_file and cloud-init -


i'm getting started on using terraform spin aws ec2 machines. see resources online pointing use of template_file resources, i'm not sure compared cloudinit.

from understanding, cloud-init bootstrapping, load multiple scripts local machine /var/lib/instance/scripts directory on ec2 instances, ran automatically using whatever interpreter specified. then, need render in template_file?

also, question have allowed run bash scripts part of cloud-init, or python interpreter allowed well?

template_file handy in situations when want render bash script values other resources in terraform configuration , pass user-data when launching ec2 instance. shell scripts , cloud-init directives allowed, says below:

when launch instance in amazon ec2, have option of passing user data instance can used perform common automated configuration tasks , run scripts after instance starts. can pass 2 types of user data amazon ec2: shell scripts , cloud-init directives. can pass data launch wizard plain text, file (this useful launching instances via command line tools), or base64-encoded text (for api calls).

more info: http://docs.aws.amazon.com/awsec2/latest/userguide/user-data.html


Comments