terraform: move OpenStack flavorID into nodeGroups

This commit is contained in:
Malte Poll 2023-08-02 10:39:18 +02:00 committed by Malte Poll
parent 3047cb2798
commit d0ec7a3e54
3 changed files with 5 additions and 10 deletions

View File

@ -159,7 +159,6 @@ resource "openstack_compute_secgroup_v2" "vpc_secgroup" {
}
module "instance_group" {
source = "./modules/instance_group"
for_each = var.node_groups
base_name = local.name
@ -170,7 +169,7 @@ module "instance_group" {
state_disk_type = each.value.state_disk_type
availability_zone = each.value.zone
image_id = openstack_images_image_v2.constellation_os_image.image_id
flavor_id = var.flavor_id
flavor_id = each.value.flavor_id
security_groups = [openstack_compute_secgroup_v2.vpc_secgroup.id]
tags = local.tags
uid = local.uid

View File

@ -2,6 +2,7 @@ variable "node_groups" {
type = map(object({
role = string
initial_count = number // number of instances in the node group
flavor_id = string // flavor (machine type) to use for instances
state_disk_size = number // size of state disk (GiB)
state_disk_type = string // type of state disk. Can be 'standard' or 'premium'
zone = string // availability zone
@ -37,11 +38,6 @@ variable "direct_download" {
description = "If enabled, downloads OS image directly from source URL to OpenStack. Otherwise, downloads image to local machine and uploads to OpenStack."
}
variable "flavor_id" {
type = string
description = "The flavor (machine type) to use for cluster nodes."
}
variable "floating_ip_pool_id" {
type = string
description = "The pool (network name) to use for floating IPs."

View File

@ -254,8 +254,6 @@ type OpenStackClusterVariables struct {
NodeGroups map[string]OpenStackNodeGroup `hcl:"node_groups" cty:"node_groups"`
// Cloud is the (optional) name of the OpenStack cloud to use when reading the "clouds.yaml" configuration file. If empty, environment variables are used.
Cloud *string `hcl:"cloud" cty:"cloud"`
// Flavor is the ID of the OpenStack flavor (machine type) to use.
FlavorID string `hcl:"flavor_id" cty:"flavor_id"`
// FloatingIPPoolID is the ID of the OpenStack floating IP pool to use for public IPs.
FloatingIPPoolID string `hcl:"floating_ip_pool_id" cty:"floating_ip_pool_id"`
// ImageURL is the URL of the OpenStack image to use.
@ -293,7 +291,9 @@ type OpenStackNodeGroup struct {
Role string `hcl:"role" cty:"role"`
// InitialCount is the number of instances to create.
// InitialCount is optional for upgrades. OpenStack does not support upgrades yet but might in the future.
InitialCount *int `hcl:"initial_count" cty:"initial_count"`
InitialCount int `hcl:"initial_count" cty:"initial_count"`
// Flavor is the ID of the OpenStack flavor (machine type) to use.
FlavorID string `hcl:"flavor_id" cty:"flavor_id"`
// Zone is the OpenStack availability zone to use.
Zone string `hcl:"zone" cty:"zone"`
// StateDiskType is the OpenStack disk type to use for the state disk.