The Ubicloud provider enables Terraform to manage resources supported by Ubicloud.
Official documentation on how to use this provider can be found on the Terraform Registry.
The remainder of this document will focus on the development aspects of the provider.
git clonethis repository andcdinto its directorymakewill trigger the Golang build
The provided GNUmakefile defines additional commands generally useful during development.
This project uses oapi-codegen to generate a Go client to interact with Ubicloud based on an OpenAPI specification of the Ubicloud API.
It also uses OpenAPI Provider Spec Generator together with Terraform Plugin Framework Code Generator to generate parts of the Ubicloud provider itself, based on the same OpenAPI spec.
This provider uses terraform-plugin-docs
to generate documentation as part of the build, which is stored in the docs/ directory.
First, use make install to place a fresh development build of the provider in your
${GOBIN}
(defaults to ${GOPATH}/bin or ${HOME}/go/bin if ${GOPATH} is not set). Repeat
this every time you make changes to the provider locally.
Then, in your ${HOME}/.terraformrc (Unix) / %APPDATA%\terraform.rc (Windows), add a provider_installation that contains
the following dev_overrides:
provider_installation {
dev_overrides {
"ubicloud/ubicloud" = "${GOBIN}" //< replace `${GOBIN}` with the actual path on your system
}
direct {}
}For more details check out the Terraform documentation on development overrides for provider-developers.
In order to test the provider, you can run
make testaccto run provider acceptance tests
Important: Acceptance tests (testacc) will actually spawn
terraform and the provider, and create real resources on Ubicloud. Read more about acceptance tests on the
official Terraform page.
Acceptance tests require the definition of these environment variables:
UBICLOUD_ACC_TEST_PROJECTID of an existing project. Resources will be created in that project.UBICLOUD_ACC_TEST_LOCATIONLocation name, e.g. 'eu-central-h1'. Resources will be created in that location.UBICLOUD_ACC_TEST_FIREWALLID of an existing firewall. Some of the resources will be attached to that firewall.UBICLOUD_ACC_TEST_PRIVATE_SUBNETID of an existing private subnet. Needs to be in the same location as defined above. Some of the resources will be created in that subnet.
The release process is automated via GitHub Actions, and it's defined in the Workflow release.yml.
Each release is cut by pushing a semantically versioned tag to the default branch.