I provision AWS Elasticsearch service with Terraform and want to setup CloudWatch alarms for some metrics like CPU Usage etc. also by using Terraform.
In order to do it I have to put NodeId
to aws_cloudwatch_metric_alarm
resource:
The problem is that aws_elasticsearch_domain
resource doesn't have suitable Attributes Reference
And I also haven't found anything suitable in aws es cli https://docs.aws.amazon.com/cli/latest/reference/es/index.html
Any ideas how to get this NodeId
to use in Terraform?
You can get the nodeId from elasticsearch api instead of relying on aws sdk/cli.
Specifically, you can query the cat/nodes
api.
Link for reference: https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With