UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

134 lines (133 loc) 5.35 kB
import * as pulumi from "@pulumi/pulumi"; /** * Use this data source to get the Account ID of the [AWS Elastic Load Balancing Service Account](http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html#attach-bucket-policy) * in a given region for the purpose of permitting in S3 bucket policy. * * > **Note:** For AWS Regions opened since Jakarta (`ap-southeast-3`) in December 2021, AWS [documents that](https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html#attach-bucket-policy) a [service principal name](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#principal-services) should be used instead of an AWS account ID in any relevant IAM policy. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const main = aws.elb.getServiceAccount({}); * const elbLogs = new aws.s3.Bucket("elb_logs", {bucket: "my-elb-tf-test-bucket"}); * const elbLogsAcl = new aws.s3.BucketAcl("elb_logs_acl", { * bucket: elbLogs.id, * acl: "private", * }); * const allowElbLogging = pulumi.all([main, elbLogs.arn]).apply(([main, arn]) => aws.iam.getPolicyDocumentOutput({ * statements: [{ * effect: "Allow", * principals: [{ * type: "AWS", * identifiers: [main.arn], * }], * actions: ["s3:PutObject"], * resources: [`${arn}/AWSLogs/*`], * }], * })); * const allowElbLoggingBucketPolicy = new aws.s3.BucketPolicy("allow_elb_logging", { * bucket: elbLogs.id, * policy: allowElbLogging.apply(allowElbLogging => allowElbLogging.json), * }); * const bar = new aws.elb.LoadBalancer("bar", { * name: "my-foobar-elb", * availabilityZones: ["us-west-2a"], * accessLogs: { * bucket: elbLogs.id, * interval: 5, * }, * listeners: [{ * instancePort: 8000, * instanceProtocol: "http", * lbPort: 80, * lbProtocol: "http", * }], * }); * ``` */ export declare function getServiceAccount(args?: GetServiceAccountArgs, opts?: pulumi.InvokeOptions): Promise<GetServiceAccountResult>; /** * A collection of arguments for invoking getServiceAccount. */ export interface GetServiceAccountArgs { /** * Name of the Region whose AWS ELB account ID is desired. Defaults to the Region set in the provider configuration. */ region?: string; } /** * A collection of values returned by getServiceAccount. */ export interface GetServiceAccountResult { /** * ARN of the AWS ELB service account in the selected Region. */ readonly arn: string; /** * The provider-assigned unique ID for this managed resource. */ readonly id: string; readonly region: string; } /** * Use this data source to get the Account ID of the [AWS Elastic Load Balancing Service Account](http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html#attach-bucket-policy) * in a given region for the purpose of permitting in S3 bucket policy. * * > **Note:** For AWS Regions opened since Jakarta (`ap-southeast-3`) in December 2021, AWS [documents that](https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html#attach-bucket-policy) a [service principal name](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html#principal-services) should be used instead of an AWS account ID in any relevant IAM policy. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const main = aws.elb.getServiceAccount({}); * const elbLogs = new aws.s3.Bucket("elb_logs", {bucket: "my-elb-tf-test-bucket"}); * const elbLogsAcl = new aws.s3.BucketAcl("elb_logs_acl", { * bucket: elbLogs.id, * acl: "private", * }); * const allowElbLogging = pulumi.all([main, elbLogs.arn]).apply(([main, arn]) => aws.iam.getPolicyDocumentOutput({ * statements: [{ * effect: "Allow", * principals: [{ * type: "AWS", * identifiers: [main.arn], * }], * actions: ["s3:PutObject"], * resources: [`${arn}/AWSLogs/*`], * }], * })); * const allowElbLoggingBucketPolicy = new aws.s3.BucketPolicy("allow_elb_logging", { * bucket: elbLogs.id, * policy: allowElbLogging.apply(allowElbLogging => allowElbLogging.json), * }); * const bar = new aws.elb.LoadBalancer("bar", { * name: "my-foobar-elb", * availabilityZones: ["us-west-2a"], * accessLogs: { * bucket: elbLogs.id, * interval: 5, * }, * listeners: [{ * instancePort: 8000, * instanceProtocol: "http", * lbPort: 80, * lbProtocol: "http", * }], * }); * ``` */ export declare function getServiceAccountOutput(args?: GetServiceAccountOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetServiceAccountResult>; /** * A collection of arguments for invoking getServiceAccount. */ export interface GetServiceAccountOutputArgs { /** * Name of the Region whose AWS ELB account ID is desired. Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; }