cloudflare / terraform-provider-cloudflare

Cloudflare Terraform Provider
https://registry.terraform.io/providers/cloudflare/cloudflare
Mozilla Public License 2.0
789 stars 610 forks source link

cloudflare_access_group "require" is not expected here #2653

Closed verenion closed 1 year ago

verenion commented 1 year ago

Confirmation

Terraform and Cloudflare provider version

terraform -v Terraform v1.5.4 on linux_amd64

Affected resource(s)

cloudflare_access_group

Terraform configuration files

resource "cloudflare_access_group" "example" {
  account_id = "xxx"
  name       = "staging group"

  include {
    email = ["test@example.com"]
  }

  require = {
    ip = ["1.1.1.1"]
  }
}

Link to debug output

https://gist.github.com/verenion/febe6b7d784eba102f05a5bcbd989a60

Panic output

No response

Expected output

For the group to be created, as per the documentation:

https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/access_group#nested-schema-for-require

# Allowing `test@example.com` to access but only when coming from a
# specific IP.
resource "cloudflare_access_group" "example" {
  account_id = "f037e56e89293a057740de681ac9abbe"
  name       = "staging group"

  include {
    email = ["test@example.com"]
  }

  require = {
    ip = [var.office_ip]
  }
}

Actual output

I get an unsupported argument error:

│ Error: Unsupported argument
│ 
│   on cloudflare-tunnel.tf line 35, in resource "cloudflare_access_group" "example":
│   35:   require = {
│ 
│ An argument named "require" is not expected here. Did you mean to define a block of
│ type "require"?

Steps to reproduce

  1. Create a cloudflare_access_group resource with both include and require arguments.
  2. Error

Additional factoids

No response

References

No response

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

jacobbednarz commented 1 year ago

require is a block, not an attribute so it should be require {} (no equals sign).

feel free to submit a PR fixing this documentation example 😄 (https://github.com/cloudflare/terraform-provider-cloudflare/blob/master/contributing/registry-documentation.md).

github-actions[bot] commented 1 year ago

This functionality has been released in v4.12.0 of the Terraform Cloudflare Provider.

Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!