AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.10.0 published on Monday, Jul 11, 2022 by Pulumi

getLogDeliveryCanonicalUserId

The CloudFront Log Delivery Canonical User ID data source allows access to the canonical user ID of the AWS awslogsdelivery account for CloudFront bucket logging. See the Amazon CloudFront Developer Guide for more information.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleLogDeliveryCanonicalUserId = Output.Create(Aws.CloudFront.GetLogDeliveryCanonicalUserId.InvokeAsync());
        var exampleBucketV2 = new Aws.S3.BucketV2("exampleBucketV2", new Aws.S3.BucketV2Args
        {
        });
        var exampleBucketAclV2 = new Aws.S3.BucketAclV2("exampleBucketAclV2", new Aws.S3.BucketAclV2Args
        {
            Bucket = exampleBucketV2.Id,
            AccessControlPolicy = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyArgs
            {
                Grants = 
                {
                    new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantArgs
                    {
                        Grantee = new Aws.S3.Inputs.BucketAclV2AccessControlPolicyGrantGranteeArgs
                        {
                            Id = exampleLogDeliveryCanonicalUserId.Apply(exampleLogDeliveryCanonicalUserId => exampleLogDeliveryCanonicalUserId.Id),
                            Type = "CanonicalUser",
                        },
                        Permission = "FULL_CONTROL",
                    },
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/cloudfront"
	"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 {
		exampleLogDeliveryCanonicalUserId, err := cloudfront.GetLogDeliveryCanonicalUserId(ctx, nil, nil)
		if err != nil {
			return err
		}
		exampleBucketV2, err := s3.NewBucketV2(ctx, "exampleBucketV2", nil)
		if err != nil {
			return err
		}
		_, err = s3.NewBucketAclV2(ctx, "exampleBucketAclV2", &s3.BucketAclV2Args{
			Bucket: exampleBucketV2.ID(),
			AccessControlPolicy: &s3.BucketAclV2AccessControlPolicyArgs{
				Grants: s3.BucketAclV2AccessControlPolicyGrantArray{
					&s3.BucketAclV2AccessControlPolicyGrantArgs{
						Grantee: &s3.BucketAclV2AccessControlPolicyGrantGranteeArgs{
							Id:   pulumi.String(exampleLogDeliveryCanonicalUserId.Id),
							Type: pulumi.String("CanonicalUser"),
						},
						Permission: pulumi.String("FULL_CONTROL"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var exampleLogDeliveryCanonicalUserId = Output.of(CloudfrontFunctions.getLogDeliveryCanonicalUserId());

        var exampleBucketV2 = new BucketV2("exampleBucketV2");

        var exampleBucketAclV2 = new BucketAclV2("exampleBucketAclV2", BucketAclV2Args.builder()        
            .bucket(exampleBucketV2.id())
            .accessControlPolicy(BucketAclV2AccessControlPolicyArgs.builder()
                .grants(BucketAclV2AccessControlPolicyGrantArgs.builder()
                    .grantee(BucketAclV2AccessControlPolicyGrantGranteeArgs.builder()
                        .id(exampleLogDeliveryCanonicalUserId.apply(getLogDeliveryCanonicalUserIdResult -> getLogDeliveryCanonicalUserIdResult.id()))
                        .type("CanonicalUser")
                        .build())
                    .permission("FULL_CONTROL")
                    .build())
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example_log_delivery_canonical_user_id = aws.cloudfront.get_log_delivery_canonical_user_id()
example_bucket_v2 = aws.s3.BucketV2("exampleBucketV2")
example_bucket_acl_v2 = aws.s3.BucketAclV2("exampleBucketAclV2",
    bucket=example_bucket_v2.id,
    access_control_policy=aws.s3.BucketAclV2AccessControlPolicyArgs(
        grants=[aws.s3.BucketAclV2AccessControlPolicyGrantArgs(
            grantee=aws.s3.BucketAclV2AccessControlPolicyGrantGranteeArgs(
                id=example_log_delivery_canonical_user_id.id,
                type="CanonicalUser",
            ),
            permission="FULL_CONTROL",
        )],
    ))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleLogDeliveryCanonicalUserId = aws.cloudfront.getLogDeliveryCanonicalUserId({});
const exampleBucketV2 = new aws.s3.BucketV2("exampleBucketV2", {});
const exampleBucketAclV2 = new aws.s3.BucketAclV2("exampleBucketAclV2", {
    bucket: exampleBucketV2.id,
    accessControlPolicy: {
        grants: [{
            grantee: {
                id: exampleLogDeliveryCanonicalUserId.then(exampleLogDeliveryCanonicalUserId => exampleLogDeliveryCanonicalUserId.id),
                type: "CanonicalUser",
            },
            permission: "FULL_CONTROL",
        }],
    },
});
resources:
  exampleBucketV2:
    type: aws:s3:BucketV2
  exampleBucketAclV2:
    type: aws:s3:BucketAclV2
    properties:
      bucket: ${exampleBucketV2.id}
      accessControlPolicy:
        grants:
          - grantee:
              id: ${exampleLogDeliveryCanonicalUserId.id}
              type: CanonicalUser
            permission: FULL_CONTROL
variables:
  exampleLogDeliveryCanonicalUserId:
    Fn::Invoke:
      Function: aws:cloudfront:getLogDeliveryCanonicalUserId
      Arguments: {}

Using getLogDeliveryCanonicalUserId

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getLogDeliveryCanonicalUserId(args: GetLogDeliveryCanonicalUserIdArgs, opts?: InvokeOptions): Promise<GetLogDeliveryCanonicalUserIdResult>
function getLogDeliveryCanonicalUserIdOutput(args: GetLogDeliveryCanonicalUserIdOutputArgs, opts?: InvokeOptions): Output<GetLogDeliveryCanonicalUserIdResult>
def get_log_delivery_canonical_user_id(region: Optional[str] = None,
                                       opts: Optional[InvokeOptions] = None) -> GetLogDeliveryCanonicalUserIdResult
def get_log_delivery_canonical_user_id_output(region: Optional[pulumi.Input[str]] = None,
                                       opts: Optional[InvokeOptions] = None) -> Output[GetLogDeliveryCanonicalUserIdResult]
func GetLogDeliveryCanonicalUserId(ctx *Context, args *GetLogDeliveryCanonicalUserIdArgs, opts ...InvokeOption) (*GetLogDeliveryCanonicalUserIdResult, error)
func GetLogDeliveryCanonicalUserIdOutput(ctx *Context, args *GetLogDeliveryCanonicalUserIdOutputArgs, opts ...InvokeOption) GetLogDeliveryCanonicalUserIdResultOutput

> Note: This function is named GetLogDeliveryCanonicalUserId in the Go SDK.

public static class GetLogDeliveryCanonicalUserId 
{
    public static Task<GetLogDeliveryCanonicalUserIdResult> InvokeAsync(GetLogDeliveryCanonicalUserIdArgs args, InvokeOptions? opts = null)
    public static Output<GetLogDeliveryCanonicalUserIdResult> Invoke(GetLogDeliveryCanonicalUserIdInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetLogDeliveryCanonicalUserIdResult> getLogDeliveryCanonicalUserId(GetLogDeliveryCanonicalUserIdArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: aws:cloudfront/getLogDeliveryCanonicalUserId:getLogDeliveryCanonicalUserId
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Region string

The region you'd like the zone for. By default, fetches the current region.

Region string

The region you'd like the zone for. By default, fetches the current region.

region String

The region you'd like the zone for. By default, fetches the current region.

region string

The region you'd like the zone for. By default, fetches the current region.

region str

The region you'd like the zone for. By default, fetches the current region.

region String

The region you'd like the zone for. By default, fetches the current region.

getLogDeliveryCanonicalUserId Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Region string
Id string

The provider-assigned unique ID for this managed resource.

Region string
id String

The provider-assigned unique ID for this managed resource.

region String
id string

The provider-assigned unique ID for this managed resource.

region string
id str

The provider-assigned unique ID for this managed resource.

region str
id String

The provider-assigned unique ID for this managed resource.

region String

Package Details

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

This Pulumi package is based on the aws Terraform Provider.