Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - mgc_network_security_groups_rules always forces replacement #73

Open
Misterio77 opened this issue Jan 13, 2025 · 1 comment
Open
Assignees
Labels
bug Something isn't working waiting triage

Comments

@Misterio77
Copy link

Misterio77 commented Jan 13, 2025

Describe the bug

Terraform applies always replace security group rules, even if they're unchanged.

To Reproduce

  1. Use the following tf file:
terraform {
  backend "local" {
    path = ".terraform.tfstate"
  }
  required_providers {
    mgc = {
      source = "registry.terraform.io/magalucloud/mgc"
      version = "0.31.0"
    }
  }
}

resource "mgc_network_security_groups" "teste" {
  name = "teste-bug"
}

resource "mgc_network_security_groups_rules" "incoming_ssh" {
  direction = "ingress"
  port_range_min = 22
  port_range_max = 22
  protocol = "tcp"
  ethertype = "IPv4"
  remote_ip_prefix = "0.0.0.0/0"
  security_group_id = mgc_network_security_groups.teste.id
}
  1. Apply. Should work as usual.
  2. Apply again. You'll be prompted to replace the security group rule, like so:
OpenTofu will perform the following actions:

  # mgc_network_security_groups_rules.incoming_ssh must be replaced
-/+ resource "mgc_network_security_groups_rules" "incoming_ssh" {
      ~ id                = "243f858b-b811-42a9-93f8-02ad9f223f7d" -> (known after apply)
        # (7 unchanged attributes hidden)
    }

Plan: 1 to add, 0 to change, 1 to destroy.

Expected behavior

Rules should not be replaced if they're unchanged.

Desktop (please complete the following information):

  • OS: Ubuntu 24.04.1
  • Terraform: OpenTofu v1.8.8
  • Provider version: v0.31.0

Additional context

This seems similar to #71.

@publi0
Copy link
Collaborator

publi0 commented Jan 24, 2025

@Misterio77 I tried to reproduce the error but couldn't get to recreate the resource, can you please validate if this still happens?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting triage
Projects
None yet
Development

No branches or pull requests

3 participants