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

Allow empty string for expected_body in Load Balancer Monitors #539

Merged
merged 5 commits into from
Nov 19, 2019

Conversation

Evesy
Copy link
Contributor

@Evesy Evesy commented Nov 15, 2019

Fixes #447

@ghost ghost added the size/S label Nov 15, 2019
@Evesy
Copy link
Contributor Author

Evesy commented Nov 15, 2019

@jacobbednarz If you don't mind, would appreciate your opinion on what approach to take for this.

Right now I've just taken the approach of defaulting expected_body to "", so even though a user-specified value of "" will not pass the non-zero validation, it will be set accordingly anyway.

The object in the Cloudflare API after creating a Load Balancer Monitor with minimal config sets expected_body to "" so this falls in line with the existing Cloudflare behaviour.

I can't run the full test suite right now so I can't validate this currently works as is. Was hoping you could feedback with a general direction to head before I sink too much time into it (First time touching a Terraform provider, want to make sure I'm doing the right thing!)

@jacobbednarz
Copy link
Member

Thanks for this @Evesy! The approach looks fine to me. I don't have any reservations about the "" being set as that's how we're handling it in other places. The main thing here is that is it only used for HTTP/HTTPS monitors and doesn't get applied or prevent a TCP monitor being created.

To run the unit and acceptance tests, you can follow the documentation in the README. I've kicked off an integration test run now and will report back on the results when it's finished.

@jacobbednarz
Copy link
Member

We have a new failure

TestAccCloudflareLoadBalancerMonitor_NoRequired

------- Stdout: -------
=== RUN   TestAccCloudflareLoadBalancerMonitor_NoRequired
=== PAUSE TestAccCloudflareLoadBalancerMonitor_NoRequired
=== CONT  TestAccCloudflareLoadBalancerMonitor_NoRequired
--- FAIL: TestAccCloudflareLoadBalancerMonitor_NoRequired (0.97s)
    testing.go:616: Step 0, no error received, but expected a match to:
        
        expected_body must be set
        
        
FAIL

@ghost ghost added the kind/documentation Categorizes issue or PR as related to documentation. label Nov 19, 2019
@Evesy
Copy link
Contributor Author

Evesy commented Nov 19, 2019

Thanks, I've updated that test assertion now since expected_body will no longer be required user input.

I'll have to look at getting an isolated environment set up with our Enterprise account in order to run the full acceptance tests as my personal account is on the Free plan

@jacobbednarz
Copy link
Member

I'll have to look at getting an isolated environment set up with our Enterprise account in order to run the full acceptance tests as my personal account is on the Free plan

That's 👌, don't stress too much about it. We have dedicated CI environments setup for this type of thing if you don't/can't get access to a particular type of account.

@jacobbednarz
Copy link
Member

CI is green now. Once we make that resource name change, I'm happy to land this.

Avoid accidental collisons
@jacobbednarz jacobbednarz merged commit ac07ef7 into cloudflare:master Nov 19, 2019
@jacobbednarz
Copy link
Member

thanks for this @Evesy! you rock 🤘

boekkooi-lengoo pushed a commit to boekkooi-lengoo/terraform-provider-cloudflare that referenced this pull request Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/documentation Categorizes issue or PR as related to documentation. size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cloudflare_load_balancer_monitor rejects empty string for expected_body
2 participants