Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: browser_cache_ttl is incorrectly sent as a string when unchanged #390

Merged
merged 1 commit into from
Jun 25, 2019

Conversation

stevehodgkiss
Copy link
Contributor

@stevehodgkiss stevehodgkiss commented Jun 24, 2019

Fixes an issue added in https://github.com/terraform-providers/terraform-provider-cloudflare/pull/379 where changing an unrelated value will result in browser_cache_ttl being sent as a string rather than an integer. The error message returned from CloudFlare is "TTL values must be whole numbers only". Removing the changed from the conditional fixes that.

There's an issue where changing an unrelated value will result in the
value being sent to CloudFlare as a string rather than an integer.
@ghost ghost added the size/XS label Jun 24, 2019
Copy link
Member

@jacobbednarz jacobbednarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this a little closer, this might be covering up an issue not fixing the underlying cause. My thinking here is that we shouldn't ever be sending the value to the remote unless it has changed (where "changed" is new or updated). changed is assigned to the result of HasChange() which should take care of diffing the old and new results.

The error message returned from CloudFlare is "TTL values must be whole numbers only".

For anyone following along at home, this issue in the payload is that we are sending the value back as a string when it's intending to be an integer.

# good payload
{
	"targets": [{
		"target": "url",
		"constraint": {
			"operator": "matches",
			"value": "terraform-test.example.com"
		}
	}],
	"actions": [{
		"id": "browser_cache_ttl",
		"value": 1
	}],
	"priority": 1,
	"status": "active",
	"modified_on": "0001-01-01T00:00:00Z",
	"created_on": "0001-01-01T00:00:00Z"
}
# bad payload
{
	"targets": [{
		"target": "url",
		"constraint": {
			"operator": "matches",
			"value": "terraform-test.example.com"
		}
	}],
	"actions": [{
		"id": "browser_cache_ttl",
		"value": "1"
	}],
	"priority": 1,
	"status": "active",
	"modified_on": "0001-01-01T00:00:00Z",
	"created_on": "0001-01-01T00:00:00Z"
}

I'll have a dig around and see why the value is being sent when it hasn't changed.

Copy link
Member

@jacobbednarz jacobbednarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore me, I was thinking of another issue which is unrelated.

Happy to 🚢 , just waiting on integration to finish.

@jacobbednarz
Copy link
Member

CI has 3 failures at the moment but look unrelated.

TestAccCloudflareWorkerRoute_MultiScriptEnt 
TestAccCloudflareWorkerRoute_SingleScriptEnt 
TestAccCloudflareWorkerRoute_SingleScriptNonEnt

I'll investigate these separately.

@jacobbednarz jacobbednarz merged commit eda81d0 into cloudflare:master Jun 25, 2019
@jacobbednarz
Copy link
Member

Thanks a bunch @stevehodgkiss! 🎈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants