Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
Expand All @@ -33,7 +33,7 @@ jobs:
# handling.
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6.2.0
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
Expand Down
28 changes: 15 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ permissions:
env:
# Go language version to use for building. This value should also be updated
# in the release workflow if changed.
GO_VERSION: "1.22"
GO_VERSION: "1.24"

jobs:
# Ensure project builds before running testing matrix
Expand All @@ -48,15 +48,14 @@ jobs:
terraform_wrapper: false

generate:
# this seems to cause an error as the generation now wants to exec
# terraform and it's not available here. need to consider what to do.
# go generate needs Terraform in the path, use latest version
runs-on: ubuntu-latest
if: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: hashicorp/setup-terraform@v3
- run: go generate ./...
- name: git diff
run: |
Expand All @@ -73,17 +72,20 @@ jobs:
max-parallel: 1
fail-fast: false
matrix:
# list whatever Terraform versions here you would like to support
# jobs run in parallel -- some tests create resources with
# specific IDs which must be unique... some test resource randomization
# is needed but doesn't exist... Currently only testing w/ 1.6
# max-parallel: 1 should fix this!
# list whatever Terraform versions here you would like to support jobs
# run in parallel -- some tests create resources with specific IDs
# which must be unique... some test resource randomization is needed
# but doesn't exist... Currently only testing w/ 1.6 max-parallel: 1
# should fix this!
# Specific versions needed!
# NOTE: required tests are configured in branch protection!
#
# https://releases.hashicorp.com/terraform/
#
terraform:
- "1.8.5"
- "1.9.8"
- "1.10.4"
- "1.11.4"
- "1.12.2"
- "1.13.0"

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -114,7 +116,7 @@ jobs:
TF_VAR_password: ${{ secrets.PASSWORD }}
TF_VAR_token: ${{ secrets.TOKEN }}
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }}
run: go test -timeout 1h -race -v -covermode atomic -coverprofile=covprofile ./internal/...
run: go test -timeout 1h -race -v -covermode atomic -coverprofile=covprofile -coverpkg=./internal/... ./internal/...
timeout-minutes: 60

- name: Install goveralls
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ website/node_modules
*.test
*.iml
coverage.out
coverage.html
mise.toml

website/vendor
vendor
Expand Down
65 changes: 49 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

Lists the changes in the provider.

## Version 0.8.4

- ensure the provider works / passes all tests against a 2.9.0 instance
- uses Go 1.24
- updated all dependencies including the gocmlclient which should now work
a bit faster when a token (vs username/password) is used
- added some more tests for data sources
- formatting and naming best practices
- fix external connector update check for single configurations

## Version 0.8.3

- only check the CML host address a) if not dynamic provider configuration and
Expand All @@ -12,7 +22,8 @@ Lists the changes in the provider.
## Version 0.8.2

- go version 1.22 used
- updated dependencies (plugin-framework 1.13.0, plugin-go 0.25.0, plugin-testing 1.10.0)
- updated dependencies (plugin-framework 1.13.0, plugin-go 0.25.0,
plugin-testing 1.10.0)
- use newer gocmlclient which supports CML 2.8.0
- added signing public key to repo
- provider configuration check: Ensure valid CML host address (HTTPS)
Expand All @@ -28,13 +39,17 @@ Lists the changes in the provider.
- update gocmlclient to 0.1.0, supporting CML 2.7.0
- tested w/ 2.7.1
- ability to use named configurations (added w/ 2.7.0) (partially addresses #100)
- deprecate `use_cache` capability, there's a flag in the provider configuration to turn this on (fixes #94)
- deprecate `use_cache` capability, there's a flag in the provider
configuration to turn this on (fixes #94)
- replace link resource when changing link slots (fixes #95)
- update all dependencies as of July 2024
- run acceptance tests with 1.7 and 1.8 instead of 1.4 and 1.6
- removed github.com/hashicorp/terraform-plugin-sdk/v2 as a direct dependency, use TF framework testing module instead of SDK v2 testing module
- configurations which only differ in line endings (CR/LF vs LF, DOS / Unix) are now equivalent (fixes #106)
- deprecate `elements` in the `lifecycle` resource, replaced by using standard `depends_on`
- removed github.com/hashicorp/terraform-plugin-sdk/v2 as a direct dependency,
use TF framework testing module instead of SDK v2 testing module
- configurations which only differ in line endings (CR/LF vs LF, DOS / Unix)
are now equivalent (fixes #106)
- deprecate `elements` in the `lifecycle` resource, replaced by using standard
`depends_on`
- properly formatted tunnel.sh script
- allow to use a token with the integration tests (less requests, faster)

Expand All @@ -43,9 +58,11 @@ Lists the changes in the provider.
- added support for "hide links" node resource property, fixes #80
- added external connector data source
- fixed integration test for groups data source
- return error for external connector configuration when device name is provided instead of "NAT" or "System Bridge", fixes #81
- return error for external connector configuration when device name is
provided instead of "NAT" or "System Bridge", fixes #81
- updated all package dependencies
- fix CPULimit property for UMS and ExtConn (they are now always NULL starting with 2.6.0)
- fix CPULimit property for UMS and ExtConn (they are now always NULL starting
with 2.6.0)
- some cosmetic and test changes
- added a add-to-booted-lab lifecycle test (addresses #75 but can't reproduce)
- formatted code base w/ gofumpt
Expand All @@ -57,26 +74,37 @@ Lists the changes in the provider.

## Version 0.6.2

- The provider (via gocmlclient) now honors proxy configuration provided via environment variables `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` (or the lowercase versions thereof). `HTTPS_PROXY` takes precedence over `HTTP_PROXY` for https requests.
- The provider (via gocmlclient) now honors proxy configuration provided via
environment variables `HTTP_PROXY`, `HTTPS_PROXY` and `NO_PROXY` (or the
lowercase versions thereof). `HTTPS_PROXY` takes precedence over `HTTP_PROXY`
for https requests.
- bump gocmlclient to 0.0.21 (better handling of error conditions / proxy use)
- added `ignore_errors` attribute to the system data source to be able to simply ignore errors when waiting for the controller to provide status.
- added `ignore_errors` attribute to the system data source to be able to
simply ignore errors when waiting for the controller to provide status.

## Version 0.6.1

- allow dynamic configuration of the provider by introducing a `dynamic_config` provider config flag. This defaults to `false`. When set to `true` then the provider configuration is only validated when actual resources are read or created. This is for specific use cases like AWS deployments where the CML2 instance IP is only known after the EC2 instance has been created.
- allow dynamic configuration of the provider by introducing a `dynamic_config`
provider config flag. This defaults to `false`. When set to `true` then the
provider configuration is only validated when actual resources are read or
created. This is for specific use cases like AWS deployments where the CML2
instance IP is only known after the EC2 instance has been created.
- bump the gocmlclient to 0.0.18

## Version 0.6.0

- allow empty node configurations (fixes #50)
- new data sources
- "system" for version and ready check, can be used with a timeout to wait until the system becomes ready
- "system" for version and ready check, can be used with a timeout to wait
until the system becomes ready
- "groups" to retrieve a list of groups from the system
- "users" to retrieve a list of users from the system
- new resources
- "user" for user operations
- "group" for group operations
- changed "lists" to "sets" where applicable. That said, IP addresses should likely also be treated as sets (unordered, unique values) and not as (ordered) lists
- changed "lists" to "sets" where applicable. That said, IP addresses should
likely also be treated as sets (unordered, unique values) and not as (ordered)
lists
- set correct ID for node and lab data sources
- updated dependencies

Expand All @@ -100,8 +128,10 @@ Lists the changes in the provider.

### Breaking changes

- link resources: change the attribute names for slots from `node_a_slot` to `slot_a` and `node_b_slot` to `slot_b`
- image definition data source: change the attribute name of the node definition filter from `node_definition_id` to `nodedefinition` for consistency
- link resources: change the attribute names for slots from `node_a_slot` to
`slot_a` and `node_b_slot` to `slot_b`
- image definition data source: change the attribute name of the node
definition filter from `node_definition_id` to `nodedefinition` for consistency

### Other changes

Expand Down Expand Up @@ -141,7 +171,9 @@ Lists the changes in the provider.
- adapted to the terraform-provider-framework v0.0.15 changes
- udpated documentation
- `cml2_node.label` is now a required attribute
- `cml2_lifecycle.lab_id` replaces the `id` for consistency. This will break existing lifecycle resources but it's easy to fix: just rename the `id` to `lab_id`.
- `cml2_lifecycle.lab_id` replaces the `id` for consistency. This will break
existing lifecycle resources but it's easy to fix: just rename the `id` to
`lab_id`.
- `cml2_lifecycle.id` is now auto-generated as a UUIDv4
- `cml2_lifecycle` resource logic changes... produces more concise change sets
- added a `cml2_lifecycle` acceptance test
Expand All @@ -156,7 +188,8 @@ for a few resources and data sources:
- `cml2_lab` manages labs (the top level element)
- `cml2_node` manages nodes as elements of labs
- `cml2_link` manages links connecting nodes as elements of labs
- `cml2_lifecycle` manages the lifecycle of labs either by importing existing topology files or by referencing created labs via the lab resource
- `cml2_lifecycle` manages the lifecycle of labs either by importing existing
topology files or by referencing created labs via the lab resource
- data sources
- `cml2_lab` reads an existing lab
- `cml2_node` reads an existing node
Expand Down
16 changes: 15 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ VERSION := $(shell git describe --long | sed -re 's/^v(.*)$$/\1/')
DEST := ~/.terraform.d/plugins/$(ORG)/$(NAME)/$(VERSION)/$(ARCH)

MIRROR := /tmp/terraform/$(ORG)/$(NAME)
TESTARGS := -cover -v

COVEROUT := coverage
COVERAGE := -cover -coverprofile $(COVEROUT).out

TESTARGS := -v $(COVERAGE)

# Run tests
.PHONY: tests
Expand All @@ -35,3 +39,13 @@ mirror:
goreleaser release --skip-publish --rm-dist
test -d $(DEST) || mkdir -p $(MIRROR)
cp dist/*.zip $(MIRROR)

.PHONY: cover
cover:
# go test -v -coverprofile $(NAME).out ./...
go tool cover -html $(COVEROUT).out -o $(COVEROUT).html
open $(COVEROUT).html

.PHONY: clean
clean:
@bash -c "rm -f $(COVEROUT).{html,out}"
62 changes: 31 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
module github.com/ciscodevnet/terraform-provider-cml2

go 1.22.10
go 1.24.6

require (
github.com/google/go-cmp v0.6.0
github.com/google/go-cmp v0.7.0
github.com/google/uuid v1.6.0
github.com/hashicorp/terraform-plugin-docs v0.20.1
github.com/hashicorp/terraform-plugin-framework v1.13.0
github.com/hashicorp/terraform-plugin-go v0.25.0
github.com/hashicorp/terraform-plugin-docs v0.21.0
github.com/hashicorp/terraform-plugin-framework v1.15.1
github.com/hashicorp/terraform-plugin-go v0.28.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-testing v1.11.0
github.com/rschmied/gocmlclient v0.1.0
github.com/hashicorp/terraform-plugin-testing v1.13.3
github.com/rschmied/gocmlclient v0.1.1
github.com/stretchr/testify v1.10.0
)

require (
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.3.1 // indirect
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.2 // indirect
github.com/ProtonMail/go-crypto v1.1.6 // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/bmatcuk/doublestar/v4 v4.7.1 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/bmatcuk/doublestar/v4 v4.8.1 // indirect
github.com/cloudflare/circl v1.6.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/hashicorp/cli v1.1.6 // indirect
github.com/hashicorp/cli v1.1.7 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-cty v1.5.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.2 // indirect
github.com/hashicorp/go-plugin v1.7.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // 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.9.0 // indirect
github.com/hashicorp/hc-install v0.9.2 // indirect
github.com/hashicorp/hcl/v2 v2.23.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.21.0 // indirect
github.com/hashicorp/terraform-json v0.23.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.4 // indirect
github.com/hashicorp/terraform-exec v0.23.0 // indirect
github.com/hashicorp/terraform-json v0.25.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0 // indirect
github.com/hashicorp/terraform-registry-address v0.4.0 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
Expand All @@ -60,7 +60,7 @@ require (
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/oklog/run v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
Expand All @@ -70,20 +70,20 @@ require (
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yuin/goldmark v1.7.7 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.15.0 // indirect
github.com/zclconf/go-cty v1.16.3 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
golang.org/x/crypto v0.32.0 // indirect
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.22.0 // indirect
golang.org/x/mod v0.26.0 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/tools v0.35.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
google.golang.org/grpc v1.69.4 // indirect
google.golang.org/protobuf v1.36.3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
google.golang.org/grpc v1.75.0 // indirect
google.golang.org/protobuf v1.36.8 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
Loading