BucketCorsConfigurationV2Args

data class BucketCorsConfigurationV2Args(val bucket: Output<String>? = null, val corsRules: Output<List<BucketCorsConfigurationV2CorsRuleArgs>>? = null, val expectedBucketOwner: Output<String>? = null) : ConvertibleToJava<BucketCorsConfigurationV2Args>

Provides an S3 bucket CORS configuration resource. For more information about CORS, go to Enabling Cross-Origin Resource Sharing in the Amazon S3 User Guide.

NOTE: S3 Buckets only support a single CORS configuration. Declaring multiple aws.s3.BucketCorsConfigurationV2 resources to the same S3 Bucket will cause a perpetual difference in configuration.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketCorsConfigurationV2;
import com.pulumi.aws.s3.BucketCorsConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketCorsConfigurationV2CorsRuleArgs;
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) {
var exampleBucketV2 = new BucketV2("exampleBucketV2");
var exampleBucketCorsConfigurationV2 = new BucketCorsConfigurationV2("exampleBucketCorsConfigurationV2", BucketCorsConfigurationV2Args.builder()
.bucket(exampleBucketV2.id())
.corsRules(
BucketCorsConfigurationV2CorsRuleArgs.builder()
.allowedHeaders("*")
.allowedMethods(
"PUT",
"POST")
.allowedOrigins("https://s3-website-test.domain.example")
.exposeHeaders("ETag")
.maxAgeSeconds(3000)
.build(),
BucketCorsConfigurationV2CorsRuleArgs.builder()
.allowedMethods("GET")
.allowedOrigins("*")
.build())
.build());
}
}

Import

If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the bucket and expected_bucket_owner separated by a comma (,): Using pulumi import to import S3 bucket CORS configuration using the bucket or using the bucket and expected_bucket_owner separated by a comma (,). For example: If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, import using the bucket:

$ pulumi import aws:s3/bucketCorsConfigurationV2:BucketCorsConfigurationV2 example bucket-name

If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the bucket and expected_bucket_owner separated by a comma (,):

$ pulumi import aws:s3/bucketCorsConfigurationV2:BucketCorsConfigurationV2 example bucket-name,123456789012

Constructors

Link copied to clipboard
fun BucketCorsConfigurationV2Args(bucket: Output<String>? = null, corsRules: Output<List<BucketCorsConfigurationV2CorsRuleArgs>>? = null, expectedBucketOwner: Output<String>? = null)

Functions

Link copied to clipboard
open override fun toJava(): BucketCorsConfigurationV2Args

Properties

Link copied to clipboard
val bucket: Output<String>? = null

Name of the bucket.

Link copied to clipboard

Set of origins and methods (cross-origin access that you want to allow). See below. You can configure up to 100 rules.

Link copied to clipboard
val expectedBucketOwner: Output<String>? = null

Account ID of the expected bucket owner.