DomainPolicy
Allows setting policy to an Elasticsearch domain while referencing domain attributes (e.g. ARN)
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.ElasticSearch.Domain("example", new Aws.ElasticSearch.DomainArgs
{
ElasticsearchVersion = "2.3",
});
var main = new Aws.ElasticSearch.DomainPolicy("main", new Aws.ElasticSearch.DomainPolicyArgs
{
AccessPolicies = example.Arn.Apply(arn => @$"{{
""Version"": ""2012-10-17"",
""Statement"": [
{{
""Action"": ""es:*"",
""Principal"": ""*"",
""Effect"": ""Allow"",
""Condition"": {{
""IpAddress"": {{""aws:SourceIp"": ""127.0.0.1/32""}}
}},
""Resource"": ""{arn}/*""
}}
]
}}
"),
DomainName = example.DomainName,
});
}
}
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/elasticsearch"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := elasticsearch.NewDomain(ctx, "example", &elasticsearch.DomainArgs{
ElasticsearchVersion: pulumi.String("2.3"),
})
if err != nil {
return err
}
_, err = elasticsearch.NewDomainPolicy(ctx, "main", &elasticsearch.DomainPolicyArgs{
AccessPolicies: example.Arn.ApplyT(func(arn string) (string, error) {
return fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Statement\": [\n", " {\n", " \"Action\": \"es:*\",\n", " \"Principal\": \"*\",\n", " \"Effect\": \"Allow\",\n", " \"Condition\": {\n", " \"IpAddress\": {\"aws:SourceIp\": \"127.0.0.1/32\"}\n", " },\n", " \"Resource\": \"", arn, "/*\"\n", " }\n", " ]\n", "}\n", "\n"), nil
}).(pulumi.StringOutput),
DomainName: example.DomainName,
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example = aws.elasticsearch.Domain("example", elasticsearch_version="2.3")
main = aws.elasticsearch.DomainPolicy("main",
access_policies=example.arn.apply(lambda arn: f"""{{
"Version": "2012-10-17",
"Statement": [
{{
"Action": "es:*",
"Principal": "*",
"Effect": "Allow",
"Condition": {{
"IpAddress": {{"aws:SourceIp": "127.0.0.1/32"}}
}},
"Resource": "{arn}/*"
}}
]
}}
"""),
domain_name=example.domain_name)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.elasticsearch.Domain("example", {
elasticsearchVersion: "2.3",
});
const main = new aws.elasticsearch.DomainPolicy("main", {
accessPolicies: pulumi.interpolate`{
"Version": "2012-10-17",
"Statement": [
{
"Action": "es:*",
"Principal": "*",
"Effect": "Allow",
"Condition": {
"IpAddress": {"aws:SourceIp": "127.0.0.1/32"}
},
"Resource": "${example.arn}/*"
}
]
}
`,
domainName: example.domainName,
});Create a DomainPolicy Resource
new DomainPolicy(name: string, args: DomainPolicyArgs, opts?: CustomResourceOptions);def DomainPolicy(resource_name, opts=None, access_policies=None, domain_name=None, __props__=None);func NewDomainPolicy(ctx *Context, name string, args DomainPolicyArgs, opts ...ResourceOption) (*DomainPolicy, error)public DomainPolicy(string name, DomainPolicyArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args DomainPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args DomainPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DomainPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
DomainPolicy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The DomainPolicy resource accepts the following input properties:
- Access
Policies string IAM policy document specifying the access policies for the domain
- Domain
Name string Name of the domain.
- Access
Policies interface{} IAM policy document specifying the access policies for the domain
- Domain
Name string Name of the domain.
- access
Policies string | PolicyDocument IAM policy document specifying the access policies for the domain
- domain
Name string Name of the domain.
- access_
policies string | str IAM policy document specifying the access policies for the domain
- domain_
name str Name of the domain.
Outputs
All input properties are implicitly available as output properties. Additionally, the DomainPolicy resource produces the following output properties:
Look up an Existing DomainPolicy Resource
Get an existing DomainPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: DomainPolicyState, opts?: CustomResourceOptions): DomainPolicystatic get(resource_name, id, opts=None, access_policies=None, domain_name=None, __props__=None);func GetDomainPolicy(ctx *Context, name string, id IDInput, state *DomainPolicyState, opts ...ResourceOption) (*DomainPolicy, error)public static DomainPolicy Get(string name, Input<string> id, DomainPolicyState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Access
Policies string IAM policy document specifying the access policies for the domain
- Domain
Name string Name of the domain.
- Access
Policies interface{} IAM policy document specifying the access policies for the domain
- Domain
Name string Name of the domain.
- access
Policies string | PolicyDocument IAM policy document specifying the access policies for the domain
- domain
Name string Name of the domain.
- access_
policies string | str IAM policy document specifying the access policies for the domain
- domain_
name str Name of the domain.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.