digitalocean / terraform-provider-digitalocean

Terraform DigitalOcean provider
https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs
Mozilla Public License 2.0
505 stars 276 forks source link

digitalocean_firewall resource throws error if dynamic values are used in source_load_balancer_uids array. #793

Open lots0logs opened 2 years ago

lots0logs commented 2 years ago

Bug Report


Describe the bug

Using a data source to retrieve the id of loadbalancer and using that id in source_load_balancer_uids array results in the following error:

Error: Null value found in list
with digitalocean_firewall.firewall
on firewall.tf line 2, in resource "digitalocean_firewall" "firewall":
resource "digitalocean_firewall" "firewall" {
Null values are not allowed for this attribute value.

Affected Resource(s)

Expected Behavior

It should work without error.

Actual Behavior

It doesn't work.

Steps to Reproduce

  1. terraform plan

Terraform Configuration Files

data "digitalocean_loadbalancer" "lb" {
    depends_on = [rancher2_app_v2.ingress_nginx]
    name       = "cluster--lb"
}

resource "digitalocean_firewall" "firewall" {
    name = cluster"

    inbound_rule {
        protocol         = "tcp"
        port_range       = "1-65535"

        source_load_balancer_uids = [
            data.digitalocean_loadbalancer.lb.id,
        ]
    }
}

Terraform Version

Terraform v1.1.5
on linux_amd64
+ provider registry.terraform.io/cloudflare/cloudflare v3.9.1
+ provider registry.terraform.io/digitalocean/digitalocean v2.17.1
+ provider registry.terraform.io/hashicorp/kubernetes v2.8.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/rancher/rancher2 v1.22.2

Debug Output That contains information I can't share. FWIW I can see the data source for the load balancer is retrieved without issue and it contains the id in the terraform state.

Panic Output

Additional context

Important Factoids

References

96

danaelhe commented 2 years ago

Hi there,

Thank you so much for this write up. We will review it and apply changes if necessary as soon as we can.