Skip to content

Commit

Permalink
Use static resource ID if "id" field is nil
Browse files Browse the repository at this point in the history
This is currently the case for Secondary DNS records. In the future
these records will get their own IDs, but for now, let's do this to
prevent a panic when casting a nil `interface{}` to a string.

References: DNS-10305
  • Loading branch information
janik-cloudflare committed Nov 16, 2023
1 parent 7bd973a commit 362b05a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/app/cf-terraforming/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ func generateResources() func(cmd *cobra.Command, args []string) {
structData := jsonStructData[i].(map[string]interface{})

resourceID := ""
if os.Getenv("USE_STATIC_RESOURCE_IDS") == "true" {
if structData["id"] == nil || os.Getenv("USE_STATIC_RESOURCE_IDS") == "true" {
resourceID = "terraform_managed_resource"
} else {
id := ""
Expand Down

0 comments on commit 362b05a

Please sign in to comment.