cf-terraforming icon indicating copy to clipboard operation
cf-terraforming copied to clipboard

cloudflare_zone_lockdown generate not pulling configurations

Open gray1117 opened this issue 4 years ago • 3 comments

Confirmation

  • [X] My issue isn't already found on the issue tracker.
  • [X] I have replicated my issue using the latest version of the library and it is still present.

cf-terraforming version

cf-terraforming v0.4.0

Expected outcome

When issuing command 'cf-terraforming generate --resource-type cloudflare_zone_lockdown --zone ${ZONE_ID}' to get the full configuration for the zone's zone_lockdown settings; should look as below

resource "cloudflare_zone_lockdown" "terraform_managed_resource_908987238984798y3ed" {
    description = "description"
    paused = false
    urls = [ "example.com" ]
    zone_id = "${ZONE_ID}"
    configurations {
        target = "ip_range"
        value = "198.51.100.0/16"
      }    
  } 

Actual outcome

the 'configurations' section is not being generated

resource "cloudflare_zone_lockdown" "terraform_managed_resource_908987238984798y3ed" {
    description = "description"
    paused = false
    urls = [ "example.com" ]
    zone_id = "${ZONE_ID}"  
  } 

commands with verbose set

  cf-terraforming generate --resource-type cloudflare_zone_lockdown --zone ${ZONE_ID} -v
  DEBU[0000] initializing cloudflare-go with API Token     account_Id= zone_id=9834989232981273
  DEBU[0014] initialising Terraform in .                  
  DEBU[0020] reading Terraform schema for Cloudflare provider 
  DEBU[0026] beginning to read and build cloudflare_zone_lockdown resources 
  DEBU[0027] got unknown attribute configuration: key priority, value <nil>, value type <nil> 
  DEBU[0027] unexpected attribute struct type []interface {} for block configurations 
  DEBU[0027] got unknown attribute configuration: key priority, value <nil>, value type <nil> 
  DEBU[0027] unexpected attribute struct type []interface {} for block configurations 
  DEBU[0027] got unknown attribute configuration: key priority, value <nil>, value type <nil> 
  DEBU[0027] unexpected attribute struct type []interface {} for block configurations   

Steps to reproduce

Try to generate zone_lockdown .tf configurations using below command: cf-terraforming generate --resource-type cloudflare_zone_lockdown --zone ${ZONE_ID} -v

References

No response

gray1117 avatar Nov 03 '21 16:11 gray1117

can you please dump the HTTP response you're getting here? we have test coverage for this (tf, yaml HTTP response) which show this correctly outputting the resources so something isn't quite right here.

this is the output on the latest version of cf-terraforming

$ cf-terraforming generate \
  --resource-type "cloudflare_zone_lockdown" \
  --email "[redacted]" \
  -k "[redacted]" \
  --zone "0da42c8d2132a9ddaf714f9e7c920711" 

resource "cloudflare_zone_lockdown" "terraform_managed_resource_d6365f6e12ae4fafb3b3ddc0382a42d9" {
  description = "example"
  paused      = false
  urls        = ["www.example.com"]
  zone_id     = "0da42c8d2132a9ddaf714f9e7c920711"
  configurations {
    target = "ip"
    value  = "1.1.1.1"
  }
}

jacobbednarz avatar Nov 03 '21 22:11 jacobbednarz

The cURL response is below, thanks for responding to this issue

curl -X GET "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/firewall/lockdowns?page=1&per_page=100"
-H "Authorization: Bearer [redacted]"
-H "Content-Type: application/yaml" { "result": [ { "id": "redacted", "paused": false, "modified_on": "2021-11-02T16:47:09.561133456Z", "description": "description", "urls": [ "test.example.com" ], "configurations": [ { "target": "ip_range", "value": "x.x.x.x/21" } ], "created_on": "2021-11-02T16:47:09.561133456Z" }, { "id": "redacted", "paused": false, "modified_on": "2021-09-27T12:01:33.842692595Z", "description": "description", "urls": [ "example.com/something/", "example.com/" ], "configurations": [ { "target": "ip_range", "value": "x.x.x.x/21" } ], "created_on": "2021-09-27T12:01:33.842692595Z" }, { "id": "redacted", "paused": false, "modified_on": "2018-09-21T07:49:52.929782668Z", "description": "description", "urls": [ "www.example.com/*" ], "configurations": [ { "target": "ip_range", "value": "x.x.x.x/21" } ], "created_on": "2018-09-21T07:49:52.929782668Z" } ], "success": true, "errors": [], "messages": [], "result_info": { "page": 1, "per_page": 100, "count": 3, "total_count": 3, "total_pages": 1 } }

gray1117 avatar Nov 04 '21 09:11 gray1117

Hello, has there been any progress on the above issue?

gray1117 avatar Nov 19 '21 10:11 gray1117