aws logo
AWS Classic v5.33.0, Mar 24 23

aws.cloudwatch.EventPermission

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

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var devAccountAccess = new Aws.CloudWatch.EventPermission("devAccountAccess", new()
    {
        Principal = "123456789012",
        StatementId = "DevAccountAccess",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/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
	})
}
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());

    }
}
import pulumi
import pulumi_aws as aws

dev_account_access = aws.cloudwatch.EventPermission("devAccountAccess",
    principal="123456789012",
    statement_id="DevAccountAccess")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const devAccountAccess = new aws.cloudwatch.EventPermission("devAccountAccess", {
    principal: "123456789012",
    statementId: "DevAccountAccess",
});
resources:
  devAccountAccess:
    type: aws:cloudwatch:EventPermission
    properties:
      principal: '123456789012'
      statementId: DevAccountAccess

Organization Access

using System.Collections.Generic;
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 = aws_organizations_organization.Example.Id,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/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(aws_organizations_organization.Example.Id),
			},
		})
		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.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(aws_organizations_organization.example().id())
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

organization_access = aws.cloudwatch.EventPermission("organizationAccess",
    principal="*",
    statement_id="OrganizationAccess",
    condition=aws.cloudwatch.EventPermissionConditionArgs(
        key="aws:PrincipalOrgID",
        type="StringEquals",
        value=aws_organizations_organization["example"]["id"],
    ))
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: aws_organizations_organization.example.id,
    },
});
resources:
  organizationAccess:
    type: aws:cloudwatch:EventPermission
    properties:
      principal: '*'
      statementId: OrganizationAccess
      condition:
        key: aws:PrincipalOrgID
        type: StringEquals
        value: ${aws_organizations_organization.example.id}

Create EventPermission Resource

new EventPermission(name: string, args: EventPermissionArgs, opts?: CustomResourceOptions);
@overload
def EventPermission(resource_name: 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)
@overload
def EventPermission(resource_name: str,
                    args: EventPermissionArgs,
                    opts: Optional[ResourceOptions] = 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.

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.

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 EventPermissionConditionArgs

Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.

EventBusName string

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 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 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 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 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 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 EventPermissionConditionArgs

Configuration block to limit the event bus permissions you are granting to only accounts that fulfill the condition. Specified below.

EventBusName string

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 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 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 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 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 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

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

EventBridge permissions can be imported using the event_bus_name/statement_id (if you omit event_bus_name, the default event bus will be used), e.g.,

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

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.