Skip to content

Commit

Permalink
feat(350) install terraform via asdf
Browse files Browse the repository at this point in the history
References #252, #350.
  • Loading branch information
smoyer64 committed Sep 19, 2022
1 parent 345813d commit 8fda8e8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 81 deletions.
1 change: 1 addition & 0 deletions roles/asdf/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
# TODO: add bash completion for kubectx
# TODO: add bash completion for kubens
# TODO: add bash completion for minikube
# TODO: add bash completion for terraform

- name: hook direnv into the bash shell
blockinfile:
Expand Down
3 changes: 3 additions & 0 deletions roles/asdf/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ removes:
- { path: "/usr/bin", pattern: "^minikube$"}
- { path: "/opt", pattern: "^skaffold$"}
- { path: "/usr/bin", pattern: "^skaffold$"}
- { path: "/opt", pattern: "^terraform$"}
- { path: "/usr/bin", pattern: "^terraform$"}
- { path: "/opt", pattern: "^terragrunt$"}
- { path: "/usr/bin", pattern: "^terragrunt$"}

Expand Down Expand Up @@ -60,5 +62,6 @@ tools:
- { name: "skaffold", version: "{{ skaffold_version }}"}
- { name: "sops", version: "{{ sops_version }}"}
- { name: "swag", version: "{{ swag_version }}"}
- { name: "terraform", version: "{{ terraform_version }}"}
- { name: "terragrunt", version: "{{ terragrunt_version }}"}
- { name: "yq", version: "{{ yq_version }}"}
77 changes: 8 additions & 69 deletions roles/containerization/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,75 +222,14 @@
# Terraform
#

- name: "create the installation directory for Terraform"
file:
name: "{{ terraform_installation_directory }}"
state: "directory"
tags:
- containerization
- kubernetes
- terraform

- name: "download the Terraform release archive"
get_url:
url: "{{ terraform_url }}"
dest: "~/{{ terraform_file }}"
mode: "755"
register: "terraform_download_result"
tags:
- containerization
- kubernetes
- terraform

- name: "expand the Terraform archive"
unarchive:
src: "~/{{ terraform_file }}"
dest: "{{ terraform_installation_directory }}"
copy: "no"
creates: "{{ terraform_home_directory }}"
when: "terraform_download_result is changed"
register: "terraform_unarchive_result"
tags:
- containerization
- kubernetes
- terraform

- name: "rename the Terraform archive directory to the version number"
command: "mv {{ terraform_installation_directory }}/terraform {{ terraform_home_directory }}"
when: "terraform_unarchive_result is changed"
tags:
- containerization
- kubernetes
- terraform

- name: "make a pretty symlink to the latest version of Terraform"
file:
src: "{{ terraform_home_directory }}"
dest: "{{ terraform_installation_directory }}/latest"
state: "link"
tags:
- containerization
- kubernetes
- terraform

- name: "create a symlink to the terraform executable"
file:
src: "{{ terraform_installation_directory }}/latest"
dest: "/usr/bin/terraform"
state: "link"
tags:
- containerization
- kubernetes
- terraform

- name: "set-up Terraform's bash completion"
template:
src: "../files/terraform.bash"
dest: "/etc/bash_completion.d/"
tags:
- containerization
- kubernetes
- terraform
# - name: "set-up Terraform's bash completion"
# template:
# src: "../files/terraform.bash"
# dest: "/etc/bash_completion.d/"
# tags:
# - containerization
# - kubernetes
# - terraform

#
# Kail
Expand Down
11 changes: 0 additions & 11 deletions roles/containerization/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ istio_url: "{{ istio_host }}/{{ istio_path }}/{{ istio_file }}"
istio_installation_directory: "/opt/istio"
istio_home_directory: "{{ istio_installation_directory }}/{{ istio_version }}"

# https://releases.hashicorp.com/terraform/0.11.10/terraform_0.11.10_linux_amd64.zip

terraform_host: "https://releases.hashicorp.com"
terraform_path: "terraform/{{ terraform_version }}"
terraform_file: "terraform_{{ terraform_version }}_linux_amd64.zip"

terraform_url: "{{terraform_host }}/{{ terraform_path }}/{{ terraform_file }}"

terraform_installation_directory: "/opt/terraform"
terraform_home_directory: "{{ terraform_installation_directory }}/{{ terraform_version }}"

# https://github.com/boz/kail/releases/download/v0.7.0/kail_0.7.0_linux_amd64.tar.gz

kail_host: "https://github.com"
Expand Down
2 changes: 1 addition & 1 deletion versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ semver_version: latest
skaffold_version: latest
sops_version: latest
swag_version: latest
terraform_version: latest
terragrunt_version: latest
yq_version: latest

Expand Down Expand Up @@ -77,7 +78,6 @@ helm_version: 3.9.4
helm_checksum: "sha256:31960ff2f76a7379d9bac526ddf889fb79241191f1dbe2a24f7864ddcb3f6560"
istio_version: 1.14.3
istio_checksum: "sha256:f5e2fbd1b15433fbf9597ee2818e837d221c45714a24f3aa392a46e0e1384eb4"
terraform_version: 1.2.8
kail_version: 0.15.0
stern_version: 1.21.0
stern_checksum: "sha256:18bb5afa0426d1ca2e975bee2a04037378d99ffdda6e3383a575ad28d5c2d04d"
Expand Down

0 comments on commit 8fda8e8

Please sign in to comment.