Skip to content

TERRA-45 ⁃ astra_access_list only creates the first address #53

@edmeister

Description

@edmeister

Terraform Version

Terraform core: 1.0.11
Astra provider: 1.0.12

Affected Resource(s)

Please list the resources as a list, for example:

  • astra_access_list

Terraform Configuration Files

module "astra" {
  ...
  private_link_access_cidr = [
    "10.0.0.1/32",
    "10.0.0.2/32",
    "10.0.0.3/32",
  ]
}

# actual module
variable "private_link_access_cidr" {
  type        = list(string)
  description = "List of CIDR's with access to the private link"
  default     = []
}

resource "astra_database" "database" {
  ...
}

resource "astra_access_list" "access_list" {
  database_id = astra_database.database.id

  addresses {
    dynamic "request" {
      for_each = var.private_link_access_cidr
      content {
        address = request.value
        enabled = true
      }
    }
  }
}

Expected Behavior

The database should have an access list with 3 records.

Actual Behavior

The terraform plan shows the resource as it is intended:

# module.astra.astra_access_list.access_list will be created
  + resource "astra_access_list" "access_list" {
      + database_id = (known after apply)
      + id          = (known after apply)

      + addresses {
          + request {
              + address = "10.0.0.1/32"
              + enabled = true
            }
          + request {
              + address = "10.0.0.2/32"
              + enabled = true
            }
          + request {
              + address = "10.0.0.3/32"
              + enabled = true
            }
        }
    }

Only the first address is created. See screenshot below.

image

The tfstate contains the 3 records:

    {
      "module": "module.astra",
      "mode": "managed",
      "type": "astra_access_list",
      "name": "access_list",
      "provider": "provider[\"registry.terraform.io/datastax/astra\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "addresses": [
              {
                "request": [
                  {
                    "address": "10.0.0.1/32",
                    "description": "",
                    "enabled": true
                  },
                  {
                    "address": "10.0.0.2/32",
                    "description": "",
                    "enabled": true
                  },
                  {
                    "address": "10.0.0.3/32",
                    "description": "",
                    "enabled": true
                  }
                ]
              }
            ],
            "database_id": "*****************",
            "id": "*******************"
          },
          "sensitive_attributes": [],
          "private": "bnVsbA==",
          "dependencies": [
            "module.astra.astra_database.database"
          ]
        }
      ]
    },

Steps to Reproduce

Just apply the code on a new database.

┆Issue is synchronized with this Jira Task by Unito
┆friendlyId: TERRA-45
┆priority: Major

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions