opensearch-project / terraform-provider-opensearch

https://registry.terraform.io/providers/opensearch-project/opensearch
Apache License 2.0
73 stars 56 forks source link

[DOCS] Add terraform example for using opensearch_channel_configuration #110

Closed joesome-git closed 6 months ago

joesome-git commented 10 months ago

There's currently no usage example for resource opensearch_channel_configuration. It would be useful to include it on the OpenSearch terraform module documentation.


resource "opensearch_channel_configuration" "sns_channel_configuration" {
  body = <<EOF
{
  "id": "sample-sns-id",
  "name": "sample-name",
  "config": {
    "name": "Sample Sns Channel",
    "description": "Sample chime description",
    "config_type": "sns",
    "is_enabled": true,
    "sns": {
      "topic_arn": "arn:aws:sns:us-east-1:123456789012:MyTopic",
      "role_arn": "arn:aws:iam::123456789012:role/MyRole"
    }
  }
}
EOF
}
SkollRyu commented 10 months ago

Thank for bringing up this issue. @prudhvigodithi , can you assign this to me? Thanks

peterzhuamazon commented 10 months ago

The docs are missing here: https://registry.terraform.io/providers/opensearch-project/opensearch/latest/docs/resources/channel_configuration

Need to run this cli to add the docs: https://github.com/hashicorp/terraform-plugin-docs

martinrw commented 9 months ago

The example above only partially worked for me... after applying the plan it wanted to make further changes each time, here is what worked in the end:

resource "opensearch_channel_configuration" "name_here_slack" {
  body = <<EOF
{
  "config_id": "name-here",
  "config": {
    "name": "Name Here",
    "description" : "Description here",
    "config_type" : "slack",
    "is_enabled" : true,
    "slack": {
      "url": "https://slack.webhook.url.com/ddsfsdfsddsffsd"
    }
  }
}
EOF
}

The difference being that "name" isn't needed at the top level and id should be config_id. see the API docs for full reference https://opensearch.org/docs/latest/observing-your-data/notifications/api/