mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-02-25 09:11:24 -05:00
terraform: allow STACKIT / OpenStack instance type to be UUID or name
This commit is contained in:
parent
79aaa77b6b
commit
3ce10eb00f
@ -913,7 +913,7 @@ func (c *Config) WithOpenStackProviderDefaults(openStackProvider string) *Config
|
|||||||
c.Provider.OpenStack.YawolFlavorID = "3b11b27e-6c73-470d-b595-1d85b95a8cdf"
|
c.Provider.OpenStack.YawolFlavorID = "3b11b27e-6c73-470d-b595-1d85b95a8cdf"
|
||||||
c.Provider.OpenStack.DeployCSIDriver = toPtr(true)
|
c.Provider.OpenStack.DeployCSIDriver = toPtr(true)
|
||||||
for groupName, group := range c.NodeGroups {
|
for groupName, group := range c.NodeGroups {
|
||||||
group.InstanceType = "2715eabe-3ffc-4c36-b02a-efa8c141a96a"
|
group.InstanceType = "m1a.4cd"
|
||||||
group.StateDiskType = "storage_premium_perf6"
|
group.StateDiskType = "storage_premium_perf6"
|
||||||
c.NodeGroups[groupName] = group
|
c.NodeGroups[groupName] = group
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ locals {
|
|||||||
tags = distinct(sort(concat(var.tags, ["constellation-role-${var.role}"], ["constellation-node-group-${var.node_group_name}"])))
|
tags = distinct(sort(concat(var.tags, ["constellation-role-${var.role}"], ["constellation-node-group-${var.node_group_name}"])))
|
||||||
group_uid = random_id.uid.hex
|
group_uid = random_id.uid.hex
|
||||||
name = "${var.base_name}-${var.role}-${local.group_uid}"
|
name = "${var.base_name}-${var.role}-${local.group_uid}"
|
||||||
|
flavor_id_is_uuid = length(var.flavor_id) == 36 && length(regexall("^[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}$", var.flavor_id)) == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "random_id" "uid" {
|
resource "random_id" "uid" {
|
||||||
@ -36,11 +37,16 @@ resource "openstack_networking_port_v2" "port" {
|
|||||||
# policies = ["soft-anti-affinity"]
|
# policies = ["soft-anti-affinity"]
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
data "openstack_compute_flavor_v2" "flavor" {
|
||||||
|
flavor_id = local.flavor_id_is_uuid ? var.flavor_id : null
|
||||||
|
name = local.flavor_id_is_uuid ? null : var.flavor_id
|
||||||
|
}
|
||||||
|
|
||||||
resource "openstack_compute_instance_v2" "instance_group_member" {
|
resource "openstack_compute_instance_v2" "instance_group_member" {
|
||||||
name = "${local.name}-${count.index}"
|
name = "${local.name}-${count.index}"
|
||||||
count = var.initial_count
|
count = var.initial_count
|
||||||
image_id = var.image_id
|
image_id = var.image_id
|
||||||
flavor_id = var.flavor_id
|
flavor_id = data.openstack_compute_flavor_v2.flavor.id
|
||||||
tags = local.tags
|
tags = local.tags
|
||||||
# TODO(malt3): get this API enabled in the test environment
|
# TODO(malt3): get this API enabled in the test environment
|
||||||
# scheduler_hints {
|
# scheduler_hints {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user