...
Code Block |
---|
# main.tf locals { keypair_name = "john-cloudy-publickey" virtual_image = "ubuntu-24.04-20250604102601" plan = "vm.a6000.1" app_name = "demo" instance_name = "john-cloudy" instance_index = 1 private_networks = ["private"] external_network = "external" ecuritysecurity_groups = ["defaultssh"] instance_has_fip = true extra_volume = true extra_volume_size = 512 extra_volume2 = true extra_volume2_size = 512 tags = { environment = "production" owner = "john-cloudy" deployment-tool = "terraform" } } terraform { required_version = ">= 0.14.0" required_providers { openstack = { source = "terraform-provider-openstack/openstack" version = "~> 1.53.0" } } } data "openstack_images_image_v2" "image" { name = local.virtual_image most_recent = true } data "openstack_compute_flavor_v2" "flavor" { name = local.plan } module "instance" { source = "./ewc-tf-module-openstack-compute" app_name = local.app_name instance_name = local.instance_name instance_index = local.instance_index image_id = data.openstack_images_image_v2.image.id flavor_id = data.openstack_compute_flavor_v2.flavor.id keypair_name = local.keypair_name networks = local.private_networks instance_has_fip = local.instance_has_fip extra_volume = local.extra_volume extra_volume_size = local.extra_volume_size extra_volume2 = local.extra_volume2 extra_volume2_size = local.extra_volume2_size security_groups = local.security_groups external_network_name = local.external_network tags = local.tags } |
...
4.1. (Optional) Update Customization & Re-run
Note |
---|
Always review the changes planned by Terraform before approving it, to avoid unexpected resource deletion. Changes such a changes the Items' documentation to learn about its specific inputs. |
As is the case for other Items open-sourced by the EWC, you can change the inputs of the OpenStack Compute Terraform Module at any point in time, by simply re-running with the new values. Picture for following user-journey:
...
Luckily, deleting Terraform-managed infrastructure is easy. While still on the same directory as the main.tf
file you previously created, run:
Code Block |
---|
$ terraform apply --destroy |
You will be prompted for confirmation. Make sure the resources listed for destruction are indeed related to your VM. Confirm to accept changes by typing yes
.
...