8627d5eb by Volodymyr Tsap

A small refactor

1 parent b5a5a554
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
5 3. Created variable files: terraform.tfvars, variables.tf 5 3. Created variable files: terraform.tfvars, variables.tf
6 4. Example for list element selection in *vpc_security_group_ids* 6 4. Example for list element selection in *vpc_security_group_ids*
7 5. Example for map element lookup in *instance_type* 7 5. Example for map element lookup in *instance_type*
8 8 6. Add metadata variable count
9 ``` 9 ```
10 # setup your AMS access parameters in ~/.aws 10 # setup your AMS access parameters in ~/.aws
11 11
......
1 # Sample2. Creating ubuntu instance using set of files
2
3 1. Build custom image using packer. Build/redeploy workflow
4 2. Deploy a sample application using *user_data*
5 3. Create RDS MySQL database, pass db endpoint to application
6 4. Adding outputs
7
8 ```
9 # setup your AMS access parameters in ~/.aws
10
11 # Init terraform
12 terraform init
13 # Create instance
14 terraform apply
15 ```
1 # Sample4. Using funtions and count hints
2
3 1. Moving deployment script into temlplate provider
4 2. Using *length()* function to get size and create multiple resources
5
6 ```
7 # setup your AMS access parameters in ~/.aws
8
9 # Init terraform
10 terraform init
11 # Create instance
12 terraform apply
13 ```
1 ## Define provider
2 provider "aws" {
3 region = "${var.region}"
4 }
5
6 # Template for initial configuration bash script 1 # Template for initial configuration bash script
7 data "template_file" "init" { 2 data "template_file" "init" {
8 template = "${file("init.tpl")}" 3 template = "${file("files/init.tpl")}"
9 count = "${length(var.instance_suffix)}" 4 count = "${length(var.instance_suffix)}"
10 5
11 vars { 6 vars {
......
1 ## Define provider
2 provider "aws" {
3 region = "${var.region}"
4 }