cli: allow tagging cloud resources with custom tags (#3033)

This commit is contained in:
miampf 2024-04-19 09:07:57 +00:00 committed by GitHub
parent f60c133724
commit b187966581
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 172 additions and 42 deletions

View file

@ -104,6 +104,7 @@ func awsTerraformVars(conf *config.Config, imageRef string) *terraform.AWSCluste
EnableSNP: conf.GetAttestationConfig().GetVariant().Equal(variant.AWSSEVSNP{}),
CustomEndpoint: conf.CustomEndpoint,
InternalLoadBalancer: conf.InternalLoadBalancer,
AdditionalTags: conf.Tags,
}
}
@ -158,6 +159,7 @@ func azureTerraformVars(conf *config.Config, imageRef string) (*terraform.AzureC
CustomEndpoint: conf.CustomEndpoint,
InternalLoadBalancer: conf.InternalLoadBalancer,
MarketplaceImage: nil,
AdditionalTags: conf.Tags,
}
if conf.UseMarketplaceImage() {
@ -226,6 +228,7 @@ func gcpTerraformVars(conf *config.Config, imageRef string) *terraform.GCPCluste
CustomEndpoint: conf.CustomEndpoint,
InternalLoadBalancer: conf.InternalLoadBalancer,
CCTechnology: ccTech,
AdditionalLabels: conf.Tags,
}
}
@ -261,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),
@ -272,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
}