User Tools

Site Tools


terraform

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
terraform [2020/02/18 09:22] – jsandersterraform [2020/02/19 09:33] (current) – jsanders
Line 43: Line 43:
   }   }
 If specifying the profile through the ''AWS_PROFILE'' environment variable, you may also need to set ''AWS_SDK_LOAD_CONFIG'' to a truthy value (e.g. ''AWS_SDK_LOAD_CONFIG=1'') for advanced AWS client configurations, such as profiles that use the ''source_profile'' or ''role_arn'' configurations. If specifying the profile through the ''AWS_PROFILE'' environment variable, you may also need to set ''AWS_SDK_LOAD_CONFIG'' to a truthy value (e.g. ''AWS_SDK_LOAD_CONFIG=1'') for advanced AWS client configurations, such as profiles that use the ''source_profile'' or ''role_arn'' configurations.
-\\+==== Adding User Data in Configs ==== 
 +To add a user data file into a startup/config script, first store your script in a server-accessible location, then create a file named ''userdata.txt'' using the following template: 
 +  <powershell> 
 +  C:\\Path\\To\\Your\\Launch\\Scripts\\InitializeInstance.ps1 -Schedule 
 +  </powershell> 
 +You can then launch the instance by specifying the text file containing pointers to your script(s): 
 +  resource "aws_instance" "my-test-instance" { 
 +    ami             = "${data.aws_ami.ec2-worker-initial-encrypted-ami.id}" 
 +    instance_type   = "t2.micro" 
 +   
 +    tags { 
 +      Name = "my-test-instance" 
 +    } 
 +   
 +    user_data = "${file(userdata.txt)}" 
 +  }
 ==== Selected Documentation ==== ==== Selected Documentation ====
   - [[https://www.terraform.io/docs/providers/aws/index.html#argument-reference|Provider: AWS - Argument Reference]] - These arguments, along with the [[terraform#generic_provider|generic provider arguments]], are supported in the AWS Provider block   - [[https://www.terraform.io/docs/providers/aws/index.html#argument-reference|Provider: AWS - Argument Reference]] - These arguments, along with the [[terraform#generic_provider|generic provider arguments]], are supported in the AWS Provider block
terraform.1582035777.txt.gz · Last modified: by jsanders