forked from astronomer/terraform-kubernetes-astronomer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
72 lines (62 loc) · 1.82 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
variable deployment_id {}
variable route53_domain {
default = "astronomer-development.com"
}
module "aws" {
source = "astronomer/astronomer-aws/aws"
version = "1.1.101"
deployment_id = var.deployment_id
admin_email = "[email protected]"
route53_domain = var.route53_domain
enable_bastion = false
tags = {
"CI" = true
}
cluster_type = "private"
management_api = "public"
}
# install tiller, which is the server-side component
# of Helm, the Kubernetes package manager
module "system_components" {
dependencies = [module.aws.depended_on]
source = "astronomer/astronomer-system-components/kubernetes"
enable_istio = "false"
}
module "astronomer" {
dependencies = [module.system_components.depended_on]
source = "../.."
db_connection_string = module.aws.db_connection_string
tls_cert = module.aws.tls_cert
tls_key = module.aws.tls_key
astronomer_helm_values = <<EOF
---
global:
# Base domain for all subdomains exposed through ingress
baseDomain: ${module.aws.base_domain}
tlsSecret: astronomer-tls
istioEnabled: false
postgresqlEnabled: false
nginx:
loadBalancerIP: "~"
privateLoadBalancer: true
perserveSourceIP: true
EOF
}
data "aws_lambda_invocation" "elb_name" {
depends_on = [module.astronomer]
function_name = "${module.aws.elb_lookup_function_name}"
input = "{}"
}
data "aws_elb" "nginx_lb" {
name = data.aws_lambda_invocation.elb_name.result_map["Name"]
}
data "aws_route53_zone" "selected" {
name = "${var.route53_domain}."
}
resource "aws_route53_record" "astronomer" {
zone_id = "${data.aws_route53_zone.selected.zone_id}"
name = "*.${var.deployment_id}.${data.aws_route53_zone.selected.name}"
type = "CNAME"
ttl = "30"
records = [data.aws_elb.nginx_lb.dns_name]
}