diff --git a/docs/data-sources/sos_bucket_policy.md b/docs/data-sources/sos_bucket_policy.md new file mode 100644 index 00000000..5040c4f9 --- /dev/null +++ b/docs/data-sources/sos_bucket_policy.md @@ -0,0 +1,41 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "exoscale_sos_bucket_policy Data Source - terraform-provider-exoscale" +subcategory: "" +description: |- + Fetch Exoscale SOS Bucket Policies https://community.exoscale.com/documentation/storage/bucketpolicy/. +--- + +# exoscale_sos_bucket_policy (Data Source) + +Fetch Exoscale [SOS Bucket Policies](https://community.exoscale.com/documentation/storage/bucketpolicy/). + + + + +## Schema + +### Required + +- `bucket` (String) The name of the bucket to which the policy is to be applied. +- `zone` (String) The Exoscale [Zone](https://www.exoscale.com/datacenters/) name. + +### Optional + +- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + +### Read-Only + +- `policy` (String) The content of the policy + + +### Nested Schema for `timeouts` + +Optional: + +- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). +- `delete` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs. +- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled. +- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). + + diff --git a/docs/resources/sos_bucket_policy.md b/docs/resources/sos_bucket_policy.md new file mode 100644 index 00000000..e42bf75e --- /dev/null +++ b/docs/resources/sos_bucket_policy.md @@ -0,0 +1,40 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "exoscale_sos_bucket_policy Resource - terraform-provider-exoscale" +subcategory: "" +description: |- + Manage Exoscale SOS Bucket Policies https://community.exoscale.com/documentation/storage/bucketpolicy/. +--- + +# exoscale_sos_bucket_policy (Resource) + +Manage Exoscale [SOS Bucket Policies](https://community.exoscale.com/documentation/storage/bucketpolicy/). + + + + +## Schema + +### Required + +- `bucket` (String) ❗ The name of the bucket to which the policy is to be applied. +- `policy` (String) The content of the policy +- `zone` (String) ❗ The Exoscale [Zone](https://www.exoscale.com/datacenters/) name. + +### Optional + +- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) + + +### Nested Schema for `timeouts` + +Optional: + +- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). +- `delete` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs. +- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled. +- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). + +-> The symbol ❗ in an attribute indicates that modifying it, will force the creation of a new resource. + + diff --git a/pkg/resources/sos_bucket_policy/attributes.go b/pkg/resources/sos_bucket_policy/attributes.go index 71d0cbd5..0030cdb4 100644 --- a/pkg/resources/sos_bucket_policy/attributes.go +++ b/pkg/resources/sos_bucket_policy/attributes.go @@ -6,5 +6,5 @@ const ( AttrPolicy = "policy" attrPolicyDescription = "The content of the policy" AttrZone = "zone" - attrZoneDescription = "❗ The Exoscale [Zone](https://www.exoscale.com/datacenters/) name." + attrZoneDescription = "The Exoscale [Zone](https://www.exoscale.com/datacenters/) name." ) diff --git a/pkg/resources/sos_bucket_policy/resource.go b/pkg/resources/sos_bucket_policy/resource.go index 72f655cb..04f32cd3 100644 --- a/pkg/resources/sos_bucket_policy/resource.go +++ b/pkg/resources/sos_bucket_policy/resource.go @@ -60,7 +60,7 @@ func (r *ResourceSOSBucketPolicy) Schema(ctx context.Context, req resource.Schem MarkdownDescription: ResourceSOSBucketPolicyDescription, Attributes: map[string]schema.Attribute{ AttrBucket: schema.StringAttribute{ - Description: attrBucketDescription, + Description: "❗ " + attrBucketDescription, Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), @@ -72,7 +72,7 @@ func (r *ResourceSOSBucketPolicy) Schema(ctx context.Context, req resource.Schem Required: true, }, AttrZone: schema.StringAttribute{ - MarkdownDescription: attrZoneDescription, + MarkdownDescription: "❗ " + attrZoneDescription, Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), @@ -107,7 +107,7 @@ func (r *ResourceSOSBucketPolicy) NewSOSClient(ctx context.Context, zone string) func pollBucket(ctx context.Context, sosClient *s3.Client, bucket string) error { var err error = nil - for _ = range 10 { + for range 10 { time.Sleep(500 * time.Millisecond) if _, err = sosClient.GetBucketPolicy(ctx, &s3.GetBucketPolicyInput{ Bucket: &bucket,