Skip to content

Commit 5019315

Browse files
authored
fix: scope the ibm_container_cluster_versions data lookup by region to enhance performance and ensure consistent results (#160)
1 parent fb64e8a commit 5019315

File tree

4 files changed

+46
-13
lines changed

4 files changed

+46
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,4 @@ Brewfile.lock.json
5656

5757
# VS Code State
5858
.vscode/
59+
*.code-workspace

cra-tf-validate-ignore-goals.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@
1212
"ignore_reason": "This is a valid issue - tracking in https://github.ibm.com/GoldenEye/issues/issues/174",
1313
"is_valid": true
1414
},
15+
{
16+
"scc_goal_id": "3000802",
17+
"description:": "Check whether Kubernetes Service is accessible only by using private endpoints",
18+
"ignore_reason": "This is a valid issue (same as 3000902) - tracking in https://github.ibm.com/GoldenEye/issues/issues/174",
19+
"is_valid": true
20+
},
21+
{
22+
"scc_goal_id": "3000805",
23+
"description:": "Check whether Kubernetes Service clusters are enabled with IBM Log Analysis",
24+
"ignore_reason": "False alarm. In order to have more control over the way observability agents are configured and deployed, a helm chart installation is used rather than the native provider support.",
25+
"is_valid": false
26+
},
27+
{
28+
"scc_goal_id": "3000804",
29+
"description:": "Check whether Kubernetes Service clusters are enabled with IBM Cloud Monitoring",
30+
"ignore_reason": "False alarm. In order to have more control over the way observability agents are configured and deployed, a helm chart installation is used rather than the native provider support.",
31+
"is_valid": false
32+
},
1533
{
1634
"scc_goal_id": "3000258",
1735
"description": "Check whether Cloud Object Storage has at least # users with the IAM manager role",

main.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ locals {
3232
}
3333

3434
# Lookup the current default kube version
35-
data "ibm_container_cluster_versions" "cluster_versions" {}
35+
data "ibm_container_cluster_versions" "cluster_versions" {
36+
resource_group_id = var.resource_group_id
37+
region = var.region
38+
}
3639

3740
resource "ibm_resource_instance" "cos_instance" {
3841
count = var.use_existing_cos ? 0 : 1

module-metadata.json

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,15 @@
165165
"type": "string",
166166
"description": "The IBM Cloud region where the cluster will be provisioned.",
167167
"required": true,
168+
"source": [
169+
"data.ibm_container_cluster_versions.cluster_versions.region"
170+
],
168171
"pos": {
169172
"filename": "variables.tf",
170173
"line": 17
171-
}
174+
},
175+
"cloud_data_type": "region",
176+
"deprecated": "This field is deprecated"
172177
},
173178
"resource_group_id": {
174179
"name": "resource_group_id",
@@ -177,6 +182,7 @@
177182
"required": true,
178183
"source": [
179184
"data.ibm_container_cluster_config.cluster_config.resource_group_id",
185+
"data.ibm_container_cluster_versions.cluster_versions.resource_group_id",
180186
"ibm_container_vpc_cluster.autoscaling_cluster.resource_group_id",
181187
"ibm_container_vpc_cluster.cluster.resource_group_id",
182188
"ibm_container_vpc_worker_pool.autoscaling_pool.resource_group_id",
@@ -363,7 +369,8 @@
363369
"filename": "outputs.tf",
364370
"line": 43
365371
},
366-
"type": "string"
372+
"type": "string",
373+
"cloud_data_type": "region"
367374
},
368375
"resource_group_id": {
369376
"name": "resource_group_id",
@@ -427,7 +434,7 @@
427434
},
428435
"pos": {
429436
"filename": "main.tf",
430-
"line": 120
437+
"line": 123
431438
}
432439
},
433440
"ibm_container_vpc_cluster.cluster": {
@@ -450,7 +457,7 @@
450457
},
451458
"pos": {
452459
"filename": "main.tf",
453-
"line": 58
460+
"line": 61
454461
}
455462
},
456463
"ibm_container_vpc_worker_pool.autoscaling_pool": {
@@ -466,7 +473,7 @@
466473
},
467474
"pos": {
468475
"filename": "main.tf",
469-
"line": 271
476+
"line": 274
470477
}
471478
},
472479
"ibm_container_vpc_worker_pool.pool": {
@@ -482,7 +489,7 @@
482489
},
483490
"pos": {
484491
"filename": "main.tf",
485-
"line": 230
492+
"line": 233
486493
}
487494
},
488495
"ibm_resource_instance.cos_instance": {
@@ -498,7 +505,7 @@
498505
},
499506
"pos": {
500507
"filename": "main.tf",
501-
"line": 37
508+
"line": 40
502509
}
503510
},
504511
"ibm_resource_tag.cluster_access_tag": {
@@ -515,7 +522,7 @@
515522
},
516523
"pos": {
517524
"filename": "main.tf",
518-
"line": 184
525+
"line": 187
519526
}
520527
},
521528
"ibm_resource_tag.cos_access_tag": {
@@ -531,7 +538,7 @@
531538
},
532539
"pos": {
533540
"filename": "main.tf",
534-
"line": 47
541+
"line": 50
535542
}
536543
},
537544
"null_resource.confirm_network_healthy": {
@@ -546,7 +553,7 @@
546553
},
547554
"pos": {
548555
"filename": "main.tf",
549-
"line": 331
556+
"line": 334
550557
}
551558
},
552559
"null_resource.reset_api_key": {
@@ -558,7 +565,7 @@
558565
},
559566
"pos": {
560567
"filename": "main.tf",
561-
"line": 205
568+
"line": 208
562569
}
563570
}
564571
},
@@ -576,13 +583,17 @@
576583
},
577584
"pos": {
578585
"filename": "main.tf",
579-
"line": 219
586+
"line": 222
580587
}
581588
},
582589
"data.ibm_container_cluster_versions.cluster_versions": {
583590
"mode": "data",
584591
"type": "ibm_container_cluster_versions",
585592
"name": "cluster_versions",
593+
"attributes": {
594+
"region": "region",
595+
"resource_group_id": "resource_group_id"
596+
},
586597
"provider": {
587598
"name": "ibm"
588599
},

0 commit comments

Comments
 (0)