ionoscloud.S3BucketCorsConfiguration
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";
const example = new ionoscloud.S3Bucket("example", {});
const test = new ionoscloud.S3BucketCorsConfiguration("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.S3Bucket("example")
test = ionoscloud.S3BucketCorsConfiguration("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/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := ionoscloud.NewS3Bucket(ctx, "example", nil)
if err != nil {
return err
}
_, err = ionoscloud.NewS3BucketCorsConfiguration(ctx, "test", &ionoscloud.S3BucketCorsConfigurationArgs{
Bucket: example.Name,
CorsRules: ionoscloud.S3BucketCorsConfigurationCorsRuleArray{
&ionoscloud.S3BucketCorsConfigurationCorsRuleArgs{
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.Float64(3000),
Id: pulumi.Float64(1234),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;
return await Deployment.RunAsync(() =>
{
var example = new Ionoscloud.S3Bucket("example");
var test = new Ionoscloud.S3BucketCorsConfiguration("test", new()
{
Bucket = example.Name,
CorsRules = new[]
{
new Ionoscloud.Inputs.S3BucketCorsConfigurationCorsRuleArgs
{
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.pulumi.ionoscloud.S3Bucket;
import com.pulumi.ionoscloud.S3BucketCorsConfiguration;
import com.pulumi.ionoscloud.S3BucketCorsConfigurationArgs;
import com.pulumi.ionoscloud.inputs.S3BucketCorsConfigurationCorsRuleArgs;
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 S3Bucket("example");
var test = new S3BucketCorsConfiguration("test", S3BucketCorsConfigurationArgs.builder()
.bucket(example.name())
.corsRules(S3BucketCorsConfigurationCorsRuleArgs.builder()
.allowedHeaders("*")
.allowedMethods(
"PUT",
"POST")
.allowedOrigins("https://s3-website-test.hashicorp.com")
.exposeHeaders("ETag")
.maxAgeSeconds(3000)
.id(1234)
.build())
.build());
}
}
resources:
example:
type: ionoscloud:S3Bucket
test:
type: ionoscloud:S3BucketCorsConfiguration
properties:
bucket: ${example.name}
corsRules:
- allowedHeaders:
- '*'
allowedMethods:
- PUT
- POST
allowedOrigins:
- https://s3-website-test.hashicorp.com
exposeHeaders:
- ETag
maxAgeSeconds: 3000
id: 1234
Create S3BucketCorsConfiguration Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new S3BucketCorsConfiguration(name: string, args: S3BucketCorsConfigurationArgs, opts?: CustomResourceOptions);
@overload
def S3BucketCorsConfiguration(resource_name: str,
args: S3BucketCorsConfigurationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def S3BucketCorsConfiguration(resource_name: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
cors_rules: Optional[Sequence[S3BucketCorsConfigurationCorsRuleArgs]] = None)
func NewS3BucketCorsConfiguration(ctx *Context, name string, args S3BucketCorsConfigurationArgs, opts ...ResourceOption) (*S3BucketCorsConfiguration, error)
public S3BucketCorsConfiguration(string name, S3BucketCorsConfigurationArgs args, CustomResourceOptions? opts = null)
public S3BucketCorsConfiguration(String name, S3BucketCorsConfigurationArgs args)
public S3BucketCorsConfiguration(String name, S3BucketCorsConfigurationArgs args, CustomResourceOptions options)
type: ionoscloud:S3BucketCorsConfiguration
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 S3BucketCorsConfigurationArgs
- 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 S3BucketCorsConfigurationArgs
- 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 S3BucketCorsConfigurationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args S3BucketCorsConfigurationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args S3BucketCorsConfigurationArgs
- 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 s3bucketCorsConfigurationResource = new Ionoscloud.S3BucketCorsConfiguration("s3bucketCorsConfigurationResource", new()
{
Bucket = "string",
CorsRules = new[]
{
new Ionoscloud.Inputs.S3BucketCorsConfigurationCorsRuleArgs
{
AllowedMethods = new[]
{
"string",
},
AllowedOrigins = new[]
{
"string",
},
AllowedHeaders = new[]
{
"string",
},
ExposeHeaders = new[]
{
"string",
},
Id = 0,
MaxAgeSeconds = 0,
},
},
});
example, err := ionoscloud.NewS3BucketCorsConfiguration(ctx, "s3bucketCorsConfigurationResource", &ionoscloud.S3BucketCorsConfigurationArgs{
Bucket: pulumi.String("string"),
CorsRules: ionoscloud.S3BucketCorsConfigurationCorsRuleArray{
&ionoscloud.S3BucketCorsConfigurationCorsRuleArgs{
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.Float64(0),
MaxAgeSeconds: pulumi.Float64(0),
},
},
})
var s3bucketCorsConfigurationResource = new S3BucketCorsConfiguration("s3bucketCorsConfigurationResource", S3BucketCorsConfigurationArgs.builder()
.bucket("string")
.corsRules(S3BucketCorsConfigurationCorsRuleArgs.builder()
.allowedMethods("string")
.allowedOrigins("string")
.allowedHeaders("string")
.exposeHeaders("string")
.id(0)
.maxAgeSeconds(0)
.build())
.build());
s3bucket_cors_configuration_resource = ionoscloud.S3BucketCorsConfiguration("s3bucketCorsConfigurationResource",
bucket="string",
cors_rules=[{
"allowed_methods": ["string"],
"allowed_origins": ["string"],
"allowed_headers": ["string"],
"expose_headers": ["string"],
"id": 0,
"max_age_seconds": 0,
}])
const s3bucketCorsConfigurationResource = new ionoscloud.S3BucketCorsConfiguration("s3bucketCorsConfigurationResource", {
bucket: "string",
corsRules: [{
allowedMethods: ["string"],
allowedOrigins: ["string"],
allowedHeaders: ["string"],
exposeHeaders: ["string"],
id: 0,
maxAgeSeconds: 0,
}],
});
type: ionoscloud:S3BucketCorsConfiguration
properties:
bucket: string
corsRules:
- allowedHeaders:
- string
allowedMethods:
- string
allowedOrigins:
- string
exposeHeaders:
- string
id: 0
maxAgeSeconds: 0
S3BucketCorsConfiguration 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 S3BucketCorsConfiguration resource accepts the following input properties:
- Bucket string
- [string] The name of the bucket where the object will be stored.
- Cors
Rules List<S3BucketCors Configuration Cors Rule> - [block] A block of cors_rule as defined below.
- Bucket string
- [string] The name of the bucket where the object will be stored.
- Cors
Rules []S3BucketCors Configuration Cors Rule Args - [block] A block of cors_rule as defined below.
- bucket String
- [string] The name of the bucket where the object will be stored.
- cors
Rules List<S3BucketCors Configuration Cors Rule> - [block] A block of cors_rule as defined below.
- bucket string
- [string] The name of the bucket where the object will be stored.
- cors
Rules S3BucketCors Configuration Cors Rule[] - [block] A block of cors_rule as defined below.
- bucket str
- [string] The name of the bucket where the object will be stored.
- cors_
rules Sequence[S3BucketCors Configuration Cors Rule Args] - [block] A block of cors_rule as defined below.
- bucket String
- [string] The name of the bucket where the object will be stored.
- cors
Rules List<Property Map> - [block] A block of cors_rule as defined below.
Outputs
All input properties are implicitly available as output properties. Additionally, the S3BucketCorsConfiguration 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 S3BucketCorsConfiguration Resource
Get an existing S3BucketCorsConfiguration 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?: S3BucketCorsConfigurationState, opts?: CustomResourceOptions): S3BucketCorsConfiguration
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bucket: Optional[str] = None,
cors_rules: Optional[Sequence[S3BucketCorsConfigurationCorsRuleArgs]] = None) -> S3BucketCorsConfiguration
func GetS3BucketCorsConfiguration(ctx *Context, name string, id IDInput, state *S3BucketCorsConfigurationState, opts ...ResourceOption) (*S3BucketCorsConfiguration, error)
public static S3BucketCorsConfiguration Get(string name, Input<string> id, S3BucketCorsConfigurationState? state, CustomResourceOptions? opts = null)
public static S3BucketCorsConfiguration get(String name, Output<String> id, S3BucketCorsConfigurationState state, CustomResourceOptions options)
resources: _: type: ionoscloud:S3BucketCorsConfiguration 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.
- Bucket string
- [string] The name of the bucket where the object will be stored.
- Cors
Rules List<S3BucketCors Configuration Cors Rule> - [block] A block of cors_rule as defined below.
- Bucket string
- [string] The name of the bucket where the object will be stored.
- Cors
Rules []S3BucketCors Configuration Cors Rule Args - [block] A block of cors_rule as defined below.
- bucket String
- [string] The name of the bucket where the object will be stored.
- cors
Rules List<S3BucketCors Configuration Cors Rule> - [block] A block of cors_rule as defined below.
- bucket string
- [string] The name of the bucket where the object will be stored.
- cors
Rules S3BucketCors Configuration Cors Rule[] - [block] A block of cors_rule as defined below.
- bucket str
- [string] The name of the bucket where the object will be stored.
- cors_
rules Sequence[S3BucketCors Configuration Cors Rule Args] - [block] A block of cors_rule as defined below.
- bucket String
- [string] The name of the bucket where the object will be stored.
- cors
Rules List<Property Map> - [block] A block of cors_rule as defined below.
Supporting Types
S3BucketCorsConfigurationCorsRule, S3BucketCorsConfigurationCorsRuleArgs
- Allowed
Methods List<string> - [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
- Allowed
Origins List<string> - [list] Specifies which origins are allowed to make requests to the resource.
- Allowed
Headers List<string> - [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
- Expose
Headers List<string> - [list] Specifies which headers are exposed to the browser.
- Id double
[int] Container for the Contract Number of the owner
Days and years are mutually exclusive. You can only specify one of them.
- Max
Age doubleSeconds - [int] Specifies how long the results of a pre-flight request can be cached in seconds.
- Allowed
Methods []string - [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
- Allowed
Origins []string - [list] Specifies which origins are allowed to make requests to the resource.
- Allowed
Headers []string - [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
- Expose
Headers []string - [list] Specifies which headers are exposed to the browser.
- Id float64
[int] Container for the Contract Number of the owner
Days and years are mutually exclusive. You can only specify one of them.
- Max
Age float64Seconds - [int] Specifies how long the results of a pre-flight request can be cached in seconds.
- allowed
Methods List<String> - [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
- allowed
Origins List<String> - [list] Specifies which origins are allowed to make requests to the resource.
- allowed
Headers List<String> - [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
- expose
Headers List<String> - [list] Specifies which headers are exposed to the browser.
- id Double
[int] Container for the Contract Number of the owner
Days and years are mutually exclusive. You can only specify one of them.
- max
Age DoubleSeconds - [int] Specifies how long the results of a pre-flight request can be cached in seconds.
- allowed
Methods string[] - [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
- allowed
Origins string[] - [list] Specifies which origins are allowed to make requests to the resource.
- allowed
Headers string[] - [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
- expose
Headers 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.
- max
Age numberSeconds - [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 float
[int] Container for the Contract Number of the owner
Days and years are mutually exclusive. You can only specify one of them.
- max_
age_ floatseconds - [int] Specifies how long the results of a pre-flight request can be cached in seconds.
- allowed
Methods List<String> - [list] An HTTP method that you allow the origin to execute. Valid values are GET, PUT, HEAD, POST, DELETE.
- allowed
Origins List<String> - [list] Specifies which origins are allowed to make requests to the resource.
- allowed
Headers List<String> - [list] Specifies which headers are allowed in a preflight OPTIONS request through the Access-Control-Request-Headers header
- expose
Headers 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.
- max
Age NumberSeconds - [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:index/s3BucketCorsConfiguration:S3BucketCorsConfiguration example example
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- ionoscloud ionos-cloud/terraform-provider-ionoscloud
- License
- Notes
- This Pulumi package is based on the
ionoscloud
Terraform Provider.