Skip to content

Commit

Permalink
Merge pull request #32 from Mirantis/PRODENG-2464-no-warranty
Browse files Browse the repository at this point in the history
PRODENG-2464 no warranty
  • Loading branch information
james-nesbitt authored Dec 7, 2023
2 parents ff3417e + 9b69466 commit 786ee14
Showing 1 changed file with 119 additions and 16 deletions.
135 changes: 119 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,128 @@
# terraform-provider-msr
# Mirantis MSR provider

Terraform providers to manage Mirantis Products.
Mirantis MSR provider for managing resources in a running MSR stack.

[![CodeQL](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/codeql-analysis.yml)
[![Go](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/go.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/Mirantis/terraform-provider-msr.svg)](https://pkg.go.dev/github.com/Mirantis/terraform-provider-msr)
[![Greetings](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/greetings.yml/badge.svg?branch=main)](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/greetings.yml)
[![Labeler](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/label.yml/badge.svg)](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/label.yml)
[![tag](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/tag.yml/badge.svg)](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/tag.yml)
[![tfsec](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/tfsec.yaml/badge.svg)](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/tfsec.yaml)
[![validate](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/validate.yml/badge.svg)](https://github.com/Mirantis/terraform-provider-msr/actions/workflows/validate.yml)
This provider does not currently install MSR. The goal of the provider
is to interact with an existing installation.

## contributions
This provider is developed internally, and comes with no warranty. Use it
at your own risk.

## directory structure overview
## Requirements

- [Terraform](https://www.terraform.io/downloads.html) >= 1.4
- [Go](https://golang.org/doc/install) >= 1.20
- [GoReleaser](https://goreleaser.com/) : If you want to use it locally

## Building The Provider

1. Clone the repository
2. Enter the repository directory
3. Build the provider using the `make local` command (uses goreleaser)

```shell
$/> make local
```

## Adding Dependencies

This provider uses [Go modules](https://github.com/golang/go/wiki/Modules).
Please see the Go documentation for the most up to date information about using
Go modules.

To add a new dependency `github.com/author/dependency` to your Terraform provider:

```shell
go get github.com/author/dependency
go mod tidy
```

Then commit the changes to `go.mod` and `go.sum`.


## Using the provider

The provider, once installed properly can be used in any terraform root/chart.

### Using the released provider

Go to the terraform registry page and follow the instructions for declaring
the provider version in your chart/module

@see https://registry.terraform.io/providers/Mirantis/msr/latest

### Using the local source code provider

The `make local` target will use goreleaser to build the provider, and
then provide instructions on how to configure `terraform` to use the
provider locally,

@see https://developer.hashicorp.com/terraform/cli/config/config-file#development-overrides-for-provider-developers

## Developing the Provider

### Using the local provider

You can develop the provider locally, and test the development version by building
the plugin locally, and then configuring terraform to use the local version as a
`dev_override` for the production version.

To build the local plugin:
```
make local
```

It is recommended that you use the `dev_override` by using a special TF config file
and running terraform with an environment variable telling it to use the special file.
This avoids using the development version globally, preventing simple mistakes.

First create a file like my_tf_config_file:

```
provider_installation {
# This disables the version and checksum verifications for this provider
# and forces Terraform to look for the MKE provider plugin in the
# given directory.
dev_overrides {
"mirantis/msr" = "path/to/this/repo/dist/terraform-provider-msr_linux_amd64_v1"
}
# 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 {}
}
```

@NOTE that you mus replace `linux` and `amd64` if you are on a Mac/Windows machine
or not on a 64bit intel/amd processor. See `go env GOOS` and `go env GOARCH` for
the correct values.

then run terraform with a config file override pointing to the new file:
```
$/> TF_CLI_CONFIG_FILE=my_tf_config_file terraform plan
```
(or use an environment variable export)

@see: https://developer.hashicorp.com/terraform/cli/config/config-file#development-overrides-for-provider-developers"

### Contributing

To generate or update documentation, run `go generate`.

In order to run the testing mode unit test suite:

```
make test
```

## discussions
In order to run the full suite of Acceptance tests, run `make testacc`.

## docs
*Note:* Acceptance tests require that you have an environment set up for
testing that msr can use.

## workflows
```shell
make testacc
```

<!-- BEGIN_TF_DOCS -->
## Requirements
Expand All @@ -45,4 +148,4 @@ No inputs.
## Outputs

No outputs.
<!-- END_TF_DOCS -->
<!-- END_TF_DOCS -->

0 comments on commit 786ee14

Please sign in to comment.