Skip to content

Commit

Permalink
feat(QCDN-23781): certificate template resource and data source
Browse files Browse the repository at this point in the history
  • Loading branch information
yuv-at-qwilt committed Nov 17, 2024
1 parent 4ef30bb commit 29bd6d3
Show file tree
Hide file tree
Showing 693 changed files with 52,603 additions and 14,657 deletions.
29 changes: 29 additions & 0 deletions examples/playground/qwilt-config-certificate-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Qwilt Basic Resource Example

This is a simple example demonstrating how to configure a single site, site configuration, certificate, and activation resource.

In this example, the host_index JSON configuration is embedded in *main.tf*.

If you prefer to maintain the SVTA configuration in a separate file, remove the embedded host_index, and instead use the reference to *examplesitebasic.json*:

```
host_index = file("./examplesitebasic.json")
```



To use this example:

1. Make sure your QCDN_API_KEY env variable is set. (This is the recommended authentication method.)

For more information on authentication, see the [User Guide](https://docs.qwilt.com/docs/terraform-user-guide#authentication), which also covers alternative methods.

2. Replace the placeholder values with your own specific configuration details.

Replace the example certificate and key values with your own.

3. Apply the configuration:

```
$ terraform apply
```
20 changes: 20 additions & 0 deletions examples/playground/qwilt-config-certificate-template/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
terraform {
required_providers {
qwilt = {
source = "qwilt.com/qwiltinc/qwilt"
}
}
}

provider "qwilt" {
}

resource "qwilt_cdn_certificate_template" "exmaple" {
common_name = "example.com"
auto_managed_certificate_template = true
organization_name = "Qwilt"
locality = "Hod Hasharon"
country = "IL"
state = "Israel"
sans = ["www.example.com"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#variable "token" {
# description = "API Token"
# type = string
# sensitive = true
#}
11 changes: 11 additions & 0 deletions examples/resources/qwilt_cdn_certificate_template/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#Create an empty resource to import into.

#After the import is complete, manually set the required attributes
#in the resource based on the imported state.


resource "qwilt_cdn_certificate_template" "example" {
}

terraform import qwilt_cdn_certificate_template.example <certificate_template_id>
6 changes: 6 additions & 0 deletions examples/resources/qwilt_cdn_certificate_template/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

resource "qwilt_cdn_certificate_template" "example" {
common_name = "example.com"
auto_managed_certificate_template = true
}

24 changes: 12 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ toolchain go1.22.3

require (
github.com/hashicorp/terraform-plugin-docs v0.19.4
github.com/hashicorp/terraform-plugin-framework v1.7.0
github.com/hashicorp/terraform-plugin-go v0.22.1
github.com/hashicorp/terraform-plugin-framework v1.13.0
github.com/hashicorp/terraform-plugin-framework-validators v0.15.0
github.com/hashicorp/terraform-plugin-go v0.25.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-mux v0.15.0
github.com/hashicorp/terraform-plugin-mux v0.17.0
)

require (
Expand Down Expand Up @@ -39,7 +40,7 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.6.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-plugin v1.6.2 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/hc-install v0.7.0 // indirect
Expand Down Expand Up @@ -68,16 +69,15 @@ require (
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/tools v0.18.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.35.1 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
24 changes: 24 additions & 0 deletions qwilt/cdn/api/api_models.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,30 @@ type CertificateUpdateRequest struct {
Description string `json:"description"`
}

type CertificateTemplate struct {
CertificateTemplateID int64 `json:"certificateTemplateId"`
Country *string `json:"country"`
Tenant string `json:"tenant"`
State *string `json:"state"`
Locality *string `json:"locality"`
OrganizationName *string `json:"organizationName"`
CommonName string `json:"commonName"`
SANs []string `json:"sans"`
AutoManagedCertificateTemplate bool `json:"autoManagedCertificateTemplate"`
LastCertificateID *int64 `json:"lastCertificateId"`
CsrIds []int64 `json:"csrIds"`
}

type CertificateTemplateCreateRequest struct {
Country *string `json:"country,omitempty"`
State *string `json:"state,omitempty"`
Locality *string `json:"locality,omitempty"`
OrganizationName *string `json:"organizationName,omitempty"`
CommonName string `json:"commonName"`
SANs []string `json:"sans,omitempty"`
AutoManagedCertificateTemplate bool `json:"autoManagedCertificateTemplate"`
}

// SiteCertificateLinkRequest - Model for requesting a new Link Request
type SiteCertificateLinkRequest struct {
CertificateId string `json:"certificateId"`
Expand Down
Loading

0 comments on commit 29bd6d3

Please sign in to comment.