Skip to content

Commit

Permalink
Fix Data Warehouse documentation (#183)
Browse files Browse the repository at this point in the history
Fix documentation generation of the Data Warehouse resources.

The `cdp_vw_hive` resource type has been renamed to `cdp_dw_vw_hive`.
  • Loading branch information
vcsomor authored Nov 21, 2024
1 parent b0169cb commit c7153f4
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 35 deletions.
5 changes: 1 addition & 4 deletions docs/resources/dw_aws_cluster.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cdp_dw_aws_cluster Resource - terraform-provider-cdp"
subcategory: ""
subcategory: "Data Warehouse"
description: |-
Creates an AWS Data Warehouse cluster.
---
Expand Down Expand Up @@ -134,5 +133,3 @@ Optional:
- `async` (Boolean) Boolean value that specifies if Terraform should wait for resource creation/deletion.
- `call_failure_threshold` (Number) Threshold value that specifies how many times should a single call failure happen before giving up the polling.
- `polling_timeout` (Number) Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion.


5 changes: 1 addition & 4 deletions docs/resources/dw_database_catalog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cdp_dw_database_catalog Resource - terraform-provider-cdp"
subcategory: ""
subcategory: "Data Warehouse"
description: |-
Creates an AWS Data Warehouse database catalog.
---
Expand Down Expand Up @@ -38,5 +37,3 @@ Optional:
- `async` (Boolean) Boolean value that specifies if Terraform should wait for resource creation/deletion.
- `call_failure_threshold` (Number) Threshold value that specifies how many times should a single call failure happen before giving up the polling.
- `polling_timeout` (Number) Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion.


29 changes: 22 additions & 7 deletions docs/resources/vw_hive.md → docs/resources/dw_vw_hive.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cdp_vw_hive Resource - terraform-provider-cdp"
subcategory: ""
page_title: "cdp_dw_vw_hive Resource - terraform-provider-cdp"
subcategory: "Data Warehouse"
description: |-
A Hive Virtual Warehouse is service which is able to run big SQL queries.
---

# cdp_vw_hive (Resource)
# cdp_dw_vw_hive (Resource)

A Hive Virtual Warehouse is service which is able to run big SQL queries.

## Example Usage

```terraform
## Copyright 2024 Cloudera. All Rights Reserved.
#
# This file is licensed under the Apache License Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
#
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
# OF ANY KIND, either express or implied. Refer to the License for the specific
# permissions and limitations governing your use of the file.
resource "cdp_dw_vw_hive" "example" {
cluster_id = var.cluster_id
database_catalog_id = var.database_catalog_id
name = var.name
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -39,5 +56,3 @@ Optional:
- `async` (Boolean) Boolean value that specifies if Terraform should wait for resource creation/deletion.
- `call_failure_threshold` (Number) Threshold value that specifies how many times should a single call failure happen before giving up the polling.
- `polling_timeout` (Number) Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion.


8 changes: 4 additions & 4 deletions docs/resources/environments_aws_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ The AWS credential is used for authorization to provision resources such as comp
# permissions and limitations governing your use of the file.
resource "cdp_environments_aws_credential" "example" {
credential_name = "example-cdp-aws-credential"
role_arn = "arn:aws:iam::11111111111:role/example-cross-account-role"
description = "Example AWS Credentials"
credential_name = "example-cdp-aws-credential"
role_arn = "arn:aws:iam::11111111111:role/example-cross-account-role"
description = "Example AWS Credentials"
skip_org_policy_decisions = false
verify_permissions = false
verify_permissions = false
}
output "credential_name" {
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/iam_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ output "crn" {
### Read-Only

- `crn` (String) The CRN of the resource.
- `id` (String) The ID of this resource.
- `id` (String) The ID of this resource.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# OF ANY KIND, either express or implied. Refer to the License for the specific
# permissions and limitations governing your use of the file.

resource "cdp_vw_hive" "example" {
resource "cdp_dw_vw_hive" "example" {
cluster_id = var.cluster_id
database_catalog_id = var.database_catalog_id
name = var.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
# permissions and limitations governing your use of the file.

resource "cdp_environments_aws_credential" "example" {
credential_name = "example-cdp-aws-credential"
role_arn = "arn:aws:iam::11111111111:role/example-cross-account-role"
description = "Example AWS Credentials"
credential_name = "example-cdp-aws-credential"
role_arn = "arn:aws:iam::11111111111:role/example-cross-account-role"
description = "Example AWS Credentials"
skip_org_policy_decisions = false
verify_permissions = false
verify_permissions = false
}

output "credential_name" {
Expand Down
2 changes: 1 addition & 1 deletion resources/dw/resource_dw_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func testAccDwCatalog() string {

func testAccHiveVirtualWarehouse(name string) string {
return fmt.Sprintf(`
resource "cdp_vw_hive" "test_hive" {
resource "cdp_dw_vw_hive" "test_hive" {
cluster_id = cdp_dw_aws_cluster.test_data_warehouse_aws.cluster_id
database_catalog_id = cdp_dw_database_catalog.test_catalog.id
name = %[1]q
Expand Down
2 changes: 1 addition & 1 deletion resources/dw/virtualwarehouse/hive/resource_hive_vw.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *hiveResource) Configure(_ context.Context, req resource.ConfigureReques
}

func (r *hiveResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_vw_hive"
resp.TypeName = req.ProviderTypeName + "_dw_vw_hive"
}

func (r *hiveResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
Expand Down
10 changes: 5 additions & 5 deletions resources/dw/virtualwarehouse/hive/resource_hive_vw_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ func TestAccHive_basic(t *testing.T) {
cdpacctest.TestAccCdpProviderConfig(),
testAccHiveBasicConfig(params)),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("cdp_vw_hive.test_hive", "name", params.Name),
resource.TestCheckResourceAttr("cdp_vw_hive.test_hive", "cluster_id", params.ClusterID),
resource.TestCheckResourceAttr("cdp_vw_hive.test_hive", "database_catalog_id", params.DatabaseCatalogID),
resource.TestCheckResourceAttr("cdp_dw_vw_hive.test_hive", "name", params.Name),
resource.TestCheckResourceAttr("cdp_dw_vw_hive.test_hive", "cluster_id", params.ClusterID),
resource.TestCheckResourceAttr("cdp_dw_vw_hive.test_hive", "database_catalog_id", params.DatabaseCatalogID),
),
},
// Delete testing automatically occurs in TestCase
Expand All @@ -76,7 +76,7 @@ func TestAccHive_basic(t *testing.T) {

func testAccHiveBasicConfig(params hiveTestParameters) string {
return fmt.Sprintf(`
resource "cdp_vw_hive" "test_hive" {
resource "cdp_dw_vw_hive" "test_hive" {
cluster_id = %[1]q
database_catalog_id = %[2]q
name = %[3]q
Expand All @@ -86,7 +86,7 @@ func testAccHiveBasicConfig(params hiveTestParameters) string {

func testCheckHiveDestroy(s *terraform.State) error {
for _, rs := range s.RootModule().Resources {
if rs.Type != "cdp_vw_hive" {
if rs.Type != "cdp_dw_vw_hive" {
continue
}

Expand Down
5 changes: 3 additions & 2 deletions resources/dw/virtualwarehouse/hive/resource_hive_vw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
)

var testHiveSchema = schema.Schema{
MarkdownDescription: "A Hive Virtual Warehouse is service which is able to run big SQL queries.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Computed: true,
Expand Down Expand Up @@ -174,10 +175,10 @@ func (suite *HiveTestSuite) TestHiveMetadata() {
// Function under test
dwApi.Metadata(
context.TODO(),
resource.MetadataRequest{ProviderTypeName: "dw"},
resource.MetadataRequest{ProviderTypeName: "cdp"},
&resp,
)
suite.Equal("dw_vw_hive", resp.TypeName)
suite.Equal("cdp_dw_vw_hive", resp.TypeName)
}

func (suite *HiveTestSuite) TestHiveSchema() {
Expand Down
1 change: 1 addition & 0 deletions resources/dw/virtualwarehouse/hive/schema_hive_vw.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
)

var hiveSchema = schema.Schema{
MarkdownDescription: "A Hive Virtual Warehouse is service which is able to run big SQL queries.",
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Computed: true,
Expand Down
26 changes: 26 additions & 0 deletions templates/resources/dw_aws_cluster.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}"
subcategory: "Data Warehouse"
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}

{{ if .HasExample -}}
## Example Usage

{{ tffile .ExampleFile }}
{{- end }}

{{ .SchemaMarkdown | trimspace }}

{{- if .HasImport }}
## Import

Import is supported using the following syntax:

{{codefile "shell" .ImportFile }}
{{- end }}
26 changes: 26 additions & 0 deletions templates/resources/dw_database_catalog.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}"
subcategory: "Data Warehouse"
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}

{{ if .HasExample -}}
## Example Usage

{{ tffile .ExampleFile }}
{{- end }}

{{ .SchemaMarkdown | trimspace }}

{{- if .HasImport }}
## Import

Import is supported using the following syntax:

{{codefile "shell" .ImportFile }}
{{- end }}
26 changes: 26 additions & 0 deletions templates/resources/dw_vw_hive.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}"
subcategory: "Data Warehouse"
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}

{{ if .HasExample -}}
## Example Usage

{{ tffile .ExampleFile }}
{{- end }}

{{ .SchemaMarkdown | trimspace }}

{{- if .HasImport }}
## Import

Import is supported using the following syntax:

{{codefile "shell" .ImportFile }}
{{- end }}
2 changes: 1 addition & 1 deletion templates/resources/iam_group.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ description: |-
Import is supported using the following syntax:

{{codefile "shell" .ImportFile }}
{{- end }}
{{- end }}

0 comments on commit c7153f4

Please sign in to comment.