Skip to content

Commit

Permalink
terraform: rename Azure location field
Browse files Browse the repository at this point in the history
  • Loading branch information
msanft committed Dec 14, 2023
1 parent 7f0128f commit 929a3b6
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions cli/internal/cloudcmd/iam.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type GCPIAMConfig struct {

// AzureIAMConfig holds the necessary values for Azure IAM configuration.
type AzureIAMConfig struct {
Region string
Location string
ServicePrincipal string
ResourceGroup string
}
Expand Down Expand Up @@ -167,7 +167,7 @@ func (c *IAMCreator) createAzure(ctx context.Context, cl tfIAMClient, opts *IAMC
defer rollbackOnError(c.out, &retErr, &rollbackerTerraform{client: cl}, opts.TFLogLevel)

vars := terraform.AzureIAMVariables{
Region: opts.Azure.Region,
Location: opts.Azure.Location,
ResourceGroup: opts.Azure.ResourceGroup,
ServicePrincipal: opts.Azure.ServicePrincipal,
}
Expand Down
2 changes: 1 addition & 1 deletion cli/internal/cloudcmd/iam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestIAMCreator(t *testing.T) {
}

validAzureIAMConfig := AzureIAMConfig{
Region: "westus",
Location: "westus",
ServicePrincipal: "constell-test",
ResourceGroup: "constell-test",
}
Expand Down
2 changes: 1 addition & 1 deletion cli/internal/cloudcmd/tfvars.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func azureTerraformVars(conf *config.Config, imageRef string) (*terraform.AzureC

func azureTerraformIAMVars(conf *config.Config, oldVars terraform.AzureIAMVariables) *terraform.AzureIAMVariables {
return &terraform.AzureIAMVariables{
Region: conf.Provider.Azure.Location,
Location: conf.Provider.Azure.Location,
ServicePrincipal: oldVars.ServicePrincipal,
ResourceGroup: conf.Provider.Azure.ResourceGroup,
}
Expand Down
2 changes: 1 addition & 1 deletion cli/internal/cmd/iamcreateazure.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type azureIAMCreator struct {
func (c *azureIAMCreator) getIAMConfigOptions() *cloudcmd.IAMConfigOptions {
return &cloudcmd.IAMConfigOptions{
Azure: cloudcmd.AzureIAMConfig{
Region: c.flags.region,
Location: c.flags.region,
ResourceGroup: c.flags.resourceGroup,
ServicePrincipal: c.flags.servicePrincipal,
},
Expand Down
2 changes: 1 addition & 1 deletion cli/internal/cmd/iamupgradeapply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestIamUpgradeApply(t *testing.T) {
require.NoError(t, fh.Write(
filepath.Join(constants.TerraformIAMWorkingDir, "terraform.tfvars"),
[]byte(
"region = \"foo\"\n"+
"location = \"foo\"\n"+
"resource_group_name = \"bar\"\n"+
"service_principal_name = \"baz\"\n",
),
Expand Down
4 changes: 2 additions & 2 deletions cli/internal/terraform/terraform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func TestPrepareIAM(t *testing.T) {
ServiceAccountID: "const-test-case",
}
azureVars := &AzureIAMVariables{
Region: "westus",
Location: "westus",
ResourceGroup: "constell-test-rg",
}
awsVars := &AWSIAMVariables{
Expand Down Expand Up @@ -542,7 +542,7 @@ func TestCreateIAM(t *testing.T) {
ServiceAccountID: "const-test-case",
}
azureVars := &AzureIAMVariables{
Region: "westus",
Location: "westus",
ResourceGroup: "constell-test-rg",
}
awsVars := &AWSIAMVariables{
Expand Down
4 changes: 2 additions & 2 deletions cli/internal/terraform/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ type AzureNodeGroup struct {

// AzureIAMVariables is user configuration for creating the IAM configuration with Terraform on Microsoft Azure.
type AzureIAMVariables struct {
// Region is the Azure region to use. (e.g. westus)
Region string `hcl:"region" cty:"region"`
// 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.
ServicePrincipal string `hcl:"service_principal_name" cty:"service_principal_name"`
// ResourceGroup is the name of the resource group to use.
Expand Down
4 changes: 2 additions & 2 deletions cli/internal/terraform/variables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ marketplace_image = {

func TestAzureIAMVariables(t *testing.T) {
vars := AzureIAMVariables{
Region: "eu-central-1",
Location: "eu-central-1",
ServicePrincipal: "my-service-principal",
ResourceGroup: "my-resource-group",
}
Expand Down Expand Up @@ -368,7 +368,7 @@ func TestVariablesFromBytes(t *testing.T) {
assert.Equal(awsVars, loadedAWSVars)

azureVars := AzureIAMVariables{
Region: "test",
Location: "test",
}
var loadedAzureVars AzureIAMVariables
err = VariablesFromBytes([]byte(azureVars.String()), &loadedAzureVars)
Expand Down
6 changes: 3 additions & 3 deletions terraform/infrastructure/iam/azure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ data "azuread_client_config" "current" {}
# Create base resource group
resource "azurerm_resource_group" "base_resource_group" {
name = var.resource_group_name
location = var.region
location = var.location
}

# Create identity resource group
resource "azurerm_resource_group" "identity_resource_group" {
name = "${var.resource_group_name}-identity"
location = var.region
location = var.location
}

# Create managed identity
resource "azurerm_user_assigned_identity" "identity_uami" {
location = var.region
location = var.location
name = var.service_principal_name
resource_group_name = azurerm_resource_group.identity_resource_group.name
}
Expand Down
4 changes: 2 additions & 2 deletions terraform/infrastructure/iam/azure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variable "service_principal_name" {
description = "Name for the service principal used within the cluster."
}

variable "region" {
variable "location" {
type = string
description = "Azure region the cluster should reside in."
description = "Azure location the cluster should reside in."
}
2 changes: 1 addition & 1 deletion terraform/legacy-module/azure-constellation/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module "fetch_image" {

module "azure_iam" {
source = "../../infrastructure/iam/azure"
region = var.location
location = var.location
service_principal_name = var.service_principal_name
resource_group_name = var.resource_group_name
}
Expand Down

0 comments on commit 929a3b6

Please sign in to comment.