-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloud-init.tf
49 lines (48 loc) · 1.4 KB
/
cloud-init.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
data "template_cloudinit_config" "config" {
gzip = true
base64_encode = true
part {
content_type = "text/cloud-config"
content = <<-EOF
package_update: true
packages:
- docker.io
- docker-compose
groups:
- docker
users:
- default
- name: ubuntu
groups: docker
write_files:
- path: /home/ubuntu/wireguard/wg-config.yaml
encoding: b64
content: ${var.wg_access_server_config}
permissions: '0644'
- path: /home/ubuntu/wireguard/dex-config.yaml
encoding: b64
content: ${var.dex_config}
permissions: '0644'
- path: /home/ubuntu/wireguard/docker-compose.yaml
encoding: b64
content: ${var.docker_compose_file}
permissions: '0644'
- path: /home/ubuntu/wireguard/nginx-certbot.env
encoding: b64
content: ${var.nginx_certbot_env}
permissions: '0644'
- path: /home/ubuntu/wireguard/user_conf.d/nginx-dex.conf
encoding: b64
content: ${var.nginx_dex_config}
permissions: '0644'
- path: /home/ubuntu/wireguard/user_conf.d/nginx-wg.conf
encoding: b64
content: ${var.nginx_wg_config}
permissions: '0644'
runcmd:
- [chown, -R, ubuntu.ubuntu, /home/ubuntu/ ]
- [ cd, /home/ubuntu/wireguard ]
- [ docker-compose, up, -d ]
EOF
}
}