Skip to content

Commit 50965af

Browse files
authored
feat: add bucket versioning support, prepare v0.3.0 (#41)
Implements #40
1 parent f0c23cb commit 50965af

20 files changed

+576
-102
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
55

66
## [Unreleased]
77

8+
## [0.3.0]
9+
10+
### Added:
11+
12+
- objsto_bucket_versioning resource for configuring bucket versioning settings.
13+
- objsto_object: `version_id` attribute to store the version ID of the object.
14+
815
## [0.2.2]
916

1017
### Fixed
@@ -36,7 +43,8 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
3643

3744
- Minimal implementation of bucket, bucket policy, bucket lifecycle configuration, and object resources.
3845

39-
[Unreleased]: https://github.com/UpCloudLtd/terraform-provider-upcloud/compare/v0.2.2...HEAD
46+
[Unreleased]: https://github.com/UpCloudLtd/terraform-provider-upcloud/compare/v0.3.0...HEAD
47+
[0.3.0]: https://github.com/UpCloudLtd/terraform-provider-upcloud/compare/v0.2.2...v0.3.0
4048
[0.2.2]: https://github.com/UpCloudLtd/terraform-provider-upcloud/compare/v0.2.1...v0.2.2
4149
[0.2.1]: https://github.com/UpCloudLtd/terraform-provider-upcloud/compare/v0.2.0...v0.2.1
4250
[0.2.0]: https://github.com/UpCloudLtd/terraform-provider-upcloud/compare/v0.1.1...v0.2.0

docs/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
# generated by https://github.com/hashicorp/terraform-plugin-docs
33
page_title: "objsto Provider"
4-
subcategory: ""
54
description: |-
65
The objsto provider is used to manage S3 compatible object storage services such as UpCloud Managed Object Storage https://upcloud.com/products/object-storage. The provider manages the resources using the S3 API of the target object storage service.
76
---

docs/resources/bucket_cors_configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "objsto_bucket" "example" {
1717
bucket = "example"
1818
}
1919
20-
resource "objsto_bucket_cors_configuration" "this" {
20+
resource "objsto_bucket_cors_configuration" "example" {
2121
bucket = objsto_bucket.example.bucket
2222
2323
cors_rule {

docs/resources/bucket_lifecycle_configuration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ Optional Attributes:
7373

7474
Blocks:
7575

76-
- `expiration` (Block, Optional) The expiration of the object. (see [below for nested schema](#nestedblock--rule--expiration))
77-
- `filter` (Block, Optional) A filter to select object that the rule applies to. (see [below for nested schema](#nestedblock--rule--filter))
78-
- `noncurrent_version_expiration` (Block, Optional) The expiration of the noncurrent versions of the object. (see [below for nested schema](#nestedblock--rule--noncurrent_version_expiration))
76+
- `expiration` (Block) The expiration of the object. (see [below for nested schema](#nestedblock--rule--expiration))
77+
- `filter` (Block) A filter to select object that the rule applies to. (see [below for nested schema](#nestedblock--rule--filter))
78+
- `noncurrent_version_expiration` (Block) The expiration of the noncurrent versions of the object. (see [below for nested schema](#nestedblock--rule--noncurrent_version_expiration))
7979

8080
<a id="nestedblock--rule--expiration"></a>
8181
### Nested Schema for `rule.expiration`
@@ -98,7 +98,7 @@ Optional Attributes:
9898

9999
Blocks:
100100

101-
- `and` (Block, Optional) A logical AND filter. (see [below for nested schema](#nestedblock--rule--filter--and))
101+
- `and` (Block) A logical AND filter. (see [below for nested schema](#nestedblock--rule--filter--and))
102102

103103
<a id="nestedatt--rule--filter--tag"></a>
104104
### Nested Schema for `rule.filter.tag`
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "objsto_bucket_versioning Resource - objsto"
4+
subcategory: ""
5+
description: |-
6+
A bucket versioning resource. Note that there can only be one versioning configuration per bucket. Deleting this resource will set versioning to suspended.
7+
---
8+
9+
# objsto_bucket_versioning (Resource)
10+
11+
A bucket versioning resource. Note that there can only be one versioning configuration per bucket. Deleting this resource will set versioning to suspended.
12+
13+
## Example Usage
14+
15+
```terraform
16+
resource "objsto_bucket" "example" {
17+
bucket = "example"
18+
}
19+
20+
resource "objsto_bucket_versioning" "example" {
21+
bucket = objsto_bucket.example.bucket
22+
23+
versioning_configuration {
24+
status = "Enabled"
25+
}
26+
}
27+
```
28+
29+
<!-- schema generated by tfplugindocs -->
30+
## Schema
31+
32+
### Required Attributes
33+
34+
- `bucket` (String) The name of the bucket for which to configure versioning.
35+
36+
### Blocks
37+
38+
- `versioning_configuration` (Block) A versioning configuration to apply to the bucket. (see [below for nested schema](#nestedblock--versioning_configuration))
39+
40+
<a id="nestedblock--versioning_configuration"></a>
41+
### Nested Schema for `versioning_configuration`
42+
43+
Required Attributes:
44+
45+
- `status` (String) The versioning status of the bucket.

docs/resources/object.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ resource "objsto_object" "example" {
3939

4040
- `id` (String) The id of the object. The id is in `{bucket}/{key}` format.
4141
- `url` (String) The URL of the object.
42+
- `version_id` (String) The version ID of the object. This is only set if the bucket has versioning enabled.

examples/resources/objsto_bucket_cors_configuration/resource.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ resource "objsto_bucket" "example" {
22
bucket = "example"
33
}
44

5-
resource "objsto_bucket_cors_configuration" "this" {
5+
resource "objsto_bucket_cors_configuration" "example" {
66
bucket = objsto_bucket.example.bucket
77

88
cors_rule {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
resource "objsto_bucket" "example" {
2+
bucket = "example"
3+
}
4+
5+
resource "objsto_bucket_versioning" "example" {
6+
bucket = objsto_bucket.example.bucket
7+
8+
versioning_configuration {
9+
status = "Enabled"
10+
}
11+
}

internal/provider/bucket_cors_configuration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func TestAccBucketCORSConfigurationResource(t *testing.T) {
9292
),
9393
}
9494

95-
resource.Test(t, resource.TestCase{
95+
resource.ParallelTest(t, resource.TestCase{
9696
PreCheck: func() { testAccPreCheck(t) },
9797
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
9898
Steps: []resource.TestStep{

internal/provider/bucket_lifecycle_configuration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func TestAccBucketLifecycleConfigurationResource(t *testing.T) {
1313
"bucket_name": config.StringVariable(bucket_name),
1414
}
1515

16-
resource.Test(t, resource.TestCase{
16+
resource.ParallelTest(t, resource.TestCase{
1717
PreCheck: func() { testAccPreCheck(t) },
1818
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
1919
Steps: []resource.TestStep{

0 commit comments

Comments
 (0)