atlassian / terraform-provider-artifactory

Terraform provider to manage Artifactory
Apache License 2.0
89 stars 42 forks source link

permission_target - empty 'actions' block crashes Terraform. #73

Open kubiak95 opened 4 years ago

kubiak95 commented 4 years ago

Community Note

Terraform Version

Terraform v0.12.21 terraform-provider-artifactory 2.0.0-alpha1

Affected Resource(s)

Terraform Configuration Files

provider "artifactory" {
  url = var.auth_url
  api_key = var.auth_api_key
}

resource "artifactory_permission_target" "permission_target" {

  name = "test-permission-target"

  repo {
    excludes_pattern = [ "npm/**" ]
    includes_pattern = [ "pypi/**" ]
    repositories = [ "test-repo" ]

    actions {
    }
  }
}

Panic Output

https://gist.github.com/kubiak95/4d9650bdb47a481b7d58128fdc7ea256

Expected Behavior

  1. Terraform should return an error message (e.g. 'actions block cannot be empty') and exit 'gracefully'. OR
  2. Terraform should omit the empty actions block.

Actual Behavior

Terraform panics and crashes.

Steps to Reproduce

  1. Create a config file like the one shown above with an empty actions block.
  2. terraform apply

Additional Context

This crash is an outcome of me playing with dynamic blocks like so:

actions {
  dynamic "users" {
    for_each...
    }
  }
}

If I don't specify any users or groups, the result is an empty actions block. I will get around this by making actions dynamic as well, but ultimately Terraform crashed so I'm reporting it.

References

hashicorp/terraform#24098