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

feat(notification): add auto destroy configuration triggers #1394

Merged
merged 5 commits into from
Jul 2, 2024

Conversation

notchairmk
Copy link
Member

@notchairmk notchairmk commented Jun 28, 2024

Description

Adds workspace:auto_destroy_reminder and workspace:auto_destroy_run_results as allowable notification configuration trigger types.

Depends on #1393
Fixes #1380

Remember to:

Testing plan

Note: I didn't add a test because ephemeral workspaces/auto-destroy functionality requires an organization with premium entitlements.

I tested this out locally with the following configuration:

terraform {
  required_providers {
    tfe = {
      source  = "hashicorp/tfe"
      version = "=0.56"
    }
  }
}

provider "tfe" {
  hostname = <hostname>
  token    = <token>
}

data "tfe_organization" "org" {
  name = "hashicorp"
}

resource "tfe_workspace" "auto_destroy_test" {
  name         = "tfe-auto-destroy-test"
  organization = data.tfe_organization.org.name
}

resource "tfe_notification_configuration" "test" {
  name             = "test"
  destination_type = "generic"
  enabled          = true
  workspace_id     = tfe_workspace.auto_destroy_test.id

  url = "http://example.com/?update=true"

  triggers = [
    "run:created",
    "run:planning",
    "run:needs_attention",
    "run:applying",
    "run:completed",
    "run:errored",
    "assessment:drifted",
    "assessment:failed",
    "assessment:check_failure",
    "workspace:auto_destroy_reminder",
    "workspace:auto_destroy_run_results",
  ]
}

External links

Include any links here that might be helpful for people reviewing your PR. If there are none, feel free to delete this section.

Output from acceptance tests

Please run applicable acceptance tests locally and include the output here. See testing.md to learn how to run acceptance tests.

If you are an external contributor, your contribution(s) will first be reviewed before running them against the project's CI pipeline.

$ TESTARGS="-run TestAccTFEWorkspace" make testacc

...

@notchairmk notchairmk requested a review from a team June 28, 2024 22:31
@notchairmk notchairmk requested a review from a team as a code owner June 28, 2024 22:31
@notchairmk notchairmk changed the title Notchairmk/workspace auto destroy notifications feat(notification): add auto destroy configuration triggers Jun 28, 2024
@notchairmk notchairmk force-pushed the notchairmk/workspace-auto-destroy-notifications branch from 95a57b7 to cd00e7e Compare July 1, 2024 15:06
@simonxmh
Copy link

simonxmh commented Jul 2, 2024

Tested and it seems to work, but it seems like we don't show it in the UI
Screenshot 2024-07-02 at 12 12 05 PM

EDIT:seems if they're all checked here then it goes to "all events"
Screenshot 2024-07-02 at 12 16 59 PM

Copy link

@simonxmh simonxmh left a comment

Choose a reason for hiding this comment

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

Looks good

@notchairmk notchairmk merged commit d5c41d2 into main Jul 2, 2024
9 checks passed
@notchairmk notchairmk deleted the notchairmk/workspace-auto-destroy-notifications branch July 2, 2024 17:59
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

Successfully merging this pull request may close these issues.

tfe_notification_configuration - Add Support for Auto Destroy Triggers
2 participants