Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge main into csr #1

Merged
merged 4 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Terraform Provider release workflow.
name: Release

# This GitHub action creates a release when a tag that matches the pattern
# "v*" (e.g. v0.1.0) is created.
on:
push:
tags:
- 'v*'

# Releases need permissions to read and write the repository contents.
# GitHub considers creating releases and uploading assets as writing contents.
permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version-file: 'go.mod'
cache: true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
args: release --clean
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Qwilt Terraform Provider

> Qwilt CDN Terraform provider.
> ⚠️ **Disclaimer**: the project is still in the 0.x.x version, which means it’s still in the experimental phase.

## Requirements

Expand Down
13 changes: 7 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ Interact with Qwilt services.
## Example Usage

```terraform
# Configuration resources are implicitly defining dependencies by using references.
# The implicit order is as follows:
# 1. qwiltcdn_certificate, qwiltcdn_site
# 2. qwiltcdn_site_configuration (implicitly depends-on qwiltcdn_site - by using references)
# 3. qwiltcdn_site_activation (implicitly depends-on qwiltcdn_site_configuration, qwiltcdn_certificate - by using references)

# authentication is supported by methods: login and xapi token
# 1. xapi_token is always the preferred method
# 2. user/password are supported but not recommended and might be deprecated in the near future.
# 3. each of these variables can be replaced with a corresponding env variable:
# - username --> QCDN_USERNAME
# - password --> QCDN_PASSWORD
# - xapi_token --> QCDN_XAPI_TOKEN

provider "qwiltcdn" {
# Specify username, or set env variable QCDN_USERNAME
Expand Down
38 changes: 38 additions & 0 deletions docs/resources/site_activation_staging.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,22 @@ description: |-

Manages a Qwilt CDN site activation and certificate assignment.

## Example Usage

```terraform
#THIS FEATURE IS EXPERIMENTAL AND SHOULD NOT BE USED!

#Notes
#this resource is similar to site_activation resource but activates the selected configuration to staging segment only.
#Note that activation cannot be performed if a previous activation is still in-progress


resource "qwiltcdn_site_activation_staging" "example" {
site_id = qwiltcdn_site_configuration.example.site_id
revision_id = qwiltcdn_site_configuration.example.revision_id
#certificate_id = qwiltcdn_certificate.example.cert_id
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -39,3 +54,26 @@ Manages a Qwilt CDN site activation and certificate assignment.
- `target` (String) The value will always be 'staging'.
- `username` (String) Username that initiated the publishing operation.
- `validators_err_details` (String) Details about errors generated during validation.

## Import

Import is supported using the following syntax:

```shell
#THIS FEATURE IS EXPERIMENTAL AND SHOULD NOT BE USED!

#keep an empty resource to import into
#after import is completed the user should manually set the required attributes in the resource from the imported state file
#it is advised to change site_id and site_id and revision_id attributes with references to qwiltcdn_site_configuration resource to achieve implicit dependency
resource "qwiltcdn_site_activation" "example" {
}

# site_activation_staging can be imported using their site ID, e.g.
terraform import qwiltcdn_site_activation_staging.example <site_id>

# By default, either:
# 1. the active publish operation will be imported
# 2. the latest published operation if no publish is active
# Alternatively, a specific publish_id of the site configuration can be selected by appending an : followed by the publish_id to the site ID, e.g. */
terraform import qwiltcdn_site_activation_staging.example <site_id>:<publish_id>
```
2 changes: 1 addition & 1 deletion examples/playground/qwilt-config-basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ provider "qwiltcdn" {
}

resource "qwiltcdn_site" "example" {
site_name = "Terraform Basic Example Site"
site_name = "Terraform Basic Example Site"
}

resource "qwiltcdn_site_configuration" "example" {
Expand Down
13 changes: 7 additions & 6 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Configuration resources are implicitly defining dependencies by using references.
# The implicit order is as follows:
# 1. qwiltcdn_certificate, qwiltcdn_site
# 2. qwiltcdn_site_configuration (implicitly depends-on qwiltcdn_site - by using references)
# 3. qwiltcdn_site_activation (implicitly depends-on qwiltcdn_site_configuration, qwiltcdn_certificate - by using references)

# authentication is supported by methods: login and xapi token
# 1. xapi_token is always the preferred method
# 2. user/password are supported but not recommended and might be deprecated in the near future.
# 3. each of these variables can be replaced with a corresponding env variable:
# - username --> QCDN_USERNAME
# - password --> QCDN_PASSWORD
# - xapi_token --> QCDN_XAPI_TOKEN

provider "qwiltcdn" {
# Specify username, or set env variable QCDN_USERNAME
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#THIS FEATURE IS EXPERIMENTAL AND SHOULD NOT BE USED!

#keep an empty resource to import into
#after import is completed the user should manually set the required attributes in the resource from the imported state file
#it is advised to change site_id and site_id and revision_id attributes with references to qwiltcdn_site_configuration resource to achieve implicit dependency
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#
#THIS FEATURE IS EXPERIMENTAL AND SHOULD NOT BE USED!

#Notes
#this resource is similar to site_activation resource but activates the selected configuration to staging segment only.
#Note that activation cannot be performed if a previous activation is still in-progress
Expand Down
70 changes: 37 additions & 33 deletions goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- env:
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- -s -w -X "github.com/qwilt/terraform-provider-qwilt/version.ProviderVersion={{.Version}}"
goos:
- linux
- freebsd
- windows
- linux
- darwin

goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
binary: '{{ .ProjectName }}_v{{ .Version }}'
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
# We must pass the --batch flag to indicate to GitHub Actions that its
# not interactive.
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
release:
draft: true
#changelog:
# skip: true