Skip to content

Creating stackit_security_group_rule accepting any ports results in inconsistent state #1035

@albgus

Description

@albgus

Description

Creating a stackit_security_group_rule with port_range with max and min values set to 0 results in an inconsistent result after apply in Terraform.

After creation It looks correct in the web interface though where 0 is displayed Start-port: Any

Steps to reproduce

Apply the following Terraform

resource "stackit_security_group" "this" {
  project_id = var.project_id

  name        = "repro"
}
resource "stackit_security_group_rule" "this" {
  project_id = var.project_id

  security_group_id = stackit_security_group.this.security_group_id

  direction  = "ingress"
  ether_type = "IPv4"

  protocol = {
    name = "tcp"
  }
  port_range = {
    max    = 0
    min    = 0
  }

  ip_range                 = "10.0.0.0/8"
}

Actual behavior

╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to stackit_security_group_rule.this, provider "provider[\"registry.terraform.io/stackitcloud/stackit\"]" produced an unexpected new value: .port_range: was
│ cty.ObjectVal(map[string]cty.Value{"max":cty.NumberIntVal(0), "min":cty.NumberIntVal(0)}), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Expected behavior

A security group with source ports Any: Any is created

Environment

Terraform v1.9.8
on darwin_arm64
+ provider registry.terraform.io/stackitcloud/stackit v0.67.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions