Skip to content

Commit 8435566

Browse files
authored
Static SANs must be a list (#14)
1 parent 5753bab commit 8435566

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.4.1
2+
3+
BUG FIXES:
4+
* smallstep_workload.static_sans is a list of strings not a set since the first is used as the Common Name.
5+
16
## 0.4.0
27

38
FEATURES:

docs/resources/workload.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ resource "smallstep_workload" "redis" {
9191
For example, if the device instance data in the collection is `{"internal_host": "foo.internal", "external_host", "foo.example.com"}` at the time the workload certificate is issued and this field is set to `["internal_host", "external_host"]`, then the certificate would include the SANs `foo.internal` and `foo.example.com`.
9292
- `hooks` (Attributes) The collection of commands to run when a certificate for a managed endpoint is signed or renewed. (see [below for nested schema](#nestedatt--hooks))
9393
- `reload_info` (Attributes) The properties used to reload a service. (see [below for nested schema](#nestedatt--reload_info))
94-
- `static_sans` (Set of String) SANs that will be added to every certificate issued for this workload. The first will be used as the default Common Name.
94+
- `static_sans` (List of String) SANs that will be added to every certificate issued for this workload. The first will be used as the default Common Name.
9595

9696
### Read-Only
9797

internal/provider/workload/model.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type Model struct {
2828
Hooks types.Object `tfsdk:"hooks"`
2929
AdminEmails types.Set `tfsdk:"admin_emails"`
3030
DeviceMetadataKeySANs types.Set `tfsdk:"device_metadata_key_sans"`
31-
StaticSANs types.Set `tfsdk:"static_sans"`
31+
StaticSANs types.List `tfsdk:"static_sans"`
3232
}
3333

3434
func fromAPI(ctx context.Context, workload *v20230301.Workload, state utils.AttributeGetter) (*Model, diag.Diagnostics) {
@@ -72,7 +72,7 @@ func fromAPI(ctx context.Context, workload *v20230301.Workload, state utils.Attr
7272
},
7373
}
7474

75-
model.StaticSANs, d = utils.ToOptionalSet(ctx, workload.StaticSANs, state, path.Root("static_sans"))
75+
model.StaticSANs, d = utils.ToOptionalList(ctx, workload.StaticSANs, state, path.Root("static_sans"))
7676
diags.Append(d...)
7777
if diags.HasError() {
7878
return nil, diags

internal/provider/workload/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func (r *Resource) Schema(ctx context.Context, req resource.SchemaRequest, resp
208208
setplanmodifier.UseStateForUnknown(),
209209
},
210210
},
211-
"static_sans": schema.SetAttribute{
211+
"static_sans": schema.ListAttribute{
212212
MarkdownDescription: props["staticSANs"],
213213
ElementType: types.StringType,
214214
Optional: true,

0 commit comments

Comments
 (0)