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

Add pullzoneEdgeruleTriggerTypeMap values to the Terraform docs #17

Open
DMeechan opened this issue Oct 11, 2024 · 1 comment
Open

Add pullzoneEdgeruleTriggerTypeMap values to the Terraform docs #17

DMeechan opened this issue Oct 11, 2024 · 1 comment

Comments

@DMeechan
Copy link

DMeechan commented Oct 11, 2024

Hi! Could you add the different values for bunnynet_pullzone_edgerule.triggers.type to the Terraform docs please?

I was getting this panic: value not found in map error:

  Stack trace from the terraform-provider-bunnynet_v0.3.15 plugin:

  panic: value not found in map

  goroutine 113 [running]:
  github.com/bunnyway/terraform-provider-bunnynet/internal/provider.mapValueToKey[...](0x1400022e4f8?, {0x140003442d4?, 0xb})
  	github.com/bunnyway/terraform-provider-bunnynet/internal/provider/utils.go:25 +0xac
  github.com/bunnyway/terraform-provider-bunnynet/internal/provider.(*PullzoneEdgeruleResource).convertModelToApi(_, {_, _}, {{0x2, {0x140001c23c0, 0x24}}, {0x2, 0x257583}, {0x2, 0x1}, ...})
  	github.com/bunnyway/terraform-provider-bunnynet/internal/provider/resource_pullzone_edgerule.go:438 +0x8c8
  github.com/bunnyway/terraform-provider-bunnynet/internal/provider.(*PullzoneEdgeruleResource).Update(0x14000112028, {0x101613c00, 0x140002110b0}, {{{{0x101617ff0, 0x140002838c0}, {0x101528260, 0x14000282d80}}, {0x1016196f8, 0x140006988c0}}, {{{0x101617ff0, ...}, ...}, ...}, ...}, ...)
  	github.com/bunnyway/terraform-provider-bunnynet/internal/provider/resource_pullzone_edgerule.go:303 +0x1c8
  github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).UpdateResource(0x1400013d600, {0x101613c00, 0x140002110b0}, 0x1400022f320, 0x1400022f230)
...etc...

  Error: The terraform-provider-bunnynet_v0.3.15 plugin crashed!

  This is always indicative of a bug within the plugin. It would be immensely
  helpful if you could report the crash with the plugin's maintainers so that it
  can be fixed. The output above should help diagnose the issue.


  exit status 1

Cause:

Turns out I was using an invalid value for the trigger type. I found the correct value in the source code (in my case I needed UrlQueryString)

Thanks!

@rafael-at-bunny
Copy link
Collaborator

Hi.

Thank you for reporting this. Unfortunately terraform-plugin-docs doesn't have support for this at the moment.

However, it's also an oversight on my part that there was no validation for the triggers. I've added it via cd53025, alongside with some tests to avoid regressions.

│ Error: Trigger type must be valid
│ 
│   with bunnynet_pullzone_edgerule.block_admin,
│   on issue-17.tf line 21, in resource "bunnynet_pullzone_edgerule" "block_admin":
│   21:   triggers = [
│   22:     {
│   23:       type       = "invalid"
│   24:       match_type = "MatchAny"
│   25:       patterns   = ["*"]
│   26:       parameter1 = null
│   27:       parameter2 = null
│   28:     }
│   29:   ]
│ 
│ Trigger "type" must be one of
│ ["ResponseHeader","CountryCode","RemoteIP","RandomChance","StatusCode","CookieValue","Url","RequestHeader","UrlExtension","UrlQueryString","RequestMethod","CountryStateCode"].

I'll keep this issue open until we have upstream support, or at least some workaround implemented.

Thank you.

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

No branches or pull requests

2 participants