Skip to content

Commit

Permalink
Merge pull request #580 from jafowler/do-not-return-custom-pages-with…
Browse files Browse the repository at this point in the history
…out-urls
  • Loading branch information
jacobbednarz authored Jun 18, 2023
2 parents 9f77aae + 654ff4c commit 65f84eb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/app/cf-terraforming/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,18 @@ func generateResources() func(cmd *cobra.Command, args []string) {
}
}

var newJsonStructData []interface{}
// remap ID to the "type" field
for i := 0; i < resourceCount; i++ {
jsonStructData[i].(map[string]interface{})["type"] = jsonStructData[i].(map[string]interface{})["id"]
// we only want repsonses that have 'url'
if jsonStructData[i].(map[string]interface{})["url"] != nil {
newJsonStructData = append(newJsonStructData, jsonStructData[i])
}
}
jsonStructData = newJsonStructData
resourceCount = len(jsonStructData)

case "cloudflare_custom_hostname_fallback_origin":
var jsonPayload []cloudflare.CustomHostnameFallbackOrigin
apiCall, err := api.CustomHostnameFallbackOrigin(context.Background(), zoneID)
Expand Down
12 changes: 12 additions & 0 deletions testdata/cloudflare/cloudflare_custom_pages_account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ interactions:
],
"preview_target": "preview:target",
"description": "example"
},
{
"id": "basic_challenge",
"created_on": "2014-01-01T05:20:00.12345Z",
"modified_on": "2014-01-01T05:20:00.12345Z",
"url": null,
"state": "customized",
"required_tokens": [
"::CAPTCHA_BOX::"
],
"preview_target": "preview:target",
"description": "example"
}
]
}
Expand Down
12 changes: 12 additions & 0 deletions testdata/cloudflare/cloudflare_custom_pages_zone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ interactions:
],
"preview_target": "preview:target",
"description": "example"
},
{
"id": "basic_challenge",
"created_on": "2014-01-01T05:20:00.12345Z",
"modified_on": "2014-01-01T05:20:00.12345Z",
"url": null,
"state": "customized",
"required_tokens": [
"::CAPTCHA_BOX::"
],
"preview_target": "preview:target",
"description": "example"
}
]
}
Expand Down

0 comments on commit 65f84eb

Please sign in to comment.