Skip to content

Commit

Permalink
CDPCP-13591 Cloudera Data Warehouse - Data Visualisation Support
Browse files Browse the repository at this point in the history
Fix testing issues.
  • Loading branch information
Viktor Csomor committed Dec 20, 2024
1 parent 2c7464a commit 39d21ac
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions docs/resources/dw_data_visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ terraform {
resource "cdp_dw_data_visualization" "example" {
cluster_id = "env-id"
name = "data-visualization"
image_version = "2024.0.18.4-5"
image_version = "7.2.7-b48"
resource_template = "default"
Expand All @@ -47,7 +47,7 @@ resource "cdp_dw_data_visualization" "example" {

### Required

- `admin_groups` (String) List of the LDAP groups which can administer this Data Visualization instance. At least one valid group is required.
- `admin_groups` (List of String) List of the LDAP groups which can administer this Data Visualization instance. At least one valid group is required.
- `cluster_id` (String) The id of the CDW Cluster which the Data Visualization is attached to.
- `name` (String) The name of the Data Visualization.

Expand All @@ -56,7 +56,7 @@ resource "cdp_dw_data_visualization" "example" {
- `image_version` (String) The version of the Data Visualization.
- `polling_options` (Attributes) Polling related configuration options that could specify various values that will be used during CDP resource creation. (see [below for nested schema](#nestedatt--polling_options))
- `resource_template` (String) The name of the resource template being used. Available options: reduced, medium, large. Empty means the default resources template will be assigned.
- `user_groups` (String) List of the LDAP groups which have access to this Data Visualization instance.
- `user_groups` (List of String) List of the LDAP groups which have access to this Data Visualization instance.

### Read-Only

Expand Down
2 changes: 1 addition & 1 deletion examples/resources/cdp_dw_data_visualization/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ terraform {
resource "cdp_dw_data_visualization" "example" {
cluster_id = "env-id"
name = "data-visualization"
image_version = "2024.0.18.4-5"
image_version = "7.2.7-b48"

resource_template = "default"

Expand Down
9 changes: 3 additions & 6 deletions resources/dw/dataviz/resource_dataviz.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ func (r *datavizResource) Create(ctx context.Context, req resource.CreateRequest
if opts := plan.PollingOptions; !(opts != nil && opts.Async.ValueBool()) {
if _, err = r.retryStateConf(ctx, setupRetryCfg(clusterID, vizID), &plan).WaitForStateContext(ctx); err != nil {
resp.Diagnostics.AddError(
"Error waiting for Data Warehouse hive virtual warehouse",
"Could not create hive, unexpected error: "+err.Error(),
"Error waiting for Data Visualization",
"Could not create Data Visualization, unexpected error: "+err.Error(),
)
return
}
Expand All @@ -113,9 +113,6 @@ func (r *datavizResource) Create(ctx context.Context, req resource.CreateRequest
),
)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
}

func (r *datavizResource) Read(ctx context.Context, _ resource.ReadRequest, _ *resource.ReadResponse) {
Expand Down Expand Up @@ -215,7 +212,7 @@ func (r *datavizResource) retryStateConf(
Delay: 30 * time.Second,
Timeout: utils.GetPollingTimeout(po, 20*time.Minute),
PollInterval: 30 * time.Second,
Refresh: r.stateRefresh(ctx, cfg.clusterID, cfg.clusterID, &failedCnt, utils.GetCallFailureThreshold(po, 3)),
Refresh: r.stateRefresh(ctx, cfg.clusterID, cfg.vizID, &failedCnt, utils.GetCallFailureThreshold(po, 3)),
}
}

Expand Down
7 changes: 5 additions & 2 deletions resources/dw/dataviz/schema_dataviz.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/types"
)

var datavizSchema = schema.Schema{
Expand Down Expand Up @@ -52,12 +53,14 @@ var datavizSchema = schema.Schema{
MarkdownDescription: "The name of the resource template being used. Available options: reduced, medium, large. Empty means the default resources template will be assigned.",
},

"user_groups": schema.StringAttribute{
"user_groups": schema.ListAttribute{
Optional: true,
ElementType: types.StringType,
MarkdownDescription: "List of the LDAP groups which have access to this Data Visualization instance.",
},
"admin_groups": schema.StringAttribute{
"admin_groups": schema.ListAttribute{
Required: true,
ElementType: types.StringType,
MarkdownDescription: "List of the LDAP groups which can administer this Data Visualization instance. At least one valid group is required.",
},

Expand Down

0 comments on commit 39d21ac

Please sign in to comment.