Skip to content

Commit c3e6b78

Browse files
committed
Add terraform configurations for single-cluster ref arch
1 parent 66e24cf commit c3e6b78

File tree

5 files changed

+58
-50
lines changed

5 files changed

+58
-50
lines changed

install/infra/single-cluster/aws/Makefile

+47-45
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,53 @@ apply: apply-cluster apply-tools
2121
.PHONY: destroy
2222
destroy: destroy-tools destroy-cluster
2323

24+
.PHONY: plan-cluster
25+
plan-cluster:
26+
@terraform plan -target=module.eks
27+
28+
.PHONY: plan-tools
29+
plan-tools: plan-cm-edns plan-cluster-issuer
30+
31+
.PHONY: plan-cm-edns
32+
plan-cm-edns:
33+
@terraform plan -target=module.certmanager -target=module.externaldns
34+
35+
.PHONY: plan-cluster-issuer
36+
plan-cluster-issuer:
37+
@terraform plan -target=module.cluster-issuer
38+
39+
.PHONY: apply-cluster
40+
apply-cluster:
41+
@terraform apply -target=module.eks --auto-approve
42+
43+
.PHONY: apply-tools
44+
apply-tools: install-cm-edns install-cluster-issuer
45+
46+
.PHONY: install-cm-edns
47+
install-cm-edns:
48+
@terraform apply -target=module.certmanager -target=module.externaldns --auto-approve
49+
50+
PHONY: install-cluster-issuer
51+
install-cluster-issuer:
52+
@terraform apply -target=module.cluster-issuer --auto-approve
53+
54+
.PHONY: destroy-cluster
55+
destroy-cluster:
56+
@terraform destroy -target=module.eks --auto-approve
57+
58+
.PHONY: destroy-tools
59+
destroy-tools: destroy-cluster-issuer destroy-cm-edns
60+
61+
.PHONY: destroy-cm-edns
62+
destroy-cm-edns:
63+
@terraform destroy -target=module.certmanager -target=module.externaldns --auto-approve
64+
65+
.PHONY: destroy-cluster-issuer
66+
destroy-cluster-issuer:
67+
@terraform destroy -target=module.cluster-issuer --auto-approve
68+
69+
## Output targets
70+
2471
.PHONY: refresh
2572
refresh:
2673
@echo "Refreshing terraform state"
@@ -73,49 +120,4 @@ output-issuer:
73120
@echo "================="
74121
@terraform output -json cluster_issuer | jq
75122

76-
.PHONY: plan-cluster
77-
plan-cluster:
78-
@terraform plan -target=module.eks
79-
80-
.PHONY: plan-tools
81-
plan-tools: plan-cm-edns plan-cluster-issuer
82-
83-
.PHONY: plan-cm-edns
84-
plan-cm-edns:
85-
@terraform plan -target=module.certmanager -target=module.externaldns
86-
87-
.PHONY: plan-cluster-issuer
88-
plan-cluster-issuer:
89-
@terraform plan -target=module.cluster-issuer
90-
91-
.PHONY: apply-cluster
92-
apply-cluster:
93-
@terraform apply -target=module.eks --auto-approve
94-
95-
.PHONY: apply-tools
96-
apply-tools: install-cm-edns install-cluster-issuer
97-
98-
.PHONY: install-cm-edns
99-
install-cm-edns:
100-
@terraform apply -target=module.certmanager -target=module.externaldns --auto-approve
101-
102-
PHONY: install-cluster-issuer
103-
install-cluster-issuer:
104-
@terraform apply -target=module.cluster-issuer --auto-approve
105-
106-
.PHONY: destroy-cluster
107-
destroy-cluster:
108-
@terraform destroy -target=module.eks --auto-approve
109-
110-
.PHONY: destroy-tools
111-
destroy-tools: destroy-cluster-issuer destroy-cm-edns
112-
113-
.PHONY: destroy-cm-edns
114-
destroy-cm-edns:
115-
@terraform destroy -target=module.certmanager -target=module.externaldns --auto-approve
116-
117-
.PHONY: destroy-cluster-issuer
118-
destroy-cluster-issuer:
119-
@terraform destroy -target=module.cluster-issuer --auto-approve
120-
121123
# end

install/infra/single-cluster/aws/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ corresponding TLS certificate requests.
9797
9898
## Initialize terraform backend and confirm the plan
9999
100+
> ⚠️ We ship 4 terraform modules here and some of them have dependencies among each other (eg: `cert-manager` module depends on `eks` module for `kubeconfig`, or the `cluster-issuer` module depends on `cert-manager` for the CRD). Hence a simple run of `terraform plan` or `terraform apply` may lead to errors. Hence we wrap [targeted `terraform` operations](https://learn.hashicorp.com/tutorials/terraform/resource-targeting) in the following make targets. If you wish you use `terraform` commands instead, please make sure you look into the Makefile to understand the target order.
101+
102+
100103
* Initialize the terraform backend with:
101104
102105
``` sh
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
terraform {
22
backend "s3" {
3-
bucket = "nan-tf-bucket"
3+
bucket = "gitpod-tf"
44
key = "aws/terraform.state"
55
}
66
}

install/infra/single-cluster/aws/terraform.tfvars

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# the cluster_name should be of length less than 16 characters
2-
cluster_name = "nan"
1+
# the cluster_name should be of length less than 15 characters and surrounded by double quotes
2+
cluster_name =
33

4-
# a route53 zone and certificate request will be created for this domain
5-
domain_name = "nan-cluster.doptig.com"
4+
# a route53 zone and certificate request will be created for this domain and surrounded by double quotes
5+
domain_name =
66

77
region = "eu-west-1"
88

install/tests/main.tf

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ module "eks" {
9292
image_id = var.eks_node_image_id
9393
kubeconfig = var.kubeconfig
9494
cluster_version = var.cluster_version
95+
create_external_registry = true
96+
create_external_database = true
97+
create_external_storage = true
9598
}
9699

97100
module "certmanager" {

0 commit comments

Comments
 (0)