Skip to content

oci_core_drg_route_distribution_statement does not (but should) allow empty list match_criteria #2492

@jeliker1

Description

@jeliker1

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version and Provider Version

erraform v1.12.2
on darwin_arm64

  • provider registry.terraform.io/oracle/oci v7.27.0

Affected Resource(s)

affected_resources = oci_core_drg_route_distribution_statement
affected_resources = terraform

Terraform Configuration Files

resource "oci_core_drg_route_distribution_statement" "test_drg_route_distribution_statement" {
    #Required
    drg_route_distribution_id = var.drg_route_distribution_id
    action = "ACCEPT"

    dynamic "match_criteria" {
        for_each = var.match_criteria
        content {
            match_type = match_criteria.value.match_type

            #Optional
            attachment_type   = lookup(match_criteria.value, "attachment_type", null)
            drg_attachment_id = lookup(match_criteria.value, "drg_attachment_id", null)
            priority          = lookup(match_criteria.value, "priority", null)
        }
    }
}

Debug Output

╷
│ Error: Insufficient match_criteria blocks
│ 
│   on test.tf line 14, in resource "oci_core_drg_route_distribution_statement" "drg_route_distribution_statements":14: resource "oci_core_drg_route_distribution_statement" "test_drg_route_distribution_statement" {
│ 
│ At least 1 "match_criteria" blocks are required.

Panic Output

Expected Behavior

Optional attribute match_criteria may be excluded if the intention is to match "all".

Actual Behavior

Optional attribute 'match_criteriamust be included or an error will be thrown by the provider. Additionally,match_criteriamust have at least one match statement (i.e. it is not good enough to have an emptymatch_criteria` block)

Steps to Reproduce

  1. terraform apply
  2. Note the error if var.match_criteria = []
  3. Add at least one match_criteria block to the list and note error does not occur. Note that default distribution list "ALL" created when DRG is created does not have match_criteria (has empty list)

Important Factoids

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions