Skip to content

Commit 8e26ccd

Browse files
authored
Uncharted update (#150)
* Simplify Terraform required providers * Bugfix for TLS EKS dependency issues * Add Helm provider * Add kube state metrics * Update Terraform Lock * Add kube state metrics version * Simplify Dev Containers * Update Terraform versions and remote state * Update GitHub Action workflow * Update Terraform lockfile
1 parent ea19a92 commit 8e26ccd

File tree

7 files changed

+73
-155
lines changed

7 files changed

+73
-155
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/codespaces-linux/.devcontainer/base.Dockerfile
2-
3-
FROM mcr.microsoft.com/vscode/devcontainers/universal:2-focal
1+
# See https://hub.docker.com/r/hashicorp/terraform for more information
2+
FROM hashicorp/terraform:1.2.6

.devcontainer/devcontainer.json

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77
"dockerfile": "Dockerfile"
88
},
99

10-
"features": {
11-
"terraform": {
12-
"version": "latest",
13-
"tflint": "latest"
14-
}
15-
},
16-
1710
// Configure tool-specific properties.
1811
"customizations": {
1912
// Configure properties specific to VS Code.
@@ -25,22 +18,5 @@
2518
"HashiCorp.terraform"
2619
]
2720
}
28-
},
29-
30-
"remoteUser": "codespace",
31-
32-
"overrideCommand": false,
33-
34-
"mounts": ["source=codespaces-linux-var-lib-docker,target=/var/lib/docker,type=volume"],
35-
36-
"runArgs": [
37-
"--cap-add=SYS_PTRACE",
38-
"--security-opt",
39-
"seccomp=unconfined",
40-
"--privileged",
41-
"--init"
42-
],
43-
44-
// "oryx build" will automatically install your dependencies and attempt to build your project
45-
"postCreateCommand": "oryx build -p virtualenv_name=.venv --log-file /tmp/oryx-build.log --manifest-dir /tmp || echo 'Could not auto-build. Skipping.'"
21+
}
4622
}

.github/workflows/terraform.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
32
name: "Code Quality: Terraform"
43

54
on:
@@ -13,23 +12,20 @@ jobs:
1312
name: Terraform
1413
runs-on: ubuntu-latest
1514
steps:
16-
- name: Checkout Repository
17-
uses: actions/checkout@v2
15+
- name: Check out repository
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Terraform
19+
uses: hashicorp/setup-terraform@v2
1820
with:
19-
fetch-depth: 1
21+
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
2022

21-
- name: Setup Terraform
22-
uses: hashicorp/setup-terraform@v1.2.1
23-
2423
- name: Run `terraform fmt`
25-
id: fmt
26-
run: terraform fmt -diff -check -no-color -recursive
24+
run: terraform fmt -check
2725

2826
- name: Run `terraform init`
2927
id: init
3028
run: terraform init
3129

3230
- name: Run `terraform validate`
33-
id: validate
34-
if: github.event_name == 'pull_request'
35-
run: terraform validate -no-color
31+
run: terraform validate -no-color

.terraform.lock.hcl

Lines changed: 25 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

helm.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# https://registry.terraform.io/providers/hashicorp/helm/latest/docs
2+
provider "helm" {
3+
kubernetes {
4+
host = data.aws_eks_cluster.cluster.endpoint
5+
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
6+
token = data.aws_eks_cluster_auth.cluster.token
7+
}
8+
}

kube-state-metrics.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release
2+
resource "helm_release" "kube_state_metrics" {
3+
name = "kube-state-metrics"
4+
5+
repository = "https://prometheus-community.github.io/helm-charts"
6+
chart = "kube-state-metrics"
7+
namespace = kubernetes_namespace.kube_state_metrics.metadata[0].name
8+
version = "4.13.0"
9+
}
10+
11+
# https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/namespace
12+
resource "kubernetes_namespace" "kube_state_metrics" {
13+
metadata {
14+
annotations = {
15+
name = "kube-state-metrics"
16+
}
17+
name = "kube-state-metrics"
18+
}
19+
}

terraform.tf

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
terraform {
22
required_providers {
3-
# https://registry.terraform.io/providers/hashicorp/null/latest
4-
null = {
5-
source = "hashicorp/null"
6-
version = "3.1.1"
7-
}
8-
9-
# https://registry.terraform.io/providers/hashicorp/template/latest
10-
template = {
11-
source = "hashicorp/template"
12-
version = "2.2.0"
13-
}
143

154
# https://registry.terraform.io/providers/hashicorp/kubernetes/latest
165
kubernetes = {
@@ -24,22 +13,18 @@ terraform {
2413
version = "4.23.0"
2514
}
2615

27-
# https://registry.terraform.io/providers/hashicorp/random/latest
28-
random = {
29-
source = "hashicorp/random"
30-
version = "3.3.2"
31-
}
32-
33-
# https://registry.terraform.io/providers/hashicorp/local/latest
34-
local = {
35-
source = "hashicorp/local"
36-
version = "2.2.3"
16+
# https://registry.terraform.io/providers/hashicorp/helm/latest/docs/resources/release
17+
helm = {
18+
source = "hashicorp/helm"
19+
version = "2.6.0"
3720
}
21+
}
22+
backend "remote" {
23+
hostname = "app.terraform.io"
24+
organization = "onlydole"
3825

39-
# https://registry.terraform.io/providers/hashicorp/tls/latest
40-
tls = {
41-
source = "hashicorp/tls"
42-
version = "3.4.0"
26+
workspaces {
27+
name = "eks-in-action"
4328
}
4429
}
4530
}

0 commit comments

Comments
 (0)