1. Packages
  2. AWS
  3. API Docs
  4. ssm
  5. ResourceDataSync
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

aws.ssm.ResourceDataSync

Explore with Pulumi AI

aws logo
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

    Provides a SSM resource data sync.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const hogeBucketV2 = new aws.s3.BucketV2("hoge", {bucket: "tf-test-bucket-1234"});
    const hoge = aws.iam.getPolicyDocument({
        statements: [
            {
                sid: "SSMBucketPermissionsCheck",
                effect: "Allow",
                principals: [{
                    type: "Service",
                    identifiers: ["ssm.amazonaws.com"],
                }],
                actions: ["s3:GetBucketAcl"],
                resources: ["arn:aws:s3:::tf-test-bucket-1234"],
            },
            {
                sid: "SSMBucketDelivery",
                effect: "Allow",
                principals: [{
                    type: "Service",
                    identifiers: ["ssm.amazonaws.com"],
                }],
                actions: ["s3:PutObject"],
                resources: ["arn:aws:s3:::tf-test-bucket-1234/*"],
                conditions: [{
                    test: "StringEquals",
                    variable: "s3:x-amz-acl",
                    values: ["bucket-owner-full-control"],
                }],
            },
        ],
    });
    const hogeBucketPolicy = new aws.s3.BucketPolicy("hoge", {
        bucket: hogeBucketV2.id,
        policy: hoge.then(hoge => hoge.json),
    });
    const foo = new aws.ssm.ResourceDataSync("foo", {
        name: "foo",
        s3Destination: {
            bucketName: hogeBucketV2.bucket,
            region: hogeBucketV2.region,
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    hoge_bucket_v2 = aws.s3.BucketV2("hoge", bucket="tf-test-bucket-1234")
    hoge = aws.iam.get_policy_document(statements=[
        {
            "sid": "SSMBucketPermissionsCheck",
            "effect": "Allow",
            "principals": [{
                "type": "Service",
                "identifiers": ["ssm.amazonaws.com"],
            }],
            "actions": ["s3:GetBucketAcl"],
            "resources": ["arn:aws:s3:::tf-test-bucket-1234"],
        },
        {
            "sid": "SSMBucketDelivery",
            "effect": "Allow",
            "principals": [{
                "type": "Service",
                "identifiers": ["ssm.amazonaws.com"],
            }],
            "actions": ["s3:PutObject"],
            "resources": ["arn:aws:s3:::tf-test-bucket-1234/*"],
            "conditions": [{
                "test": "StringEquals",
                "variable": "s3:x-amz-acl",
                "values": ["bucket-owner-full-control"],
            }],
        },
    ])
    hoge_bucket_policy = aws.s3.BucketPolicy("hoge",
        bucket=hoge_bucket_v2.id,
        policy=hoge.json)
    foo = aws.ssm.ResourceDataSync("foo",
        name="foo",
        s3_destination={
            "bucket_name": hoge_bucket_v2.bucket,
            "region": hoge_bucket_v2.region,
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		hogeBucketV2, err := s3.NewBucketV2(ctx, "hoge", &s3.BucketV2Args{
    			Bucket: pulumi.String("tf-test-bucket-1234"),
    		})
    		if err != nil {
    			return err
    		}
    		hoge, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
    			Statements: []iam.GetPolicyDocumentStatement{
    				{
    					Sid:    pulumi.StringRef("SSMBucketPermissionsCheck"),
    					Effect: pulumi.StringRef("Allow"),
    					Principals: []iam.GetPolicyDocumentStatementPrincipal{
    						{
    							Type: "Service",
    							Identifiers: []string{
    								"ssm.amazonaws.com",
    							},
    						},
    					},
    					Actions: []string{
    						"s3:GetBucketAcl",
    					},
    					Resources: []string{
    						"arn:aws:s3:::tf-test-bucket-1234",
    					},
    				},
    				{
    					Sid:    pulumi.StringRef("SSMBucketDelivery"),
    					Effect: pulumi.StringRef("Allow"),
    					Principals: []iam.GetPolicyDocumentStatementPrincipal{
    						{
    							Type: "Service",
    							Identifiers: []string{
    								"ssm.amazonaws.com",
    							},
    						},
    					},
    					Actions: []string{
    						"s3:PutObject",
    					},
    					Resources: []string{
    						"arn:aws:s3:::tf-test-bucket-1234/*",
    					},
    					Conditions: []iam.GetPolicyDocumentStatementCondition{
    						{
    							Test:     "StringEquals",
    							Variable: "s3:x-amz-acl",
    							Values: []string{
    								"bucket-owner-full-control",
    							},
    						},
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = s3.NewBucketPolicy(ctx, "hoge", &s3.BucketPolicyArgs{
    			Bucket: hogeBucketV2.ID(),
    			Policy: pulumi.String(hoge.Json),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ssm.NewResourceDataSync(ctx, "foo", &ssm.ResourceDataSyncArgs{
    			Name: pulumi.String("foo"),
    			S3Destination: &ssm.ResourceDataSyncS3DestinationArgs{
    				BucketName: hogeBucketV2.Bucket,
    				Region:     hogeBucketV2.Region,
    			},
    		})
    		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 hogeBucketV2 = new Aws.S3.BucketV2("hoge", new()
        {
            Bucket = "tf-test-bucket-1234",
        });
    
        var hoge = Aws.Iam.GetPolicyDocument.Invoke(new()
        {
            Statements = new[]
            {
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Sid = "SSMBucketPermissionsCheck",
                    Effect = "Allow",
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "Service",
                            Identifiers = new[]
                            {
                                "ssm.amazonaws.com",
                            },
                        },
                    },
                    Actions = new[]
                    {
                        "s3:GetBucketAcl",
                    },
                    Resources = new[]
                    {
                        "arn:aws:s3:::tf-test-bucket-1234",
                    },
                },
                new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
                {
                    Sid = "SSMBucketDelivery",
                    Effect = "Allow",
                    Principals = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                        {
                            Type = "Service",
                            Identifiers = new[]
                            {
                                "ssm.amazonaws.com",
                            },
                        },
                    },
                    Actions = new[]
                    {
                        "s3:PutObject",
                    },
                    Resources = new[]
                    {
                        "arn:aws:s3:::tf-test-bucket-1234/*",
                    },
                    Conditions = new[]
                    {
                        new Aws.Iam.Inputs.GetPolicyDocumentStatementConditionInputArgs
                        {
                            Test = "StringEquals",
                            Variable = "s3:x-amz-acl",
                            Values = new[]
                            {
                                "bucket-owner-full-control",
                            },
                        },
                    },
                },
            },
        });
    
        var hogeBucketPolicy = new Aws.S3.BucketPolicy("hoge", new()
        {
            Bucket = hogeBucketV2.Id,
            Policy = hoge.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
        });
    
        var foo = new Aws.Ssm.ResourceDataSync("foo", new()
        {
            Name = "foo",
            S3Destination = new Aws.Ssm.Inputs.ResourceDataSyncS3DestinationArgs
            {
                BucketName = hogeBucketV2.Bucket,
                Region = hogeBucketV2.Region,
            },
        });
    
    });
    
    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.IamFunctions;
    import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
    import com.pulumi.aws.s3.BucketPolicy;
    import com.pulumi.aws.s3.BucketPolicyArgs;
    import com.pulumi.aws.ssm.ResourceDataSync;
    import com.pulumi.aws.ssm.ResourceDataSyncArgs;
    import com.pulumi.aws.ssm.inputs.ResourceDataSyncS3DestinationArgs;
    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 hogeBucketV2 = new BucketV2("hogeBucketV2", BucketV2Args.builder()
                .bucket("tf-test-bucket-1234")
                .build());
    
            final var hoge = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                .statements(            
                    GetPolicyDocumentStatementArgs.builder()
                        .sid("SSMBucketPermissionsCheck")
                        .effect("Allow")
                        .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                            .type("Service")
                            .identifiers("ssm.amazonaws.com")
                            .build())
                        .actions("s3:GetBucketAcl")
                        .resources("arn:aws:s3:::tf-test-bucket-1234")
                        .build(),
                    GetPolicyDocumentStatementArgs.builder()
                        .sid("SSMBucketDelivery")
                        .effect("Allow")
                        .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                            .type("Service")
                            .identifiers("ssm.amazonaws.com")
                            .build())
                        .actions("s3:PutObject")
                        .resources("arn:aws:s3:::tf-test-bucket-1234/*")
                        .conditions(GetPolicyDocumentStatementConditionArgs.builder()
                            .test("StringEquals")
                            .variable("s3:x-amz-acl")
                            .values("bucket-owner-full-control")
                            .build())
                        .build())
                .build());
    
            var hogeBucketPolicy = new BucketPolicy("hogeBucketPolicy", BucketPolicyArgs.builder()
                .bucket(hogeBucketV2.id())
                .policy(hoge.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
                .build());
    
            var foo = new ResourceDataSync("foo", ResourceDataSyncArgs.builder()
                .name("foo")
                .s3Destination(ResourceDataSyncS3DestinationArgs.builder()
                    .bucketName(hogeBucketV2.bucket())
                    .region(hogeBucketV2.region())
                    .build())
                .build());
    
        }
    }
    
    resources:
      hogeBucketV2:
        type: aws:s3:BucketV2
        name: hoge
        properties:
          bucket: tf-test-bucket-1234
      hogeBucketPolicy:
        type: aws:s3:BucketPolicy
        name: hoge
        properties:
          bucket: ${hogeBucketV2.id}
          policy: ${hoge.json}
      foo:
        type: aws:ssm:ResourceDataSync
        properties:
          name: foo
          s3Destination:
            bucketName: ${hogeBucketV2.bucket}
            region: ${hogeBucketV2.region}
    variables:
      hoge:
        fn::invoke:
          Function: aws:iam:getPolicyDocument
          Arguments:
            statements:
              - sid: SSMBucketPermissionsCheck
                effect: Allow
                principals:
                  - type: Service
                    identifiers:
                      - ssm.amazonaws.com
                actions:
                  - s3:GetBucketAcl
                resources:
                  - arn:aws:s3:::tf-test-bucket-1234
              - sid: SSMBucketDelivery
                effect: Allow
                principals:
                  - type: Service
                    identifiers:
                      - ssm.amazonaws.com
                actions:
                  - s3:PutObject
                resources:
                  - arn:aws:s3:::tf-test-bucket-1234/*
                conditions:
                  - test: StringEquals
                    variable: s3:x-amz-acl
                    values:
                      - bucket-owner-full-control
    

    Create ResourceDataSync Resource

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

    Constructor syntax

    new ResourceDataSync(name: string, args: ResourceDataSyncArgs, opts?: CustomResourceOptions);
    @overload
    def ResourceDataSync(resource_name: str,
                         args: ResourceDataSyncArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def ResourceDataSync(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         s3_destination: Optional[ResourceDataSyncS3DestinationArgs] = None,
                         name: Optional[str] = None)
    func NewResourceDataSync(ctx *Context, name string, args ResourceDataSyncArgs, opts ...ResourceOption) (*ResourceDataSync, error)
    public ResourceDataSync(string name, ResourceDataSyncArgs args, CustomResourceOptions? opts = null)
    public ResourceDataSync(String name, ResourceDataSyncArgs args)
    public ResourceDataSync(String name, ResourceDataSyncArgs args, CustomResourceOptions options)
    
    type: aws:ssm:ResourceDataSync
    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 ResourceDataSyncArgs
    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 ResourceDataSyncArgs
    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 ResourceDataSyncArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourceDataSyncArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourceDataSyncArgs
    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 resourceDataSyncResource = new Aws.Ssm.ResourceDataSync("resourceDataSyncResource", new()
    {
        S3Destination = new Aws.Ssm.Inputs.ResourceDataSyncS3DestinationArgs
        {
            BucketName = "string",
            Region = "string",
            KmsKeyArn = "string",
            Prefix = "string",
            SyncFormat = "string",
        },
        Name = "string",
    });
    
    example, err := ssm.NewResourceDataSync(ctx, "resourceDataSyncResource", &ssm.ResourceDataSyncArgs{
    	S3Destination: &ssm.ResourceDataSyncS3DestinationArgs{
    		BucketName: pulumi.String("string"),
    		Region:     pulumi.String("string"),
    		KmsKeyArn:  pulumi.String("string"),
    		Prefix:     pulumi.String("string"),
    		SyncFormat: pulumi.String("string"),
    	},
    	Name: pulumi.String("string"),
    })
    
    var resourceDataSyncResource = new ResourceDataSync("resourceDataSyncResource", ResourceDataSyncArgs.builder()
        .s3Destination(ResourceDataSyncS3DestinationArgs.builder()
            .bucketName("string")
            .region("string")
            .kmsKeyArn("string")
            .prefix("string")
            .syncFormat("string")
            .build())
        .name("string")
        .build());
    
    resource_data_sync_resource = aws.ssm.ResourceDataSync("resourceDataSyncResource",
        s3_destination={
            "bucketName": "string",
            "region": "string",
            "kmsKeyArn": "string",
            "prefix": "string",
            "syncFormat": "string",
        },
        name="string")
    
    const resourceDataSyncResource = new aws.ssm.ResourceDataSync("resourceDataSyncResource", {
        s3Destination: {
            bucketName: "string",
            region: "string",
            kmsKeyArn: "string",
            prefix: "string",
            syncFormat: "string",
        },
        name: "string",
    });
    
    type: aws:ssm:ResourceDataSync
    properties:
        name: string
        s3Destination:
            bucketName: string
            kmsKeyArn: string
            prefix: string
            region: string
            syncFormat: string
    

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

    S3Destination ResourceDataSyncS3Destination
    Amazon S3 configuration details for the sync.
    Name string
    Name for the configuration.
    S3Destination ResourceDataSyncS3DestinationArgs
    Amazon S3 configuration details for the sync.
    Name string
    Name for the configuration.
    s3Destination ResourceDataSyncS3Destination
    Amazon S3 configuration details for the sync.
    name String
    Name for the configuration.
    s3Destination ResourceDataSyncS3Destination
    Amazon S3 configuration details for the sync.
    name string
    Name for the configuration.
    s3_destination ResourceDataSyncS3DestinationArgs
    Amazon S3 configuration details for the sync.
    name str
    Name for the configuration.
    s3Destination Property Map
    Amazon S3 configuration details for the sync.
    name String
    Name for the configuration.

    Outputs

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

    Get an existing ResourceDataSync 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?: ResourceDataSyncState, opts?: CustomResourceOptions): ResourceDataSync
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            name: Optional[str] = None,
            s3_destination: Optional[ResourceDataSyncS3DestinationArgs] = None) -> ResourceDataSync
    func GetResourceDataSync(ctx *Context, name string, id IDInput, state *ResourceDataSyncState, opts ...ResourceOption) (*ResourceDataSync, error)
    public static ResourceDataSync Get(string name, Input<string> id, ResourceDataSyncState? state, CustomResourceOptions? opts = null)
    public static ResourceDataSync get(String name, Output<String> id, ResourceDataSyncState 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
    Name for the configuration.
    S3Destination ResourceDataSyncS3Destination
    Amazon S3 configuration details for the sync.
    Name string
    Name for the configuration.
    S3Destination ResourceDataSyncS3DestinationArgs
    Amazon S3 configuration details for the sync.
    name String
    Name for the configuration.
    s3Destination ResourceDataSyncS3Destination
    Amazon S3 configuration details for the sync.
    name string
    Name for the configuration.
    s3Destination ResourceDataSyncS3Destination
    Amazon S3 configuration details for the sync.
    name str
    Name for the configuration.
    s3_destination ResourceDataSyncS3DestinationArgs
    Amazon S3 configuration details for the sync.
    name String
    Name for the configuration.
    s3Destination Property Map
    Amazon S3 configuration details for the sync.

    Supporting Types

    ResourceDataSyncS3Destination, ResourceDataSyncS3DestinationArgs

    BucketName string
    Name of S3 bucket where the aggregated data is stored.
    Region string
    Region with the bucket targeted by the Resource Data Sync.
    KmsKeyArn string
    ARN of an encryption key for a destination in Amazon S3.
    Prefix string
    Prefix for the bucket.
    SyncFormat string
    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.
    BucketName string
    Name of S3 bucket where the aggregated data is stored.
    Region string
    Region with the bucket targeted by the Resource Data Sync.
    KmsKeyArn string
    ARN of an encryption key for a destination in Amazon S3.
    Prefix string
    Prefix for the bucket.
    SyncFormat string
    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.
    bucketName String
    Name of S3 bucket where the aggregated data is stored.
    region String
    Region with the bucket targeted by the Resource Data Sync.
    kmsKeyArn String
    ARN of an encryption key for a destination in Amazon S3.
    prefix String
    Prefix for the bucket.
    syncFormat String
    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.
    bucketName string
    Name of S3 bucket where the aggregated data is stored.
    region string
    Region with the bucket targeted by the Resource Data Sync.
    kmsKeyArn string
    ARN of an encryption key for a destination in Amazon S3.
    prefix string
    Prefix for the bucket.
    syncFormat string
    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.
    bucket_name str
    Name of S3 bucket where the aggregated data is stored.
    region str
    Region with the bucket targeted by the Resource Data Sync.
    kms_key_arn str
    ARN of an encryption key for a destination in Amazon S3.
    prefix str
    Prefix for the bucket.
    sync_format str
    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.
    bucketName String
    Name of S3 bucket where the aggregated data is stored.
    region String
    Region with the bucket targeted by the Resource Data Sync.
    kmsKeyArn String
    ARN of an encryption key for a destination in Amazon S3.
    prefix String
    Prefix for the bucket.
    syncFormat String
    A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe.

    Import

    Using pulumi import, import SSM resource data sync using the name. For example:

    $ pulumi import aws:ssm/resourceDataSync:ResourceDataSync example example-name
    

    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
    AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi