1. Packages
  2. AWS Cloud Control
  3. API Docs
  4. xray
  5. ResourcePolicy

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.27.0 published on Monday, Apr 14, 2025 by Pulumi

aws-native.xray.ResourcePolicy

Explore with Pulumi AI

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.27.0 published on Monday, Apr 14, 2025 by Pulumi

This schema provides construct and validation rules for AWS-XRay Resource Policy resource parameters.

Example Usage

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var myResourcePolicy = new AwsNative.XRay.ResourcePolicy("myResourcePolicy", new()
    {
        BypassPolicyLockoutCheck = false,
        PolicyDocument = "{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Sid\": \"SNSAccess\", \"Effect\": \"Allow\", \"Principal\": { \"Service\": \"sns.amazonaws.com\" }, \"Action\": [ \"xray:PutTraceSegments\", \"xray:GetSamplingRules\", \"xray:GetSamplingTargets\" ], \"Resource\": \"*\", \"Condition\": { \"StringEquals\": { \"aws:SourceAccount\": \"my-account-id\" }, \"StringLike\": { \"aws:SourceArn\": \"arn:$my-partition:sns:$my-region:$my-account-id:my-topic-name\" } } } ] }",
        PolicyName = "MySnsActiveTracingPolicy",
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/xray"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := xray.NewResourcePolicy(ctx, "myResourcePolicy", &xray.ResourcePolicyArgs{
			BypassPolicyLockoutCheck: pulumi.Bool(false),
			PolicyDocument:           pulumi.String("{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Sid\": \"SNSAccess\", \"Effect\": \"Allow\", \"Principal\": { \"Service\": \"sns.amazonaws.com\" }, \"Action\": [ \"xray:PutTraceSegments\", \"xray:GetSamplingRules\", \"xray:GetSamplingTargets\" ], \"Resource\": \"*\", \"Condition\": { \"StringEquals\": { \"aws:SourceAccount\": \"my-account-id\" }, \"StringLike\": { \"aws:SourceArn\": \"arn:$my-partition:sns:$my-region:$my-account-id:my-topic-name\" } } } ] }"),
			PolicyName:               pulumi.String("MySnsActiveTracingPolicy"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const myResourcePolicy = new aws_native.xray.ResourcePolicy("myResourcePolicy", {
    bypassPolicyLockoutCheck: false,
    policyDocument: "{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Sid\": \"SNSAccess\", \"Effect\": \"Allow\", \"Principal\": { \"Service\": \"sns.amazonaws.com\" }, \"Action\": [ \"xray:PutTraceSegments\", \"xray:GetSamplingRules\", \"xray:GetSamplingTargets\" ], \"Resource\": \"*\", \"Condition\": { \"StringEquals\": { \"aws:SourceAccount\": \"my-account-id\" }, \"StringLike\": { \"aws:SourceArn\": \"arn:$my-partition:sns:$my-region:$my-account-id:my-topic-name\" } } } ] }",
    policyName: "MySnsActiveTracingPolicy",
});
Copy
import pulumi
import pulumi_aws_native as aws_native

my_resource_policy = aws_native.xray.ResourcePolicy("myResourcePolicy",
    bypass_policy_lockout_check=False,
    policy_document="{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Sid\": \"SNSAccess\", \"Effect\": \"Allow\", \"Principal\": { \"Service\": \"sns.amazonaws.com\" }, \"Action\": [ \"xray:PutTraceSegments\", \"xray:GetSamplingRules\", \"xray:GetSamplingTargets\" ], \"Resource\": \"*\", \"Condition\": { \"StringEquals\": { \"aws:SourceAccount\": \"my-account-id\" }, \"StringLike\": { \"aws:SourceArn\": \"arn:$my-partition:sns:$my-region:$my-account-id:my-topic-name\" } } } ] }",
    policy_name="MySnsActiveTracingPolicy")
Copy

Coming soon!

Example

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AwsNative = Pulumi.AwsNative;

return await Deployment.RunAsync(() => 
{
    var myResourcePolicy = new AwsNative.XRay.ResourcePolicy("myResourcePolicy", new()
    {
        BypassPolicyLockoutCheck = false,
        PolicyDocument = "{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Sid\": \"SNSAccess\", \"Effect\": \"Allow\", \"Principal\": { \"Service\": \"sns.amazonaws.com\" }, \"Action\": [ \"xray:PutTraceSegments\", \"xray:GetSamplingRules\", \"xray:GetSamplingTargets\" ], \"Resource\": \"*\", \"Condition\": { \"StringEquals\": { \"aws:SourceAccount\": \"my-account-id\" }, \"StringLike\": { \"aws:SourceArn\": \"arn:$my-partition:sns:$my-region:$my-account-id:my-topic-name\" } } } ] }",
        PolicyName = "MySNSActiveTracingPolicy",
    });

});
Copy
package main

import (
	"github.com/pulumi/pulumi-aws-native/sdk/go/aws/xray"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := xray.NewResourcePolicy(ctx, "myResourcePolicy", &xray.ResourcePolicyArgs{
			BypassPolicyLockoutCheck: pulumi.Bool(false),
			PolicyDocument:           pulumi.String("{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Sid\": \"SNSAccess\", \"Effect\": \"Allow\", \"Principal\": { \"Service\": \"sns.amazonaws.com\" }, \"Action\": [ \"xray:PutTraceSegments\", \"xray:GetSamplingRules\", \"xray:GetSamplingTargets\" ], \"Resource\": \"*\", \"Condition\": { \"StringEquals\": { \"aws:SourceAccount\": \"my-account-id\" }, \"StringLike\": { \"aws:SourceArn\": \"arn:$my-partition:sns:$my-region:$my-account-id:my-topic-name\" } } } ] }"),
			PolicyName:               pulumi.String("MySNSActiveTracingPolicy"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as aws_native from "@pulumi/aws-native";

const myResourcePolicy = new aws_native.xray.ResourcePolicy("myResourcePolicy", {
    bypassPolicyLockoutCheck: false,
    policyDocument: "{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Sid\": \"SNSAccess\", \"Effect\": \"Allow\", \"Principal\": { \"Service\": \"sns.amazonaws.com\" }, \"Action\": [ \"xray:PutTraceSegments\", \"xray:GetSamplingRules\", \"xray:GetSamplingTargets\" ], \"Resource\": \"*\", \"Condition\": { \"StringEquals\": { \"aws:SourceAccount\": \"my-account-id\" }, \"StringLike\": { \"aws:SourceArn\": \"arn:$my-partition:sns:$my-region:$my-account-id:my-topic-name\" } } } ] }",
    policyName: "MySNSActiveTracingPolicy",
});
Copy
import pulumi
import pulumi_aws_native as aws_native

my_resource_policy = aws_native.xray.ResourcePolicy("myResourcePolicy",
    bypass_policy_lockout_check=False,
    policy_document="{ \"Version\": \"2012-10-17\", \"Statement\": [ { \"Sid\": \"SNSAccess\", \"Effect\": \"Allow\", \"Principal\": { \"Service\": \"sns.amazonaws.com\" }, \"Action\": [ \"xray:PutTraceSegments\", \"xray:GetSamplingRules\", \"xray:GetSamplingTargets\" ], \"Resource\": \"*\", \"Condition\": { \"StringEquals\": { \"aws:SourceAccount\": \"my-account-id\" }, \"StringLike\": { \"aws:SourceArn\": \"arn:$my-partition:sns:$my-region:$my-account-id:my-topic-name\" } } } ] }",
    policy_name="MySNSActiveTracingPolicy")
Copy

Coming soon!

Create ResourcePolicy Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ResourcePolicy(name: string, args: ResourcePolicyArgs, opts?: CustomResourceOptions);
@overload
def ResourcePolicy(resource_name: str,
                   args: ResourcePolicyArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def ResourcePolicy(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   policy_document: Optional[str] = None,
                   bypass_policy_lockout_check: Optional[bool] = None,
                   policy_name: Optional[str] = None)
func NewResourcePolicy(ctx *Context, name string, args ResourcePolicyArgs, opts ...ResourceOption) (*ResourcePolicy, error)
public ResourcePolicy(string name, ResourcePolicyArgs args, CustomResourceOptions? opts = null)
public ResourcePolicy(String name, ResourcePolicyArgs args)
public ResourcePolicy(String name, ResourcePolicyArgs args, CustomResourceOptions options)
type: aws-native:xray:ResourcePolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ResourcePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ResourcePolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ResourcePolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ResourcePolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ResourcePolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ResourcePolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ResourcePolicy resource accepts the following input properties:

PolicyDocument This property is required. string
The resource policy document, which can be up to 5kb in size.
BypassPolicyLockoutCheck bool
A flag to indicate whether to bypass the resource policy lockout safety check
PolicyName string
The name of the resource policy. Must be unique within a specific AWS account.
PolicyDocument This property is required. string
The resource policy document, which can be up to 5kb in size.
BypassPolicyLockoutCheck bool
A flag to indicate whether to bypass the resource policy lockout safety check
PolicyName string
The name of the resource policy. Must be unique within a specific AWS account.
policyDocument This property is required. String
The resource policy document, which can be up to 5kb in size.
bypassPolicyLockoutCheck Boolean
A flag to indicate whether to bypass the resource policy lockout safety check
policyName String
The name of the resource policy. Must be unique within a specific AWS account.
policyDocument This property is required. string
The resource policy document, which can be up to 5kb in size.
bypassPolicyLockoutCheck boolean
A flag to indicate whether to bypass the resource policy lockout safety check
policyName string
The name of the resource policy. Must be unique within a specific AWS account.
policy_document This property is required. str
The resource policy document, which can be up to 5kb in size.
bypass_policy_lockout_check bool
A flag to indicate whether to bypass the resource policy lockout safety check
policy_name str
The name of the resource policy. Must be unique within a specific AWS account.
policyDocument This property is required. String
The resource policy document, which can be up to 5kb in size.
bypassPolicyLockoutCheck Boolean
A flag to indicate whether to bypass the resource policy lockout safety check
policyName String
The name of the resource policy. Must be unique within a specific AWS account.

Outputs

All input properties are implicitly available as output properties. Additionally, the ResourcePolicy 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.

Package Details

Repository
AWS Native pulumi/pulumi-aws-native
License
Apache-2.0

We recommend new projects start with resources from the AWS provider.

AWS Cloud Control v1.27.0 published on Monday, Apr 14, 2025 by Pulumi