-
-
Notifications
You must be signed in to change notification settings - Fork 139
/
resource_virtual_environment_file.tf
65 lines (55 loc) · 2.1 KB
/
resource_virtual_environment_file.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
#===============================================================================
# Cloud Config (cloud-init)
#===============================================================================
resource "proxmox_virtual_environment_file" "user_config" {
content_type = "snippets"
datastore_id = element(data.proxmox_virtual_environment_datastores.example.datastore_ids, index(data.proxmox_virtual_environment_datastores.example.datastore_ids, "local"))
node_name = data.proxmox_virtual_environment_datastores.example.node_name
source_raw {
data = <<-EOF
#cloud-config
chpasswd:
list: |
ubuntu:example
expire: false
hostname: terraform-provider-proxmox-example
users:
- default
- name: ubuntu
groups: sudo
shell: /bin/bash
ssh-authorized-keys:
- ${trimspace(tls_private_key.example.public_key_openssh)}
sudo: ALL=(ALL) NOPASSWD:ALL
EOF
file_name = "terraform-provider-proxmox-example-user-config.yaml"
}
}
resource "proxmox_virtual_environment_file" "vendor_config" {
content_type = "snippets"
datastore_id = element(data.proxmox_virtual_environment_datastores.example.datastore_ids, index(data.proxmox_virtual_environment_datastores.example.datastore_ids, "local"))
node_name = data.proxmox_virtual_environment_datastores.example.node_name
source_raw {
data = <<EOF
#cloud-config
runcmd:
- apt update
- apt install -y qemu-guest-agent
- systemctl enable qemu-guest-agent
- systemctl start qemu-guest-agent
- echo "done" > /tmp/vendor-cloud-init-done
EOF
file_name = "terraform-provider-proxmox-example-vendor-config.yaml"
}
}
resource "proxmox_virtual_environment_file" "meta_config" {
content_type = "snippets"
datastore_id = element(data.proxmox_virtual_environment_datastores.example.datastore_ids, index(data.proxmox_virtual_environment_datastores.example.datastore_ids, "local"))
node_name = data.proxmox_virtual_environment_datastores.example.node_name
source_raw {
data = <<EOF
local-hostname: myhost.internal
EOF
file_name = "meta-config.yaml"
}
}