Skip to content

Commit

Permalink
dev-docs: document provider usage
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Sanft <[email protected]>
  • Loading branch information
msanft committed Nov 22, 2023
1 parent 288cff2 commit be43c6d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
32 changes: 32 additions & 0 deletions dev-docs/workflows/terraform-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Constellation Terraform Provider

This document explains the basic ways of working with the [Constellation Terraform Provider](../../terraform-provider-constellation/).

## Building the Terraform Provider

The Constellation Terraform provider can be built through Bazel, either via the [`devbuild` target](./build-develop-deploy.md) (recommended), which will create a `terraform` directory
with the provider binary and some utility files in the current working directory, or explicitly via this command:

```bash
bazel build //terraform-provider-constellation:tf_provider
```

## Using the Terraform Provider

The Terraform provider binary can be used with the normal Terraform CLI, by setting a [development override](https://developer.hashicorp.com/terraform/cli/config/config-file#development-overrides-for-provider-developers),
so that the registry path to the provider is replaced with the path to the locally built provider. If using the [`devbuild` target](./build-develop-deploy.md), a `config.tfrc` file with the override set to the path
of the built binary is placed automatically in the `terraform` directory in the current working directory. Otherwise, the file can be also built and copied to the current working directory explicitly via this command:

```bash
bazel build //terraform-provider-constellation:terraform_rc
cp bazel-bin/terraform-provider-constellation/config.tfrc .
sed -i "s|@@TERRAFORM_PROVIDER_PATH@@|$(realpath bazel-bin/terraform-provider-constellation/tf_provider_/tf_provider)|g" config.tfrc
```

Afterwards, all Terraform commands that should use the local provider build should be prefixed with `TF_CLI_CONFIG_FILE=config.tfrc` like so:

```bash
TF_CLI_CONFIG_FILE=config.tfrc terraform init
TF_CLI_CONFIG_FILE=config.tfrc terraform apply
...
```
8 changes: 0 additions & 8 deletions terraform-provider-constellation/README.md

This file was deleted.

0 comments on commit be43c6d

Please sign in to comment.