DeliveryChannel
Provides an AWS Config Delivery Channel.
Note: Delivery Channel requires a
Configuration Recorderto be present. Use ofdepends_on(as shown below) is recommended to avoid race conditions.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
{
ForceDestroy = true,
});
var fooDeliveryChannel = new Aws.Cfg.DeliveryChannel("fooDeliveryChannel", new Aws.Cfg.DeliveryChannelArgs
{
S3BucketName = bucket.BucketName,
}, new CustomResourceOptions
{
DependsOn =
{
"aws_config_configuration_recorder.foo",
},
});
var role = new Aws.Iam.Role("role", new Aws.Iam.RoleArgs
{
AssumeRolePolicy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
""Action"": ""sts:AssumeRole"",
""Principal"": {
""Service"": ""config.amazonaws.com""
},
""Effect"": ""Allow"",
""Sid"": """"
}
]
}
",
});
var fooRecorder = new Aws.Cfg.Recorder("fooRecorder", new Aws.Cfg.RecorderArgs
{
RoleArn = role.Arn,
});
var rolePolicy = new Aws.Iam.RolePolicy("rolePolicy", new Aws.Iam.RolePolicyArgs
{
Policy = Output.Tuple(bucket.Arn, bucket.Arn).Apply(values =>
{
var bucketArn = values.Item1;
var bucketArn1 = values.Item2;
return @$"{{
""Version"": ""2012-10-17"",
""Statement"": [
{{
""Action"": [
""s3:*""
],
""Effect"": ""Allow"",
""Resource"": [
""{bucketArn}"",
""{bucketArn1}/*""
]
}}
]
}}
";
}),
Role = role.Id,
});
}
}
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/cfg"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/iam"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
bucket, err := s3.NewBucket(ctx, "bucket", &s3.BucketArgs{
ForceDestroy: pulumi.Bool(true),
})
if err != nil {
return err
}
_, err = cfg.NewDeliveryChannel(ctx, "fooDeliveryChannel", &cfg.DeliveryChannelArgs{
S3BucketName: bucket.Bucket,
}, pulumi.DependsOn([]pulumi.Resource{
"aws_config_configuration_recorder.foo",
}))
if err != nil {
return err
}
role, err := iam.NewRole(ctx, "role", &iam.RoleArgs{
AssumeRolePolicy: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", " \"Version\": \"2012-10-17\",\n", " \"Statement\": [\n", " {\n", " \"Action\": \"sts:AssumeRole\",\n", " \"Principal\": {\n", " \"Service\": \"config.amazonaws.com\"\n", " },\n", " \"Effect\": \"Allow\",\n", " \"Sid\": \"\"\n", " }\n", " ]\n", "}\n", "\n")),
})
if err != nil {
return err
}
_, err = cfg.NewRecorder(ctx, "fooRecorder", &cfg.RecorderArgs{
RoleArn: role.Arn,
})
if err != nil {
return err
}
_, err = iam.NewRolePolicy(ctx, "rolePolicy", &iam.RolePolicyArgs{
Policy: pulumi.All(bucket.Arn, bucket.Arn).ApplyT(func(_args []interface{}) (string, error) {
bucketArn := _args[0].(string)
bucketArn1 := _args[1].(string)
return fmt.Sprintf("%v%v%v%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\": [\n", " \"s3:*\"\n", " ],\n", " \"Effect\": \"Allow\",\n", " \"Resource\": [\n", " \"", bucketArn, "\",\n", " \"", bucketArn1, "/*\"\n", " ]\n", " }\n", " ]\n", "}\n", "\n"), nil
}).(pulumi.StringOutput),
Role: role.ID(),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
bucket = aws.s3.Bucket("bucket", force_destroy=True)
foo_delivery_channel = aws.cfg.DeliveryChannel("fooDeliveryChannel", s3_bucket_name=bucket.bucket,
opts=ResourceOptions(depends_on=["aws_config_configuration_recorder.foo"]))
role = aws.iam.Role("role", assume_role_policy="""{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "config.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
""")
foo_recorder = aws.cfg.Recorder("fooRecorder", role_arn=role.arn)
role_policy = aws.iam.RolePolicy("rolePolicy",
policy=pulumi.Output.all(bucket.arn, bucket.arn).apply(lambda bucketArn, bucketArn1: f"""{{
"Version": "2012-10-17",
"Statement": [
{{
"Action": [
"s3:*"
],
"Effect": "Allow",
"Resource": [
"{bucket_arn}",
"{bucket_arn1}/*"
]
}}
]
}}
"""),
role=role.id)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const bucket = new aws.s3.Bucket("b", {
forceDestroy: true,
});
const role = new aws.iam.Role("r", {
assumeRolePolicy: `{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "config.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
`,
});
const fooRecorder = new aws.cfg.Recorder("foo", {
roleArn: role.arn,
});
const fooDeliveryChannel = new aws.cfg.DeliveryChannel("foo", {
s3BucketName: bucket.bucket,
}, { dependsOn: [fooRecorder] });
const rolePolicy = new aws.iam.RolePolicy("p", {
policy: pulumi.interpolate`{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:*"
],
"Effect": "Allow",
"Resource": [
"${bucket.arn}",
"${bucket.arn}/*"
]
}
]
}
`,
role: role.id,
});Create a DeliveryChannel Resource
new DeliveryChannel(name: string, args: DeliveryChannelArgs, opts?: CustomResourceOptions);def DeliveryChannel(resource_name, opts=None, name=None, s3_bucket_name=None, s3_key_prefix=None, snapshot_delivery_properties=None, sns_topic_arn=None, __props__=None);func NewDeliveryChannel(ctx *Context, name string, args DeliveryChannelArgs, opts ...ResourceOption) (*DeliveryChannel, error)public DeliveryChannel(string name, DeliveryChannelArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args DeliveryChannelArgs
- 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 DeliveryChannelArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DeliveryChannelArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
DeliveryChannel Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The DeliveryChannel resource accepts the following input properties:
- S3Bucket
Name string The name of the S3 bucket used to store the configuration history.
- Name string
The name of the delivery channel. Defaults to
default. Changing it recreates the resource.- S3Key
Prefix string The prefix for the specified S3 bucket.
- Snapshot
Delivery DeliveryProperties Channel Snapshot Delivery Properties Args Options for how AWS Config delivers configuration snapshots. See below
- Sns
Topic stringArn The ARN of the SNS topic that AWS Config delivers notifications to.
- S3Bucket
Name string The name of the S3 bucket used to store the configuration history.
- Name string
The name of the delivery channel. Defaults to
default. Changing it recreates the resource.- S3Key
Prefix string The prefix for the specified S3 bucket.
- Snapshot
Delivery DeliveryProperties Channel Snapshot Delivery Properties Options for how AWS Config delivers configuration snapshots. See below
- Sns
Topic stringArn The ARN of the SNS topic that AWS Config delivers notifications to.
- s3Bucket
Name string The name of the S3 bucket used to store the configuration history.
- name string
The name of the delivery channel. Defaults to
default. Changing it recreates the resource.- s3Key
Prefix string The prefix for the specified S3 bucket.
- snapshot
Delivery DeliveryProperties Channel Snapshot Delivery Properties Options for how AWS Config delivers configuration snapshots. See below
- sns
Topic stringArn The ARN of the SNS topic that AWS Config delivers notifications to.
- s3_
bucket_ strname The name of the S3 bucket used to store the configuration history.
- name str
The name of the delivery channel. Defaults to
default. Changing it recreates the resource.- s3_
key_ strprefix The prefix for the specified S3 bucket.
- snapshot_
delivery_ Dict[Deliveryproperties Channel Snapshot Delivery Properties] Options for how AWS Config delivers configuration snapshots. See below
- sns_
topic_ strarn The ARN of the SNS topic that AWS Config delivers notifications to.
Outputs
All input properties are implicitly available as output properties. Additionally, the DeliveryChannel resource produces the following output properties:
Look up an Existing DeliveryChannel Resource
Get an existing DeliveryChannel 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?: DeliveryChannelState, opts?: CustomResourceOptions): DeliveryChannelstatic get(resource_name, id, opts=None, name=None, s3_bucket_name=None, s3_key_prefix=None, snapshot_delivery_properties=None, sns_topic_arn=None, __props__=None);func GetDeliveryChannel(ctx *Context, name string, id IDInput, state *DeliveryChannelState, opts ...ResourceOption) (*DeliveryChannel, error)public static DeliveryChannel Get(string name, Input<string> id, DeliveryChannelState? 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:
- Name string
The name of the delivery channel. Defaults to
default. Changing it recreates the resource.- S3Bucket
Name string The name of the S3 bucket used to store the configuration history.
- S3Key
Prefix string The prefix for the specified S3 bucket.
- Snapshot
Delivery DeliveryProperties Channel Snapshot Delivery Properties Args Options for how AWS Config delivers configuration snapshots. See below
- Sns
Topic stringArn The ARN of the SNS topic that AWS Config delivers notifications to.
- Name string
The name of the delivery channel. Defaults to
default. Changing it recreates the resource.- S3Bucket
Name string The name of the S3 bucket used to store the configuration history.
- S3Key
Prefix string The prefix for the specified S3 bucket.
- Snapshot
Delivery DeliveryProperties Channel Snapshot Delivery Properties Options for how AWS Config delivers configuration snapshots. See below
- Sns
Topic stringArn The ARN of the SNS topic that AWS Config delivers notifications to.
- name string
The name of the delivery channel. Defaults to
default. Changing it recreates the resource.- s3Bucket
Name string The name of the S3 bucket used to store the configuration history.
- s3Key
Prefix string The prefix for the specified S3 bucket.
- snapshot
Delivery DeliveryProperties Channel Snapshot Delivery Properties Options for how AWS Config delivers configuration snapshots. See below
- sns
Topic stringArn The ARN of the SNS topic that AWS Config delivers notifications to.
- name str
The name of the delivery channel. Defaults to
default. Changing it recreates the resource.- s3_
bucket_ strname The name of the S3 bucket used to store the configuration history.
- s3_
key_ strprefix The prefix for the specified S3 bucket.
- snapshot_
delivery_ Dict[Deliveryproperties Channel Snapshot Delivery Properties] Options for how AWS Config delivers configuration snapshots. See below
- sns_
topic_ strarn The ARN of the SNS topic that AWS Config delivers notifications to.
Supporting Types
DeliveryChannelSnapshotDeliveryProperties
- Delivery
Frequency string - The frequency with which AWS Config recurringly delivers configuration snapshots.
e.g.
One_HourorThree_Hours. Valid values are listed here.
- The frequency with which AWS Config recurringly delivers configuration snapshots.
e.g.
- Delivery
Frequency string - The frequency with which AWS Config recurringly delivers configuration snapshots.
e.g.
One_HourorThree_Hours. Valid values are listed here.
- The frequency with which AWS Config recurringly delivers configuration snapshots.
e.g.
- delivery
Frequency string - The frequency with which AWS Config recurringly delivers configuration snapshots.
e.g.
One_HourorThree_Hours. Valid values are listed here.
- The frequency with which AWS Config recurringly delivers configuration snapshots.
e.g.
- delivery
Frequency str - The frequency with which AWS Config recurringly delivers configuration snapshots.
e.g.
One_HourorThree_Hours. Valid values are listed here.
- The frequency with which AWS Config recurringly delivers configuration snapshots.
e.g.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.