DeliveryChannel

Provides an AWS Config Delivery Channel.

Note: Delivery Channel requires a Configuration Recorder to be present. Use of depends_on (as shown below) is recommended to avoid race conditions.

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var bucketV2 = new Aws.S3.BucketV2("bucketV2", new()
    {
        ForceDestroy = true,
    });

    var role = new Aws.Iam.Role("role", new()
    {
        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()
    {
        RoleArn = role.Arn,
    });

    var fooDeliveryChannel = new Aws.Cfg.DeliveryChannel("fooDeliveryChannel", new()
    {
        S3BucketName = bucketV2.Bucket,
    }, new CustomResourceOptions
    {
        DependsOn = new[]
        {
            fooRecorder,
        },
    });

    var rolePolicy = new Aws.Iam.RolePolicy("rolePolicy", new()
    {
        Role = role.Id,
        Policy = Output.Tuple(bucketV2.Arn, bucketV2.Arn).Apply(values =>
        {
            var bucketV2Arn = values.Item1;
            var bucketV2Arn1 = values.Item2;
            return @$"{{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {{
      ""Action"": [
        ""s3:*""
      ],
      ""Effect"": ""Allow"",
      ""Resource"": [
        ""{bucketV2Arn}"",
        ""{bucketV2Arn1}/*""
      ]
    }}
  ]
}}
";
        }),
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/cfg"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		bucketV2, err := s3.NewBucketV2(ctx, "bucketV2", &s3.BucketV2Args{
			ForceDestroy: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		role, err := iam.NewRole(ctx, "role", &iam.RoleArgs{
			AssumeRolePolicy: pulumi.Any(fmt.Sprintf(`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "config.amazonaws.com"
      },
      "Effect": "Allow",
      "Sid": ""
    }
  ]
}
`)),
		})
		if err != nil {
			return err
		}
		fooRecorder, err := cfg.NewRecorder(ctx, "fooRecorder", &cfg.RecorderArgs{
			RoleArn: role.Arn,
		})
		if err != nil {
			return err
		}
		_, err = cfg.NewDeliveryChannel(ctx, "fooDeliveryChannel", &cfg.DeliveryChannelArgs{
			S3BucketName: bucketV2.Bucket,
		}, pulumi.DependsOn([]pulumi.Resource{
			fooRecorder,
		}))
		if err != nil {
			return err
		}
		_, err = iam.NewRolePolicy(ctx, "rolePolicy", &iam.RolePolicyArgs{
			Role: role.ID(),
			Policy: pulumi.All(bucketV2.Arn, bucketV2.Arn).ApplyT(func(_args []interface{}) (string, error) {
				bucketV2Arn := _args[0].(string)
				bucketV2Arn1 := _args[1].(string)
				return fmt.Sprintf(`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "s3:*"
      ],
      "Effect": "Allow",
      "Resource": [
        "%v",
        "%v/*"
      ]
    }
  ]
}
`, bucketV2Arn, bucketV2Arn1), nil
			}).(pulumi.StringOutput),
		})
		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.s3.BucketV2;
import com.pulumi.aws.s3.BucketV2Args;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.cfg.Recorder;
import com.pulumi.aws.cfg.RecorderArgs;
import com.pulumi.aws.cfg.DeliveryChannel;
import com.pulumi.aws.cfg.DeliveryChannelArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import com.pulumi.resources.CustomResourceOptions;
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 bucketV2 = new BucketV2("bucketV2", BucketV2Args.builder()        
            .forceDestroy(true)
            .build());

        var role = new Role("role", RoleArgs.builder()        
            .assumeRolePolicy("""
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "config.amazonaws.com"
      },
      "Effect": "Allow",
      "Sid": ""
    }
  ]
}
            """)
            .build());

        var fooRecorder = new Recorder("fooRecorder", RecorderArgs.builder()        
            .roleArn(role.arn())
            .build());

        var fooDeliveryChannel = new DeliveryChannel("fooDeliveryChannel", DeliveryChannelArgs.builder()        
            .s3BucketName(bucketV2.bucket())
            .build(), CustomResourceOptions.builder()
                .dependsOn(fooRecorder)
                .build());

        var rolePolicy = new RolePolicy("rolePolicy", RolePolicyArgs.builder()        
            .role(role.id())
            .policy(Output.tuple(bucketV2.arn(), bucketV2.arn()).applyValue(values -> {
                var bucketV2Arn = values.t1;
                var bucketV2Arn1 = values.t2;
                return """
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "s3:*"
      ],
      "Effect": "Allow",
      "Resource": [
        "%s",
        "%s/*"
      ]
    }
  ]
}
", bucketV2Arn,bucketV2Arn1);
            }))
            .build());

    }
}
import pulumi
import pulumi_aws as aws

bucket_v2 = aws.s3.BucketV2("bucketV2", force_destroy=True)
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)
foo_delivery_channel = aws.cfg.DeliveryChannel("fooDeliveryChannel", s3_bucket_name=bucket_v2.bucket,
opts=pulumi.ResourceOptions(depends_on=[foo_recorder]))
role_policy = aws.iam.RolePolicy("rolePolicy",
    role=role.id,
    policy=pulumi.Output.all(bucket_v2.arn, bucket_v2.arn).apply(lambda bucketV2Arn, bucketV2Arn1: f"""{{
  "Version": "2012-10-17",
  "Statement": [
    {{
      "Action": [
        "s3:*"
      ],
      "Effect": "Allow",
      "Resource": [
        "{bucket_v2_arn}",
        "{bucket_v2_arn1}/*"
      ]
    }}
  ]
}}
"""))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const bucketV2 = new aws.s3.BucketV2("bucketV2", {forceDestroy: true});
const role = new aws.iam.Role("role", {assumeRolePolicy: `{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "config.amazonaws.com"
      },
      "Effect": "Allow",
      "Sid": ""
    }
  ]
}
`});
const fooRecorder = new aws.cfg.Recorder("fooRecorder", {roleArn: role.arn});
const fooDeliveryChannel = new aws.cfg.DeliveryChannel("fooDeliveryChannel", {s3BucketName: bucketV2.bucket}, {
    dependsOn: [fooRecorder],
});
const rolePolicy = new aws.iam.RolePolicy("rolePolicy", {
    role: role.id,
    policy: pulumi.interpolate`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "s3:*"
      ],
      "Effect": "Allow",
      "Resource": [
        "${bucketV2.arn}",
        "${bucketV2.arn}/*"
      ]
    }
  ]
}
`,
});
resources:
  fooDeliveryChannel:
    type: aws:cfg:DeliveryChannel
    properties:
      s3BucketName: ${bucketV2.bucket}
    options:
      dependson:
        - ${fooRecorder}
  bucketV2:
    type: aws:s3:BucketV2
    properties:
      forceDestroy: true
  fooRecorder:
    type: aws:cfg:Recorder
    properties:
      roleArn: ${role.arn}
  role:
    type: aws:iam:Role
    properties:
      assumeRolePolicy: |
        {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Principal": {
                "Service": "config.amazonaws.com"
              },
              "Effect": "Allow",
              "Sid": ""
            }
          ]
        }        
  rolePolicy:
    type: aws:iam:RolePolicy
    properties:
      role: ${role.id}
      policy: |
        {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Action": [
                "s3:*"
              ],
              "Effect": "Allow",
              "Resource": [
                "${bucketV2.arn}",
                "${bucketV2.arn}/*"
              ]
            }
          ]
        }        

Create DeliveryChannel Resource

new DeliveryChannel(name: string, args: DeliveryChannelArgs, opts?: CustomResourceOptions);
@overload
def DeliveryChannel(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    name: Optional[str] = None,
                    s3_bucket_name: Optional[str] = None,
                    s3_key_prefix: Optional[str] = None,
                    s3_kms_key_arn: Optional[str] = None,
                    snapshot_delivery_properties: Optional[DeliveryChannelSnapshotDeliveryPropertiesArgs] = None,
                    sns_topic_arn: Optional[str] = None)
@overload
def DeliveryChannel(resource_name: str,
                    args: DeliveryChannelArgs,
                    opts: Optional[ResourceOptions] = None)
func NewDeliveryChannel(ctx *Context, name string, args DeliveryChannelArgs, opts ...ResourceOption) (*DeliveryChannel, error)
public DeliveryChannel(string name, DeliveryChannelArgs args, CustomResourceOptions? opts = null)
public DeliveryChannel(String name, DeliveryChannelArgs args)
public DeliveryChannel(String name, DeliveryChannelArgs args, CustomResourceOptions options)
type: aws:cfg:DeliveryChannel
properties: # The arguments to resource properties.
options: # 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.
resource_name str
The unique name of the resource.
args DeliveryChannelArgs
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 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.
name String
The unique name of the resource.
args DeliveryChannelArgs
The arguments to resource properties.
options 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 Architecture and Concepts docs.

Inputs

The DeliveryChannel resource accepts the following input properties:

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

S3KeyPrefix string

The prefix for the specified S3 bucket.

S3KmsKeyArn string

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

SnapshotDeliveryProperties DeliveryChannelSnapshotDeliveryPropertiesArgs

Options for how AWS Config delivers configuration snapshots. See below

SnsTopicArn string

The ARN of the SNS topic that AWS Config delivers notifications to.

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

S3KeyPrefix string

The prefix for the specified S3 bucket.

S3KmsKeyArn string

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

SnapshotDeliveryProperties DeliveryChannelSnapshotDeliveryPropertiesArgs

Options for how AWS Config delivers configuration snapshots. See below

SnsTopicArn string

The ARN of the SNS topic that AWS Config delivers notifications to.

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

s3KeyPrefix String

The prefix for the specified S3 bucket.

s3KmsKeyArn String

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

snapshotDeliveryProperties DeliveryChannelSnapshotDeliveryPropertiesArgs

Options for how AWS Config delivers configuration snapshots. See below

snsTopicArn String

The ARN of the SNS topic that AWS Config delivers notifications to.

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

s3KeyPrefix string

The prefix for the specified S3 bucket.

s3KmsKeyArn string

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

snapshotDeliveryProperties DeliveryChannelSnapshotDeliveryPropertiesArgs

Options for how AWS Config delivers configuration snapshots. See below

snsTopicArn string

The ARN of the SNS topic that AWS Config delivers notifications to.

s3_bucket_name str

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

The prefix for the specified S3 bucket.

s3_kms_key_arn str

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

snapshot_delivery_properties DeliveryChannelSnapshotDeliveryPropertiesArgs

Options for how AWS Config delivers configuration snapshots. See below

sns_topic_arn str

The ARN of the SNS topic that AWS Config delivers notifications to.

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

s3KeyPrefix String

The prefix for the specified S3 bucket.

s3KmsKeyArn String

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

snapshotDeliveryProperties Property Map

Options for how AWS Config delivers configuration snapshots. See below

snsTopicArn String

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:

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 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): DeliveryChannel
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        name: Optional[str] = None,
        s3_bucket_name: Optional[str] = None,
        s3_key_prefix: Optional[str] = None,
        s3_kms_key_arn: Optional[str] = None,
        snapshot_delivery_properties: Optional[DeliveryChannelSnapshotDeliveryPropertiesArgs] = None,
        sns_topic_arn: Optional[str] = None) -> DeliveryChannel
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)
public static DeliveryChannel get(String name, Output<String> id, DeliveryChannelState 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:
Name string

The name of the delivery channel. Defaults to default. Changing it recreates the resource.

S3BucketName string

The name of the S3 bucket used to store the configuration history.

S3KeyPrefix string

The prefix for the specified S3 bucket.

S3KmsKeyArn string

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

SnapshotDeliveryProperties DeliveryChannelSnapshotDeliveryPropertiesArgs

Options for how AWS Config delivers configuration snapshots. See below

SnsTopicArn string

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.

S3BucketName string

The name of the S3 bucket used to store the configuration history.

S3KeyPrefix string

The prefix for the specified S3 bucket.

S3KmsKeyArn string

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

SnapshotDeliveryProperties DeliveryChannelSnapshotDeliveryPropertiesArgs

Options for how AWS Config delivers configuration snapshots. See below

SnsTopicArn string

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.

s3BucketName String

The name of the S3 bucket used to store the configuration history.

s3KeyPrefix String

The prefix for the specified S3 bucket.

s3KmsKeyArn String

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

snapshotDeliveryProperties DeliveryChannelSnapshotDeliveryPropertiesArgs

Options for how AWS Config delivers configuration snapshots. See below

snsTopicArn String

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.

s3BucketName string

The name of the S3 bucket used to store the configuration history.

s3KeyPrefix string

The prefix for the specified S3 bucket.

s3KmsKeyArn string

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

snapshotDeliveryProperties DeliveryChannelSnapshotDeliveryPropertiesArgs

Options for how AWS Config delivers configuration snapshots. See below

snsTopicArn string

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

The name of the S3 bucket used to store the configuration history.

s3_key_prefix str

The prefix for the specified S3 bucket.

s3_kms_key_arn str

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

snapshot_delivery_properties DeliveryChannelSnapshotDeliveryPropertiesArgs

Options for how AWS Config delivers configuration snapshots. See below

sns_topic_arn str

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.

s3BucketName String

The name of the S3 bucket used to store the configuration history.

s3KeyPrefix String

The prefix for the specified S3 bucket.

s3KmsKeyArn String

The ARN of the AWS KMS key used to encrypt objects delivered by AWS Config. Must belong to the same Region as the destination S3 bucket.

snapshotDeliveryProperties Property Map

Options for how AWS Config delivers configuration snapshots. See below

snsTopicArn String

The ARN of the SNS topic that AWS Config delivers notifications to.

Supporting Types

DeliveryChannelSnapshotDeliveryProperties

DeliveryFrequency string
  • The frequency with which AWS Config recurringly delivers configuration snapshotsE.g., One_Hour or Three_Hours. Valid values are listed here.
DeliveryFrequency string
  • The frequency with which AWS Config recurringly delivers configuration snapshotsE.g., One_Hour or Three_Hours. Valid values are listed here.
deliveryFrequency String
  • The frequency with which AWS Config recurringly delivers configuration snapshotsE.g., One_Hour or Three_Hours. Valid values are listed here.
deliveryFrequency string
  • The frequency with which AWS Config recurringly delivers configuration snapshotsE.g., One_Hour or Three_Hours. Valid values are listed here.
delivery_frequency str
  • The frequency with which AWS Config recurringly delivers configuration snapshotsE.g., One_Hour or Three_Hours. Valid values are listed here.
deliveryFrequency String
  • The frequency with which AWS Config recurringly delivers configuration snapshotsE.g., One_Hour or Three_Hours. Valid values are listed here.

Import

Delivery Channel can be imported using the name, e.g.,

 $ pulumi import aws:cfg/deliveryChannel:DeliveryChannel foo example

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.