Skip to content

Resource: awsElasticsearchDomainPolicy

Allows setting policy to an Elasticsearch domain while referencing domain attributes (e.g., ARN)

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsElasticsearchDomainExample =
  new aws.elasticsearchDomain.ElasticsearchDomain(this, "example", {
    domainName: "tf-test",
    elasticsearchVersion: "2.3",
  });
new aws.elasticsearchDomainPolicy.ElasticsearchDomainPolicy(this, "main", {
  accessPolicies: `{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": "es:*",
            "Principal": "*",
            "Effect": "Allow",
            "Condition": {
                "IpAddress": {"aws:SourceIp": "127.0.0.1/32"}
            },
            "Resource": "\${${awsElasticsearchDomainExample.arn}}/*"
        }
    ]
}
`,
  domainName: awsElasticsearchDomainExample.domainName,
});

Argument Reference

The following arguments are supported:

  • domainName - (Required) Name of the domain.
  • accessPolicies - (Optional) IAM policy document specifying the access policies for the domain

Attributes Reference

No additional attributes are exported.