Skip to content

Commit 624ed85

Browse files
committed
add and correct documentation
1 parent 62dfb95 commit 624ed85

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

docs/resources/object.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ The following arguments are supported:
4949

5050
* `metadata` - (Optional) Map of metadata used for the object (keys must be lowercase).
5151

52+
* `content_type` - (Optional) The standard MIME type of the object's content (e.g., 'application/json', 'text/plain'). This specifies how the object should be interpreted by clients. See RFC 9110: https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type
53+
5254
* `tags` - (Optional) Map of tags.
5355

5456
* `sse_customer_key` - (Optional) Customer's encryption keys to encrypt data (SSE-C)

docs/resources/object_bucket_website_configuration.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,27 @@ Refer to the [dedicated documentation](https://www.scaleway.com/en/docs/object-s
1212
## Example Usage
1313

1414
```terraform
15-
resource "scaleway_object_bucket" "main" {
16-
name = "MyBucket"
15+
resource "scaleway_object_bucket" "test" {
16+
name = "my-bucket"
1717
acl = "public-read"
1818
}
1919
20-
resource "scaleway_object_bucket_website_configuration" "main" {
21-
bucket = scaleway_object_bucket.main.id
20+
resource scaleway_object "some_file" {
21+
bucket = scaleway_object_bucket.test.name
22+
key = "index.html"
23+
file = "index.html"
24+
visibility = "public-read"
25+
content_type = "text/html"
26+
}
27+
28+
resource "scaleway_object_bucket_website_configuration" "test" {
29+
bucket = scaleway_object_bucket.test.name
2230
index_document {
2331
suffix = "index.html"
2432
}
33+
error_document {
34+
key = "error.html"
35+
}
2536
}
2637
```
2738

internal/services/object/object.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ func ResourceObject() *schema.Resource {
9090
ValidateDiagFunc: validateMapKeyLowerCase(),
9191
},
9292
"content_type": {
93-
Type: schema.TypeString,
94-
Optional: true,
93+
Type: schema.TypeString,
94+
Optional: true,
9595
Description: "The standard MIME type of the object's content (e.g., 'application/json', 'text/plain'). This specifies how the object should be interpreted by clients. See RFC 9110: https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type",
9696
},
9797
"tags": {
@@ -151,13 +151,12 @@ func resourceObjectCreate(ctx context.Context, d *schema.ResourceData, m interfa
151151
storageClassStr := d.Get("storage_class").(string)
152152
storageClass := s3Types.StorageClass(storageClassStr)
153153

154-
155154
req := &s3.PutObjectInput{
156155
Bucket: types.ExpandStringPtr(bucket),
157156
Key: types.ExpandStringPtr(key),
158157
StorageClass: storageClass,
159158
Metadata: types.ExpandMapStringString(d.Get("metadata")),
160-
ContentType: types.ExpandStringPtr(d.Get("content_type")),
159+
ContentType: types.ExpandStringPtr(d.Get("content_type")),
161160
}
162161

163162
visibilityStr := types.ExpandStringPtr(d.Get("visibility").(string))
@@ -258,7 +257,7 @@ func resourceObjectUpdate(ctx context.Context, d *schema.ResourceData, m interfa
258257
StorageClass: s3Types.StorageClass(d.Get("storage_class").(string)),
259258
Metadata: types.ExpandMapStringString(d.Get("metadata")),
260259
ACL: s3Types.ObjectCannedACL(d.Get("visibility").(string)),
261-
ContentType: types.ExpandStringPtr(d.Get("content_type")),
260+
ContentType: types.ExpandStringPtr(d.Get("content_type")),
262261
}
263262

264263
if encryptionKey, ok := d.GetOk("sse_customer_key"); ok {
@@ -292,7 +291,7 @@ func resourceObjectUpdate(ctx context.Context, d *schema.ResourceData, m interfa
292291
CopySource: scw.StringPtr(fmt.Sprintf("%s/%s", bucket, key)),
293292
Metadata: types.ExpandMapStringString(d.Get("metadata")),
294293
ACL: s3Types.ObjectCannedACL(d.Get("visibility").(string)),
295-
ContentType: types.ExpandStringPtr("content_type"),
294+
ContentType: types.ExpandStringPtr("content_type"),
296295
}
297296

298297
if encryptionKey, ok := d.GetOk("sse_customer_key"); ok {

0 commit comments

Comments
 (0)