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

Release/v1.9.1 #60

Merged
merged 10 commits into from
Sep 26, 2023
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Release Notes

## Version 1.9.1 (September 26, 2023)

### Bug fixes

* CPS
* Fixed nil pointer evaluating *cps.DNSNameSettings.CloneDNSNames ([#52](https://github.com/akamai/cli-terraform/issues/52))

* Identity and Access Management (IAM)
* Fixed newline escaping in `description` field after exporting a role

* PAPI
* Add missing fields to `akamai_property_builder` for `origin` and `siteShield` behaviors

## Version 1.9.0 (August 29, 2023)

### Features/Enhancements
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $(BIN)/tflint: $(BIN) ; $(info $(M) Installing tflint...)
curl -sSfL https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash

GOLANGCILINT = $(BIN)/golangci-lint
GOLANGCI_LINT_VERSION = v1.50.1
GOLANGCI_LINT_VERSION = v1.52.2
$(BIN)/golangci-lint: ; $(info $(M) Installing golangci-lint...)
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BIN) $(GOLANGCI_LINT_VERSION)

Expand Down Expand Up @@ -116,4 +116,4 @@ clean-tools: ## Cleanup installed packages
help: ## List all make targets
echo $(MAKEFILE_LIST)
@grep -E '^[ a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.0-experimental
# This script was copied from 'terraform-provider-akamai'
FROM golang:1.18-alpine3.16
FROM golang:1.20-alpine3.18
ENV PROVIDER_VERSION="1.0.0" \
GO111MODULE="on" \
CGO_ENABLED=0 \
Expand Down
2 changes: 1 addition & 1 deletion cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"commands": [
{
"name": "terraform",
"version": "1.9.0",
"version": "1.9.1",
"description": "Administer and Manage Akamai Terraform configurations",
"bin": "https://github.com/akamai/cli-terraform/releases/download/v{{.Version}}/akamai-{{.Name}}-{{.Version}}-{{.OS}}{{.Arch}}{{.BinSuffix}}",
"auto-complete": true,
Expand Down
2 changes: 1 addition & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (

var (
// Version holds current version of cli-terraform
Version = "1.9.0"
Version = "1.9.1"
)

// Run initializes the cli and runs it
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ module github.com/akamai/cli-terraform
go 1.18

require (
github.com/akamai/AkamaiOPEN-edgegrid-golang/v7 v7.2.1
github.com/akamai/AkamaiOPEN-edgegrid-golang/v7 v7.3.0
github.com/akamai/cli v1.5.5
github.com/fatih/color v1.13.0
github.com/hashicorp/hcl/v2 v2.11.1
github.com/jinzhu/copier v0.4.0
github.com/shirou/gopsutil v2.20.4+incompatible
github.com/stretchr/testify v1.8.0
github.com/tj/assert v0.0.3
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDO
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8=
github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
github.com/akamai/AkamaiOPEN-edgegrid-golang/v7 v7.2.1 h1:amPKOiXDgUXQcSMMg0XXvOZkF9sQcffZXZrZT4VJ3z0=
github.com/akamai/AkamaiOPEN-edgegrid-golang/v7 v7.2.1/go.mod h1:zZWAMUwE4q5sVPgnjz9jiqtXA01tM3m9HYd6Wk0ev90=
github.com/akamai/AkamaiOPEN-edgegrid-golang/v7 v7.3.0 h1:eiPKdmGPXJCfnavOVhJ2vNDHwNilLzdXfn/CqnPmfZ4=
github.com/akamai/AkamaiOPEN-edgegrid-golang/v7 v7.3.0/go.mod h1:+8Nc6CkB/hiTEvoxxZwvY3whU5QsXxW4RhSARTMnAfI=
github.com/akamai/cli v1.5.5 h1:XKubVW8WOVP8qcgJRK2MOj8HeqC4kudvSOM0m8mJsj0=
github.com/akamai/cli v1.5.5/go.mod h1:29wClp63PEEkpDLxtqM/JrVmnwOCSaE+itIJjCAIECE=
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129 h1:MzBOUgng9orim59UnfUTLRjMpd09C5uEVQ6RPGeCaVI=
Expand Down Expand Up @@ -62,6 +62,8 @@ github.com/hashicorp/hcl/v2 v2.11.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oay
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec h1:qv2VnGeEQHchGaZ/u7lxST/RaJw+cv273q79D81Xbog=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0=
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
Expand Down
13 changes: 13 additions & 0 deletions pkg/providers/cps/create_cps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/akamai/AkamaiOPEN-edgegrid-golang/v7/pkg/tools"
"github.com/akamai/cli-terraform/pkg/templates"
"github.com/akamai/cli/pkg/terminal"
"github.com/jinzhu/copier"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -491,6 +492,18 @@ func TestCreateCPS(t *testing.T) {
dataDir: "dv_enrollment_min",
filesToCheck: []string{"enrollment.tf", "import.sh", "variables.tf"},
},
"export DV enrollment without DNSNameSettings": {
init: func(m *cps.Mock) {
var enrollment cps.Enrollment
_ = copier.CopyWithOption(&enrollment, enrollmentDVMin, copier.Option{DeepCopy: true})
enrollment.NetworkConfiguration.DNSNameSettings = nil
expectGetEnrollment(m, 1, enrollment, nil).Once()
},
enrollmentID: 1,
contractID: "ctr_1",
dataDir: "dv_enrollment_min",
filesToCheck: []string{"enrollment.tf", "import.sh", "variables.tf"},
},
"export DV enrollment": {
init: func(m *cps.Mock) {
expectGetEnrollment(m, 1, enrollmentDVAll, nil).Once()
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/cps/templates/enrollment.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ provider "akamai" {
{{- if .DisallowedTLSVersions}}
disallowed_tls_versions = [{{range .DisallowedTLSVersions}}"{{.}}",{{end}}]
{{- end}}
{{- if .DNSNameSettings.CloneDNSNames}}
{{- if and .DNSNameSettings .DNSNameSettings.CloneDNSNames}}
clone_dns_names = {{.DNSNameSettings.CloneDNSNames}}
{{- end}}
geography = "{{.Geography}}"
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/iam/create_iam_role_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ func TestProcessIAMRoleTemplates(t *testing.T) {
{
RoleID: 12345,
RoleName: "Custom role",
RoleDescription: "Custom role description",
RoleDescription: "Custom role\ndescription",
GrantedRoles: []int{992, 707, 452, 677, 726, 296, 457, 987},
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/iam/templates/roles.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{{- range .TFRoles -}}
resource "akamai_iam_role" "role_id_{{.RoleID}}" {
name = "{{.RoleName}}"
description = "{{.RoleDescription}}"
description = "{{escape .RoleDescription}}"
granted_roles = {{formatIntList .GrantedRoles}}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/iam/testdata/iam_role_by_id_basic/role.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ provider "akamai" {

resource "akamai_iam_role" "role_id_12345" {
name = "Custom role"
description = "Custom role description"
description = "Custom role\ndescription"
granted_roles = [992, 707, 452, 677, 726, 296, 457, 987]
}

2 changes: 1 addition & 1 deletion pkg/providers/papi/templates/includes.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
akamai = {
source = "akamai/akamai"
version = ">= 3.2.0"
version = ">= 5.3.0"
}
}
required_version = ">= 0.13"
Expand Down
2 changes: 1 addition & 1 deletion pkg/providers/papi/templates/property.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ terraform {
required_providers {
akamai = {
source = "akamai/akamai"
version = ">= 5.0.0"
version = ">= 5.3.0"
}
}
required_version = ">= 0.13"
Expand Down
175 changes: 171 additions & 4 deletions pkg/providers/papi/templates/rules_v2023-01-05.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -5439,12 +5439,91 @@ origin {
{{- range $v := $v}}
custom_certificate_authorities {
{{- range $k, $v := $v}}
{{- if and (eq $k "pemEncodedCert") (ne $v nil)}}
pem_encoded_cert = {{template "Text" $v}}
{{- if and (eq $k "subjectCN") (ne $v nil)}}
subject_cn = {{template "Text" $v}}
{{- end}}
{{- if eq $k "subjectAlternativeNames"}}
subject_alternative_names = [{{range $v}}"{{. | Escape}}", {{end}}]
{{- end}}
{{- if eq $k "subjectRDNs" }}
{{- if $v}}
subject_rdns {
{{- range $k, $v := $v}}
{{- if and (eq $k "C") (ne $v nil)}}
c = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "OU") (ne $v nil)}}
ou = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "O") (ne $v nil)}}
o = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "CN") (ne $v nil)}}
cn = {{template "Text" $v}}
{{- end}}
{{- end}}
}
{{- end}}
{{- end}}
{{- if eq $k "issuerRDNs" }}
{{- if $v}}
issuer_rdns {
{{- range $k, $v := $v}}
{{- if and (eq $k "C") (ne $v nil)}}
c = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "OU") (ne $v nil)}}
ou = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "O") (ne $v nil)}}
o = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "CN") (ne $v nil)}}
cn = {{template "Text" $v}}
{{- end}}
{{- end}}
}
{{- end}}
{{- end}}
{{- if and (eq $k "notBefore") (ne $v nil)}}
not_before = {{$v | AsInt}}
{{- end}}
{{- if and (eq $k "notAfter") (ne $v nil)}}
not_after = {{$v | AsInt}}
{{- end}}
{{- if and (eq $k "sigAlgName") (ne $v nil)}}
sig_alg_name = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "publicKey") (ne $v nil)}}
public_key = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "publicKeyAlgorithm") (ne $v nil)}}
public_key_algorithm = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "publicKeyFormat") (ne $v nil)}}
public_key_format = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "serialNumber") (ne $v nil)}}
serial_number = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "version") (ne $v nil)}}
version = {{$v | AsInt}}
{{- end}}
{{- if and (eq $k "sha1Fingerprint") (ne $v nil)}}
sha1_fingerprint = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "pemEncodedCert") (ne $v nil)}}
pem_encoded_cert = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "canBeLeaf") (ne $v nil)}}
can_be_leaf = {{$v}}
{{- end}}
{{- if and (eq $k "canBeCA") (ne $v nil)}}
can_be_ca = {{$v}}
{{- end}}
{{- if and (eq $k "selfSigned") (ne $v nil)}}
self_signed = {{$v}}
{{- end}}
{{- end}}
}
{{- end}}
Expand All @@ -5453,12 +5532,91 @@ origin {
{{- range $v := $v}}
custom_certificates {
{{- range $k, $v := $v}}
{{- if and (eq $k "pemEncodedCert") (ne $v nil)}}
pem_encoded_cert = {{template "Text" $v}}
{{- if and (eq $k "subjectCN") (ne $v nil)}}
subject_cn = {{template "Text" $v}}
{{- end}}
{{- if eq $k "subjectAlternativeNames"}}
subject_alternative_names = [{{range $v}}"{{. | Escape}}", {{end}}]
{{- end}}
{{- if eq $k "subjectRDNs" }}
{{- if $v}}
subject_rdns {
{{- range $k, $v := $v}}
{{- if and (eq $k "C") (ne $v nil)}}
c = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "OU") (ne $v nil)}}
ou = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "O") (ne $v nil)}}
o = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "CN") (ne $v nil)}}
cn = {{template "Text" $v}}
{{- end}}
{{- end}}
}
{{- end}}
{{- end}}
{{- if eq $k "issuerRDNs" }}
{{- if $v}}
issuer_rdns {
{{- range $k, $v := $v}}
{{- if and (eq $k "C") (ne $v nil)}}
c = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "OU") (ne $v nil)}}
ou = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "O") (ne $v nil)}}
o = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "CN") (ne $v nil)}}
cn = {{template "Text" $v}}
{{- end}}
{{- end}}
}
{{- end}}
{{- end}}
{{- if and (eq $k "notBefore") (ne $v nil)}}
not_before = {{$v | AsInt}}
{{- end}}
{{- if and (eq $k "notAfter") (ne $v nil)}}
not_after = {{$v | AsInt}}
{{- end}}
{{- if and (eq $k "sigAlgName") (ne $v nil)}}
sig_alg_name = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "publicKey") (ne $v nil)}}
public_key = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "publicKeyAlgorithm") (ne $v nil)}}
public_key_algorithm = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "publicKeyFormat") (ne $v nil)}}
public_key_format = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "serialNumber") (ne $v nil)}}
serial_number = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "version") (ne $v nil)}}
version = {{$v | AsInt}}
{{- end}}
{{- if and (eq $k "sha1Fingerprint") (ne $v nil)}}
sha1_fingerprint = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "pemEncodedCert") (ne $v nil)}}
pem_encoded_cert = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "canBeLeaf") (ne $v nil)}}
can_be_leaf = {{$v}}
{{- end}}
{{- if and (eq $k "canBeCA") (ne $v nil)}}
can_be_ca = {{$v}}
{{- end}}
{{- if and (eq $k "selfSigned") (ne $v nil)}}
self_signed = {{$v}}
{{- end}}
{{- end}}
}
{{- end}}
Expand Down Expand Up @@ -7256,6 +7414,15 @@ site_shield {
{{- if and (eq $k "srmap") (ne $v nil)}}
srmap = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "chinaCdnMap") (ne $v nil)}}
china_cdn_map = {{template "Text" $v}}
{{- end}}
{{- if and (eq $k "hasMixedHosts") (ne $v nil)}}
has_mixed_hosts = {{$v}}
{{- end}}
{{- if and (eq $k "src") (ne $v nil)}}
src = {{template "Text" $v}}
{{- end}}
{{- end}}
}
{{- end}}
Expand Down
Loading