Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Remark on tf plan review

...

4.1. (Optional) Update Customization & Re-run

Note

Always Depending on the type of change you configure, resources could be updated in place, or destroyed an recreated. To avoid unexpected downtime or data loss, 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 inputsthem. 

Tip

 The Terraform plan output list resources that shall will be updated in-place will be clearly marked and listed separately from those which will be new added  or destroyed. The tilde character (~) is also used to flag resources that are that updated in place.

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:

...

Code Block
# main.tf (no public internet, no 2nd extra volume)
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"
  ecurity_groups    = ["defaultssh"]
  instance_has_fip   = false
  extra_volume       = true
  extra_volume_size  = 512
  extra_volume2      = false
  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
}

...