1. Packages
  2. Packages
  3. Volcenginecc Provider
  4. API Docs
  5. tos
  6. BucketCors
Viewing docs for volcenginecc v0.0.35
published on Thursday, May 14, 2026 by Volcengine
volcenginecc logo
Viewing docs for volcenginecc v0.0.35
published on Thursday, May 14, 2026 by Volcengine

    Set CORS (Cross-Origin Resource Sharing) rules for the bucket.

    Example Usage

    Example coming soon!
    
    Example coming soon!
    
    Example coming soon!
    
    Example coming soon!
    
    Example coming soon!
    
    resources:
      tOSBucketCorsDemo:
        type: volcenginecc:tos:BucketCors
        name: TOSBucketCorsDemo
        properties:
          bucketName: ccapi-test
          corsRules:
            - allowed_origins:
                - http://test1.example.com:8080
                - http://test2.example.com:8088
              allowed_methods:
                - PUT
                - DELETE
              expose_headers:
                - x-tos-version-id
              max_age_seconds: 7200
              allowed_headers:
                - Content-Type
                - Authorization
              response_vary: false
            - allowed_origins:
                - https://*.example.org
              allowed_methods:
                - HEAD
              expose_headers:
                - x-tos-request-id
              max_age_seconds: 1800
              allowed_headers:
                - '*'
              response_vary: true
    
    Example coming soon!
    

    Create BucketCors Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new BucketCors(name: string, args: BucketCorsArgs, opts?: CustomResourceOptions);
    @overload
    def BucketCors(resource_name: str,
                   args: BucketCorsArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def BucketCors(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   bucket_name: Optional[str] = None,
                   cors_rules: Optional[Sequence[BucketCorsCorsRuleArgs]] = None)
    func NewBucketCors(ctx *Context, name string, args BucketCorsArgs, opts ...ResourceOption) (*BucketCors, error)
    public BucketCors(string name, BucketCorsArgs args, CustomResourceOptions? opts = null)
    public BucketCors(String name, BucketCorsArgs args)
    public BucketCors(String name, BucketCorsArgs args, CustomResourceOptions options)
    
    type: volcenginecc:tos:BucketCors
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "volcenginecc_tos_bucketcors" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args BucketCorsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args BucketCorsArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args BucketCorsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BucketCorsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BucketCorsArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var bucketCorsResource = new Volcenginecc.Tos.BucketCors("bucketCorsResource", new()
    {
        BucketName = "string",
        CorsRules = new[]
        {
            new Volcenginecc.Tos.Inputs.BucketCorsCorsRuleArgs
            {
                AllowedHeaders = new[]
                {
                    "string",
                },
                AllowedMethods = new[]
                {
                    "string",
                },
                AllowedOrigins = new[]
                {
                    "string",
                },
                ExposeHeaders = new[]
                {
                    "string",
                },
                MaxAgeSeconds = 0,
                ResponseVary = false,
            },
        },
    });
    
    example, err := tos.NewBucketCors(ctx, "bucketCorsResource", &tos.BucketCorsArgs{
    	BucketName: pulumi.String("string"),
    	CorsRules: tos.BucketCorsCorsRuleArray{
    		&tos.BucketCorsCorsRuleArgs{
    			AllowedHeaders: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			AllowedMethods: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			AllowedOrigins: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			ExposeHeaders: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			MaxAgeSeconds: pulumi.Int(0),
    			ResponseVary:  pulumi.Bool(false),
    		},
    	},
    })
    
    resource "volcenginecc_tos_bucketcors" "bucketCorsResource" {
      bucket_name = "string"
      cors_rules {
        allowed_headers = ["string"]
        allowed_methods = ["string"]
        allowed_origins = ["string"]
        expose_headers  = ["string"]
        max_age_seconds = 0
        response_vary   = false
      }
    }
    
    var bucketCorsResource = new BucketCors("bucketCorsResource", BucketCorsArgs.builder()
        .bucketName("string")
        .corsRules(BucketCorsCorsRuleArgs.builder()
            .allowedHeaders("string")
            .allowedMethods("string")
            .allowedOrigins("string")
            .exposeHeaders("string")
            .maxAgeSeconds(0)
            .responseVary(false)
            .build())
        .build());
    
    bucket_cors_resource = volcenginecc.tos.BucketCors("bucketCorsResource",
        bucket_name="string",
        cors_rules=[{
            "allowed_headers": ["string"],
            "allowed_methods": ["string"],
            "allowed_origins": ["string"],
            "expose_headers": ["string"],
            "max_age_seconds": 0,
            "response_vary": False,
        }])
    
    const bucketCorsResource = new volcenginecc.tos.BucketCors("bucketCorsResource", {
        bucketName: "string",
        corsRules: [{
            allowedHeaders: ["string"],
            allowedMethods: ["string"],
            allowedOrigins: ["string"],
            exposeHeaders: ["string"],
            maxAgeSeconds: 0,
            responseVary: false,
        }],
    });
    
    type: volcenginecc:tos:BucketCors
    properties:
        bucketName: string
        corsRules:
            - allowedHeaders:
                - string
              allowedMethods:
                - string
              allowedOrigins:
                - string
              exposeHeaders:
                - string
              maxAgeSeconds: 0
              responseVary: false
    

    BucketCors Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The BucketCors resource accepts the following input properties:

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BucketCors resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing BucketCors Resource

    Get an existing BucketCors resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: BucketCorsState, opts?: CustomResourceOptions): BucketCors
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket_name: Optional[str] = None,
            cors_rules: Optional[Sequence[BucketCorsCorsRuleArgs]] = None) -> BucketCors
    func GetBucketCors(ctx *Context, name string, id IDInput, state *BucketCorsState, opts ...ResourceOption) (*BucketCors, error)
    public static BucketCors Get(string name, Input<string> id, BucketCorsState? state, CustomResourceOptions? opts = null)
    public static BucketCors get(String name, Output<String> id, BucketCorsState state, CustomResourceOptions options)
    resources:  _:    type: volcenginecc:tos:BucketCors    get:      id: ${id}
    import {
      to = volcenginecc_tos_bucketcors.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.

    Supporting Types

    BucketCorsCorsRule, BucketCorsCorsRuleArgs

    AllowedHeaders List<string>
    Specify the response headers allowed for cross-origin requests.
    AllowedMethods List<string>
    Specify the allowed methods for cross-origin requests.
    AllowedOrigins List<string>
    Specify the allowed origins for cross-origin requests.
    ExposeHeaders List<string>
    Specify additional headers to include in the CORS response to provide extra information to the client.
    MaxAgeSeconds int
    Specify the cache duration for OPTIONS request responses on the client side, in seconds. Default is 3600.
    ResponseVary bool
    Whether to return the Vary: Origin header
    AllowedHeaders []string
    Specify the response headers allowed for cross-origin requests.
    AllowedMethods []string
    Specify the allowed methods for cross-origin requests.
    AllowedOrigins []string
    Specify the allowed origins for cross-origin requests.
    ExposeHeaders []string
    Specify additional headers to include in the CORS response to provide extra information to the client.
    MaxAgeSeconds int
    Specify the cache duration for OPTIONS request responses on the client side, in seconds. Default is 3600.
    ResponseVary bool
    Whether to return the Vary: Origin header
    allowed_headers list(string)
    Specify the response headers allowed for cross-origin requests.
    allowed_methods list(string)
    Specify the allowed methods for cross-origin requests.
    allowed_origins list(string)
    Specify the allowed origins for cross-origin requests.
    expose_headers list(string)
    Specify additional headers to include in the CORS response to provide extra information to the client.
    max_age_seconds number
    Specify the cache duration for OPTIONS request responses on the client side, in seconds. Default is 3600.
    response_vary bool
    Whether to return the Vary: Origin header
    allowedHeaders List<String>
    Specify the response headers allowed for cross-origin requests.
    allowedMethods List<String>
    Specify the allowed methods for cross-origin requests.
    allowedOrigins List<String>
    Specify the allowed origins for cross-origin requests.
    exposeHeaders List<String>
    Specify additional headers to include in the CORS response to provide extra information to the client.
    maxAgeSeconds Integer
    Specify the cache duration for OPTIONS request responses on the client side, in seconds. Default is 3600.
    responseVary Boolean
    Whether to return the Vary: Origin header
    allowedHeaders string[]
    Specify the response headers allowed for cross-origin requests.
    allowedMethods string[]
    Specify the allowed methods for cross-origin requests.
    allowedOrigins string[]
    Specify the allowed origins for cross-origin requests.
    exposeHeaders string[]
    Specify additional headers to include in the CORS response to provide extra information to the client.
    maxAgeSeconds number
    Specify the cache duration for OPTIONS request responses on the client side, in seconds. Default is 3600.
    responseVary boolean
    Whether to return the Vary: Origin header
    allowed_headers Sequence[str]
    Specify the response headers allowed for cross-origin requests.
    allowed_methods Sequence[str]
    Specify the allowed methods for cross-origin requests.
    allowed_origins Sequence[str]
    Specify the allowed origins for cross-origin requests.
    expose_headers Sequence[str]
    Specify additional headers to include in the CORS response to provide extra information to the client.
    max_age_seconds int
    Specify the cache duration for OPTIONS request responses on the client side, in seconds. Default is 3600.
    response_vary bool
    Whether to return the Vary: Origin header
    allowedHeaders List<String>
    Specify the response headers allowed for cross-origin requests.
    allowedMethods List<String>
    Specify the allowed methods for cross-origin requests.
    allowedOrigins List<String>
    Specify the allowed origins for cross-origin requests.
    exposeHeaders List<String>
    Specify additional headers to include in the CORS response to provide extra information to the client.
    maxAgeSeconds Number
    Specify the cache duration for OPTIONS request responses on the client side, in seconds. Default is 3600.
    responseVary Boolean
    Whether to return the Vary: Origin header

    Import

    $ pulumi import volcenginecc:tos/bucketCors:BucketCors example "bucket_name"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    volcenginecc volcengine/pulumi-volcenginecc
    License
    MPL-2.0
    Notes
    This Pulumi package is based on the volcenginecc Terraform Provider.
    volcenginecc logo
    Viewing docs for volcenginecc v0.0.35
    published on Thursday, May 14, 2026 by Volcengine
      Try Pulumi Cloud free. Your team will thank you.