AWS Classic v5.41.0, May 15 23
AWS Classic v5.41.0, May 15 23
aws.cloudsearch.DomainServiceAccessPolicy
Explore with Pulumi AI
Provides an CloudSearch domain service access policy resource.
The provider waits for the domain service access policy to become Active
when applying a configuration.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleDomain = new Aws.CloudSearch.Domain("exampleDomain");
var examplePolicyDocument = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Sid = "search_only",
Effect = "Allow",
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "*",
Identifiers = new[]
{
"*",
},
},
},
Actions = new[]
{
"cloudsearch:search",
"cloudsearch:document",
},
Conditions = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementConditionInputArgs
{
Test = "IpAddress",
Variable = "aws:SourceIp",
Values = new[]
{
"192.0.2.0/32",
},
},
},
},
},
});
var exampleDomainServiceAccessPolicy = new Aws.CloudSearch.DomainServiceAccessPolicy("exampleDomainServiceAccessPolicy", new()
{
DomainName = exampleDomain.Id,
AccessPolicy = examplePolicyDocument.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/cloudsearch"
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleDomain, err := cloudsearch.NewDomain(ctx, "exampleDomain", nil)
if err != nil {
return err
}
examplePolicyDocument, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Sid: pulumi.StringRef("search_only"),
Effect: pulumi.StringRef("Allow"),
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "*",
Identifiers: []string{
"*",
},
},
},
Actions: []string{
"cloudsearch:search",
"cloudsearch:document",
},
Conditions: []iam.GetPolicyDocumentStatementCondition{
{
Test: "IpAddress",
Variable: "aws:SourceIp",
Values: []string{
"192.0.2.0/32",
},
},
},
},
},
}, nil)
if err != nil {
return err
}
_, err = cloudsearch.NewDomainServiceAccessPolicy(ctx, "exampleDomainServiceAccessPolicy", &cloudsearch.DomainServiceAccessPolicyArgs{
DomainName: exampleDomain.ID(),
AccessPolicy: *pulumi.String(examplePolicyDocument.Json),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudsearch.Domain;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.cloudsearch.DomainServiceAccessPolicy;
import com.pulumi.aws.cloudsearch.DomainServiceAccessPolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var exampleDomain = new Domain("exampleDomain");
final var examplePolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.sid("search_only")
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("*")
.identifiers("*")
.build())
.actions(
"cloudsearch:search",
"cloudsearch:document")
.conditions(GetPolicyDocumentStatementConditionArgs.builder()
.test("IpAddress")
.variable("aws:SourceIp")
.values("192.0.2.0/32")
.build())
.build())
.build());
var exampleDomainServiceAccessPolicy = new DomainServiceAccessPolicy("exampleDomainServiceAccessPolicy", DomainServiceAccessPolicyArgs.builder()
.domainName(exampleDomain.id())
.accessPolicy(examplePolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
}
}
import pulumi
import pulumi_aws as aws
example_domain = aws.cloudsearch.Domain("exampleDomain")
example_policy_document = aws.iam.get_policy_document(statements=[aws.iam.GetPolicyDocumentStatementArgs(
sid="search_only",
effect="Allow",
principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
type="*",
identifiers=["*"],
)],
actions=[
"cloudsearch:search",
"cloudsearch:document",
],
conditions=[aws.iam.GetPolicyDocumentStatementConditionArgs(
test="IpAddress",
variable="aws:SourceIp",
values=["192.0.2.0/32"],
)],
)])
example_domain_service_access_policy = aws.cloudsearch.DomainServiceAccessPolicy("exampleDomainServiceAccessPolicy",
domain_name=example_domain.id,
access_policy=example_policy_document.json)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleDomain = new aws.cloudsearch.Domain("exampleDomain", {});
const examplePolicyDocument = aws.iam.getPolicyDocument({
statements: [{
sid: "search_only",
effect: "Allow",
principals: [{
type: "*",
identifiers: ["*"],
}],
actions: [
"cloudsearch:search",
"cloudsearch:document",
],
conditions: [{
test: "IpAddress",
variable: "aws:SourceIp",
values: ["192.0.2.0/32"],
}],
}],
});
const exampleDomainServiceAccessPolicy = new aws.cloudsearch.DomainServiceAccessPolicy("exampleDomainServiceAccessPolicy", {
domainName: exampleDomain.id,
accessPolicy: examplePolicyDocument.then(examplePolicyDocument => examplePolicyDocument.json),
});
resources:
exampleDomain:
type: aws:cloudsearch:Domain
exampleDomainServiceAccessPolicy:
type: aws:cloudsearch:DomainServiceAccessPolicy
properties:
domainName: ${exampleDomain.id}
accessPolicy: ${examplePolicyDocument.json}
variables:
examplePolicyDocument:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- sid: search_only
effect: Allow
principals:
- type: '*'
identifiers:
- '*'
actions:
- cloudsearch:search
- cloudsearch:document
conditions:
- test: IpAddress
variable: aws:SourceIp
values:
- 192.0.2.0/32
Create DomainServiceAccessPolicy Resource
new DomainServiceAccessPolicy(name: string, args: DomainServiceAccessPolicyArgs, opts?: CustomResourceOptions);
@overload
def DomainServiceAccessPolicy(resource_name: str,
opts: Optional[ResourceOptions] = None,
access_policy: Optional[str] = None,
domain_name: Optional[str] = None)
@overload
def DomainServiceAccessPolicy(resource_name: str,
args: DomainServiceAccessPolicyArgs,
opts: Optional[ResourceOptions] = None)
func NewDomainServiceAccessPolicy(ctx *Context, name string, args DomainServiceAccessPolicyArgs, opts ...ResourceOption) (*DomainServiceAccessPolicy, error)
public DomainServiceAccessPolicy(string name, DomainServiceAccessPolicyArgs args, CustomResourceOptions? opts = null)
public DomainServiceAccessPolicy(String name, DomainServiceAccessPolicyArgs args)
public DomainServiceAccessPolicy(String name, DomainServiceAccessPolicyArgs args, CustomResourceOptions options)
type: aws:cloudsearch:DomainServiceAccessPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DomainServiceAccessPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args DomainServiceAccessPolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args DomainServiceAccessPolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DomainServiceAccessPolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DomainServiceAccessPolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
DomainServiceAccessPolicy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The DomainServiceAccessPolicy resource accepts the following input properties:
- Access
Policy string The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- Domain
Name string The CloudSearch domain name the policy applies to.
- Access
Policy string The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- Domain
Name string The CloudSearch domain name the policy applies to.
- access
Policy String The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- domain
Name String The CloudSearch domain name the policy applies to.
- access
Policy string The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- domain
Name string The CloudSearch domain name the policy applies to.
- access_
policy str The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- domain_
name str The CloudSearch domain name the policy applies to.
- access
Policy String The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- domain
Name String The CloudSearch domain name the policy applies to.
Outputs
All input properties are implicitly available as output properties. Additionally, the DomainServiceAccessPolicy resource produces the following output properties:
- Id string
The provider-assigned unique ID for this managed resource.
- Id string
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
- id string
The provider-assigned unique ID for this managed resource.
- id str
The provider-assigned unique ID for this managed resource.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing DomainServiceAccessPolicy Resource
Get an existing DomainServiceAccessPolicy 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?: DomainServiceAccessPolicyState, opts?: CustomResourceOptions): DomainServiceAccessPolicy
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
access_policy: Optional[str] = None,
domain_name: Optional[str] = None) -> DomainServiceAccessPolicy
func GetDomainServiceAccessPolicy(ctx *Context, name string, id IDInput, state *DomainServiceAccessPolicyState, opts ...ResourceOption) (*DomainServiceAccessPolicy, error)
public static DomainServiceAccessPolicy Get(string name, Input<string> id, DomainServiceAccessPolicyState? state, CustomResourceOptions? opts = null)
public static DomainServiceAccessPolicy get(String name, Output<String> id, DomainServiceAccessPolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Access
Policy string The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- Domain
Name string The CloudSearch domain name the policy applies to.
- Access
Policy string The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- Domain
Name string The CloudSearch domain name the policy applies to.
- access
Policy String The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- domain
Name String The CloudSearch domain name the policy applies to.
- access
Policy string The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- domain
Name string The CloudSearch domain name the policy applies to.
- access_
policy str The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- domain_
name str The CloudSearch domain name the policy applies to.
- access
Policy String The access rules you want to configure. These rules replace any existing rules. See the AWS documentation for details.
- domain
Name String The CloudSearch domain name the policy applies to.
Import
CloudSearch domain service access policies can be imported using the domain name, e.g.,
$ pulumi import aws:cloudsearch/domainServiceAccessPolicy:DomainServiceAccessPolicy example example-domain
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.