Skip to content

Error creating Security Group rule with open connectivity from specific source #788

@zurichr

Description

@zurichr

Description

An error occurs when creating a security group rule with a port range of 1-65535.

Steps to reproduce

resource "stackit_security_group" "sg0" {
  project_id = var.project_id
  name       = "${var.country}-sg0"
  stateful   = true
}

resource "stackit_security_group_rule" "sg0-rule0" {
  project_id        = var.project_id
  security_group_id = stackit_security_group.sg0.security_group_id
  direction         = "ingress"
  ether_type        = "IPv4"
  description       = "${var.country}-allow-all-from-admin"
  ip_range          = "172.16.0.96/27"
  protocol = {
    name = "tcp"
  }
  port_range = { 
    min = 1
    max = 65535 
  }
}

Actual behavior

Error: Provider produced inconsistent result after apply

When applying changes to stackit_security_group_rule.sg0-rule0, provider "provider[\"registry.terraform.io/stackitcloud/stackit\"]" produced an unexpected new value:
.port_range: was cty.ObjectVal(map[string]cty.Value{"max":cty.NumberIntVal(65535), "min":cty.NumberIntVal(1)}), but now null.

This is a bug in the provider, which should be reported in the provider's own issue tracker.

The resource has been actually created and is visible in the portal with Start-port: Any / End-port: Any.
However, an error is reported, and Terraform attempts to recreate it every time I run terraform apply.

If I change the configuration to:

  port_range = { 
    min = 2
    max = 65535 
  }

or comment the block above, everything works as expected.

While it may not be the most critical feature, it is worth reporting.

Environment

  • OS: Ubuntu 22.04.5 LTS
  • Terraform version: v1.11.3
  • Version of the STACKIT Terraform provider: v0.50.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions