cli: add --subscriptionID flag for iam create azure command (#3328)

* deps: update Terraform azurerm to v4
* Set Azure subscription ID when applying Terraform files
* Upgrade azurerm to v4.1.0
* Mark subscriptionID flag as not required
* deps: tidy all modules

---------

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel Weiße <dw@edgeless.systems>
Co-authored-by: edgelessci <edgelessci@users.noreply.github.com>
This commit is contained in:
renovate[bot] 2024-09-17 12:30:22 +02:00 committed by GitHub
parent c6a9c2574b
commit a295ecaffb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 200 additions and 137 deletions

View file

@ -172,7 +172,7 @@ type GCPNodeGroup struct {
DiskType string `hcl:"disk_type" cty:"disk_type"`
}
// GCPIAMVariables is user configuration for creating the IAM confioguration with Terraform on GCP.
// GCPIAMVariables is user configuration for creating the IAM configuration with Terraform on GCP.
type GCPIAMVariables struct {
// Project is the ID of the GCP project to use.
Project string `hcl:"project_id" cty:"project_id"`
@ -193,6 +193,8 @@ func (v *GCPIAMVariables) String() string {
// AzureClusterVariables is user configuration for creating a cluster with Terraform on Azure.
type AzureClusterVariables struct {
// SubscriptionID is the Azure subscription ID to use.
SubscriptionID string `hcl:"subscription_id" cty:"subscription_id"`
// Name of the cluster.
Name string `hcl:"name" cty:"name"`
// ImageID is the ID of the Azure image to use.
@ -254,6 +256,8 @@ type AzureNodeGroup struct {
// AzureIAMVariables is user configuration for creating the IAM configuration with Terraform on Microsoft Azure.
type AzureIAMVariables struct {
// SubscriptionID is the Azure subscription ID to use.
SubscriptionID string `hcl:"subscription_id,optional" cty:"subscription_id"` // TODO(v2.18): remove optional tag. This is only required for migration from var files that dont have the value yet.
// Location is the Azure location to use. (e.g. westus)
Location string `hcl:"location" cty:"location"`
// ServicePrincipal is the name of the service principal to use.

View file

@ -180,7 +180,8 @@ service_account_id = "my-service-account"
func TestAzureClusterVariables(t *testing.T) {
vars := AzureClusterVariables{
Name: "cluster-name",
SubscriptionID: "01234567-cdef-0123-4567-89abcdef0123",
Name: "cluster-name",
NodeGroups: map[string]AzureNodeGroup{
constants.ControlPlaneDefault: {
Role: "ControlPlane",
@ -207,7 +208,8 @@ func TestAzureClusterVariables(t *testing.T) {
}
// test that the variables are correctly rendered
want := `name = "cluster-name"
want := `subscription_id = "01234567-cdef-0123-4567-89abcdef0123"
name = "cluster-name"
image_id = "image-0123456789abcdef"
create_maa = true
debug = true
@ -241,13 +243,15 @@ additional_tags = null
func TestAzureIAMVariables(t *testing.T) {
vars := AzureIAMVariables{
SubscriptionID: "01234567-cdef-0123-4567-89abcdef0123",
Location: "eu-central-1",
ServicePrincipal: "my-service-principal",
ResourceGroup: "my-resource-group",
}
// test that the variables are correctly rendered
want := `location = "eu-central-1"
want := `subscription_id = "01234567-cdef-0123-4567-89abcdef0123"
location = "eu-central-1"
service_principal_name = "my-service-principal"
resource_group_name = "my-resource-group"
`