Skip to content

Commit 1502d5e

Browse files
authored
Merge pull request #106 from Backblaze/bump-go-deps
Bump go deps
2 parents c33293e + 2fca542 commit 1502d5e

File tree

17 files changed

+259
-180
lines changed

17 files changed

+259
-180
lines changed

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defaults:
1010

1111
env:
1212
PYTHON_DEFAULT_VERSION: '3.13'
13-
GO_DEFAULT_VERSION: '1.22'
13+
GO_DEFAULT_VERSION: '1.24'
1414
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1515

1616
jobs:

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defaults:
1818

1919
env:
2020
PYTHON_DEFAULT_VERSION: '3.13'
21-
GO_DEFAULT_VERSION: '1.22'
21+
GO_DEFAULT_VERSION: '1.24'
2222

2323
jobs:
2424
lint:

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
### Infrastructure
1414
* Upgrade pyinstaller to 6.11.1
1515
* Use `go vet` for linting
16+
* Use Go 1.24.1
1617

1718
### Fixed
1819
* Fix an issue with missing `content_md5` in case the file has been uploaded as a large file

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Runtime requirements:
1313
- [Terraform](https://www.terraform.io/downloads.html) >= 1.0.0
1414

1515
Development requirements:
16-
- [Go](https://golang.org/doc/install) == 1.22
16+
- [Go](https://golang.org/doc/install) == 1.24
1717
- [Python](https://github.com/pyenv/pyenv) == 3.13
1818

1919
Dependencies
@@ -64,7 +64,7 @@ Debugging
6464
---------
6565

6666
Set TF_LOG_PROVIDER and TF_LOG_PATH env variables to see detailed information from the provider.
67-
Check https://www.terraform.io/docs/internals/debugging.html for details
67+
Check https://www.terraform.io/docs/internals/debugging.html for details
6868

6969
Release History
7070
-----------------

b2/provider.go

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
package b2
1212

1313
import (
14+
"bytes"
1415
"context"
1516
"fmt"
17+
"strings"
1618

1719
"github.com/hashicorp/terraform-plugin-log/tflog"
1820
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
@@ -24,10 +26,62 @@ func init() {
2426

2527
schema.SchemaDescriptionBuilder = func(s *schema.Schema) string {
2628
desc := s.Description
27-
if s.Default != nil {
28-
desc += fmt.Sprintf(" Defaults to `%v`.", s.Default)
29+
desc = strings.TrimSpace(desc)
30+
31+
if !bytes.HasSuffix([]byte(desc), []byte(".")) && desc != "" {
32+
desc += "."
33+
}
34+
35+
if s.Default != nil || s.DefaultFunc != nil {
36+
if s.DefaultFunc != nil {
37+
val, err := s.DefaultFunc()
38+
if err == nil && val != nil {
39+
desc += fmt.Sprintf(" Defaults to `%v`.", val)
40+
}
41+
} else if s.Default == "" {
42+
desc += " Defaults to `\"\"`."
43+
} else {
44+
desc += fmt.Sprintf(" Defaults to `%v`.", s.Default)
45+
}
46+
}
47+
48+
if s.RequiredWith != nil && len(s.RequiredWith) > 0 {
49+
requiredWith := make([]string, len(s.RequiredWith))
50+
for i, c := range s.RequiredWith {
51+
requiredWith[i] = fmt.Sprintf("`%s`", c)
52+
}
53+
desc += fmt.Sprintf(" Required when using %s.", strings.Join(requiredWith, ", "))
54+
}
55+
56+
if s.ConflictsWith != nil && len(s.ConflictsWith) > 0 {
57+
conflicts := make([]string, len(s.ConflictsWith))
58+
for i, c := range s.ConflictsWith {
59+
conflicts[i] = fmt.Sprintf("`%s`", c)
60+
}
61+
desc += fmt.Sprintf(" Conflicts with %s.", strings.Join(conflicts, ", "))
62+
}
63+
64+
if s.ExactlyOneOf != nil && len(s.ExactlyOneOf) > 0 {
65+
exactlyOneOfs := make([]string, len(s.ExactlyOneOf))
66+
for i, c := range s.ExactlyOneOf {
67+
exactlyOneOfs[i] = fmt.Sprintf("`%s`", c)
68+
}
69+
desc += fmt.Sprintf(" Must provide only one of %s.", strings.Join(exactlyOneOfs, ", "))
70+
}
71+
72+
if s.AtLeastOneOf != nil && len(s.AtLeastOneOf) > 0 {
73+
atLeastOneOfs := make([]string, len(s.AtLeastOneOf))
74+
for i, c := range s.AtLeastOneOf {
75+
atLeastOneOfs[i] = fmt.Sprintf("`%s`", c)
76+
}
77+
desc += fmt.Sprintf(" Must provide at least one of %s.", strings.Join(atLeastOneOfs, ", "))
2978
}
30-
return desc
79+
80+
if s.ForceNew {
81+
desc += " **Modifying this attribute will force creation of a new resource.**"
82+
}
83+
84+
return strings.TrimSpace(desc)
3185
}
3286
}
3387

@@ -51,7 +105,7 @@ func New(version string, exec string) func() *schema.Provider {
51105
},
52106
"endpoint": {
53107
Description: "B2 endpoint - the string 'production' or a custom B2 API URL (B2_ENDPOINT env)." +
54-
" Defaults to 'production'. You should not need to set this unless you work at Backblaze.",
108+
" You should not need to set this unless you work at Backblaze.",
55109
Type: schema.TypeString,
56110
Optional: true,
57111
DefaultFunc: schema.EnvDefaultFunc("B2_ENDPOINT", "production"),

b2/templates.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func getDataSourceCorsRulesElem() *schema.Resource {
108108
Computed: true,
109109
},
110110
"allowed_origins": {
111-
Description: "A non-empty list specifying which origins the rule covers. ",
111+
Description: "A non-empty list specifying which origins the rule covers.",
112112
Type: schema.TypeList,
113113
Elem: &schema.Schema{
114114
Type: schema.TypeString,

docs/data-sources/bucket_file_signed_url.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ B2 signed URL for a bucket file data source.
2222

2323
### Optional
2424

25-
- `duration` (Number) The duration for which the presigned URL is valid
25+
- `duration` (Number) The duration for which the presigned URL is valid.
2626

2727
### Read-Only
2828

2929
- `id` (String) The ID of this resource.
30-
- `signed_url` (String) The signed URL for the given file
30+
- `signed_url` (String) The signed URL for the given file.

docs/index.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
page_title: "B2 Provider"
3-
subcategory: ""
43
description: |-
54
65
---
@@ -40,6 +39,6 @@ resource "b2_bucket" "example_bucket" {
4039

4140
### Optional
4241

43-
- `application_key` (String, Sensitive) B2 Application Key (B2_APPLICATION_KEY env)
44-
- `application_key_id` (String, Sensitive) B2 Application Key ID (B2_APPLICATION_KEY_ID env)
45-
- `endpoint` (String) B2 endpoint - the string 'production' or a custom B2 API URL (B2_ENDPOINT env). Defaults to 'production'. You should not need to set this unless you work at Backblaze.
42+
- `application_key` (String, Sensitive) B2 Application Key (B2_APPLICATION_KEY env).
43+
- `application_key_id` (String, Sensitive) B2 Application Key ID (B2_APPLICATION_KEY_ID env).
44+
- `endpoint` (String) B2 endpoint - the string 'production' or a custom B2 API URL (B2_ENDPOINT env). You should not need to set this unless you work at Backblaze. Defaults to `production`.

docs/resources/application_key.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ B2 application key resource.
1717

1818
### Required
1919

20-
- `capabilities` (Set of String) A set of strings, each one naming a capability the key has.
21-
- `key_name` (String) The name of the key.
20+
- `capabilities` (Set of String) A set of strings, each one naming a capability the key has. **Modifying this attribute will force creation of a new resource.**
21+
- `key_name` (String) The name of the key. **Modifying this attribute will force creation of a new resource.**
2222

2323
### Optional
2424

25-
- `bucket_id` (String) When present, restricts access to one bucket.
26-
- `name_prefix` (String) When present, restricts access to files whose names start with the prefix.
25+
- `bucket_id` (String) When present, restricts access to one bucket. **Modifying this attribute will force creation of a new resource.**
26+
- `name_prefix` (String) When present, restricts access to files whose names start with the prefix. Required when using `bucket_id`. **Modifying this attribute will force creation of a new resource.**
2727

2828
### Read-Only
2929

docs/resources/bucket.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ B2 bucket resource.
1717

1818
### Required
1919

20-
- `bucket_name` (String) The name of the bucket.
20+
- `bucket_name` (String) The name of the bucket. **Modifying this attribute will force creation of a new resource.**
2121
- `bucket_type` (String) The bucket type. Either 'allPublic', meaning that files in this bucket can be downloaded by anybody, or 'allPrivate'.
2222

2323
### Optional
@@ -66,8 +66,8 @@ Optional:
6666

6767
Optional:
6868

69-
- `default_retention` (Block List, Max: 1) Default retention settings for files uploaded to this bucket (see [below for nested schema](#nestedblock--file_lock_configuration--default_retention))
70-
- `is_file_lock_enabled` (Boolean) If present, the boolean value specifies whether bucket is File Lock-enabled. Defaults to `false`.
69+
- `default_retention` (Block List, Max: 1) Default retention settings for files uploaded to this bucket. (see [below for nested schema](#nestedblock--file_lock_configuration--default_retention))
70+
- `is_file_lock_enabled` (Boolean) If present, the boolean value specifies whether bucket is File Lock-enabled. Defaults to `false`. **Modifying this attribute will force creation of a new resource.**
7171

7272
<a id="nestedblock--file_lock_configuration--default_retention"></a>
7373
### Nested Schema for `file_lock_configuration.default_retention`
@@ -78,15 +78,15 @@ Required:
7878

7979
Optional:
8080

81-
- `period` (Block List, Max: 1) How long for to make files immutable (see [below for nested schema](#nestedblock--file_lock_configuration--default_retention--period))
81+
- `period` (Block List, Max: 1) How long for to make files immutable. (see [below for nested schema](#nestedblock--file_lock_configuration--default_retention--period))
8282

8383
<a id="nestedblock--file_lock_configuration--default_retention--period"></a>
8484
### Nested Schema for `file_lock_configuration.default_retention.period`
8585

8686
Required:
8787

88-
- `duration` (Number) Duration
89-
- `unit` (String) Unit for duration (days|years)
88+
- `duration` (Number) Duration.
89+
- `unit` (String) Unit for duration (days|years).
9090

9191

9292

0 commit comments

Comments
 (0)