oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
760 stars 683 forks source link

No more than 1 "tcp_options" blocks are allowed #2111

Open bassg0navy opened 6 months ago

bassg0navy commented 6 months ago

Community Note

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