summaryrefslogtreecommitdiff
path: root/final/container.tf
diff options
context:
space:
mode:
Diffstat (limited to 'final/container.tf')
-rw-r--r--final/container.tf27
1 files changed, 27 insertions, 0 deletions
diff --git a/final/container.tf b/final/container.tf
new file mode 100644
index 0000000..99c97f5
--- /dev/null
+++ b/final/container.tf
@@ -0,0 +1,27 @@
+resource "incus_instance" "instance" {
+for_each = var.containers
+ name = "${each.key}"
+ project = "lamp"
+ image = "images:${each.value.image}"
+ wait_for {
+ type = "ipv4"
+ }
+ provisioner "local-exec" {
+ command = "./local_script ${self.ipv4_address} ${self.name}"
+ }
+ connection {
+ type = "ssh"
+ host = self.ipv4_address
+ user = "ansible"
+ private_key = file("~/.ssh/id_rsa")
+
+ }
+ provisioner "remote-exec" {
+ inline = [
+ "cloud-init status || true"
+ ]
+ }
+ depends_on = [
+ incus_profile.lamp
+ ]
+}