Skip to content

Commit

Permalink
docs(resource|domain): added docs and terraform examples (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndopj authored Oct 9, 2023
1 parent cd5786b commit e5526aa
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 8 deletions.
73 changes: 73 additions & 0 deletions docs/resources/domain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "montecarlo_domain Resource - terraform-provider-montecarlo"
subcategory: ""
description: |-
(Beta version !!) A named resource which lets you define a collection of tables or views by selecting a combination of tables, schemas or databases. Domains can be used to create notifications and authorization groups as a way to adjust the scope without having to redefine a list of tables every time.
---

# montecarlo_domain (Resource)

**(Beta version !!)** A named resource which lets you define a collection of tables or views by selecting a combination of tables, schemas or databases. Domains can be used to create notifications and authorization groups as a way to adjust the scope without having to redefine a list of tables every time.

## Example Usage

```terraform
# This resource is currently only in Beta version ! Assignments such as projects,
# datasets and tables can only be provided in MCON's format (Monte Carlo universal identifiers).
# Stable release for this resource will contain automatic translation of data assets to the MCON's
#
# Users using `tags` attribute instead of assignments can consider this functionality as stable
# MCON format is following: MCON++{account_uuid}++{resource_uuid}++{object_type}++{object_id}
resource "montecarlo_domain" "example_assignments" {
name = "name"
description = "description"
assignments = [
"MCON++a84380ed-b962-4bd3-b150-04bc38a209d5++427a1600-2653-40c5-a1e7-5ec98703ee9d++project++gcp-project1-722af1c6",
"MCON++a84380ed-b962-4bd3-b150-04bc38a209d5++e7c59fd6-7ca8-41e7-8325-062ea38d3df5++dataset++postgre-dataset-1"
]
}
resource "montecarlo_domain" "example_tags" {
name = "name"
description = "description"
tags = [
{
name = "owner"
value = "bi-team-a"
},
{
name = "montecarlo"
}
]
}
```

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

### Required

- `name` (String) The name of the Domain as it will be presented in Monte Carlo.

### Optional

- `assignments` (List of String) Objects assigned to domain (in MCONs format: MCON++{account_uuid}++{resource_uuid}++{object_type}++{object_id}).
- `description` (String) Description of the domain as it will be presented in Monte Carlo.
- `tags` (Attributes List) Filter by tag key/value pairs for tables. (see [below for nested schema](#nestedatt--tags))

### Read-Only

- `uuid` (String) Unique identifier of domain managed by this resource.

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

Required:

- `name` (String) Tag name

Optional:

- `value` (String) Tag value
29 changes: 29 additions & 0 deletions examples/resources/montecarlo_domain/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This resource is currently only in Beta version ! Assignments such as projects,
# datasets and tables can only be provided in MCON's format (Monte Carlo universal identifiers).
# Stable release for this resource will contain automatic translation of data assets to the MCON's
#
# Users using `tags` attribute instead of assignments can consider this functionality as stable
# MCON format is following: MCON++{account_uuid}++{resource_uuid}++{object_type}++{object_id}

resource "montecarlo_domain" "example_assignments" {
name = "name"
description = "description"
assignments = [
"MCON++a84380ed-b962-4bd3-b150-04bc38a209d5++427a1600-2653-40c5-a1e7-5ec98703ee9d++project++gcp-project1-722af1c6",
"MCON++a84380ed-b962-4bd3-b150-04bc38a209d5++e7c59fd6-7ca8-41e7-8325-062ea38d3df5++dataset++postgre-dataset-1"
]
}

resource "montecarlo_domain" "example_tags" {
name = "name"
description = "description"
tags = [
{
name = "owner"
value = "bi-team-a"
},
{
name = "montecarlo"
}
]
}
2 changes: 1 addition & 1 deletion monte_carlo/client/mock/monte_carlo_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 10 additions & 7 deletions monte_carlo/resources/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ func (r *DomainResource) Metadata(ctx context.Context, req resource.MetadataRequ
func (r *DomainResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
// This description is used by the documentation generator and the language server.
MarkdownDescription: "",
MarkdownDescription: "**(Beta version !!)** A named resource which lets you define a collection of tables or views by selecting " +
"a combination of tables, schemas or databases. Domains can be used to create notifications and authorization groups as " +
"a way to adjust the scope without having to redefine a list of tables every time.",
Attributes: map[string]schema.Attribute{
"uuid": schema.StringAttribute{
Computed: true,
Expand Down Expand Up @@ -79,13 +81,13 @@ func (r *DomainResource) Schema(ctx context.Context, req resource.SchemaRequest,
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
Required: true,
MarkdownDescription: "",
MarkdownDescription: "Tag name",
},
"value": schema.StringAttribute{
Computed: true,
Optional: true,
Default: stringdefault.StaticString(""),
MarkdownDescription: "",
MarkdownDescription: "Tag value",
},
},
},
Expand All @@ -97,10 +99,11 @@ func (r *DomainResource) Schema(ctx context.Context, req resource.SchemaRequest,
),
},
"assignments": schema.ListAttribute{
Computed: true,
Optional: true,
ElementType: types.StringType,
MarkdownDescription: "Objects assigned to domain (as MCONs).",
Computed: true,
Optional: true,
ElementType: types.StringType,
MarkdownDescription: "Objects assigned to domain (in MCONs format: " +
"MCON++{account_uuid}++{resource_uuid}++{object_type}++{object_id}).",
Default: listdefault.StaticValue(
types.ListValueMust(
types.StringType,
Expand Down

0 comments on commit e5526aa

Please sign in to comment.