Skip to content

Commit b693f57

Browse files
committed
add e2e test
1 parent a51e98d commit b693f57

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

examples/named_cluster/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ resource "azurerm_user_assigned_identity" "test" {
3939

4040
# Just for demo purpose, not necessary to named cluster.
4141
resource "azurerm_log_analytics_workspace" "main" {
42-
location = local.resource_group.location
42+
location = coalesce(var.log_analytics_workspace_location, local.resource_group.location)
4343
name = "prefix-workspace"
4444
resource_group_name = local.resource_group.name
4545
retention_in_days = 30

examples/named_cluster/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ variable "location" {
1313
default = "eastus"
1414
}
1515

16+
variable "log_analytics_workspace_location" {
17+
default = null
18+
}
19+
1620
variable "managed_identity_principal_id" {
1721
type = string
1822
default = null

test/e2e/terraform_aks_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,18 @@ func TestExamplesWithoutAssertion(t *testing.T) {
103103
})
104104
}
105105
}
106+
107+
func TestExamples_differentLocationForLogAnalyticsSolution(t *testing.T) {
108+
var vars map[string]any
109+
managedIdentityId := os.Getenv("MSI_ID")
110+
if managedIdentityId != "" {
111+
vars = map[string]any{
112+
"managed_identity_principal_id": managedIdentityId,
113+
}
114+
}
115+
vars["log_analytics_workspace_location"] = "eastus2"
116+
test_helper.RunE2ETest(t, "../../", "examples/named_cluster", terraform.Options{
117+
Upgrade: true,
118+
Vars: vars,
119+
}, nil)
120+
}

0 commit comments

Comments
 (0)