1. Packages
  2. Packages
  3. Ionoscloud
  4. API Docs
  5. objectstorage
  6. CorsConfiguration
Viewing docs for IonosCloud v0.3.0
published on Wednesday, Apr 15, 2026 by ionos-cloud
ionoscloud logo
Viewing docs for IonosCloud v0.3.0
published on Wednesday, Apr 15, 2026 by ionos-cloud

    Manages Object Lock Configuration for Buckets on IonosCloud.

    ⚠️ Note: The Terraform provider only supports contract-owned buckets. User-owned buckets are not supported, and there are no plans to introduce support for them. As a result, user-owned buckets cannot be created, updated, deleted, read, or imported using this provider.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@ionos-cloud/sdk-pulumi";
    
    const example = new ionoscloud.objectstorage.Bucket("example", {name: "example"});
    const test = new ionoscloud.objectstorage.CorsConfiguration("test", {
        bucket: example.name,
        corsRules: [{
            allowedHeaders: ["*"],
            allowedMethods: [
                "PUT",
                "POST",
            ],
            allowedOrigins: ["https://s3-website-test.hashicorp.com"],
            exposeHeaders: ["ETag"],
            maxAgeSeconds: 3000,
            id: 1234,
        }],
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.objectstorage.Bucket("example", name="example")
    test = ionoscloud.objectstorage.CorsConfiguration("test",
        bucket=example.name,
        cors_rules=[{
            "allowed_headers": ["*"],
            "allowed_methods": [
                "PUT",
                "POST",
            ],
            "allowed_origins": ["https://s3-website-test.hashicorp.com"],
            "expose_headers": ["ETag"],
            "max_age_seconds": 3000,
            "id": 1234,
        }])
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/objectstorage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := objectstorage.NewBucket(ctx, "example", &objectstorage.BucketArgs{
    			Name: pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = objectstorage.NewCorsConfiguration(ctx, "test", &objectstorage.CorsConfigurationArgs{
    			Bucket: example.Name,
    			CorsRules: objectstorage.CorsConfigurationCorsRuleArray{
    				&objectstorage.CorsConfigurationCorsRuleArgs{
    					AllowedHeaders: pulumi.StringArray{
    						pulumi.String("*"),
    					},
    					AllowedMethods: pulumi.StringArray{
    						pulumi.String("PUT"),
    						pulumi.String("POST"),
    					},
    					AllowedOrigins: pulumi.StringArray{
    						pulumi.String("https://s3-website-test.hashicorp.com"),
    					},
    					ExposeHeaders: pulumi.StringArray{
    						pulumi.String("ETag"),
    					},
    					MaxAgeSeconds: pulumi.Int(3000),
    					Id:            pulumi.Int(1234),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Ionoscloud.Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Ionoscloud.Objectstorage.Bucket("example", new()
        {
            Name = "example",
        });
    
        var test = new Ionoscloud.Objectstorage.CorsConfiguration("test", new()
        {
            Bucket = example.Name,
            CorsRules = new[]
            {
                new Ionoscloud.Objectstorage.Inputs.CorsConfigurationCorsRuleArgs
                {
                    AllowedHeaders = new[]
                    {
                        "*",
                    },
                    AllowedMethods = new[]
                    {
                        "PUT",
                        "POST",
                    },
                    AllowedOrigins = new[]
                    {
                        "https://s3-website-test.hashicorp.com",
                    },
                    ExposeHeaders = new[]
                    {
                        "ETag",
                    },
                    MaxAgeSeconds = 3000,
                    Id = 1234,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.ionoscloud.pulumi.ionoscloud.objectstorage.Bucket;
    import com.ionoscloud.pulumi.ionoscloud.objectstorage.BucketArgs;
    import com.ionoscloud.pulumi.ionoscloud.objectstorage.CorsConfiguration;
    import com.ionoscloud.pulumi.ionoscloud.objectstorage.CorsConfigurationArgs;
    import com.pulumi.ionoscloud.objectstorage.inputs.CorsConfigurationCorsRuleArgs;
    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 example = new Bucket("example", BucketArgs.builder()
                .name("example")
                .build());
    
            var test = new CorsConfiguration("test", CorsConfigurationArgs.builder()
                .bucket(example.name())
                .corsRules(CorsConfigurationCorsRuleArgs.builder()
                    .allowedHeaders("*")
                    .allowedMethods(                
                        "PUT",
                        "POST")
                    .allowedOrigins("https://s3-website-test.hashicorp.com")
                    .exposeHeaders("ETag")
                    .maxAgeSeconds(3000)
                    .id(1234)
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: ionoscloud:objectstorage:Bucket
        properties:
          name: example
      test:
        type: ionoscloud:objectstorage:CorsConfiguration
        properties:
          bucket: ${example.name}
          corsRules:
            - allowedHeaders:
                - '*'
              allowedMethods:
                - PUT
                - POST
              allowedOrigins:
                - https://s3-website-test.hashicorp.com
              exposeHeaders:
                - ETag
              maxAgeSeconds: 3000
              id: 1234
    

    Create CorsConfiguration Resource

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

    Constructor syntax

    new CorsConfiguration(name: string, args: CorsConfigurationArgs, opts?: CustomResourceOptions);
    @overload
    def CorsConfiguration(resource_name: str,
                          args: CorsConfigurationArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def CorsConfiguration(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          bucket: Optional[str] = None,
                          cors_rules: Optional[Sequence[CorsConfigurationCorsRuleArgs]] = None)
    func NewCorsConfiguration(ctx *Context, name string, args CorsConfigurationArgs, opts ...ResourceOption) (*CorsConfiguration, error)
    public CorsConfiguration(string name, CorsConfigurationArgs args, CustomResourceOptions? opts = null)
    public CorsConfiguration(String name, CorsConfigurationArgs args)
    public CorsConfiguration(String name, CorsConfigurationArgs args, CustomResourceOptions options)
    
    type: ionoscloud:objectstorage:CorsConfiguration
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args CorsConfigurationArgs
    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 CorsConfigurationArgs
    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 CorsConfigurationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CorsConfigurationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CorsConfigurationArgs
    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 corsConfigurationResource = new Ionoscloud.Objectstorage.CorsConfiguration("corsConfigurationResource", new()
    {
        Bucket = "string",
        CorsRules = new[]
        {
            new Ionoscloud.Objectstorage.Inputs.CorsConfigurationCorsRuleArgs
            {
                AllowedMethods = new[]
                {
                    "string",
                },
                AllowedOrigins = new[]
                {
                    "string",
                },
                AllowedHeaders = new[]
                {
                    "string",
                },
                ExposeHeaders = new[]
                {
                    "string",
                },
                Id = 0,
                MaxAgeSeconds = 0,
            },
        },
    });
    
    example, err := objectstorage.NewCorsConfiguration(ctx, "corsConfigurationResource", &objectstorage.CorsConfigurationArgs{
    	Bucket: pulumi.String("string"),
    	CorsRules: objectstorage.CorsConfigurationCorsRuleArray{
    		&objectstorage.CorsConfigurationCorsRuleArgs{
    			AllowedMethods: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			AllowedOrigins: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			AllowedHeaders: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			ExposeHeaders: pulumi.StringArray{
    				pulumi.String("string"),
    			},
    			Id:            pulumi.Int(0),
    			MaxAgeSeconds: pulumi.Int(0),
    		},
    	},
    })
    
    var corsConfigurationResource = new CorsConfiguration("corsConfigurationResource", CorsConfigurationArgs.builder()
        .bucket("string")
        .corsRules(CorsConfigurationCorsRuleArgs.builder()
            .allowedMethods("string")
            .allowedOrigins("string")
            .allowedHeaders("string")
            .exposeHeaders("string")
            .id(0)
            .maxAgeSeconds(0)
            .build())
        .build());
    
    cors_configuration_resource = ionoscloud.objectstorage.CorsConfiguration("corsConfigurationResource",
        bucket="string",
        cors_rules=[{
            "allowed_methods": ["string"],
            "allowed_origins": ["string"],
            "allowed_headers": ["string"],
            "expose_headers": ["string"],
            "id": 0,
            "max_age_seconds": 0,
        }])
    
    const corsConfigurationResource = new ionoscloud.objectstorage.CorsConfiguration("corsConfigurationResource", {
        bucket: "string",
        corsRules: [{
            allowedMethods: ["string"],
            allowedOrigins: ["string"],
            allowedHeaders: ["string"],
            exposeHeaders: ["string"],
            id: 0,
            maxAgeSeconds: 0,
        }],
    });
    
    type: ionoscloud:objectstorage:CorsConfiguration
    properties:
        bucket: string
        corsRules:
            - allowedHeaders:
                - string
              allowedMethods:
                - string
              allowedOrigins:
                - string
              exposeHeaders:
                - string
              id: 0
              maxAgeSeconds: 0
    

    CorsConfiguration 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 CorsConfiguration resource accepts the following input properties:

    Bucket string
    [string] The name of the bucket where the object will be stored.
    CorsRules List<Ionoscloud.CorsConfigurationCorsRule>
    [block] A block of corsRule as defined below.
    Bucket string
    [string] The name of the bucket where the object will be stored.
    CorsRules []CorsConfigurationCorsRuleArgs
    [block] A block of corsRule as defined below.
    bucket String
    [string] The name of the bucket where the object will be stored.
    corsRules List<CorsConfigurationCorsRule>
    [block] A block of corsRule as defined below.
    bucket string
    [string] The name of the bucket where the object will be stored.
    corsRules CorsConfigurationCorsRule[]
    [block] A block of corsRule as defined below.
    bucket str
    [string] The name of the bucket where the object will be stored.
    cors_rules Sequence[CorsConfigurationCorsRuleArgs]
    [block] A block of corsRule as defined below.
    bucket String
    [string] The name of the bucket where the object will be stored.
    corsRules List<Property Map>
    [block] A block of corsRule as defined below.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the CorsConfiguration 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 str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing CorsConfiguration Resource

    Get an existing CorsConfiguration 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?: CorsConfigurationState, opts?: CustomResourceOptions): CorsConfiguration
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket: Optional[str] = None,
            cors_rules: Optional[Sequence[CorsConfigurationCorsRuleArgs]] = None) -> CorsConfiguration
    func GetCorsConfiguration(ctx *Context, name string, id IDInput, state *CorsConfigurationState, opts ...ResourceOption) (*CorsConfiguration, error)
    public static CorsConfiguration Get(string name, Input<string> id, CorsConfigurationState? state, CustomResourceOptions? opts = null)
    public static CorsConfiguration get(String name, Output<String> id, CorsConfigurationState state, CustomResourceOptions options)
    resources:  _:    type: ionoscloud:objectstorage:CorsConfiguration    get:      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.
    The following state arguments are supported:
    Bucket string
    [string] The name of the bucket where the object will be stored.
    CorsRules List<Ionoscloud.CorsConfigurationCorsRule>
    [block] A block of corsRule as defined below.
    Bucket string
    [string] The name of the bucket where the object will be stored.
    CorsRules []CorsConfigurationCorsRuleArgs
    [block] A block of corsRule as defined below.
    bucket String
    [string] The name of the bucket where the object will be stored.
    corsRules List<CorsConfigurationCorsRule>
    [block] A block of corsRule as defined below.
    bucket string
    [string] The name of the bucket where the object will be stored.
    corsRules CorsConfigurationCorsRule[]
    [block] A block of corsRule as defined below.
    bucket str
    [string] The name of the bucket where the object will be stored.
    cors_rules Sequence[CorsConfigurationCorsRuleArgs]
    [block] A block of corsRule as defined below.
    bucket String
    [string] The name of the bucket where the object will be stored.
    corsRules List<Property Map>
    [block] A block of corsRule as defined below.

    Supporting Types

    CorsConfigurationCorsRule, CorsConfigurationCorsRuleArgs

    AllowedMethods List<string>
    [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
    AllowedOrigins List<string>
    [list] Specifies which origins are allowed to make requests to the resource.
    AllowedHeaders List<string>
    [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
    ExposeHeaders List<string>
    [list] Specifies which headers are exposed to the browser.
    Id int

    [int] Container for the Contract Number of the owner

    Days and years are mutually exclusive. You can only specify one of them.

    MaxAgeSeconds int
    [int] Specifies how long the results of a pre-flight request can be cached in seconds.
    AllowedMethods []string
    [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
    AllowedOrigins []string
    [list] Specifies which origins are allowed to make requests to the resource.
    AllowedHeaders []string
    [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
    ExposeHeaders []string
    [list] Specifies which headers are exposed to the browser.
    Id int

    [int] Container for the Contract Number of the owner

    Days and years are mutually exclusive. You can only specify one of them.

    MaxAgeSeconds int
    [int] Specifies how long the results of a pre-flight request can be cached in seconds.
    allowedMethods List<String>
    [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
    allowedOrigins List<String>
    [list] Specifies which origins are allowed to make requests to the resource.
    allowedHeaders List<String>
    [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
    exposeHeaders List<String>
    [list] Specifies which headers are exposed to the browser.
    id Integer

    [int] Container for the Contract Number of the owner

    Days and years are mutually exclusive. You can only specify one of them.

    maxAgeSeconds Integer
    [int] Specifies how long the results of a pre-flight request can be cached in seconds.
    allowedMethods string[]
    [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
    allowedOrigins string[]
    [list] Specifies which origins are allowed to make requests to the resource.
    allowedHeaders string[]
    [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
    exposeHeaders string[]
    [list] Specifies which headers are exposed to the browser.
    id number

    [int] Container for the Contract Number of the owner

    Days and years are mutually exclusive. You can only specify one of them.

    maxAgeSeconds number
    [int] Specifies how long the results of a pre-flight request can be cached in seconds.
    allowed_methods Sequence[str]
    [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
    allowed_origins Sequence[str]
    [list] Specifies which origins are allowed to make requests to the resource.
    allowed_headers Sequence[str]
    [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
    expose_headers Sequence[str]
    [list] Specifies which headers are exposed to the browser.
    id int

    [int] Container for the Contract Number of the owner

    Days and years are mutually exclusive. You can only specify one of them.

    max_age_seconds int
    [int] Specifies how long the results of a pre-flight request can be cached in seconds.
    allowedMethods List<String>
    [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
    allowedOrigins List<String>
    [list] Specifies which origins are allowed to make requests to the resource.
    allowedHeaders List<String>
    [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
    exposeHeaders List<String>
    [list] Specifies which headers are exposed to the browser.
    id Number

    [int] Container for the Contract Number of the owner

    Days and years are mutually exclusive. You can only specify one of them.

    maxAgeSeconds Number
    [int] Specifies how long the results of a pre-flight request can be cached in seconds.

    Import

    IONOS Object Storage Bucket cors configuration can be imported using the bucket name.

    $ pulumi import ionoscloud:objectstorage/corsConfiguration:CorsConfiguration example example
    

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

    Package Details

    Repository
    ionoscloud ionos-cloud/pulumi-ionoscloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    Viewing docs for IonosCloud v0.3.0
    published on Wednesday, Apr 15, 2026 by ionos-cloud
      Try Pulumi Cloud free. Your team will thank you.