Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 87318b0

Browse files
committed
Move ca files into own modules
Signed-off-by: JoshVanL <[email protected]>
1 parent 0135dd7 commit 87318b0

File tree

11 files changed

+108
-54
lines changed

11 files changed

+108
-54
lines changed

demo/infrastructure/amazon/dns.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ data "external" "externaldns" {
77
program = ["jq", ".externaldns", "../../manifests/google-config.json"]
88
query = { }
99
}
10+
11+
module "ca" {
12+
source = "../modules/ca"
13+
14+
ca_crt_file = "${var.ca_crt_file}"
15+
ca_key_file = "${var.ca_key_file}"
16+
}

demo/infrastructure/amazon/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ locals {
33
cert_manager = "${data.external.cert_manager.result}"
44
externaldns = "${data.external.externaldns.result}"
55
gangway = "${module.gangway.config}"
6+
7+
ca = {
8+
key = "${module.ca.key}"
9+
crt = "${module.ca.crt}"
10+
}
611
}
712
}
813

demo/infrastructure/amazon/providers.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ module "cluster" {
2020

2121
cluster_version = "${var.cluster_version}"
2222
}
23+
24+
variable "ca_crt_file" {}
25+
variable "ca_key_file" {}

demo/infrastructure/digitalocean/dns.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ data "external" "externaldns" {
77
program = ["jq", ".externaldns", "../../manifests/google-config.json"]
88
query = {}
99
}
10+
11+
module "ca" {
12+
source = "../modules/ca"
13+
14+
ca_crt_file = "${var.ca_crt_file}"
15+
ca_key_file = "${var.ca_key_file}"
16+
}

demo/infrastructure/digitalocean/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ locals {
33
cert_manager = "${data.external.cert_manager.result}"
44
externaldns = "${data.external.externaldns.result}"
55
gangway = "${module.gangway.config}"
6+
7+
ca = {
8+
key = "${module.ca.key}"
9+
crt = "${module.ca.crt}"
10+
}
611
}
712
}
813

demo/infrastructure/digitalocean/providers.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ variable "digitalocean_region" {
55
}
66

77
variable "cluster_version" {
8-
default = "1.12.8-do.1"
8+
default = "1.15.5-do.0"
99
}
1010

1111
module "cluster" {
@@ -15,3 +15,6 @@ module "cluster" {
1515
cluster_version = "${var.cluster_version}"
1616
region = "${var.digitalocean_region}"
1717
}
18+
19+
variable "ca_crt_file" {}
20+
variable "ca_key_file" {}

demo/infrastructure/google/dns.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
module "dns" {
22
source = "../modules/google-dns"
33
suffix = "${random_id.suffix.hex}"
4+
}
5+
6+
module "ca" {
7+
source = "../modules/ca"
48

59
ca_crt_file = "${var.ca_crt_file}"
610
ca_key_file = "${var.ca_key_file}"

demo/infrastructure/google/output.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ locals {
33
cert_manager = "${module.dns.config}"
44
externaldns = "${module.dns.config}"
55
gangway = "${module.gangway.config}"
6+
7+
ca = {
8+
key = "${module.ca.key}"
9+
crt = "${module.ca.crt}"
10+
}
611
}
712
}
813

demo/infrastructure/modules/ca/ca.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
variable "ca_crt_file" {}
2+
variable "ca_key_file" {}
3+
4+
data "local_file" "crt_file" {
5+
filename = "${var.ca_crt_file}"
6+
}
7+
8+
data "local_file" "key_file" {
9+
filename = "${var.ca_key_file}"
10+
}
11+
12+
13+
output "crt" {
14+
value = "${data.local_file.crt_file.content}"
15+
}
16+
17+
output "key" {
18+
value = "${data.local_file.key_file.content}"
19+
}
Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
variable "suffix" {}
22

3-
variable "ca_crt_file" {}
4-
variable "ca_key_file" {}
5-
63
resource "google_service_account" "external_dns" {
74
account_id = "external-dns-${var.suffix}"
85
display_name = "External DNS/Cert Manager service account for GKE cluster cluster-${var.suffix}"
@@ -18,21 +15,11 @@ resource "google_service_account_key" "external_dns" {
1815
service_account_id = "${google_service_account.external_dns.account_id}"
1916
}
2017

21-
data "local_file" "ca_crt" {
22-
filename = "${var.ca_crt_file}"
23-
}
24-
25-
data "local_file" "ca_key" {
26-
filename = "${var.ca_key_file}"
27-
}
28-
2918
output "config" {
3019
value = {
3120
service_account_credentials = "${base64decode(google_service_account_key.external_dns.private_key)}"
3221

3322
project = "${google_service_account.external_dns.project}"
3423
provider = "google"
35-
ca_crt = "${data.local_file.ca_crt.content}"
36-
ca_key = "${data.local_file.ca_key.content}"
3724
}
3825
}

0 commit comments

Comments
 (0)