sassoftware / viya4-iac-aws

This project contains Terraform configuration files to provision infrastructure components required to deploy SAS Viya platform products products on Amazon AWS.
Apache License 2.0
39 stars 44 forks source link

Setting `autoscaling_enabled` to `false` nulls the tags value in the workers_group_defaults #117

Closed thpang closed 1 year ago

thpang commented 2 years ago

Terraform Version Details

{ "terraform_version": "\"1.1.1\"", "terraform_revision": "null", "terraform_outdated": "true", "provider_selections": "{\"registry.terraform.io/hashicorp/aws\":\"3.43.0\",\"registry.terraform.io/hashicorp/cloudinit\":\"2.2.0\",\"registry.terraform.io/hashicorp/external\":\"2.1.0\",\"registry.terraform.io/hashicorp/kubernetes\":\"2.2.0\",\"registry.terraform.io/hashicorp/local\":\"2.1.0\",\"registry.terraform.io/hashicorp/null\":\"3.1.0\",\"registry.terraform.io/hashicorp/random\":\"3.1.0\",\"registry.terraform.io/hashicorp/template\":\"2.2.0\",\"registry.terraform.io/terraform-aws-modules/http\":\"2.4.1\"}" }

Terraform Variable File Details

Standar var file no changes.

Steps to Reproduce

Set autoscaling_enabled to false this generates a null value for tags in the workers_group_defaults object here

Expected Behavior

The tags value should be at a minimum var.tags or an empty set [] if that will work.

Actual Behavior

Throwing this error:

│ Error: Iteration over null value

│

│   on .terraform/modules/eks/workers.tf line 155, in resource "aws_autoscaling_group" "workers":

│  155:         if tag_key != "Name" && !contains([for tag in lookup(var.worker_groups[count.index], "tags", local.workers_group_defaults["tags"]) : tag["key"]], tag_key)

│     ├────────────────

│     │ count.index is 3

│     │ local.workers_group_defaults["tags"] is null

│     │ var.worker_groups is tuple with 6 elements

│

│ A null value cannot be used as the collection in a 'for' expression.

╵

Additional Context

No response

References

No response

Code of Conduct

dhoucgitter commented 1 year ago

This is no longer an issue with viya4-iac-aws. Release 5.0.0 of viya4-iac-aws updated the hashicorp/aws provider to v3.72.0 and the underlying behavior that caused this problem does not occur with the updated provider. See internal ticket IAC-429 for additional details. Closing as resolved with the provider update.