Skip to content

Commit

Permalink
fix(release|registry): provider naming and docs for registry (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndopj authored Sep 28, 2023
1 parent 408cc06 commit dbb8244
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ terraform.tfvars
terraform.tfplan
terraform.tfstate
bin/
terraform-provider-monte-carlo
terraform-provider-montecarlo
modules-dev/
/pkg/
website/.vagrant
Expand Down
46 changes: 46 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "montecarlo Provider"
subcategory: ""
description: |-
This open-source Terraform provider enables users to seamlessly and quickly integrate the Monte Carlo https://www.montecarlodata.com/ data reliabillity platform into their infrastructure as a code (IaC) workflows. Provider ensures this functionality by communicating with Monte Carlo via its GraphQL API.
---

# montecarlo Provider

This open-source _Terraform_ provider enables users to seamlessly and quickly integrate the **[Monte Carlo](https://www.montecarlodata.com/)** data reliabillity platform into their infrastructure as a code (IaC) workflows. Provider ensures this functionality by communicating with **Monte Carlo** via its GraphQL API.

## Example Usage

```terraform
terraform {
required_providers {
monte_carlo = {
source = "kiwicom/montecarlo"
version = "~> 0.0.1"
}
}
}
provider "monte_carlo" {
account_service_key = {
id = "montecarlo"
token = "montecarlo"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `account_service_key` (Attributes) Monte Carlo generated **Account Service Key** used to authenticate API calls of this provider. Should not be confused with personal API key. <br><br>For more information: https://docs.getmontecarlo.com/docs/creating-an-api-token#creating-an-api-key <br><br> (see [below for nested schema](#nestedatt--account_service_key))

<a id="nestedatt--account_service_key"></a>
### Nested Schema for `account_service_key`

Required:

- `id` (String, Sensitive) Monte Carlo _Account service key_ **ID**.
- `token` (String, Sensitive) Monte Carlo _Account service key_ **token**.
40 changes: 40 additions & 0 deletions docs/resources/bigquery_warehouse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "montecarlo_bigquery_warehouse Resource - terraform-provider-montecarlo"
subcategory: ""
description: |-
This resource represents the integration of Monte Carlo with BigQuery data warehouse. While this resource is not responsible for handling data access and other operations, such as data filtering, it is responsible for managing the connection to BigQuery using the provided service account key.
---

# montecarlo_bigquery_warehouse (Resource)

This resource represents the integration of Monte Carlo with BigQuery data warehouse. While this resource is not responsible for handling data access and other operations, such as data filtering, it is responsible for managing the connection to BigQuery using the provided service account key.

## Example Usage

```terraform
resource "montecarlo_bigquery_warehouse" "example" {
name = "name"
data_collector_uuid = "uuid"
service_account_key = "{}"
deletion_protection = false
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `data_collector_uuid` (String) Unique identifier of data collector this warehouse will be attached to. Its not possible to change data collectors of already created warehouse, therefore if Terraform detects change in this attribute it will plan recreation (which might not be successfull due to deletion protection flag). Since this property is immutable in Monte Carlo warehouses it can be only changed in the configuration
- `name` (String) The name of the BigQuery warehouse as it will be presented in Monte Carlo.
- `service_account_key` (String, Sensitive) Service account key used by the warehouse connection for authentication and authorization against BigQuery. The very same service account is used to grant required permissions to Monte Carlo BigQuery warehouse for the data access. For more information follow Monte Carlo documentation: https://docs.getmontecarlo.com/docs/bigquery

### Optional

- `deletion_protection` (Boolean) Whether or not to allow Terraform to destroy the instance. Unless this field is set to false in Terraform state, a terraform destroy or terraform apply that would delete the instance will fail. This setting will prevent the deletion even if the real resource is already deleted.

### Read-Only

- `connection_uuid` (String) Unique identifier of connection responsible for communication with BigQuery.
- `uuid` (String) Unique identifier of warehouse managed by this resource.
9 changes: 9 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Examples

This directory contains examples that are mostly used for documentation, but can also be run/tested manually via the Terraform CLI.

The document generation tool looks for files in the following locations by default. All other *.tf files besides the ones mentioned below are ignored by the documentation tool. This is useful for creating examples that can run and/or ar testable even if some parts are not relevant for the documentation.

* **provider/provider.tf** example file for the provider index page
* **data-sources/`full data source name`/data-source.tf** example file for the named data source page
* **resources/`full resource name`/resource.tf** example file for the named data source page
15 changes: 15 additions & 0 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
terraform {
required_providers {
monte_carlo = {
source = "kiwicom/montecarlo"
version = "~> 0.0.1"
}
}
}

provider "monte_carlo" {
account_service_key = {
id = "montecarlo"
token = "montecarlo"
}
}
6 changes: 6 additions & 0 deletions examples/resources/montecarlo_bigquery_warehouse/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resource "montecarlo_bigquery_warehouse" "example" {
name = "name"
data_collector_uuid = "uuid"
service_account_key = "{}"
deletion_protection = false
}
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/kiwicom/terraform-provider-monte-carlo
module github.com/kiwicom/terraform-provider-montecarlo

go 1.21.1

Expand All @@ -20,8 +20,8 @@ require (
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
Expand All @@ -32,5 +32,6 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
nhooyr.io/websocket v1.8.7 // indirect
)
10 changes: 7 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,13 @@ github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQs
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
Expand Down Expand Up @@ -107,6 +109,7 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Expand All @@ -125,8 +128,9 @@ google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
14 changes: 12 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ import (
"flag"
"log"

"github.com/kiwicom/terraform-provider-monte-carlo/monte_carlo/provider"
"github.com/kiwicom/terraform-provider-montecarlo/monte_carlo/provider"

"github.com/hashicorp/terraform-plugin-framework/providerserver"
)

// Run "go generate" to format example terraform files and generate the docs for the registry/website

// If you do not have terraform installed, you can remove the formatting command, but its suggested to
// ensure the documentation is formatted properly.
//go:generate terraform fmt -recursive ./examples/

// Run the docs generation tool, check its repository for more information on how it works and how docs
// can be customized.
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/[email protected]

var (
// these will be set by the goreleaser configuration
// to appropriate values for the compiled binary.
Expand All @@ -18,7 +28,7 @@ var (

func main() {
flag.Parse()
opts := providerserver.ServeOpts{Address: "registry.terraform.io/kiwicom/data-platform", Debug: false}
opts := providerserver.ServeOpts{Address: "registry.terraform.io/kiwicom/montecarlo", Debug: false}
if err := providerserver.Serve(context.Background(), provider.New(version), opts); err != nil {
log.Fatal(err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion monte_carlo/common/common.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package common

import "github.com/kiwicom/terraform-provider-monte-carlo/monte_carlo/client"
import "github.com/kiwicom/terraform-provider-montecarlo/monte_carlo/client"

// Cyclic types commonly shared in this provider packages

Expand Down
26 changes: 15 additions & 11 deletions monte_carlo/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"fmt"

"github.com/kiwicom/terraform-provider-monte-carlo/monte_carlo/client"
"github.com/kiwicom/terraform-provider-monte-carlo/monte_carlo/common"
"github.com/kiwicom/terraform-provider-monte-carlo/monte_carlo/resources"
"github.com/kiwicom/terraform-provider-montecarlo/monte_carlo/client"
"github.com/kiwicom/terraform-provider-montecarlo/monte_carlo/common"
"github.com/kiwicom/terraform-provider-montecarlo/monte_carlo/resources"

"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/provider"
Expand Down Expand Up @@ -38,25 +38,29 @@ type ProviderAccountServiceKeyModel struct {
}

func (p *Provider) Metadata(ctx context.Context, req provider.MetadataRequest, resp *provider.MetadataResponse) {
resp.TypeName = "monte_carlo"
resp.TypeName = "montecarlo"
resp.Version = p.version
}

func (p *Provider) Schema(ctx context.Context, req provider.SchemaRequest, resp *provider.SchemaResponse) {
resp.Schema = schema.Schema{
Blocks: map[string]schema.Block{
"account_service_key": schema.SingleNestedBlock{
MarkdownDescription: "Monte Carlo generated Account Service Key used to authenticate API calls of " +
"this provider. Should not be confused with personal API key. For more information: " +
"https://docs.getmontecarlo.com/docs/creating-an-api-token#creating-an-api-key",
MarkdownDescription: "This open-source _Terraform_ provider enables users to seamlessly and quickly integrate the " +
"**[Monte Carlo](https://www.montecarlodata.com/)** data reliabillity platform into their infrastructure as a code " +
"(IaC) workflows. Provider ensures this functionality by communicating with **Monte Carlo** via its GraphQL API.",
Attributes: map[string]schema.Attribute{
"account_service_key": schema.SingleNestedAttribute{
MarkdownDescription: "Monte Carlo generated **Account Service Key** used to authenticate API calls of " +
"this provider. Should not be confused with personal API key. <br><br>For more information: " +
"https://docs.getmontecarlo.com/docs/creating-an-api-token#creating-an-api-key <br><br>",
Required: true,
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
MarkdownDescription: "Monte Carlo Account service key ID.",
MarkdownDescription: "Monte Carlo **Account service key** _ID_.",
Required: true,
Sensitive: true,
},
"token": schema.StringAttribute{
MarkdownDescription: "Monte Carlo Account service key token.",
MarkdownDescription: "Monte Carlo **Account service key** _token_.",
Required: true,
Sensitive: true,
},
Expand Down
4 changes: 2 additions & 2 deletions monte_carlo/resources/bigquery_warehouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"encoding/json"
"fmt"

"github.com/kiwicom/terraform-provider-monte-carlo/monte_carlo/client"
"github.com/kiwicom/terraform-provider-monte-carlo/monte_carlo/common"
"github.com/kiwicom/terraform-provider-montecarlo/monte_carlo/client"
"github.com/kiwicom/terraform-provider-montecarlo/monte_carlo/common"

"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/path"
Expand Down

0 comments on commit dbb8244

Please sign in to comment.