get Service Account
Use this data source to get the Account ID of the AWS Redshift Service Account in a given region for the purpose of allowing Redshift to store audit data in S3.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.redshift.RedshiftFunctions;
import com.pulumi.aws.redshift.inputs.GetServiceAccountArgs;
import com.pulumi.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketV2Args;
import com.pulumi.aws.s3.BucketPolicy;
import com.pulumi.aws.s3.BucketPolicyArgs;
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) {
final var main = RedshiftFunctions.getServiceAccount();
var bucket = new BucketV2("bucket", BucketV2Args.builder()
.forceDestroy(true)
.build());
var allowAuditLogging = new BucketPolicy("allowAuditLogging", BucketPolicyArgs.builder()
.bucket(bucket.id())
.policy("""
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "Put bucket policy needed for audit logging",
"Effect": "Allow",
"Principal": {
"AWS": "%s"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::tf-redshift-logging-test-bucket/*"
},
{
"Sid": "Get bucket policy needed for audit logging ",
"Effect": "Allow",
"Principal": {
"AWS": "%s"
},
"Action": "s3:GetBucketAcl",
"Resource": "arn:aws:s3:::tf-redshift-logging-test-bucket"
}
]
}
", main.applyValue(getServiceAccountResult -> getServiceAccountResult.arn()),main.applyValue(getServiceAccountResult -> getServiceAccountResult.arn())))
.build());
}
}
Content copied to clipboard
Return
A collection of values returned by getServiceAccount. */
Parameters
argument
A collection of arguments for invoking getServiceAccount.
Return
A collection of values returned by getServiceAccount.
See also
Parameters
region
Name of the region whose AWS Redshift account ID is desired. Defaults to the region from the AWS provider configuration.
suspend fun getServiceAccount(argument: suspend GetServiceAccountPlainArgsBuilder.() -> Unit): GetServiceAccountResult
Return
A collection of values returned by getServiceAccount.
See also
Parameters
argument
Builder for com.pulumi.aws.redshift.kotlin.inputs.GetServiceAccountPlainArgs.