terraform-provider-opsgenie icon indicating copy to clipboard operation
terraform-provider-opsgenie copied to clipboard

Feature: output the API key for opsgenie_api_integration resources

Open BapRx opened this issue 2 years ago • 2 comments

Terraform Version

❯ terraform -v
Terraform v1.3.9
on linux_amd64

Affected Resource(s)

Please list the resources as a list, for example:

  • opsgenie_api_integration

Expected Behavior

I'd like to get the computed API key from the Terraform managed PingdomV2 API integrations.

Actual Behavior

# module.opsgenie.opsgenie_api_integration.pingdom:
resource "opsgenie_api_integration" "pingdom" {
    allow_write_access     = true
    enabled                = true
    id                     = "<redacted>"
    name                   = "Pingdom CUSTOMER"
    owner_team_id          = "<redacted>"
    suppress_notifications = false
    type                   = "PingdomV2"
}

The OpsGenie interface fetches the API key with a separate call:

/webapi/v1/integrations/PingdomV2Integration/update?_=nonce&id=<integration_id>&settings=true&teamId=<owner_team_id>

BapRx avatar Mar 06 '23 09:03 BapRx

..and while we're at it, having a data source for api integrations would be great as well!

deepbrook avatar Mar 30 '23 09:03 deepbrook

Some notes from investigating this:

  • At least for Amazon SNS integrations, creating a new opsgenie_api_integration resource does return an API key.
  • Importing an existing integration as an opsgenie_api_integration resource does not import the api key; it is left null in the state file. Since the underlying API does not return the API key, it will never be populated if you import.

mbarrien avatar Oct 03 '23 20:10 mbarrien