-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcoredns.tf
31 lines (30 loc) · 1.14 KB
/
coredns.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
resource "shell_script" "coredns-yaml" {
lifecycle_commands {
create = <<-EOF
mkdir -p coredns
wget -q --https-only --timestamping "https://storage.googleapis.com/kubernetes-the-hard-way/coredns-1.8.yaml" -O coredns/coredns-1.8.yaml
sed -i "s%loadbalance%loadbalance\n forward . /etc/resolv%" coredns/coredns-1.8.yaml
EOF
read = <<-EOF
echo "{\"md5\": \"$(md5sum coredns/coredns-1.8.yaml|base64)\"}"
EOF
delete = "rm -f coredns/coredns-1.8.yaml"
}
}
resource "shell_script" "coredns-playbook" {
lifecycle_commands {
create = <<-EOF
ANSIBLE_CONFIG=ansible.cfg ansible-playbook coredns/playbook.yaml
EOF
update = <<-EOF
ANSIBLE_CONFIG=ansible.cfg ansible-playbook coredns/playbook.yaml
EOF
read = <<-EOF
echo "{\"file\": \"$(cat coredns/playbook.yaml|base64)\",
\"check\": \"$(ANSIBLE_CONFIG=ansible.cfg ansible-playbook --check coredns/playbook.yaml|base64)\"
}"
EOF
delete = ""
}
depends_on = [shell_script.kube-scheduler-playbook, shell_script.kube-controller-manager-playbook, shell_script.coredns-yaml]
}