1. Packages
  2. AWS Classic
  3. API Docs
  4. cloudwatch
  5. EventPermission

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.cloudwatch.EventPermission

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides a resource to create an EventBridge permission to support cross-account events in the current account default event bus.

    Note: EventBridge was formerly known as CloudWatch Events. The functionality is identical.

    Note: The EventBridge bus policy resource (aws.cloudwatch.EventBusPolicy) is incompatible with the EventBridge permission resource (aws.cloudwatch.EventPermission) and will overwrite permissions.

    Example Usage

    Account Access

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const devAccountAccess = new aws.cloudwatch.EventPermission("DevAccountAccess", {
        principal: "123456789012",
        statementId: "DevAccountAccess",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    dev_account_access = aws.cloudwatch.EventPermission("DevAccountAccess",
        principal="123456789012",
        statement_id="DevAccountAccess")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudwatch.NewEventPermission(ctx, "DevAccountAccess", &cloudwatch.EventPermissionArgs{
    			Principal:   pulumi.String("123456789012"),
    			StatementId: pulumi.String("DevAccountAccess"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var devAccountAccess = new Aws.CloudWatch.EventPermission("DevAccountAccess", new()
        {
            Principal = "123456789012",
            StatementId = "DevAccountAccess",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.cloudwatch.EventPermission;
    import com.pulumi.aws.cloudwatch.EventPermissionArgs;
    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 devAccountAccess = new EventPermission("devAccountAccess", EventPermissionArgs.builder()
                .principal("123456789012")
                .statementId("DevAccountAccess")
                .build());
    
        }
    }
    
    resources:
      devAccountAccess:
        type: aws:cloudwatch:EventPermission
        name: DevAccountAccess
        properties:
          principal: '123456789012'
          statementId: DevAccountAccess
    

    Organization Access

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const organizationAccess = new aws.cloudwatch.EventPermission("OrganizationAccess", {
        principal: "*",
        statementId: "OrganizationAccess",
        condition: {
            key: "aws:PrincipalOrgID",
            type: "StringEquals",
            value: example.id,
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    organization_access = aws.cloudwatch.EventPermission("OrganizationAccess",
        principal="*",
        statement_id="OrganizationAccess",
        condition={
            "key": "aws:PrincipalOrgID",
            "type": "StringEquals",
            "value": example["id"],
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudwatch.NewEventPermission(ctx, "OrganizationAccess", &cloudwatch.EventPermissionArgs{
    			Principal:   pulumi.String("*"),
    			StatementId: pulumi.String("OrganizationAccess"),
    			Condition: &cloudwatch.EventPermissionConditionArgs{
    				Key:   pulumi.String("aws:PrincipalOrgID"),
    				Type:  pulumi.String("StringEquals"),
    				Value: pulumi.Any(example.Id),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var organizationAccess = new Aws.CloudWatch.EventPermission("OrganizationAccess", new()
        {
            Principal = "*",
            StatementId = "OrganizationAccess",
            Condition = new Aws.CloudWatch.Inputs.EventPermissionConditionArgs
            {
                Key = "aws:PrincipalOrgID",
                Type = "StringEquals",
                Value = example.Id,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.cloudwatch.EventPermission;
    import com.pulumi.aws.cloudwatch.EventPermissionArgs;
    import com.pulumi.aws.cloudwatch.inputs.EventPermissionConditionArgs;
    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 organizationAccess = new EventPermission("organizationAccess", EventPermissionArgs.builder()
                .principal("*")
                .statementId("OrganizationAccess")
                .condition(EventPermissionConditionArgs.builder()
                    .key("aws:PrincipalOrgID")
                    .type("StringEquals")
                    .value(example.id())
                    .build())
                .build());
    
        }
    }
    
    resources:
      organizationAccess:
        type: aws:cloudwatch:EventPermission
        name: OrganizationAccess
        properties:
          principal: '*'
          statementId: OrganizationAccess
          condition:
            key: aws:PrincipalOrgID
            type: StringEquals
            value: ${example.id}
    

    Create EventPermission Resource

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

    Constructor syntax

    new EventPermission(name: string, args: EventPermissionArgs, opts?: CustomResourceOptions);
    @overload
    def EventPermission(resource_name: str,
                        args: EventPermissionArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def EventPermission(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        principal: Optional[str] = None,
                        statement_id: Optional[str] = None,
                        action: Optional[str] = None,
                        condition: Optional[EventPermissionConditionArgs] = None,
                        event_bus_name: Optional[str] = None)
    func NewEventPermission(ctx *Context, name string, args EventPermissionArgs, opts ...ResourceOption) (*EventPermission, error)
    public EventPermission(string name, EventPermissionArgs args, CustomResourceOptions? opts = null)
    public EventPermission(String name, EventPermissionArgs args)
    public EventPermission(String name, EventPermissionArgs args, CustomResourceOptions options)
    
    type: aws:cloudwatch:EventPermission
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args EventPermissionArgs
    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 EventPermissionArgs
    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 EventPermissionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EventPermissionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EventPermissionArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var eventPermissionResource = new Aws.CloudWatch.EventPermission("eventPermissionResource", new()
    {
        Principal = "string",
        StatementId = "string",
        Action = "string",
        Condition = new Aws.CloudWatch.Inputs.EventPermissionConditionArgs
        {
            Key = "string",
            Type = "string",
            Value = "string",
        },
        EventBusName = "string",
    });
    
    example, err := cloudwatch.NewEventPermission(ctx, "eventPermissionResource", &cloudwatch.EventPermissionArgs{
    	Principal:   pulumi.String("string"),
    	StatementId: pulumi.String("string"),
    	Action:      pulumi.String("string"),
    	Condition: &cloudwatch.EventPermissionConditionArgs{
    		Key:   pulumi.String("string"),
    		Type:  pulumi.String("string"),
    		Value: pulumi.String("string"),
    	},
    	EventBusName: pulumi.String("string"),
    })
    
    var eventPermissionResource = new EventPermission("eventPermissionResource", EventPermissionArgs.builder()
        .principal("string")
        .statementId("string")
        .action("string")
        .condition(EventPermissionConditionArgs.builder()
            .key("string")
            .type("string")
            .value("string")
            .build())
        .eventBusName("string")
        .build());
    
    event_permission_resource = aws.cloudwatch.EventPermission("eventPermissionResource",
        principal="string",
        statement_id="string",
        action="string",
        condition={
            "key": "string",
            "type": "string",
            "value": "string",
        },
        event_bus_name="string")
    
    const eventPermissionResource = new aws.cloudwatch.EventPermission("eventPermissionResource", {
        principal: "string",
        statementId: "string",
        action: "string",
        condition: {
            key: "string",
            type: "string",
            value: "string",
        },
        eventBusName: "string",
    });
    
    type: aws:cloudwatch:EventPermission
    properties:
        action: string
        condition:
            key: string
            type: string
            value: string
        eventBusName: string
        principal: string
        statementId: string
    

    EventPermission 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 EventPermission resource accepts the following input properties:

    Principal string
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    StatementId string
    An identifier string for the external account that you are granting permissions to.
    Action string
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    Condition EventPermissionCondition
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    EventBusName string
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    Principal string
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    StatementId string
    An identifier string for the external account that you are granting permissions to.
    Action string
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    Condition EventPermissionConditionArgs
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    EventBusName string
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    principal String
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    statementId String
    An identifier string for the external account that you are granting permissions to.
    action String
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    condition EventPermissionCondition
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    eventBusName String
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    principal string
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    statementId string
    An identifier string for the external account that you are granting permissions to.
    action string
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    condition EventPermissionCondition
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    eventBusName string
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    principal str
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    statement_id str
    An identifier string for the external account that you are granting permissions to.
    action str
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    condition EventPermissionConditionArgs
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    event_bus_name str
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    principal String
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    statementId String
    An identifier string for the external account that you are granting permissions to.
    action String
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    condition Property Map
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    eventBusName String
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.

    Outputs

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

    Get an existing EventPermission 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?: EventPermissionState, opts?: CustomResourceOptions): EventPermission
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            action: Optional[str] = None,
            condition: Optional[EventPermissionConditionArgs] = None,
            event_bus_name: Optional[str] = None,
            principal: Optional[str] = None,
            statement_id: Optional[str] = None) -> EventPermission
    func GetEventPermission(ctx *Context, name string, id IDInput, state *EventPermissionState, opts ...ResourceOption) (*EventPermission, error)
    public static EventPermission Get(string name, Input<string> id, EventPermissionState? state, CustomResourceOptions? opts = null)
    public static EventPermission get(String name, Output<String> id, EventPermissionState 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.
    The following state arguments are supported:
    Action string
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    Condition EventPermissionCondition
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    EventBusName string
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    Principal string
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    StatementId string
    An identifier string for the external account that you are granting permissions to.
    Action string
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    Condition EventPermissionConditionArgs
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    EventBusName string
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    Principal string
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    StatementId string
    An identifier string for the external account that you are granting permissions to.
    action String
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    condition EventPermissionCondition
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    eventBusName String
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    principal String
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    statementId String
    An identifier string for the external account that you are granting permissions to.
    action string
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    condition EventPermissionCondition
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    eventBusName string
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    principal string
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    statementId string
    An identifier string for the external account that you are granting permissions to.
    action str
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    condition EventPermissionConditionArgs
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    event_bus_name str
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    principal str
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    statement_id str
    An identifier string for the external account that you are granting permissions to.
    action String
    The action that you are enabling the other account to perform. Defaults to events:PutEvents.
    condition Property Map
    Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.
    eventBusName String
    The name of the event bus to set the permissions on. If you omit this, the permissions are set on the default event bus.
    principal String
    The 12-digit AWS account ID that you are permitting to put events to your default event bus. Specify * to permit any account to put events to your default event bus, optionally limited by condition.
    statementId String
    An identifier string for the external account that you are granting permissions to.

    Supporting Types

    EventPermissionCondition, EventPermissionConditionArgs

    Key string
    Key for the condition. Valid values: aws:PrincipalOrgID.
    Type string
    Type of condition. Value values: StringEquals.
    Value string
    Value for the key.
    Key string
    Key for the condition. Valid values: aws:PrincipalOrgID.
    Type string
    Type of condition. Value values: StringEquals.
    Value string
    Value for the key.
    key String
    Key for the condition. Valid values: aws:PrincipalOrgID.
    type String
    Type of condition. Value values: StringEquals.
    value String
    Value for the key.
    key string
    Key for the condition. Valid values: aws:PrincipalOrgID.
    type string
    Type of condition. Value values: StringEquals.
    value string
    Value for the key.
    key str
    Key for the condition. Valid values: aws:PrincipalOrgID.
    type str
    Type of condition. Value values: StringEquals.
    value str
    Value for the key.
    key String
    Key for the condition. Valid values: aws:PrincipalOrgID.
    type String
    Type of condition. Value values: StringEquals.
    value String
    Value for the key.

    Import

    Using pulumi import, import EventBridge permissions using the event_bus_name/statement_id (if you omit event_bus_name, the default event bus will be used). For example:

    $ pulumi import aws:cloudwatch/eventPermission:EventPermission DevAccountAccess example-event-bus/DevAccountAccess
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi