Skip to content

Commit 178b0d2

Browse files
authored
update installing terraform binary, terraform flow notes
1 parent 47554e6 commit 178b0d2

File tree

1 file changed

+41
-15
lines changed

1 file changed

+41
-15
lines changed

README.md

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,61 @@
11
# tl-eks-terraform
2-
Resources required for deployment of tl accounts on EKS using terraform IAC
2+
Resources required for deployment of AWS EKS using terraform IAC
33

4-
**Requirement**
4+
##Requirement
55
--------------------------
6-
terraform v0.12, python-pydot, python-pydot-ng and graphviz for resource graph visualization
6+
terraform v0.12, aws-iam-authenticator, python-pydot, python-pydot-ng and graphviz for resource graph visualization
77

88
AWS provider version auto installed from terrafrom init and set to versoon "~2.0"
99

10+
1. Installing terraform provider [manual] (https://learn.hashicorp.com/terraform/getting-started/install.html)
11+
- To install terraform, find the right package for your system from [downloads] (https://www.terraform.io/downloads.html). Select the right package, right click and copy link location
12+
- download the package using wget or curl: wget `paste link location`
13+
- unzip the package: unzip terraform.zip
14+
- terraform runs as a single binary. any other files in the package can be safely removed and terraform will still function. Move the terraform binary to one of the locations like /usr/bin or /usr/local/bin and include PATH.
15+
- mv ~/terraform /usr/local/bin/teraform
16+
- set PATH to reflect the binary. Refer to link in step 1 for installation and setup binary
17+
- verify the installation: terraform -h
1018

11-
**Usage**
19+
2. Installing aws-iam-authenticator for [Linux] (https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html)
20+
21+
3. Installing python-pydot,python-pydot-ng and graphviz for graph visualization:
22+
- sudo apt install python-pydot python-pydot-ng graphviz
23+
24+
25+
##Usage
1226
-----------------------------------
1327

14-
Use aws configure to load your api access keys to default credentials file at "~/.aws/credentials"
28+
1. Use aws configure to load your api access keys to default credentials file at "~/.aws/credentials" with profiles dev and prod. Loading through shared credentials file is not recommended, however a good approach is to get temporary STS credentials.
1529

16-
Create 2 profiles dev and prod and use the same for aws credentials as well.
30+
2. terraform variables will be defaulted to region=us-west-2 and profile=dev if not specified during the terraform plan
1731

18-
terraform variables will be defaulted to region=us-west-2 and profile=dev if not specified during the terraform plan
32+
3. All the code related to eks, vpc, storage will be under modules and for each environments for dev and prod can be created under environments directory. Always run from the envirnments main directory for terraform plan, apply, destroy and pull modules for code reusability
1933

34+
4. Terraform flow:
2035

21-
terraform validate
36+
```
37+
1. Initialize the plugins for the provider and sync the terraform backend
38+
- terraform init
2239
23-
terraform init
40+
2. To validate the syntax for terraform config files
41+
- terraform validate
2442
25-
terraform plan -out=tfplan
43+
3. To output the terraform resource config out to an output plan file before applying changes.
44+
- terraform plan -out=tfplan
2645
27-
terraform apply tfplan
46+
4. Apply changes to the terraform plan
47+
- terraform apply tfplan
2848
29-
terraform destroy -auto-approve
49+
5. View resources.
50+
- terraform show
51+
52+
6. Destroy changes to the resources or tear down the infrastructure.
53+
- terraform destroy -auto-approve
54+
55+
```
3056

3157

32-
**Resource graph**
58+
##Resource graph
3359
--------------------------------
3460
Resource graph of the terraform plan. Use graphviz to analyze it
3561

@@ -40,7 +66,7 @@ terraform graph | dot -Tsvg > images/resource-graph.svg
4066
![](images/resource-graph.svg)
4167

4268

43-
**Output**
69+
##Output
4470
-----------------------------------------------------
4571
```
4672
Apply complete! Resources: 33 added, 0 changed, 0 destroyed.
@@ -83,7 +109,7 @@ tl-dev-terraformbucket_name = arn:aws:s3:::tl-eks-dev-terraformstate
83109
84110
```
85111

86-
**Access EKS endpoint**
112+
##Access EKS endpoint
87113
------------------------------------------------------
88114
```
89115
root@ramu-VirtualBox:~# aws eks list-clusters --region us-west-2 --profile dev

0 commit comments

Comments
 (0)