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

pagerduty_incident_workflow is not applying cleanly for pagerduty.com:slack:send-markdown-message:2 #873

Open
aelmekeev opened this issue May 20, 2024 · 0 comments

Comments

@aelmekeev
Copy link

aelmekeev commented May 20, 2024

Hi there,

pagerduty_incident_workflow when it comes to using pagerduty.com:slack:send-markdown-message:2 to send slack notification to the channel requires Channel ID to be specified - otherwise the notification won't be sent to Slack. At the same time if we specify it in the resource it would always show up in the subsequents plans after apply.

Terraform Version

Terraform v1.8.3
on darwin_amd64
+ provider registry.terraform.io/pagerduty/pagerduty v3.12.1

Note:

Affected Resource(s)

  • pagerduty_incident_workflow

Terraform Configuration Files

locals {
  slack_message_inputs = [{
    name  = "Workspace"
    value = "<TODO>"
    }, {
    name  = "Channel"
    value = "A specific channel"
    }, {
    name  = "Select the Channel"
    value = "<TODO>"
  }]
}

resource "pagerduty_incident_workflow" "channel_id_test" {
  name        = "Channel ID test"
  description = "Test if slack message will be sent if channel id is not specified in incident workflow"

  step {
    name   = "Call #testtest channel with channel ID"
    action = "pagerduty.com:slack:send-markdown-message:2"


    dynamic "input" {
      for_each = local.slack_message_inputs
      content {
        name  = input.value.name
        value = input.value.value
      }
    }

    input {
      name  = "Channel ID"
      value = "<TODO>"
    }

    input {
      name  = "Message"
      value = "Call #testtest channel with channel ID"
    }
  }

  step {
    name   = "Call #testtest channel without channel ID"
    action = "pagerduty.com:slack:send-markdown-message:2"


    dynamic "input" {
      for_each = local.slack_message_inputs
      content {
        name  = input.value.name
        value = input.value.value
      }
    }

    input {
      name  = "Message"
      value = "Call #testtest channel without channel ID"
    }
  }
}

resource "pagerduty_incident_workflow_trigger" "this" {
  type                       = "manual"
  workflow                   = pagerduty_incident_workflow.channel_id_test.id
  subscribed_to_all_services = true
}

Debug Output

Don't want to sanitise the whole output but here are relevant bits of the debug log.

Panic Output

N/A

Expected Behavior

Ideally, I would prefer not to specify the channel id (see also #431) but if we have to specify it plan should be clean after successful apply.

Actual Behavior

IN the plan we see something like:

  # pagerduty_incident_workflow.channel_id_test will be updated in-place
  ~ resource "pagerduty_incident_workflow" "channel_id_test" {
        id          = "<id>"
        name        = "Channel ID test"
        # (1 unchanged attribute hidden)

      ~ step {
            id     = "<id>"
            name   = "Call #testtest channel with channel ID"
            # (1 unchanged attribute hidden)

          + input {
              + generated = false
              + name      = "Channel ID"
              + value     = "<id>"
            }

            # (5 unchanged blocks hidden)
        }

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

And if we don't specify channel id we would not get the message in slack:
image

Steps to Reproduce

  1. terraform apply
  2. terraform plan

Important Factoids

Reproducible on clean setup.

References

N/A

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

1 participant