Skip to content

Commit 83047e8

Browse files
committed
fix(cert): certificate resouurces now allow for collection ID to be specified.
1 parent 5a95276 commit 83047e8

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

GNUmakefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ NAMESPACE=keyfactor
66
WEBSITE_REPO=https://github.com/Keyfactor/terraform-provider-keyfactor
77
NAME=keyfactor
88
BINARY=terraform-provider-${NAME}
9-
VERSION=1.3.0-rc1
9+
VERSION=1.3.0
1010
OS_ARCH := $(shell go env GOOS)_$(shell go env GOARCH)
1111
BASEDIR := ~/.terraform.d/plugins
1212
INSTALLDIR := ${BASEDIR}/${HOSTNAME}/${NAMESPACE}/${NAME}/${VERSION}/${OS_ARCH}
@@ -68,9 +68,9 @@ vendor:
6868
go mod vendor
6969

7070
tag:
71-
git tag -d $(VERSION) || true
72-
git push origin $(VERSION) || true
73-
git tag $(VERSION) || true
74-
git push origin $(VERSION) || true
71+
git tag -d v$(VERSION) || true
72+
git push origin v$(VERSION) || true
73+
git tag v$(VERSION) || true
74+
git push origin v$(VERSION) || true
7575

7676
.PHONY: build release install test testacc fmtcheck fmt tag setversion vendor

docs/resources/certificate.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ resource "keyfactor_certificate" "kf_csr_cert" {
8989

9090
### Optional
9191

92+
- `collection_id` (Number) Optional certificate collection identifier used to ensure user access to the certificate.
9293
- `csr` (String) Base-64 encoded certificate signing request (CSR)
9394
- `dns_sans` (List of String) List of DNS names to use as subjects of the certificate
9495
- `ip_sans` (List of String) List of DNS names to use as subjects of the certificate

keyfactor/resource_keyfactor_certificate.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ func (r resourceKeyfactorCertificateType) GetSchema(_ context.Context) (tfsdk.Sc
152152
Computed: true,
153153
Description: "Keyfactor certificate ID",
154154
},
155+
"collection_id": {
156+
Type: types.Int64Type,
157+
Required: false,
158+
Optional: true,
159+
Description: "Optional certificate collection identifier used to ensure user access to the certificate.",
160+
},
155161
"keyfactor_request_id": {
156162
Type: types.Int64Type,
157163
Computed: true,
@@ -284,6 +290,7 @@ func (r resourceKeyfactorCertificate) Create(ctx context.Context, request tfsdk.
284290
CertificateTemplate: plan.CertificateTemplate,
285291
RequestId: types.Int64{Value: int64(enrollResponse.CertificateInformation.KeyfactorRequestID)},
286292
Metadata: plan.Metadata,
293+
CollectionId: plan.CollectionId,
287294
}
288295

289296
diags = response.State.Set(ctx, result)
@@ -360,6 +367,7 @@ func (r resourceKeyfactorCertificate) Create(ctx context.Context, request tfsdk.
360367
CertificateTemplate: plan.CertificateTemplate,
361368
RequestId: types.Int64{Value: int64(enrollResponse.CertificateInformation.KeyfactorRequestID)},
362369
Metadata: plan.Metadata,
370+
CollectionId: plan.CollectionId,
363371
}
364372

365373
diags = response.State.Set(ctx, result)

main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ func main() {
3131
flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve")
3232
flag.Parse()
3333

34+
address := "github.com/keyfactor-pub/keyfactor"
35+
if debug {
36+
address = "keyfactor.com/keyfactor/keyfactor"
37+
}
3438
opts := providerserver.ServeOpts{
35-
Address: "keyfactor.com/keyfactor-pub/keyfactor",
39+
Address: address,
3640
Debug: debug,
3741
ProtocolVersion: 6,
3842
}

0 commit comments

Comments
 (0)