civo / terraform-provider-civo

Terraform Civo provider
https://www.civo.com
Mozilla Public License 2.0
65 stars 51 forks source link

[BUG] Removing firewall_id setting from civo_instance resource setting does not revert to default value #232

Closed fernando-villalba closed 6 days ago

fernando-villalba commented 1 week ago

Description

If you apply this, then remove firewall_id setting and apply again, no change is registered by terraform

If the setting for firewall_id is removed, instead, I would expect it to revert to the default value and change the resource accordingly.


resource "civo_network" "test-issue" {
    label = "test-something"
}

resource "civo_firewall" "no_default_rules" {
  name                 = "no_default_rules"
  network_id           = civo_network.test-issue.id
  create_default_rules = false
    ingress_rule {
    label      = "ssh"
    protocol   = "tcp"
    port_range = "22"
    cidr       = ["192.168.1.1/32", "192.168.10.4/32", "192.168.10.10/32"]
    action     = "allow"
  }

}

resource "civo_instance" "foo" {
    hostname = "amazingthingy"
    tags = ["python", "nginx"]
    notes = "He perepepppppepepe"
    size = "g3.xsmall"
    network_id = civo_network.test-issue.id # Then change to this
     firewall_id = civo_firewall.no_default_rules.id # remove this and apply again
    disk_image = "debian-10"
}

Screenshots

No response

Additional information

No response

rootxrishabh commented 1 week ago

Hi @fernando-villalba, can I work on this?

uzaxirr commented 1 week ago

If the setting for firewall_id is removed, instead, I would expect it to revert to the default value and change the resource accordingly.

hii @rootxrishabh can you please elaborate your approach that you would take to solve this issue.

rootxrishabh commented 1 week ago

Hey @uzaxirr, I think to test out resource provisioning, it will require access to a running civo instance?