Class GetServiceAccount
Inheritance
System.Object
GetServiceAccount
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.CloudTrail
Assembly: Pulumi.Aws.dll
Syntax
public static class GetServiceAccount
Methods
View SourceInvokeAsync(GetServiceAccountArgs, InvokeOptions)
Use this data source to get the Account ID of the AWS CloudTrail Service Account in a given region for the purpose of allowing CloudTrail to store trail data in S3.
{{% examples %}}
Example Usage
{{% example %}}
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var main = Output.Create(Aws.CloudTrail.GetServiceAccount.InvokeAsync());
var bucket = new Aws.S3.Bucket("bucket", new Aws.S3.BucketArgs
{
ForceDestroy = true,
Policy = Output.Tuple(main, main).Apply(values =>
{
var main = values.Item1;
var main1 = values.Item2;
return @$"{{
""Version"": ""2008-10-17"",
""Statement"": [
{{
""Sid"": ""Put bucket policy needed for trails"",
""Effect"": ""Allow"",
""Principal"": {{
""AWS"": ""{main.Arn}""
}},
""Action"": ""s3:PutObject"",
""Resource"": ""arn:aws:s3:::tf-cloudtrail-logging-test-bucket/*""
}},
{{
""Sid"": ""Get bucket policy needed for trails"",
""Effect"": ""Allow"",
""Principal"": {{
""AWS"": ""{main1.Arn}""
}},
""Action"": ""s3:GetBucketAcl"",
""Resource"": ""arn:aws:s3:::tf-cloudtrail-logging-test-bucket""
}}
]
}}
";
}),
});
}
}
{{% /example %}} {{% /examples %}}
Declaration
public static Task<GetServiceAccountResult> InvokeAsync(GetServiceAccountArgs args = null, InvokeOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GetServiceAccountArgs | args | |
| InvokeOptions | options |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<GetServiceAccountResult> |