terraform-provider-corefunc

command module
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

Terraform Provider: Core Functions

Terraform Docs Go Docs GitHub Go Report Card Open Source Insights GitHub issues GitHub contributors GitHub commit activity (branch) GitHub all releases GitHub Workflow Status (with event) GitHub Workflow Status (with event)

Overview

Utilities that should have been Terraform/OpenTofu core functions.

While some of these can be implemented in HCL, some of them begin to push up against the limits of Terraform and the HCL2 configuration language. We also perform testing using the Terratest framework on a regular basis. Exposing these functions as both a Go library as well as a Terraform/OpenTofu provider enables us to use the same functionality in both our Terraform/OpenTofu applies as well as while using a testing framework.

[!NOTE] While it’s common knowledge that Terraform is great at standing up and managing Cloud infrastructure, it’s also good at running anything with an API. People regularly manage code repositories, DNS records, feature flags, identity and access management, content delivery, passwords, monitoring, alerts, zero trust network access, cryptographic signatures, and can even order a pizza.

This provider is more analogous to HashiCorp’s utility providers such as local, external, and archive.

Since earlier versions of Terraform/OpenTofu didn't have the concept of user-defined functions, the next step to open up the possibilities was to write a custom Provider which has the functions built-in, using existing support for inputs and outputs.

This does not add new syntax or constructs. Instead it uses the existing concepts around Providers, Resources, Data Sources, Variables, Outputs, and Functions (1.8) to expose new custom-built functionality.

The goal of this provider is not to call any APIs, but to provide pre-built functions in the form of Data Sources or Provider Functions (1.8).

Compatibility testing

  • We have automated testing that runs on every commit and every pull request.
  • We intend for the Go libraries to work with all non-EOL versions of Go (i.e., current, current-1).
  • Built using the Terraform Plugin Framework, which speaks Terraform Protocol v6.
Testing type Details Description
integration Terraform 1.0–1.8 Executes the provider with this release, pulling from registry.terraform.io.
integration OpenTofu 1.6–1.7 Executes the provider with this release, pulling from registry.opentofu.org.
unit Go 1.21–1.22 Tests using these versions.
mutation Go 1.21–1.22 Tests using these versions.
fuzz Go 1.21–1.22 Tests using these versions.
terratest Go 1.21–1.22 Tests using these versions.

Usage Examples

See the docs/ directory for user-facing documentation.

Documentation

Terraform Registry

If you are using this as a Terraform provider, see the documentation at registry.terraform.io.

Go Package

If you are using this as a Go library, see the documentation at pkg.go.dev.

More Information

After the provider is installed, you can run terraform-provider-corefunc on the CLI.

  • Install with either terraform init or make build.
  • The Go binary path (discovered by running ./find-go-bin.sh) is on your $PATH.

This will display the following text:

terraform-provider-corefunc
This binary is a plugin. These are not meant to be executed directly.
Please execute the program that consumes these plugins, which will
load any plugins automatically

However, by passing the --help flag, you can see the other options available, including a description of the software.

terraform-provider-corefunc --help

The provider has one primary sub-command: version. It includes long-form version information, including the build commit hash, build date, Go version, and external dependencies.

terraform-provider-corefunc version
BASIC
Version:    dev
Go version: go1.22.1
Git commit: 822858fc0c80b34eebf2a5ddd1b48684414d71b3
Build date: 2024-03-11T03:09:24Z
OS/Arch:    darwin/arm64
System:     macOS on Apple Silicon
CPU Cores:  10

DEPENDENCIES
github.com/bits-and-blooms/bitset                          v1.13.0
github.com/chanced/caps                                    v1.0.2
github.com/fatih/color                                     v1.16.0
github.com/golang/protobuf                                 v1.5.4
github.com/gookit/color                                    v1.5.4
github.com/hashicorp/go-hclog                              v1.6.2
github.com/hashicorp/go-plugin                             v1.6.0
github.com/hashicorp/go-uuid                               v1.0.3
github.com/hashicorp/terraform-plugin-framework            v1.6.1
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
[...snip...]

Documentation

Overview

See "corefunc" package for the Go library code.

Directories

Path Synopsis
Package cmd contains the CLI implementation related to the Cobra package.
Package cmd contains the CLI implementation related to the Cobra package.
Package corefunc provides a set of functions that are useful in a variety of Terraform contexts.
Package corefunc provides a set of functions that are useful in a variety of Terraform contexts.
types
Package types provides a set of structs that simplify the usage of the corefunc package.
Package types provides a set of structs that simplify the usage of the corefunc package.
Package corefuncprovider is the code that wraps the functions in the corefunc package with a Terraform interface.
Package corefuncprovider is the code that wraps the functions in the corefunc package with a Terraform interface.
generator module
Package testfixtures contains test fixtures used by both the standard Go tests as well as the Terraform acceptance tests.
Package testfixtures contains test fixtures used by both the standard Go tests as well as the Terraform acceptance tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL