1. Packages
  2. Ibm Provider
  3. API Docs
  4. CosBucketWebsiteConfiguration
ibm 1.77.1 published on Monday, Apr 14, 2025 by ibm-cloud

ibm.CosBucketWebsiteConfiguration

Explore with Pulumi AI

ibm logo
ibm 1.77.1 published on Monday, Apr 14, 2025 by ibm-cloud

    Provides an Static web hosting configuration resource. This resource is used to configure the website to use your documents as an index for the site and to potentially display errors.It can also be used to configure more advanced options including routing rules and request redirect for your domain.For more information about static web hosting please refer Static web hsoting with COS To configure a website_redirect for an object please refer ibm_cos_bucket_object.

    Note: Enabling public access to the COS bucket required to access the hosted website.Granting public access to this bucket will allow anyone to access the bucket.


    Additional Examples

    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.CosBucketWebsiteConfiguration;
    import com.pulumi.ibm.CosBucketWebsiteConfigurationArgs;
    import com.pulumi.ibm.inputs.CosBucketWebsiteConfigurationWebsiteConfigurationArgs;
    import com.pulumi.ibm.inputs.CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocumentArgs;
    import com.pulumi.ibm.inputs.CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocumentArgs;
    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) {
            // To redirect all the incoming redirect requests
            var website = new CosBucketWebsiteConfiguration("website", CosBucketWebsiteConfigurationArgs.builder()
                .bucketCrn("bucket_crn")
                .bucketLocation(data.ibm_cos_bucket().cos_bucket_website_configuration().regional_location())
                .websiteConfiguration(CosBucketWebsiteConfigurationWebsiteConfigurationArgs.builder()
                    .errorDocument(CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocumentArgs.builder()
                        .key("error.html")
                        .build())
                    .indexDocument(CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocumentArgs.builder()
                        .suffix("index.html")
                        .build())
                    .routingRules(Map.ofEntries(
                        Map.entry("condition", Map.of("keyPrefixEquals", "pages/")),
                        Map.entry("redirect", Map.of("replaceKeyPrefixWith", "web_pages/"))
                    ))
                    .build())
                .build());
    
        }
    }
    
    resources:
      # To redirect all the incoming redirect requests
      website:
        type: ibm:CosBucketWebsiteConfiguration
        properties:
          bucketCrn: bucket_crn
          bucketLocation: ${data.ibm_cos_bucket.cos_bucket_website_configuration.regional_location}
          websiteConfiguration:
            errorDocument:
              key: error.html
            indexDocument:
              suffix: index.html
            routingRules:
              - condition:
                  keyPrefixEquals: pages/
                redirect:
                  replaceKeyPrefixWith: web_pages/
    

    Adding website configuration with routing_rules configured.

    Routing rules can also be configured using the routing_rules argument as shown in the example:

    Additional Examples

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    // To redirect all the incoming redirect requests
    const website = new ibm.CosBucketWebsiteConfiguration("website", {
        bucketCrn: "bucket_crn",
        bucketLocation: data.ibm_cos_bucket.cos_bucket_website_configuration.regional_location,
        websiteConfiguration: {
            errorDocument: {
                key: "error.html",
            },
            indexDocument: {
                suffix: "index.html",
            },
            routingRules: `    [{
            "Condition": {
                "KeyPrefixEquals": "pages/"
            },
            "Redirect": {
                "ReplaceKeyPrefixWith": "web_pages/"
            }
        }]
    `,
        },
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    # To redirect all the incoming redirect requests
    website = ibm.CosBucketWebsiteConfiguration("website",
        bucket_crn="bucket_crn",
        bucket_location=data["ibm_cos_bucket"]["cos_bucket_website_configuration"]["regional_location"],
        website_configuration={
            "error_document": {
                "key": "error.html",
            },
            "index_document": {
                "suffix": "index.html",
            },
            "routing_rules": """    [{
            "Condition": {
                "KeyPrefixEquals": "pages/"
            },
            "Redirect": {
                "ReplaceKeyPrefixWith": "web_pages/"
            }
        }]
    """,
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// To redirect all the incoming redirect requests
    		_, err := ibm.NewCosBucketWebsiteConfiguration(ctx, "website", &ibm.CosBucketWebsiteConfigurationArgs{
    			BucketCrn:      pulumi.String("bucket_crn"),
    			BucketLocation: pulumi.Any(data.Ibm_cos_bucket.Cos_bucket_website_configuration.Regional_location),
    			WebsiteConfiguration: &ibm.CosBucketWebsiteConfigurationWebsiteConfigurationArgs{
    				ErrorDocument: &ibm.CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocumentArgs{
    					Key: pulumi.String("error.html"),
    				},
    				IndexDocument: &ibm.CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocumentArgs{
    					Suffix: pulumi.String("index.html"),
    				},
    				RoutingRules: pulumi.String(`    [{
            "Condition": {
                "KeyPrefixEquals": "pages/"
            },
            "Redirect": {
                "ReplaceKeyPrefixWith": "web_pages/"
            }
        }]
    `),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        // To redirect all the incoming redirect requests
        var website = new Ibm.CosBucketWebsiteConfiguration("website", new()
        {
            BucketCrn = "bucket_crn",
            BucketLocation = data.Ibm_cos_bucket.Cos_bucket_website_configuration.Regional_location,
            WebsiteConfiguration = new Ibm.Inputs.CosBucketWebsiteConfigurationWebsiteConfigurationArgs
            {
                ErrorDocument = new Ibm.Inputs.CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocumentArgs
                {
                    Key = "error.html",
                },
                IndexDocument = new Ibm.Inputs.CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocumentArgs
                {
                    Suffix = "index.html",
                },
                RoutingRules = @"    [{
            ""Condition"": {
                ""KeyPrefixEquals"": ""pages/""
            },
            ""Redirect"": {
                ""ReplaceKeyPrefixWith"": ""web_pages/""
            }
        }]
    ",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.CosBucketWebsiteConfiguration;
    import com.pulumi.ibm.CosBucketWebsiteConfigurationArgs;
    import com.pulumi.ibm.inputs.CosBucketWebsiteConfigurationWebsiteConfigurationArgs;
    import com.pulumi.ibm.inputs.CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocumentArgs;
    import com.pulumi.ibm.inputs.CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocumentArgs;
    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) {
            // To redirect all the incoming redirect requests
            var website = new CosBucketWebsiteConfiguration("website", CosBucketWebsiteConfigurationArgs.builder()
                .bucketCrn("bucket_crn")
                .bucketLocation(data.ibm_cos_bucket().cos_bucket_website_configuration().regional_location())
                .websiteConfiguration(CosBucketWebsiteConfigurationWebsiteConfigurationArgs.builder()
                    .errorDocument(CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocumentArgs.builder()
                        .key("error.html")
                        .build())
                    .indexDocument(CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocumentArgs.builder()
                        .suffix("index.html")
                        .build())
                    .routingRules("""
        [{
            "Condition": {
                "KeyPrefixEquals": "pages/"
            },
            "Redirect": {
                "ReplaceKeyPrefixWith": "web_pages/"
            }
        }]
                    """)
                    .build())
                .build());
    
        }
    }
    
    resources:
      # To redirect all the incoming redirect requests
      website:
        type: ibm:CosBucketWebsiteConfiguration
        properties:
          bucketCrn: bucket_crn
          bucketLocation: ${data.ibm_cos_bucket.cos_bucket_website_configuration.regional_location}
          websiteConfiguration:
            errorDocument:
              key: error.html
            indexDocument:
              suffix: index.html
            routingRules: |2
                  [{
                      "Condition": {
                          "KeyPrefixEquals": "pages/"
                      },
                      "Redirect": {
                          "ReplaceKeyPrefixWith": "web_pages/"
                      }
                  }]
    

    Create CosBucketWebsiteConfiguration Resource

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

    Constructor syntax

    new CosBucketWebsiteConfiguration(name: string, args: CosBucketWebsiteConfigurationArgs, opts?: CustomResourceOptions);
    @overload
    def CosBucketWebsiteConfiguration(resource_name: str,
                                      args: CosBucketWebsiteConfigurationArgs,
                                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def CosBucketWebsiteConfiguration(resource_name: str,
                                      opts: Optional[ResourceOptions] = None,
                                      bucket_crn: Optional[str] = None,
                                      bucket_location: Optional[str] = None,
                                      website_configuration: Optional[CosBucketWebsiteConfigurationWebsiteConfigurationArgs] = None,
                                      cos_bucket_website_configuration_id: Optional[str] = None,
                                      endpoint_type: Optional[str] = None,
                                      timeouts: Optional[CosBucketWebsiteConfigurationTimeoutsArgs] = None)
    func NewCosBucketWebsiteConfiguration(ctx *Context, name string, args CosBucketWebsiteConfigurationArgs, opts ...ResourceOption) (*CosBucketWebsiteConfiguration, error)
    public CosBucketWebsiteConfiguration(string name, CosBucketWebsiteConfigurationArgs args, CustomResourceOptions? opts = null)
    public CosBucketWebsiteConfiguration(String name, CosBucketWebsiteConfigurationArgs args)
    public CosBucketWebsiteConfiguration(String name, CosBucketWebsiteConfigurationArgs args, CustomResourceOptions options)
    
    type: ibm:CosBucketWebsiteConfiguration
    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 CosBucketWebsiteConfigurationArgs
    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 CosBucketWebsiteConfigurationArgs
    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 CosBucketWebsiteConfigurationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CosBucketWebsiteConfigurationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CosBucketWebsiteConfigurationArgs
    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 cosBucketWebsiteConfigurationResource = new Ibm.CosBucketWebsiteConfiguration("cosBucketWebsiteConfigurationResource", new()
    {
        BucketCrn = "string",
        BucketLocation = "string",
        WebsiteConfiguration = new Ibm.Inputs.CosBucketWebsiteConfigurationWebsiteConfigurationArgs
        {
            ErrorDocument = new Ibm.Inputs.CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocumentArgs
            {
                Key = "string",
            },
            IndexDocument = new Ibm.Inputs.CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocumentArgs
            {
                Suffix = "string",
            },
            RedirectAllRequestsTo = new Ibm.Inputs.CosBucketWebsiteConfigurationWebsiteConfigurationRedirectAllRequestsToArgs
            {
                HostName = "string",
                Protocol = "string",
            },
            RoutingRule = new[]
            {
                new Ibm.Inputs.CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleArgs
                {
                    Redirect = new Ibm.Inputs.CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleRedirectArgs
                    {
                        HostName = "string",
                        HttpRedirectCode = "string",
                        Protocol = "string",
                        ReplaceKeyPrefixWith = "string",
                        ReplaceKeyWith = "string",
                    },
                    Condition = new Ibm.Inputs.CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleConditionArgs
                    {
                        HttpErrorCodeReturnedEquals = "string",
                        KeyPrefixEquals = "string",
                    },
                },
            },
            RoutingRules = "string",
        },
        CosBucketWebsiteConfigurationId = "string",
        EndpointType = "string",
        Timeouts = new Ibm.Inputs.CosBucketWebsiteConfigurationTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
            Update = "string",
        },
    });
    
    example, err := ibm.NewCosBucketWebsiteConfiguration(ctx, "cosBucketWebsiteConfigurationResource", &ibm.CosBucketWebsiteConfigurationArgs{
    	BucketCrn:      pulumi.String("string"),
    	BucketLocation: pulumi.String("string"),
    	WebsiteConfiguration: &ibm.CosBucketWebsiteConfigurationWebsiteConfigurationArgs{
    		ErrorDocument: &ibm.CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocumentArgs{
    			Key: pulumi.String("string"),
    		},
    		IndexDocument: &ibm.CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocumentArgs{
    			Suffix: pulumi.String("string"),
    		},
    		RedirectAllRequestsTo: &ibm.CosBucketWebsiteConfigurationWebsiteConfigurationRedirectAllRequestsToArgs{
    			HostName: pulumi.String("string"),
    			Protocol: pulumi.String("string"),
    		},
    		RoutingRule: ibm.CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleArray{
    			&ibm.CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleArgs{
    				Redirect: &ibm.CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleRedirectArgs{
    					HostName:             pulumi.String("string"),
    					HttpRedirectCode:     pulumi.String("string"),
    					Protocol:             pulumi.String("string"),
    					ReplaceKeyPrefixWith: pulumi.String("string"),
    					ReplaceKeyWith:       pulumi.String("string"),
    				},
    				Condition: &ibm.CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleConditionArgs{
    					HttpErrorCodeReturnedEquals: pulumi.String("string"),
    					KeyPrefixEquals:             pulumi.String("string"),
    				},
    			},
    		},
    		RoutingRules: pulumi.String("string"),
    	},
    	CosBucketWebsiteConfigurationId: pulumi.String("string"),
    	EndpointType:                    pulumi.String("string"),
    	Timeouts: &ibm.CosBucketWebsiteConfigurationTimeoutsArgs{
    		Create: pulumi.String("string"),
    		Delete: pulumi.String("string"),
    		Update: pulumi.String("string"),
    	},
    })
    
    var cosBucketWebsiteConfigurationResource = new CosBucketWebsiteConfiguration("cosBucketWebsiteConfigurationResource", CosBucketWebsiteConfigurationArgs.builder()
        .bucketCrn("string")
        .bucketLocation("string")
        .websiteConfiguration(CosBucketWebsiteConfigurationWebsiteConfigurationArgs.builder()
            .errorDocument(CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocumentArgs.builder()
                .key("string")
                .build())
            .indexDocument(CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocumentArgs.builder()
                .suffix("string")
                .build())
            .redirectAllRequestsTo(CosBucketWebsiteConfigurationWebsiteConfigurationRedirectAllRequestsToArgs.builder()
                .hostName("string")
                .protocol("string")
                .build())
            .routingRule(CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleArgs.builder()
                .redirect(CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleRedirectArgs.builder()
                    .hostName("string")
                    .httpRedirectCode("string")
                    .protocol("string")
                    .replaceKeyPrefixWith("string")
                    .replaceKeyWith("string")
                    .build())
                .condition(CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleConditionArgs.builder()
                    .httpErrorCodeReturnedEquals("string")
                    .keyPrefixEquals("string")
                    .build())
                .build())
            .routingRules("string")
            .build())
        .cosBucketWebsiteConfigurationId("string")
        .endpointType("string")
        .timeouts(CosBucketWebsiteConfigurationTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .update("string")
            .build())
        .build());
    
    cos_bucket_website_configuration_resource = ibm.CosBucketWebsiteConfiguration("cosBucketWebsiteConfigurationResource",
        bucket_crn="string",
        bucket_location="string",
        website_configuration={
            "error_document": {
                "key": "string",
            },
            "index_document": {
                "suffix": "string",
            },
            "redirect_all_requests_to": {
                "host_name": "string",
                "protocol": "string",
            },
            "routing_rule": [{
                "redirect": {
                    "host_name": "string",
                    "http_redirect_code": "string",
                    "protocol": "string",
                    "replace_key_prefix_with": "string",
                    "replace_key_with": "string",
                },
                "condition": {
                    "http_error_code_returned_equals": "string",
                    "key_prefix_equals": "string",
                },
            }],
            "routing_rules": "string",
        },
        cos_bucket_website_configuration_id="string",
        endpoint_type="string",
        timeouts={
            "create": "string",
            "delete": "string",
            "update": "string",
        })
    
    const cosBucketWebsiteConfigurationResource = new ibm.CosBucketWebsiteConfiguration("cosBucketWebsiteConfigurationResource", {
        bucketCrn: "string",
        bucketLocation: "string",
        websiteConfiguration: {
            errorDocument: {
                key: "string",
            },
            indexDocument: {
                suffix: "string",
            },
            redirectAllRequestsTo: {
                hostName: "string",
                protocol: "string",
            },
            routingRule: [{
                redirect: {
                    hostName: "string",
                    httpRedirectCode: "string",
                    protocol: "string",
                    replaceKeyPrefixWith: "string",
                    replaceKeyWith: "string",
                },
                condition: {
                    httpErrorCodeReturnedEquals: "string",
                    keyPrefixEquals: "string",
                },
            }],
            routingRules: "string",
        },
        cosBucketWebsiteConfigurationId: "string",
        endpointType: "string",
        timeouts: {
            create: "string",
            "delete": "string",
            update: "string",
        },
    });
    
    type: ibm:CosBucketWebsiteConfiguration
    properties:
        bucketCrn: string
        bucketLocation: string
        cosBucketWebsiteConfigurationId: string
        endpointType: string
        timeouts:
            create: string
            delete: string
            update: string
        websiteConfiguration:
            errorDocument:
                key: string
            indexDocument:
                suffix: string
            redirectAllRequestsTo:
                hostName: string
                protocol: string
            routingRule:
                - condition:
                    httpErrorCodeReturnedEquals: string
                    keyPrefixEquals: string
                  redirect:
                    hostName: string
                    httpRedirectCode: string
                    protocol: string
                    replaceKeyPrefixWith: string
                    replaceKeyWith: string
            routingRules: string
    

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

    BucketCrn string
    The CRN of the COS bucket.
    BucketLocation string
    The location of the COS bucket.
    WebsiteConfiguration CosBucketWebsiteConfigurationWebsiteConfiguration

    Nested block have the following structure:

    Nested scheme for website_configuration:

    CosBucketWebsiteConfigurationId string
    (String) The ID of the bucket.
    EndpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    Timeouts CosBucketWebsiteConfigurationTimeouts
    BucketCrn string
    The CRN of the COS bucket.
    BucketLocation string
    The location of the COS bucket.
    WebsiteConfiguration CosBucketWebsiteConfigurationWebsiteConfigurationArgs

    Nested block have the following structure:

    Nested scheme for website_configuration:

    CosBucketWebsiteConfigurationId string
    (String) The ID of the bucket.
    EndpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    Timeouts CosBucketWebsiteConfigurationTimeoutsArgs
    bucketCrn String
    The CRN of the COS bucket.
    bucketLocation String
    The location of the COS bucket.
    websiteConfiguration CosBucketWebsiteConfigurationWebsiteConfiguration

    Nested block have the following structure:

    Nested scheme for website_configuration:

    cosBucketWebsiteConfigurationId String
    (String) The ID of the bucket.
    endpointType String
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts CosBucketWebsiteConfigurationTimeouts
    bucketCrn string
    The CRN of the COS bucket.
    bucketLocation string
    The location of the COS bucket.
    websiteConfiguration CosBucketWebsiteConfigurationWebsiteConfiguration

    Nested block have the following structure:

    Nested scheme for website_configuration:

    cosBucketWebsiteConfigurationId string
    (String) The ID of the bucket.
    endpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts CosBucketWebsiteConfigurationTimeouts
    bucket_crn str
    The CRN of the COS bucket.
    bucket_location str
    The location of the COS bucket.
    website_configuration CosBucketWebsiteConfigurationWebsiteConfigurationArgs

    Nested block have the following structure:

    Nested scheme for website_configuration:

    cos_bucket_website_configuration_id str
    (String) The ID of the bucket.
    endpoint_type str
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts CosBucketWebsiteConfigurationTimeoutsArgs
    bucketCrn String
    The CRN of the COS bucket.
    bucketLocation String
    The location of the COS bucket.
    websiteConfiguration Property Map

    Nested block have the following structure:

    Nested scheme for website_configuration:

    cosBucketWebsiteConfigurationId String
    (String) The ID of the bucket.
    endpointType String
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts Property Map

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    WebsiteEndpoint string
    (String) Endpoint of the website.
    Id string
    The provider-assigned unique ID for this managed resource.
    WebsiteEndpoint string
    (String) Endpoint of the website.
    id String
    The provider-assigned unique ID for this managed resource.
    websiteEndpoint String
    (String) Endpoint of the website.
    id string
    The provider-assigned unique ID for this managed resource.
    websiteEndpoint string
    (String) Endpoint of the website.
    id str
    The provider-assigned unique ID for this managed resource.
    website_endpoint str
    (String) Endpoint of the website.
    id String
    The provider-assigned unique ID for this managed resource.
    websiteEndpoint String
    (String) Endpoint of the website.

    Look up Existing CosBucketWebsiteConfiguration Resource

    Get an existing CosBucketWebsiteConfiguration 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?: CosBucketWebsiteConfigurationState, opts?: CustomResourceOptions): CosBucketWebsiteConfiguration
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket_crn: Optional[str] = None,
            bucket_location: Optional[str] = None,
            cos_bucket_website_configuration_id: Optional[str] = None,
            endpoint_type: Optional[str] = None,
            timeouts: Optional[CosBucketWebsiteConfigurationTimeoutsArgs] = None,
            website_configuration: Optional[CosBucketWebsiteConfigurationWebsiteConfigurationArgs] = None,
            website_endpoint: Optional[str] = None) -> CosBucketWebsiteConfiguration
    func GetCosBucketWebsiteConfiguration(ctx *Context, name string, id IDInput, state *CosBucketWebsiteConfigurationState, opts ...ResourceOption) (*CosBucketWebsiteConfiguration, error)
    public static CosBucketWebsiteConfiguration Get(string name, Input<string> id, CosBucketWebsiteConfigurationState? state, CustomResourceOptions? opts = null)
    public static CosBucketWebsiteConfiguration get(String name, Output<String> id, CosBucketWebsiteConfigurationState state, CustomResourceOptions options)
    resources:  _:    type: ibm:CosBucketWebsiteConfiguration    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:
    BucketCrn string
    The CRN of the COS bucket.
    BucketLocation string
    The location of the COS bucket.
    CosBucketWebsiteConfigurationId string
    (String) The ID of the bucket.
    EndpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    Timeouts CosBucketWebsiteConfigurationTimeouts
    WebsiteConfiguration CosBucketWebsiteConfigurationWebsiteConfiguration

    Nested block have the following structure:

    Nested scheme for website_configuration:

    WebsiteEndpoint string
    (String) Endpoint of the website.
    BucketCrn string
    The CRN of the COS bucket.
    BucketLocation string
    The location of the COS bucket.
    CosBucketWebsiteConfigurationId string
    (String) The ID of the bucket.
    EndpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    Timeouts CosBucketWebsiteConfigurationTimeoutsArgs
    WebsiteConfiguration CosBucketWebsiteConfigurationWebsiteConfigurationArgs

    Nested block have the following structure:

    Nested scheme for website_configuration:

    WebsiteEndpoint string
    (String) Endpoint of the website.
    bucketCrn String
    The CRN of the COS bucket.
    bucketLocation String
    The location of the COS bucket.
    cosBucketWebsiteConfigurationId String
    (String) The ID of the bucket.
    endpointType String
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts CosBucketWebsiteConfigurationTimeouts
    websiteConfiguration CosBucketWebsiteConfigurationWebsiteConfiguration

    Nested block have the following structure:

    Nested scheme for website_configuration:

    websiteEndpoint String
    (String) Endpoint of the website.
    bucketCrn string
    The CRN of the COS bucket.
    bucketLocation string
    The location of the COS bucket.
    cosBucketWebsiteConfigurationId string
    (String) The ID of the bucket.
    endpointType string
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts CosBucketWebsiteConfigurationTimeouts
    websiteConfiguration CosBucketWebsiteConfigurationWebsiteConfiguration

    Nested block have the following structure:

    Nested scheme for website_configuration:

    websiteEndpoint string
    (String) Endpoint of the website.
    bucket_crn str
    The CRN of the COS bucket.
    bucket_location str
    The location of the COS bucket.
    cos_bucket_website_configuration_id str
    (String) The ID of the bucket.
    endpoint_type str
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts CosBucketWebsiteConfigurationTimeoutsArgs
    website_configuration CosBucketWebsiteConfigurationWebsiteConfigurationArgs

    Nested block have the following structure:

    Nested scheme for website_configuration:

    website_endpoint str
    (String) Endpoint of the website.
    bucketCrn String
    The CRN of the COS bucket.
    bucketLocation String
    The location of the COS bucket.
    cosBucketWebsiteConfigurationId String
    (String) The ID of the bucket.
    endpointType String
    The type of the endpoint either public or private or direct to be used for buckets. Default value is public.
    timeouts Property Map
    websiteConfiguration Property Map

    Nested block have the following structure:

    Nested scheme for website_configuration:

    websiteEndpoint String
    (String) Endpoint of the website.

    Supporting Types

    CosBucketWebsiteConfigurationTimeouts, CosBucketWebsiteConfigurationTimeoutsArgs

    Create string
    Delete string
    Update string
    Create string
    Delete string
    Update string
    create String
    delete String
    update String
    create string
    delete string
    update string
    create str
    delete str
    update str
    create String
    delete String
    update String

    CosBucketWebsiteConfigurationWebsiteConfiguration, CosBucketWebsiteConfigurationWebsiteConfigurationArgs

    ErrorDocument CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocument

    When a static website bucket error occurs, an HTML page of the error provided by the configured error_document will be returned.

    Nested scheme for error_document:

    IndexDocument CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocument

    This is the home or default page of the website.

    Nested scheme for index_document:

    RedirectAllRequestsTo CosBucketWebsiteConfigurationWebsiteConfigurationRedirectAllRequestsTo
    Redirect requests can be set to specific page documents, individual routing rules, or redirect all requests globally to one bucket or domain.
    RoutingRule List<CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRule>

    List of rules that define when a redirect is applied and the redirect behavior.

    Nested scheme for routing_rule:

    RoutingRules string

    JSON array containing routing rules describing redirect behavior and when redirects are applied. Use this parameter when your routing rules contain empty String values ("") as seen in the example above.

    Note: There is a limitation of 50 routing rules per website configuration.

    ErrorDocument CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocument

    When a static website bucket error occurs, an HTML page of the error provided by the configured error_document will be returned.

    Nested scheme for error_document:

    IndexDocument CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocument

    This is the home or default page of the website.

    Nested scheme for index_document:

    RedirectAllRequestsTo CosBucketWebsiteConfigurationWebsiteConfigurationRedirectAllRequestsTo
    Redirect requests can be set to specific page documents, individual routing rules, or redirect all requests globally to one bucket or domain.
    RoutingRule []CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRule

    List of rules that define when a redirect is applied and the redirect behavior.

    Nested scheme for routing_rule:

    RoutingRules string

    JSON array containing routing rules describing redirect behavior and when redirects are applied. Use this parameter when your routing rules contain empty String values ("") as seen in the example above.

    Note: There is a limitation of 50 routing rules per website configuration.

    errorDocument CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocument

    When a static website bucket error occurs, an HTML page of the error provided by the configured error_document will be returned.

    Nested scheme for error_document:

    indexDocument CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocument

    This is the home or default page of the website.

    Nested scheme for index_document:

    redirectAllRequestsTo CosBucketWebsiteConfigurationWebsiteConfigurationRedirectAllRequestsTo
    Redirect requests can be set to specific page documents, individual routing rules, or redirect all requests globally to one bucket or domain.
    routingRule List<CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRule>

    List of rules that define when a redirect is applied and the redirect behavior.

    Nested scheme for routing_rule:

    routingRules String

    JSON array containing routing rules describing redirect behavior and when redirects are applied. Use this parameter when your routing rules contain empty String values ("") as seen in the example above.

    Note: There is a limitation of 50 routing rules per website configuration.

    errorDocument CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocument

    When a static website bucket error occurs, an HTML page of the error provided by the configured error_document will be returned.

    Nested scheme for error_document:

    indexDocument CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocument

    This is the home or default page of the website.

    Nested scheme for index_document:

    redirectAllRequestsTo CosBucketWebsiteConfigurationWebsiteConfigurationRedirectAllRequestsTo
    Redirect requests can be set to specific page documents, individual routing rules, or redirect all requests globally to one bucket or domain.
    routingRule CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRule[]

    List of rules that define when a redirect is applied and the redirect behavior.

    Nested scheme for routing_rule:

    routingRules string

    JSON array containing routing rules describing redirect behavior and when redirects are applied. Use this parameter when your routing rules contain empty String values ("") as seen in the example above.

    Note: There is a limitation of 50 routing rules per website configuration.

    error_document CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocument

    When a static website bucket error occurs, an HTML page of the error provided by the configured error_document will be returned.

    Nested scheme for error_document:

    index_document CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocument

    This is the home or default page of the website.

    Nested scheme for index_document:

    redirect_all_requests_to CosBucketWebsiteConfigurationWebsiteConfigurationRedirectAllRequestsTo
    Redirect requests can be set to specific page documents, individual routing rules, or redirect all requests globally to one bucket or domain.
    routing_rule Sequence[CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRule]

    List of rules that define when a redirect is applied and the redirect behavior.

    Nested scheme for routing_rule:

    routing_rules str

    JSON array containing routing rules describing redirect behavior and when redirects are applied. Use this parameter when your routing rules contain empty String values ("") as seen in the example above.

    Note: There is a limitation of 50 routing rules per website configuration.

    errorDocument Property Map

    When a static website bucket error occurs, an HTML page of the error provided by the configured error_document will be returned.

    Nested scheme for error_document:

    indexDocument Property Map

    This is the home or default page of the website.

    Nested scheme for index_document:

    redirectAllRequestsTo Property Map
    Redirect requests can be set to specific page documents, individual routing rules, or redirect all requests globally to one bucket or domain.
    routingRule List<Property Map>

    List of rules that define when a redirect is applied and the redirect behavior.

    Nested scheme for routing_rule:

    routingRules String

    JSON array containing routing rules describing redirect behavior and when redirects are applied. Use this parameter when your routing rules contain empty String values ("") as seen in the example above.

    Note: There is a limitation of 50 routing rules per website configuration.

    CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocument, CosBucketWebsiteConfigurationWebsiteConfigurationErrorDocumentArgs

    Key string
    Object key name to use when a 4XX class error occurs.
    Key string
    Object key name to use when a 4XX class error occurs.
    key String
    Object key name to use when a 4XX class error occurs.
    key string
    Object key name to use when a 4XX class error occurs.
    key str
    Object key name to use when a 4XX class error occurs.
    key String
    Object key name to use when a 4XX class error occurs.

    CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocument, CosBucketWebsiteConfigurationWebsiteConfigurationIndexDocumentArgs

    Suffix string
    This suffix is the document that will be returned for requests made to the root of the website .For example, if the suffix is index.html and you make a request to mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud, the data that is returned will be for mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud/index.html. Note: The suffix must not be empty and must not include a slash character.
    Suffix string
    This suffix is the document that will be returned for requests made to the root of the website .For example, if the suffix is index.html and you make a request to mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud, the data that is returned will be for mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud/index.html. Note: The suffix must not be empty and must not include a slash character.
    suffix String
    This suffix is the document that will be returned for requests made to the root of the website .For example, if the suffix is index.html and you make a request to mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud, the data that is returned will be for mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud/index.html. Note: The suffix must not be empty and must not include a slash character.
    suffix string
    This suffix is the document that will be returned for requests made to the root of the website .For example, if the suffix is index.html and you make a request to mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud, the data that is returned will be for mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud/index.html. Note: The suffix must not be empty and must not include a slash character.
    suffix str
    This suffix is the document that will be returned for requests made to the root of the website .For example, if the suffix is index.html and you make a request to mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud, the data that is returned will be for mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud/index.html. Note: The suffix must not be empty and must not include a slash character.
    suffix String
    This suffix is the document that will be returned for requests made to the root of the website .For example, if the suffix is index.html and you make a request to mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud, the data that is returned will be for mywebsitedomain.s3-web.us-east.cloud-object-storage.appdomain.cloud/index.html. Note: The suffix must not be empty and must not include a slash character.

    CosBucketWebsiteConfigurationWebsiteConfigurationRedirectAllRequestsTo, CosBucketWebsiteConfigurationWebsiteConfigurationRedirectAllRequestsToArgs

    HostName string
    Protocol string
    HostName string
    Protocol string
    hostName String
    protocol String
    hostName string
    protocol string
    hostName String
    protocol String

    CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRule, CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleArgs

    Redirect CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleRedirect
    Configuration block for redirect behaviour. Nested scheme for redirect:
    Condition CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleCondition

    Configuration block for a condition to be satisfied for the redirect behaviour to be applied.

    Nested scheme for condition:

    Redirect CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleRedirect
    Configuration block for redirect behaviour. Nested scheme for redirect:
    Condition CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleCondition

    Configuration block for a condition to be satisfied for the redirect behaviour to be applied.

    Nested scheme for condition:

    redirect CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleRedirect
    Configuration block for redirect behaviour. Nested scheme for redirect:
    condition CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleCondition

    Configuration block for a condition to be satisfied for the redirect behaviour to be applied.

    Nested scheme for condition:

    redirect CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleRedirect
    Configuration block for redirect behaviour. Nested scheme for redirect:
    condition CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleCondition

    Configuration block for a condition to be satisfied for the redirect behaviour to be applied.

    Nested scheme for condition:

    redirect CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleRedirect
    Configuration block for redirect behaviour. Nested scheme for redirect:
    condition CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleCondition

    Configuration block for a condition to be satisfied for the redirect behaviour to be applied.

    Nested scheme for condition:

    redirect Property Map
    Configuration block for redirect behaviour. Nested scheme for redirect:
    condition Property Map

    Configuration block for a condition to be satisfied for the redirect behaviour to be applied.

    Nested scheme for condition:

    CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleCondition, CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleConditionArgs

    HttpErrorCodeReturnedEquals string
    The HTTP error code when the redirect is applied. Valid codes are 4XX or 5XX..
    KeyPrefixEquals string
    The object key name prefix when the redirect is applied..
    HttpErrorCodeReturnedEquals string
    The HTTP error code when the redirect is applied. Valid codes are 4XX or 5XX..
    KeyPrefixEquals string
    The object key name prefix when the redirect is applied..
    httpErrorCodeReturnedEquals String
    The HTTP error code when the redirect is applied. Valid codes are 4XX or 5XX..
    keyPrefixEquals String
    The object key name prefix when the redirect is applied..
    httpErrorCodeReturnedEquals string
    The HTTP error code when the redirect is applied. Valid codes are 4XX or 5XX..
    keyPrefixEquals string
    The object key name prefix when the redirect is applied..
    http_error_code_returned_equals str
    The HTTP error code when the redirect is applied. Valid codes are 4XX or 5XX..
    key_prefix_equals str
    The object key name prefix when the redirect is applied..
    httpErrorCodeReturnedEquals String
    The HTTP error code when the redirect is applied. Valid codes are 4XX or 5XX..
    keyPrefixEquals String
    The object key name prefix when the redirect is applied..

    CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleRedirect, CosBucketWebsiteConfigurationWebsiteConfigurationRoutingRuleRedirectArgs

    HostName string
    The host name the request should be redirected to.
    HttpRedirectCode string
    The HTTP redirect code to use on the response. Valid codes are 3XX except 300..
    Protocol string
    Protocol to be used in the Location header that is returned in the response.
    ReplaceKeyPrefixWith string
    The prefix of the object key name that replaces the value of KeyPrefixEquals in the redirect request.
    ReplaceKeyWith string
    The object key to be used in the Location header that is returned in the response.
    HostName string
    The host name the request should be redirected to.
    HttpRedirectCode string
    The HTTP redirect code to use on the response. Valid codes are 3XX except 300..
    Protocol string
    Protocol to be used in the Location header that is returned in the response.
    ReplaceKeyPrefixWith string
    The prefix of the object key name that replaces the value of KeyPrefixEquals in the redirect request.
    ReplaceKeyWith string
    The object key to be used in the Location header that is returned in the response.
    hostName String
    The host name the request should be redirected to.
    httpRedirectCode String
    The HTTP redirect code to use on the response. Valid codes are 3XX except 300..
    protocol String
    Protocol to be used in the Location header that is returned in the response.
    replaceKeyPrefixWith String
    The prefix of the object key name that replaces the value of KeyPrefixEquals in the redirect request.
    replaceKeyWith String
    The object key to be used in the Location header that is returned in the response.
    hostName string
    The host name the request should be redirected to.
    httpRedirectCode string
    The HTTP redirect code to use on the response. Valid codes are 3XX except 300..
    protocol string
    Protocol to be used in the Location header that is returned in the response.
    replaceKeyPrefixWith string
    The prefix of the object key name that replaces the value of KeyPrefixEquals in the redirect request.
    replaceKeyWith string
    The object key to be used in the Location header that is returned in the response.
    host_name str
    The host name the request should be redirected to.
    http_redirect_code str
    The HTTP redirect code to use on the response. Valid codes are 3XX except 300..
    protocol str
    Protocol to be used in the Location header that is returned in the response.
    replace_key_prefix_with str
    The prefix of the object key name that replaces the value of KeyPrefixEquals in the redirect request.
    replace_key_with str
    The object key to be used in the Location header that is returned in the response.
    hostName String
    The host name the request should be redirected to.
    httpRedirectCode String
    The HTTP redirect code to use on the response. Valid codes are 3XX except 300..
    protocol String
    Protocol to be used in the Location header that is returned in the response.
    replaceKeyPrefixWith String
    The prefix of the object key name that replaces the value of KeyPrefixEquals in the redirect request.
    replaceKeyWith String
    The object key to be used in the Location header that is returned in the response.

    Import

    IBM COS Bucket

    The ibm.CosBucketWebsiteConfiguration resource can be imported by using the id. The ID is formed from the CRN (Cloud Resource Name). The CRN and bucket location can be found on the portal.

    id = $CRN:meta:$bucketlocation:$endpointtype

    Syntax

    $ terraform import ibm_cos_bucket_website_configuration.website  `$CRN:meta:$bucketlocation:public`
    

    Example

    
    $ terraform import ibm_cos_bucket_website_configuration.website crn:v1:bluemix:public:cloud-object-storage:global:a/ee858e45752d4696b2d082bcf2357559:84aaaaa4-3a22-477b-8635-75501eac96f7:bucket:bucketname:meta:us-south:public
    

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

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm logo
    ibm 1.77.1 published on Monday, Apr 14, 2025 by ibm-cloud