🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

github.com/bendbennett/terraform-provider-playground

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/bendbennett/terraform-provider-playground

v0.0.0-20240507073537-f27d4c0bd4d8
Source
Go
Version published
Created
Source

Terraform Provider Playground

This provider is based on the Terraform Provider Scaffolding repo which is built on the Terraform Plugin Framework.

The intention is for this repo to be used for testing and/or illustrating ideas relating to the creation and usage of Terraform providers.

Requirements

  • Terraform >= 1.0
  • Go >= 1.18

Building

  • Clone this repository
  • Enter the repository directory
  • Build the provider using the make install command:
make install

Running

Using CLI Configuration

Terraform can be configured to use a local version of the provider binary by using development overrides.

For instance, a .terraformrc file placed in the home directory and containing the following would result in Terraform using the local binary for this provider.

provider_installation {

  dev_overrides {
      "bendbennett/playground" = "</path/to/your>/go/bin"
  }

  # For all other providers, install them directly from their origin provider
  # registries as normal. If you omit this, Terraform will _only_ use
  # the dev_overrides block, and so no other providers will be available.
  direct {}
}

Locations describes the appropriate directory for placing CLI configuration for different operating systems.

Once the CLI configuration is in place, Terraform can be run using the local provider binary by first building and installing the binary and then using the examples.

make install
cd examples
terraform apply

Debug Mode

The Provider can be run in debug mode.

The following illustrates a typical debug configuration using GoLand:

Once the debug configuration has been setup, run the binary in debug mode:

This should generate something like the following in the console:

TF_REATTACH_PROVIDERS='{"registry.terraform.io/bendbennett/playground":{"Protocol":"grpc","ProtocolVersion":6,"Pid":10915,"Test":true,"Addr":{"Network":"unix","String":"/var/folders/23/p8tx31c53rd16t1pjt03zndc0000gq/T/plugin685580913"}}}'

Open a terminal and set the environment variable for TF_REATTACH_PROVIDERS by running:

export TF_REATTACH_PROVIDERS='{"registry.terraform.io/bendbennett/playground":{"P.........

Set breakpoints in the provider code and then run the terraform commands (e.g., terraform apply).

Testing

Unit Tests

make test

Acceptance Tests

make testacc

FAQs

Package last updated on 07 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts