openstack implementation

This commit is contained in:
miampf 2024-04-18 17:11:50 +02:00
parent 9406fe1502
commit 91627b6326
No known key found for this signature in database
GPG Key ID: EF039364B5B6886C
4 changed files with 16 additions and 1 deletions

View File

@ -264,6 +264,14 @@ func openStackTerraformVars(conf *config.Config, imageRef string) (*terraform.Op
StateDiskType: group.StateDiskType,
}
}
// since openstack does not support tags in the form of key = value, the tags will be converted
// to an array of "key=value" strings
tags := []string{}
for key, value := range conf.Tags {
tags = append(tags, fmt.Sprintf("%s=%s", key, value))
}
return &terraform.OpenStackClusterVariables{
Name: conf.Name,
Cloud: toPtr(conf.Provider.OpenStack.Cloud),
@ -275,6 +283,7 @@ func openStackTerraformVars(conf *config.Config, imageRef string) (*terraform.Op
CustomEndpoint: conf.CustomEndpoint,
InternalLoadBalancer: conf.InternalLoadBalancer,
STACKITProjectID: conf.Provider.OpenStack.STACKITProjectID,
AdditionalTags: tags,
}, nil
}

View File

@ -303,6 +303,7 @@ type OpenStackClusterVariables struct {
CustomEndpoint string `hcl:"custom_endpoint" cty:"custom_endpoint"`
// InternalLoadBalancer is true if an internal load balancer should be created.
InternalLoadBalancer bool `hcl:"internal_load_balancer" cty:"internal_load_balancer"`
AdditionalTags []string `hcl:"additional_tags" cty:"additional_tags"`
}
// GetCreateMAA gets the CreateMAA variable.

View File

@ -46,7 +46,7 @@ locals {
])
cidr_vpc_subnet_nodes = "192.168.178.0/24"
cidr_vpc_subnet_lbs = "192.168.177.0/24"
tags = ["constellation-uid-${local.uid}"]
tags = concat(["constellation-uid-${local.uid}"], var.additional_tags)
identity_service = [
for entry in data.openstack_identity_auth_scope_v3.scope.service_catalog :
entry if entry.type == "identity"

View File

@ -59,6 +59,11 @@ variable "floating_ip_pool_id" {
description = "Pool (network name) to use for floating IPs."
}
variable "additional_tags" {
type = list
description = "Additional tags that should be applied to created resources."
}
# STACKIT-specific variables
variable "stackit_project_id" {