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

Inconsistent subscription types in the webhook resource #433

Closed
offbyone opened this issue Sep 15, 2024 · 4 comments
Closed

Inconsistent subscription types in the webhook resource #433

offbyone opened this issue Sep 15, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@offbyone
Copy link

Describe the bug

I am attempting to model my existing tailnet configuration in terraform. I've imported my current webhook configuration, which left me with this plan:

  # module.tailnet.tailscale_webhook.discord must be replaced
-/+ resource "tailscale_webhook" "discord" {
      ~ id            = "wQRtqs3CNTRL" -> (known after apply)
      - provider_type = "discord" -> null # forces replacement
      + secret        = (sensitive value)
      - subscriptions = [
          - "categoryDeviceMisconfigurations",
          - "categoryTailnetManagement",
        ] -> null
        # (1 unchanged attribute hidden)

So, I updated my terraform to add those:

resource "tailscale_webhook" "discord" {
  endpoint_url = var.discord_webhook_url
  subscriptions = [
    "categoryDeviceMisconfigurations",
    "categoryTailnetManagement"
  ]
}

And now my plan results in an error:

│ Error: expected subscriptions.0 to be one of ["nodeCreated" "nodeNeedsApproval" "nodeApproved" "nodeKeyExpiringInOneDay" "nodeKeyExpired" "nodeDeleted" "policyUpdate" "userCreated" "userNeedsApproval" "userSuspended" "userRestored" "userDeleted" "userApproved" "userRoleUpdated" "subnetIPForwardingNotEnabled" "exitNodeIPForwardingNotEnabled"], got categoryDeviceMisconfigurations
│
│   with module.tailnet.tailscale_webhook.discord,
│   on tailnet/tailnet.tf line 3, in resource "tailscale_webhook" "discord":
│    3:   subscriptions = [
│    4:     "categoryDeviceMisconfigurations",
│    5:     "categoryTailnetManagement"
│    6:   ]
$ terraform version
Terraform v1.3.6
on darwin_arm64
... other providers
+ provider registry.terraform.io/tailscale/tailscale v0.17.0
@offbyone offbyone added the bug Something isn't working label Sep 15, 2024
@offbyone
Copy link
Author

(Note; I upgraded terraform to 1.9.5 and no difference)

@mpminardi
Copy link
Member

@offbyone thank you for reporting this! Looks like we missed adding proper support for category groupings for events when we added the webhook resource. Will look into fixing this.

@mpminardi mpminardi self-assigned this Sep 16, 2024
mpminardi added a commit to tailscale/tailscale-client-go that referenced this issue Sep 16, 2024
Add missing event categories for webhook subscription types. These were
missing in the initial pass, and imply groupings of events to subscribe
to.

Updates tailscale/terraform-provider-tailscale#433

Signed-off-by: Mario Minardi <mario@tailscale.com>
mpminardi added a commit to tailscale/tailscale-client-go that referenced this issue Sep 16, 2024
Add missing event categories for webhook subscription types. These were
missing in the initial pass, and imply groupings of events to subscribe
to.

Updates tailscale/terraform-provider-tailscale#433

Signed-off-by: Mario Minardi <mario@tailscale.com>
mpminardi added a commit to tailscale/tailscale-client-go that referenced this issue Sep 16, 2024
Add missing event categories for webhook subscription types. These were
missing in the initial pass, and imply groupings of events to subscribe
to.

Updates tailscale/terraform-provider-tailscale#433

Signed-off-by: Mario Minardi <mario@tailscale.com>
mpminardi added a commit to tailscale/tailscale-client-go that referenced this issue Sep 16, 2024
Add missing event categories for webhook subscription types. These were
missing in the initial pass, and imply groupings of events to subscribe
to.

Updates tailscale/terraform-provider-tailscale#433

Signed-off-by: Mario Minardi <mario@tailscale.com>
mpminardi added a commit that referenced this issue Sep 16, 2024
Add missing `categoryDeviceMisconfigurations` and
`categoryTailnetManagement` event subscriptions to the validation logic
for the `subscriptions` property for the webhook resource.

Updates #433

Signed-off-by: Mario Minardi <mario@tailscale.com>
mpminardi added a commit that referenced this issue Sep 20, 2024
Add missing `categoryDeviceMisconfigurations` and
`categoryTailnetManagement` event subscriptions to the validation logic
for the `subscriptions` property for the webhook resource.

Updates #433

Signed-off-by: Mario Minardi <mario@tailscale.com>
mpminardi added a commit that referenced this issue Sep 20, 2024
Add missing `categoryDeviceMisconfigurations` and
`categoryTailnetManagement` event subscriptions to the validation logic
for the `subscriptions` property for the webhook resource.

Updates #433

Signed-off-by: Mario Minardi <mario@tailscale.com>
@mpminardi
Copy link
Member

@offbyone we've just released a v0.17.1 of the provider which should have a fix for this.

@offbyone
Copy link
Author

Thanks! I've updated to 0.17.1 and it's all gravy now. I much appreciate the quick turnaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants