diff --git a/proxmox/terraform/README.md b/proxmox/terraform/README.md index 01c606c..a46d578 100644 --- a/proxmox/terraform/README.md +++ b/proxmox/terraform/README.md @@ -1,64 +1,65 @@ # What Terraform allows to transparently declare our infrastructure as code. Providing a (non-official so far) plugin, we can provision vm the same way for our rocq infra (proxmox) ## Prepare workstation See prepare-workstation.md ## setup.sh Create a `setup.sh` file holding the PM_{USER,PASS} information: ``` export PM_USER=@pam export PM_PASS= ``` source it in your current shell session. ``` source setup.sh ``` ## provision infra ``` +cd production # or staging terraform init terraform apply ``` # Details The provisioning is bootstraping vms declared in ".tf" files (in dependency order if any). It's using a base template (either debian-9-template, debian-10-template) installed in the hypervisor. Instructions are detailed in the `init-template.md` file. ## Init This initializes your local copy with the necessary: ``` terraform init ``` ## Plan changes Parse all *.tf files present in the folder, then compute a differential plan: ``` terraform plan ``` ## Apply changes Propose to apply the plan to the infra (interactively): ``` terraform apply ``` diff --git a/proxmox/terraform/common.tf b/proxmox/terraform/production/common.tf similarity index 100% rename from proxmox/terraform/common.tf rename to proxmox/terraform/production/common.tf diff --git a/proxmox/terraform/kelvingrove.tf b/proxmox/terraform/production/production.tf similarity index 93% rename from proxmox/terraform/kelvingrove.tf rename to proxmox/terraform/production/production.tf index bc069e1..ecb602d 100644 --- a/proxmox/terraform/kelvingrove.tf +++ b/proxmox/terraform/production/production.tf @@ -1,20 +1,20 @@ module "kelvingrove" { - source = "./modules/node" + source = "../modules/node" config = local.config hostname = "kelvingrove" description = "Keycloak server" hypervisor = "hypervisor3" vmid = 123 cores = "4" memory = "8192" numa = true balloon = 0 networks = [{ id = 0 ip = "192.168.100.106" gateway = local.config["gateway_ip"] macaddr = "72:55:5E:58:01:0B" bridge = "vmbr0" }] } diff --git a/proxmox/terraform/production/variables.tf b/proxmox/terraform/production/variables.tf new file mode 120000 index 0000000..3a65dcc --- /dev/null +++ b/proxmox/terraform/production/variables.tf @@ -0,0 +1 @@ +../variables.tf \ No newline at end of file diff --git a/proxmox/terraform/production/versions.tf b/proxmox/terraform/production/versions.tf new file mode 120000 index 0000000..8bd0ff1 --- /dev/null +++ b/proxmox/terraform/production/versions.tf @@ -0,0 +1 @@ +../versions.tf \ No newline at end of file diff --git a/proxmox/terraform/terraform.tfstate b/proxmox/terraform/terraform.tfstate deleted file mode 100644 index 9881a4e..0000000 --- a/proxmox/terraform/terraform.tfstate +++ /dev/null @@ -1,113 +0,0 @@ -{ - "version": 4, - "terraform_version": "0.13.4", - "serial": 104, - "lineage": "e2912de8-415d-4c35-8ee5-757008306227", - "outputs": {}, - "resources": [ - { - "module": "module.kelvingrove", - "mode": "managed", - "type": "proxmox_vm_qemu", - "name": "node", - "provider": "provider[\"local/telmate/proxmox\"]", - "instances": [ - { - "schema_version": 0, - "attributes": { - "agent": 0, - "balloon": 0, - "bios": "seabios", - "boot": "c", - "bootdisk": "virtio0", - "bridge": "", - "ci_wait": null, - "cicustom": "", - "cipassword": "", - "ciuser": "root", - "clone": "template-debian-10", - "clone_wait": 15, - "cores": 4, - "cpu": "host", - "desc": "Keycloak server", - "disk": [ - { - "backup": false, - "cache": "none", - "discard": "", - "format": "raw", - "id": 0, - "iothread": false, - "mbps": 0, - "mbps_rd": 0, - "mbps_rd_max": 0, - "mbps_wr": 0, - "mbps_wr_max": 0, - "replicate": false, - "size": "32G", - "ssd": false, - "storage": "proxmox", - "storage_type": "cephfs", - "type": "virtio" - } - ], - "disk_gb": 0, - "force_create": false, - "full_clone": false, - "hastate": "", - "hotplug": "network,disk,usb", - "id": "hypervisor3/qemu/123", - "ipconfig0": "ip=192.168.100.106/24,gw=192.168.100.1", - "ipconfig1": "", - "ipconfig2": "", - "iso": null, - "kvm": true, - "mac": "", - "memory": 8192, - "name": "kelvingrove", - "nameserver": "192.168.100.29", - "network": [ - { - "bridge": "vmbr0", - "firewall": false, - "id": 0, - "link_down": false, - "macaddr": "72:55:5E:58:01:0B", - "model": "virtio", - "queues": -1, - "rate": -1, - "tag": -1 - } - ], - "nic": "", - "numa": true, - "onboot": true, - "os_network_config": null, - "os_type": "cloud-init", - "pool": "", - "preprovision": true, - "qemu_os": "other", - "scsihw": "virtio-scsi-pci", - "searchdomain": "internal.softwareheritage.org", - "serial": [], - "sockets": 1, - "ssh_forward_ip": null, - "ssh_host": null, - "ssh_port": null, - "ssh_private_key": null, - "ssh_user": "root", - "sshkeys": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVKCfpeIMg7GS3Pk03ZAcBWAeDZ+AvWk2k/pPY0z8MJ3YAbqZkRtSK7yaDgJV6Gro7nn/TxdJLo2jEzzWvlC8d8AEzhZPy5Z/qfVVjqBTBM4H5+e+TItAHFfaY5+0WvIahxcfsfaq70MWfpJhszAah3ThJ4mqzYaw+dkr42+a7Gx3Ygpb/m2dpnFnxvXdcuAJYStmHKU5AWGWWM+Fm50/fdMqUfNd8MbKhkJt5ihXQmZWMOt7ls4N8i5NZWnS9YSWow8X/ENOEqCRN9TyRkc+pPS0w9DNi0BCsWvSRJOkyvQ6caEnKWlNoywCmM1AlIQD3k4RUgRWe0vqg/UKPpH3Z root@terraform\n\n\n", - "storage": "", - "storage_type": "", - "target_node": "hypervisor3", - "vcpus": 0, - "vga": [], - "vlan": -1, - "vmid": null - }, - "private": "eyJzY2hlbWFfdmVyc2lvbiI6IjAifQ==" - } - ] - } - ] -}