Skip to content

Commit

Permalink
CDPCP-13213 - Datalake creation is failing with terraform on all 3 cl…
Browse files Browse the repository at this point in the history
…oud for report_deployment_logs (#181)

this field became deprecated and regardless the set value, CB shall return false all the time, therefore there is no point of setting it anymore
  • Loading branch information
gregito authored Nov 21, 2024
1 parent 9feaa0f commit cdf1eac
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion docs/resources/dw_aws_cluster.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cdp_dw_aws_cluster Resource - terraform-provider-cdp"
subcategory: "Data Warehouse"
subcategory: ""
description: |-
Creates an AWS Data Warehouse cluster.
---
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/environments_aws_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ output "crn" {
- `network_cidr` (String)
- `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))
- `proxy_config_name` (String)
- `report_deployment_logs` (Boolean)
- `s3_guard_table_name` (String)
- `subnet_ids` (Set of String)
- `tags` (Map of String)
Expand All @@ -91,6 +90,7 @@ output "crn" {

- `crn` (String)
- `id` (String) The ID of this resource.
- `report_deployment_logs` (Boolean) [Deprecated] When true, this will report additional diagnostic information back to Cloudera.
- `status` (String)
- `status_reason` (String)
- `tunnel_type` (String)
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/environments_azure_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ output "crn" {
- `new_network_params` (Attributes) (see [below for nested schema](#nestedatt--new_network_params))
- `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))
- `proxy_config_name` (String)
- `report_deployment_logs` (Boolean)
- `resource_group_name` (String)
- `tags` (Map of String)
- `workload_analytics` (Boolean)
Expand All @@ -104,6 +103,7 @@ output "crn" {

- `crn` (String)
- `id` (String) The ID of this resource.
- `report_deployment_logs` (Boolean) [Deprecated] When true, this will report additional diagnostic information back to Cloudera.
- `status` (String)
- `status_reason` (String)

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/environments_gcp_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ output "shared_project_id" {
- `log_storage` (Attributes) GCP storage configuration for cluster and audit logs. (see [below for nested schema](#nestedatt--log_storage))
- `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))
- `proxy_config_name` (String) Name of the proxy config to use for the environment.
- `report_deployment_logs` (Boolean) When true, this will report additional diagnostic information back to Cloudera.
- `security_access` (Attributes) Firewall rules for FreeIPA, Data Lake and Data Hub deployment. (see [below for nested schema](#nestedatt--security_access))
- `tags` (Map of String) Tags that can be attached to GCP resources. Please refer to Google documentation for the rules https://cloud.google.com/compute/docs/labeling-resources#label_format.
- `workload_analytics` (Boolean) When this is enabled, diagnostic information about job and query execution is sent to Workload Manager for Data Hub clusters created within this environment.
Expand All @@ -105,6 +104,7 @@ output "shared_project_id" {

- `crn` (String) The CRN of the environment resource.
- `id` (String) The ID of this resource.
- `report_deployment_logs` (Boolean) [Deprecated] When true, this will report additional diagnostic information back to Cloudera.
- `status` (String) The last known status for the environment.
- `status_reason` (String) The last known detailed status reason for the environment.

Expand Down
2 changes: 1 addition & 1 deletion docs/resources/vw_hive.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cdp_vw_hive Resource - terraform-provider-cdp"
subcategory: "Data Warehouse"
subcategory: ""
description: |-
---
Expand Down
12 changes: 5 additions & 7 deletions resources/environments/converter_gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ func toGcpEnvironmentRequest(ctx context.Context, model *gcpEnvironmentResourceM
SharedProjectID: model.ExistingNetworkParams.SharedProjectId.ValueString(),
SubnetNames: utils.FromListValueToStringList(model.ExistingNetworkParams.SubnetNames),
},
ProxyConfigName: model.ProxyConfigName.ValueString(),
PublicKey: model.PublicKey.ValueStringPointer(),
Region: model.Region.ValueStringPointer(),
ReportDeploymentLogs: model.ReportDeploymentLogs.ValueBool(),
UsePublicIP: model.UsePublicIp.ValueBoolPointer(),
WorkloadAnalytics: model.WorkloadAnalytics.ValueBool(),
ProxyConfigName: model.ProxyConfigName.ValueString(),
PublicKey: model.PublicKey.ValueStringPointer(),
Region: model.Region.ValueStringPointer(),
UsePublicIP: model.UsePublicIp.ValueBoolPointer(),
WorkloadAnalytics: model.WorkloadAnalytics.ValueBool(),
}
if !model.FreeIpa.IsNull() && !model.FreeIpa.IsUnknown() {
trans, _ := FreeIpaModelToRequest(&model.FreeIpa, ctx)
Expand Down Expand Up @@ -127,7 +126,6 @@ func toGcpEnvironmentResource(ctx context.Context, env *environmentsmodels.Envir
model.ProxyConfigName = types.StringPointerValue(env.ProxyConfig.ProxyConfigName)
}
model.Region = types.StringPointerValue(env.Region)
model.ReportDeploymentLogs = types.BoolValue(env.ReportDeploymentLogs)
tflog.Info(ctx, "about to convert security access.")
if env.SecurityAccess != nil && len(env.SecurityAccess.SecurityGroupIDForKnox) > 0 && len(env.SecurityAccess.DefaultSecurityGroupID) > 0 {
model.SecurityAccess = &GcpSecurityAccess{
Expand Down
4 changes: 1 addition & 3 deletions resources/environments/resource_aws_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ func (r *awsEnvironmentResource) Read(ctx context.Context, req resource.ReadRequ
}
}

func (r *awsEnvironmentResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {

func (r *awsEnvironmentResource) Update(_ context.Context, _ resource.UpdateRequest, _ *resource.UpdateResponse) {
}

func (r *awsEnvironmentResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
Expand Down Expand Up @@ -210,7 +209,6 @@ func toAwsEnvironmentResource(ctx context.Context, env *environmentsmodels.Envir
model.ProxyConfigName = types.StringPointerValue(env.ProxyConfig.ProxyConfigName)
}
model.Region = types.StringPointerValue(env.Region)
model.ReportDeploymentLogs = types.BoolValue(env.ReportDeploymentLogs)
if env.SecurityAccess != nil {
var dsgIDs types.Set
if model.SecurityAccess != nil && !model.SecurityAccess.DefaultSecurityGroupIDs.IsUnknown() {
Expand Down
7 changes: 3 additions & 4 deletions resources/environments/resource_azure_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ func NewAzureEnvironmentResource() resource.Resource {
return &azureEnvironmentResource{}
}

func (r *azureEnvironmentResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
func (r *azureEnvironmentResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
resp.TypeName = req.ProviderTypeName + "_environments_azure_environment"
}

func (r *azureEnvironmentResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
func (r *azureEnvironmentResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = AzureEnvironmentSchema
}

Expand Down Expand Up @@ -208,7 +208,6 @@ func toAzureEnvironmentResource(ctx context.Context, env *environmentsmodels.Env
if env.ProxyConfig != nil {
model.ProxyConfigName = types.StringPointerValue(env.ProxyConfig.ProxyConfigName)
}
model.ReportDeploymentLogs = types.BoolValue(env.ReportDeploymentLogs)
if env.SecurityAccess != nil {
var dsgIDs types.Set
if model.SecurityAccess == nil || model.SecurityAccess.DefaultSecurityGroupIDs.IsUnknown() {
Expand Down Expand Up @@ -240,7 +239,7 @@ func toAzureEnvironmentResource(ctx context.Context, env *environmentsmodels.Env
model.WorkloadAnalytics = types.BoolValue(env.WorkloadAnalytics)
}

func (r *azureEnvironmentResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
func (r *azureEnvironmentResource) Update(_ context.Context, _ resource.UpdateRequest, _ *resource.UpdateResponse) {

}

Expand Down
7 changes: 4 additions & 3 deletions resources/environments/schema_aws_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ var AwsEnvironmentSchema = schema.Schema{
Required: true,
},
"report_deployment_logs": schema.BoolAttribute{
Optional: true,
Computed: true,
// report_deployment_logs is a deprecated field and should not be used
MarkdownDescription: " [Deprecated] When true, this will report additional diagnostic information back to Cloudera.",
Computed: true,
Default: booldefault.StaticBool(false),
PlanModifiers: []planmodifier.Bool{
boolplanmodifier.UseStateForUnknown(),
},
Expand Down Expand Up @@ -314,7 +316,6 @@ func ToAwsEnvironmentRequest(ctx context.Context, model *awsEnvironmentResourceM
}
res.ProxyConfigName = model.ProxyConfigName.ValueString()
res.Region = model.Region.ValueStringPointer()
res.ReportDeploymentLogs = model.ReportDeploymentLogs.ValueBool()
res.S3GuardTableName = model.S3GuardTableName.ValueString()
res.SecurityAccess = &environmentsmodels.SecurityAccessRequest{
Cidr: model.SecurityAccess.Cidr.ValueString(),
Expand Down
7 changes: 4 additions & 3 deletions resources/environments/schema_azure_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ var AzureEnvironmentSchema = schema.Schema{
Required: true,
},
"report_deployment_logs": schema.BoolAttribute{
Optional: true,
Computed: true,
// report_deployment_logs is a deprecated field and should not be used
MarkdownDescription: " [Deprecated] When true, this will report additional diagnostic information back to Cloudera.",
Computed: true,
Default: booldefault.StaticBool(false),
PlanModifiers: []planmodifier.Bool{
boolplanmodifier.UseStateForUnknown(),
},
Expand Down Expand Up @@ -351,7 +353,6 @@ func ToAzureEnvironmentRequest(ctx context.Context, model *azureEnvironmentResou
req.ProxyConfigName = model.ProxyConfigName.ValueString()
req.PublicKey = model.PublicKey.ValueStringPointer()
req.Region = model.Region.ValueStringPointer()
req.ReportDeploymentLogs = model.ReportDeploymentLogs.ValueBool()
req.ResourceGroupName = model.ResourceGroupName.ValueString()
req.SecurityAccess = &environmentsmodels.SecurityAccessRequest{
Cidr: model.SecurityAccess.Cidr.ValueString(),
Expand Down
5 changes: 3 additions & 2 deletions resources/environments/schema_gcp_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ func (r *gcpEnvironmentResource) Schema(_ context.Context, _ resource.SchemaRequ
},
},
"report_deployment_logs": schema.BoolAttribute{
MarkdownDescription: "When true, this will report additional diagnostic information back to Cloudera.",
Optional: true,
// report_deployment_logs is a deprecated field and should not be used
MarkdownDescription: " [Deprecated] When true, this will report additional diagnostic information back to Cloudera.",
Computed: true,
Default: booldefault.StaticBool(false),
PlanModifiers: []planmodifier.Bool{
boolplanmodifier.UseStateForUnknown(),
},
Expand Down

0 comments on commit cdf1eac

Please sign in to comment.