Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
terraform [2020/02/18 14:13] jsanders created |
terraform [2020/02/19 14:33] (current) jsanders |
||
---|---|---|---|
Line 1: | Line 1: | ||
===== Terraform ===== | ===== Terraform ===== | ||
- | Automation of infrastructure via code.\\ | + | Terraform is an open-source infrastructure as code software tool created by HashiCorp. It enables users to define and provision a datacenter infrastructure using a high-level configuration language known as Hashicorp Configuration Language (HCL), or optionally JSON. Terraform supports a number of cloud infrastructure providers such as Amazon Web Services, IBM Cloud (formerly Bluemix), Google Cloud Platform, DigitalOcean, Linode, Microsoft Azure, Oracle Cloud Infrastructure, OVH, or VMware vSphere as well as OpenNebula and OpenStack.\\ |
==== Provider Configuration ==== | ==== Provider Configuration ==== | ||
=== Generic Provider === | === Generic Provider === | ||
- | see: [[https://www.terraform.io/docs/configuration/providers.html|Providers - Configuration Language - Terraform by Hashicorp]]\\ | + | //see also:// [[https://www.terraform.io/docs/configuration/providers.html|Providers - Configuration Language - Terraform by Hashicorp]]\\ |
\\ | \\ | ||
=== AWS === | === AWS === | ||
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 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 |
===== References ===== | ===== References ===== | ||
- [[https://www.terraform.io/docs/providers/aws/index.html|Provider: AWS - Terraform by Hashicorp]] | - [[https://www.terraform.io/docs/providers/aws/index.html|Provider: AWS - Terraform by Hashicorp]] | ||
+ | - [[wp>Terraform_(software)|Terraform]] |