terraform {
required_version = ">= 0.14.0"
  required_providers {
    openstack = {
      source  = "terraform-provider-openstack/openstack"
      version = "~> 1.53.0"
    }
  }
}

resource "openstack_networking_floatingip_v2" "_3245829148481055-FIP" {
  pool = "Ext-Net"
}

resource "openstack_compute_instance_v2" "_3245829148481055-pci-test-ex3" {
  name            = "_3245829148481055-pci-test-ex3"
  image_id        = "d2083aa0-94ee-491d-a20c-0c8db1acdb96"
  flavor_name     = "d2-4"
  key_pair        = "3245829148481055-KP"
  security_groups = ["default"]
  user_data       = "#cloud-config\npackages:\n  - nginx\nruncmd:\n  - systemctl enable nginx\n  - systemctl start nginx"

  network {
    name = "3245829148481055-int-net"
  }
}

resource "openstack_compute_floatingip_associate_v2" "_3245829148481055-FIP" {
  floating_ip = "${openstack_networking_floatingip_v2._3245829148481055-FIP.address}"
  instance_id = "${openstack_compute_instance_v2._3245829148481055-pci-test-ex3.id}"
}
