@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
116 lines • 4.66 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBillingServiceAccountOutput = exports.getBillingServiceAccount = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Use this data source to get the Account ID of the [AWS Billing and Cost Management Service Account](http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-getting-started.html#step-2) for the purpose of permitting in S3 bucket policy.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const main = aws.getBillingServiceAccount({});
* const billingLogs = new aws.s3.Bucket("billing_logs", {bucket: "my-billing-tf-test-bucket"});
* const billingLogsAcl = new aws.s3.BucketAcl("billing_logs_acl", {
* bucket: billingLogs.id,
* acl: "private",
* });
* const allowBillingLogging = pulumi.all([main, billingLogs.arn, main, billingLogs.arn]).apply(([main, billingLogsArn, main1, billingLogsArn1]) => aws.iam.getPolicyDocumentOutput({
* statements: [
* {
* effect: "Allow",
* principals: [{
* type: "AWS",
* identifiers: [main.arn],
* }],
* actions: [
* "s3:GetBucketAcl",
* "s3:GetBucketPolicy",
* ],
* resources: [billingLogsArn],
* },
* {
* effect: "Allow",
* principals: [{
* type: "AWS",
* identifiers: [main1.arn],
* }],
* actions: ["s3:PutObject"],
* resources: [`${billingLogsArn1}/*`],
* },
* ],
* }));
* const allowBillingLoggingBucketPolicy = new aws.s3.BucketPolicy("allow_billing_logging", {
* bucket: billingLogs.id,
* policy: allowBillingLogging.apply(allowBillingLogging => allowBillingLogging.json),
* });
* ```
*/
function getBillingServiceAccount(args, opts) {
args = args || {};
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invoke("aws:index/getBillingServiceAccount:getBillingServiceAccount", {
"id": args.id,
}, opts);
}
exports.getBillingServiceAccount = getBillingServiceAccount;
/**
* Use this data source to get the Account ID of the [AWS Billing and Cost Management Service Account](http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-getting-started.html#step-2) for the purpose of permitting in S3 bucket policy.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const main = aws.getBillingServiceAccount({});
* const billingLogs = new aws.s3.Bucket("billing_logs", {bucket: "my-billing-tf-test-bucket"});
* const billingLogsAcl = new aws.s3.BucketAcl("billing_logs_acl", {
* bucket: billingLogs.id,
* acl: "private",
* });
* const allowBillingLogging = pulumi.all([main, billingLogs.arn, main, billingLogs.arn]).apply(([main, billingLogsArn, main1, billingLogsArn1]) => aws.iam.getPolicyDocumentOutput({
* statements: [
* {
* effect: "Allow",
* principals: [{
* type: "AWS",
* identifiers: [main.arn],
* }],
* actions: [
* "s3:GetBucketAcl",
* "s3:GetBucketPolicy",
* ],
* resources: [billingLogsArn],
* },
* {
* effect: "Allow",
* principals: [{
* type: "AWS",
* identifiers: [main1.arn],
* }],
* actions: ["s3:PutObject"],
* resources: [`${billingLogsArn1}/*`],
* },
* ],
* }));
* const allowBillingLoggingBucketPolicy = new aws.s3.BucketPolicy("allow_billing_logging", {
* bucket: billingLogs.id,
* policy: allowBillingLogging.apply(allowBillingLogging => allowBillingLogging.json),
* });
* ```
*/
function getBillingServiceAccountOutput(args, opts) {
args = args || {};
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invokeOutput("aws:index/getBillingServiceAccount:getBillingServiceAccount", {
"id": args.id,
}, opts);
}
exports.getBillingServiceAccountOutput = getBillingServiceAccountOutput;
//# sourceMappingURL=getBillingServiceAccount.js.map
;