terraform-provider-opsgenie
                                
                                
                                
                                    terraform-provider-opsgenie copied to clipboard
                            
                            
                            
                        Feature: output the API key for opsgenie_api_integration resources
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>
                                    
                                    
                                    
                                
..and while we're at it, having a data source for api integrations would be great as well!
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.