Skip to content

Commit 7bea02b

Browse files
committed
test: adding test file
1 parent 3852fed commit 7bea02b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

modules/azure/aks/buildingblock/aks.tftest.hcl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ run "valid_aks_configuration" {
22
command = plan
33

44
variables {
5+
subscription_id = "ffb344c9-26d7-45f5-9ba0-806a024ae697"
56
resource_group_name = "test-aks-rg"
67
location = "West Europe"
78
aks_cluster_name = "test-aks-cluster"
@@ -28,12 +29,12 @@ run "valid_aks_configuration" {
2829
}
2930

3031
assert {
31-
condition = azurerm_virtual_network.vnet.address_space[0] == "10.1.0.0/16"
32+
condition = one(azurerm_virtual_network.vnet.address_space) == "10.1.0.0/16"
3233
error_message = "VNet address space should match the input variable"
3334
}
3435

3536
assert {
36-
condition = azurerm_subnet.aks_subnet.address_prefixes[0] == "10.1.0.0/20"
37+
condition = one(azurerm_subnet.aks_subnet.address_prefixes) == "10.1.0.0/20"
3738
error_message = "Subnet address prefix should match the input variable"
3839
}
3940
}
@@ -42,6 +43,7 @@ run "valid_autoscaling_configuration" {
4243
command = plan
4344

4445
variables {
46+
subscription_id = "ffb344c9-26d7-45f5-9ba0-806a024ae697"
4547
resource_group_name = "test-aks-autoscale-rg"
4648
location = "West Europe"
4749
aks_cluster_name = "test-aks-autoscale"
@@ -52,11 +54,6 @@ run "valid_autoscaling_configuration" {
5254
max_node_count = 10
5355
}
5456

55-
assert {
56-
condition = azurerm_kubernetes_cluster.aks.default_node_pool[0].enable_auto_scaling == true
57-
error_message = "Auto-scaling should be enabled when specified"
58-
}
59-
6057
assert {
6158
condition = azurerm_kubernetes_cluster.aks.default_node_pool[0].min_count == 2
6259
error_message = "Min node count should match the input variable"
@@ -72,6 +69,7 @@ run "no_monitoring_when_law_null" {
7269
command = plan
7370

7471
variables {
72+
subscription_id = "ffb344c9-26d7-45f5-9ba0-806a024ae697"
7573
resource_group_name = "test-aks-no-monitoring-rg"
7674
location = "West Europe"
7775
aks_cluster_name = "test-aks-no-monitoring"
@@ -95,6 +93,7 @@ run "invalid_dns_prefix" {
9593
command = plan
9694

9795
variables {
96+
subscription_id = "ffb344c9-26d7-45f5-9ba0-806a024ae697"
9897
resource_group_name = "test-aks-rg"
9998
location = "West Europe"
10099
aks_cluster_name = "test-aks"
@@ -111,6 +110,7 @@ run "invalid_kubernetes_version" {
111110
command = plan
112111

113112
variables {
113+
subscription_id = "ffb344c9-26d7-45f5-9ba0-806a024ae697"
114114
resource_group_name = "test-aks-rg"
115115
location = "West Europe"
116116
aks_cluster_name = "test-aks"
@@ -128,6 +128,7 @@ run "invalid_admin_group_object_id" {
128128
command = plan
129129

130130
variables {
131+
subscription_id = "ffb344c9-26d7-45f5-9ba0-806a024ae697"
131132
resource_group_name = "test-aks-rg"
132133
location = "West Europe"
133134
aks_cluster_name = "test-aks"
@@ -144,6 +145,7 @@ run "invalid_node_count_too_low" {
144145
command = plan
145146

146147
variables {
148+
subscription_id = "ffb344c9-26d7-45f5-9ba0-806a024ae697"
147149
resource_group_name = "test-aks-rg"
148150
location = "West Europe"
149151
aks_cluster_name = "test-aks"
@@ -161,6 +163,7 @@ run "invalid_os_disk_size" {
161163
command = plan
162164

163165
variables {
166+
subscription_id = "ffb344c9-26d7-45f5-9ba0-806a024ae697"
164167
resource_group_name = "test-aks-rg"
165168
location = "West Europe"
166169
aks_cluster_name = "test-aks"
@@ -178,6 +181,7 @@ run "custom_network_plugin_kubenet" {
178181
command = plan
179182

180183
variables {
184+
subscription_id = "ffb344c9-26d7-45f5-9ba0-806a024ae697"
181185
resource_group_name = "test-aks-rg"
182186
location = "West Europe"
183187
aks_cluster_name = "test-aks-kubenet"
@@ -202,6 +206,7 @@ run "naming_derived_from_cluster_name" {
202206
command = plan
203207

204208
variables {
209+
subscription_id = "ffb344c9-26d7-45f5-9ba0-806a024ae697"
205210
resource_group_name = "test-aks-rg"
206211
location = "West Europe"
207212
aks_cluster_name = "myapp-prod"

0 commit comments

Comments
 (0)