terraform-provider-oci icon indicating copy to clipboard operation
terraform-provider-oci copied to clipboard

No more than 1 "tcp_options" blocks are allowed

Open bassg0navy opened this issue 2 months ago • 0 comments

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

Terraform v1.8.3 on darwin_arm64 on provider registry.terraform.io/hashicorp/oci v5.41.0

Affected Resource(s)

oci_core_security_list

Terraform Configuration Files

locals {ingress_ports = [22, 80, 443, 5000, 8081]}

resource "oci_core_security_list" "pub_security_list" {
  vcn_id         = oci_core_vcn.main.id
  compartment_id = var.compartment_id
  display_name   = "${local.vcn_prefix}-${var.public_subnet_security_list_display_name}"

  ingress_security_rules {
    protocol    = 6 # TCP protocol for SSH
    source      = "0.0.0.0/0"
    description = "Allow tcp traffic (SSH, HTTP(s), Flask, Expo) from all sources"

    dynamic "tcp_options" {
      for_each = local.ingress_ports
      iterator = port
      content {
        max = port.value
        min = port.value
      }
    }
  }
}

Debug Output

Gist

Expected Behavior

Terraform should have created an ingress_security_rules for each port listed in local.ingress_ports

Actual Behavior

Error states that no more than 1 tcp_option block are allowed inside an ingress_security_rules attribute. Why are dynamic blocks allowed inside this attribute for tcp_options if more than one can't be specified for ingress_security_rules?

Steps to Reproduce

  1. terraform plan

References

bassg0navy avatar May 12 '24 00:05 bassg0navy