Skip to content

Commit

Permalink
CDPCP-12277 Removed DL computed fields, not known right after post
Browse files Browse the repository at this point in the history
  • Loading branch information
daszabo committed Jul 25, 2024
1 parent ba8c94f commit ed31067
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 659 deletions.
28 changes: 14 additions & 14 deletions examples/resources/cdp_dw_aws_cluster/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@
# permissions and limitations governing your use of the file.

resource "cdp_dw_aws_cluster" "example" {
crn = cdp_datalake_aws_datalake.example.crn
name = "<value>"
cluster_id = "<value>"
crn = cdp_datalake_aws_datalake.example.crn
name = "<value>"
cluster_id = "<value>"
node_role_cdw_managed_policy_arn = "<value>"
database_backup_retention_days = 7
database_backup_retention_days = 7
custom_registry_options = {
registry_type = "ECR"
registry_type = "ECR"
repository_url = "<value>"
}
custom_subdomain = ""
network_settings = {
worker_subnet_ids = ["<value>", "<value>", "<value>"]
load_balancer_subnet_ids = ["<value>", "<value>", "<value>"]
use_overlay_network = false
worker_subnet_ids = ["<value>", "<value>", "<value>"]
load_balancer_subnet_ids = ["<value>", "<value>", "<value>"]
use_overlay_network = false
whitelist_k8s_cluster_access_ip_cidrs = ["0.0.0.0/0"]
whitelist_workload_access_ip_cidrs = ["0.0.0.0/0"]
use_private_load_balancer = true
use_public_worker_node = false
whitelist_workload_access_ip_cidrs = ["0.0.0.0/0"]
use_private_load_balancer = true
use_public_worker_node = false
}
instance_settings = {
custom_ami_id = ""
enable_spot_instances = false
compute_instance_types = ["<value>"]
custom_ami_id = ""
enable_spot_instances = false
compute_instance_types = ["<value>"]
additional_instance_types = ["<value>"]
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/resources/cdp_dw_hive/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# permissions and limitations governing your use of the file.

resource "cdp_vw_hive" "example" {
cluster_id = var.cluster_id
database_catalog_id = var.database_catalog_id
name = var.name
cluster_id = var.cluster_id
database_catalog_id = var.database_catalog_id
name = var.name
}
14 changes: 0 additions & 14 deletions resources/datalake/converter_gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@ func datalakeDetailsToGcpDatalakeResourceModel(ctx context.Context, resp *datala
model.EnableRangerRaz = types.BoolValue(resp.EnableRangerRaz)
model.PollingOptions = pollingOptions
model.EnvironmentCrn = types.StringValue(resp.EnvironmentCrn)
productVersions := make([]*productVersion, len(resp.ProductVersions))
for i, v := range resp.ProductVersions {
productVersions[i] = &productVersion{
Name: types.StringPointerValue(v.Name),
Version: types.StringPointerValue(v.Version),
}
}
model.Scale = types.StringValue(string(resp.Shape))
model.Status = types.StringValue(resp.Status)
model.StatusReason = types.StringValue(resp.StatusReason)
Expand All @@ -50,13 +43,6 @@ func toGcpDatalakeRequest(ctx context.Context, model *gcpDatalakeResourceModel)
StorageLocation: model.CloudProviderConfiguration.StorageLocation.ValueStringPointer(),
}
}
req.CustomInstanceGroups = make([]*datalakemodels.SdxInstanceGroupRequest, len(model.CustomInstanceGroups))
for i, v := range model.CustomInstanceGroups {
req.CustomInstanceGroups[i] = &datalakemodels.SdxInstanceGroupRequest{
InstanceType: v.InstanceType.ValueString(),
Name: v.Name.ValueStringPointer(),
}
}
req.DatalakeName = model.DatalakeName.ValueStringPointer()
req.EnableRangerRaz = model.EnableRangerRaz.ValueBool()
req.EnvironmentName = model.EnvironmentName.ValueStringPointer()
Expand Down
44 changes: 0 additions & 44 deletions resources/datalake/model_aws_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,20 @@ type awsDatalakeResourceModel struct {

CertificateExpirationState types.String `tfsdk:"certificate_expiration_state"`

ClouderaManager types.Object `tfsdk:"cloudera_manager"`

CreationDate types.String `tfsdk:"creation_date"`

Crn types.String `tfsdk:"crn"`

CustomInstanceGroups []*awsDatalakeInstanceGroup `tfsdk:"custom_instance_groups"`

DatalakeName types.String `tfsdk:"datalake_name"`

EnableRangerRaz types.Bool `tfsdk:"enable_ranger_raz"`

Endpoints types.Set `tfsdk:"endpoints"`

EnvironmentCrn types.String `tfsdk:"environment_crn"`

EnvironmentName types.String `tfsdk:"environment_name"`

Image *awsDatalakeImage `tfsdk:"image"`

InstanceGroups types.Set `tfsdk:"instance_groups"`

ProductVersions types.Set `tfsdk:"product_versions"`

JavaVersion types.Int64 `tfsdk:"java_version"`

MultiAz types.Bool `tfsdk:"multi_az"`
Expand All @@ -68,12 +58,6 @@ type awsDatalakeResourceModel struct {
Tags types.Map `tfsdk:"tags"`
}

type awsDatalakeInstanceGroup struct {
InstanceType types.String `tfsdk:"instance_type"`

Name types.String `tfsdk:"name"`
}

type awsDatalakeImage struct {
CatalogName types.String `tfsdk:"catalog_name"`

Expand Down Expand Up @@ -115,31 +99,3 @@ type instance struct {

StatusReason types.String `tfsdk:"status_reason"`
}

type clouderaManagerDetails struct {
ClouderaManagerRepositoryURL types.String `tfsdk:"cloudera_manager_repository_url"`

ClouderaManagerServerURL types.String `tfsdk:"cloudera_manager_server_url"`

Version types.String `tfsdk:"version"`
}

type endpoint struct {
DisplayName types.String `tfsdk:"display_name"`

KnoxService types.String `tfsdk:"knox_service"`

Mode types.String `tfsdk:"mode"`

Open types.Bool `tfsdk:"open"`

ServiceName types.String `tfsdk:"service_name"`

ServiceURL types.String `tfsdk:"service_url"`
}

type productVersion struct {
Name types.String `tfsdk:"name"`

Version types.String `tfsdk:"version"`
}
8 changes: 0 additions & 8 deletions resources/datalake/model_azure_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ type azureDatalakeResourceModel struct {

CertificateExpirationState types.String `tfsdk:"certificate_expiration_state"`

ClouderaManager types.Object `tfsdk:"cloudera_manager"`

CreationDate types.String `tfsdk:"creation_date"`

Crn types.String `tfsdk:"crn"`
Expand All @@ -37,18 +35,12 @@ type azureDatalakeResourceModel struct {

EnableRangerRaz types.Bool `tfsdk:"enable_ranger_raz"`

Endpoints types.Set `tfsdk:"endpoints"`

EnvironmentCrn types.String `tfsdk:"environment_crn"`

EnvironmentName types.String `tfsdk:"environment_name"`

Image *azureDatalakeImage `tfsdk:"image"`

InstanceGroups types.Set `tfsdk:"instance_groups"`

ProductVersions types.Set `tfsdk:"product_versions"`

JavaVersion types.Int64 `tfsdk:"java_version"`

Recipes []*instanceGroupRecipe `tfsdk:"recipes"`
Expand Down
8 changes: 0 additions & 8 deletions resources/datalake/model_gcp_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ type gcpDatalakeResourceModel struct {

Crn types.String `tfsdk:"crn"`

CustomInstanceGroups []*gcpDatalakeInstanceGroup `tfsdk:"custom_instance_groups"`

DatalakeName types.String `tfsdk:"datalake_name"`

EnableRangerRaz types.Bool `tfsdk:"enable_ranger_raz"`
Expand Down Expand Up @@ -61,12 +59,6 @@ type gcpConfiguration struct {
StorageLocation types.String `tfsdk:"storage_location"`
}

type gcpDatalakeInstanceGroup struct {
InstanceType types.String `tfsdk:"instance_type"`

Name types.String `tfsdk:"name"`
}

type gcpDatalakeImage struct {
CatalogName types.String `tfsdk:"catalog_name"`

Expand Down
83 changes: 0 additions & 83 deletions resources/datalake/resource_aws_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ func toAwsDatalakeRequest(ctx context.Context, model *awsDatalakeResourceModel)
InstanceProfile: model.InstanceProfile.ValueStringPointer(),
StorageBucketLocation: model.StorageLocationBase.ValueStringPointer(),
}
req.CustomInstanceGroups = make([]*datalakemodels.SdxInstanceGroupRequest, len(model.CustomInstanceGroups))
for i, v := range model.CustomInstanceGroups {
req.CustomInstanceGroups[i] = &datalakemodels.SdxInstanceGroupRequest{
InstanceType: v.InstanceType.ValueString(),
Name: v.Name.ValueStringPointer(),
}
}
req.DatalakeName = model.DatalakeName.ValueStringPointer()
req.EnableRangerRaz = model.EnableRangerRaz.ValueBool()
req.EnvironmentName = model.EnvironmentName.ValueStringPointer()
Expand Down Expand Up @@ -270,49 +263,11 @@ func datalakeDetailsToAwsDatalakeResourceModel(ctx context.Context, resp *datala
if resp.AwsConfiguration != nil {
model.InstanceProfile = types.StringValue(resp.AwsConfiguration.InstanceProfile)
}
if resp.ClouderaManager != nil {
var cmDiags diag.Diagnostics
model.ClouderaManager, cmDiags = types.ObjectValueFrom(ctx, map[string]attr.Type{
"cloudera_manager_repository_url": types.StringType,
"cloudera_manager_server_url": types.StringType,
"version": types.StringType,
}, &clouderaManagerDetails{
ClouderaManagerRepositoryURL: types.StringPointerValue(resp.ClouderaManager.ClouderaManagerRepositoryURL),
ClouderaManagerServerURL: types.StringValue(resp.ClouderaManager.ClouderaManagerServerURL),
Version: types.StringPointerValue(resp.ClouderaManager.Version),
})
diags.Append(cmDiags...)
}
model.CreationDate = types.StringValue(resp.CreationDate.String())
model.Crn = types.StringPointerValue(resp.Crn)
model.DatalakeName = types.StringPointerValue(resp.DatalakeName)
model.EnableRangerRaz = types.BoolValue(resp.EnableRangerRaz)
model.PollingOptions = pollingOptions
if resp.Endpoints != nil {
endpoints := make([]*endpoint, len(resp.Endpoints.Endpoints))
for i, v := range resp.Endpoints.Endpoints {
endpoints[i] = &endpoint{
DisplayName: types.StringPointerValue(v.DisplayName),
KnoxService: types.StringPointerValue(v.KnoxService),
Mode: types.StringPointerValue(v.Mode),
Open: types.BoolPointerValue(v.Open),
ServiceName: types.StringPointerValue(v.ServiceName),
ServiceURL: types.StringPointerValue(v.ServiceURL),
}
}
var epDiags diag.Diagnostics
model.Endpoints, epDiags = types.SetValueFrom(ctx, types.ObjectType{
AttrTypes: map[string]attr.Type{
"display_name": types.StringType,
"knox_service": types.StringType,
"mode": types.StringType,
"open": types.BoolType,
"service_name": types.StringType,
"service_url": types.StringType,
},
}, endpoints)
diags.Append(epDiags...)
}
model.EnvironmentCrn = types.StringValue(resp.EnvironmentCrn)
instanceGroups := make([]*instanceGroup, len(resp.InstanceGroups))
for i, v := range resp.InstanceGroups {
Expand Down Expand Up @@ -355,44 +310,6 @@ func datalakeDetailsToAwsDatalakeResourceModel(ctx context.Context, resp *datala
}, instances)
diags.Append(instDiags...)
}
var igDiags diag.Diagnostics
model.InstanceGroups, igDiags = types.SetValueFrom(ctx, types.ObjectType{
AttrTypes: map[string]attr.Type{
"instances": types.SetType{
ElemType: types.ObjectType{
AttrTypes: map[string]attr.Type{
"discovery_fqdn": types.StringType,
"id": types.StringType,
"instance_group": types.StringType,
"instance_status": types.StringType,
"instance_type_val": types.StringType,
"private_ip": types.StringType,
"public_ip": types.StringType,
"ssh_port": types.Int64Type,
"state": types.StringType,
"status_reason": types.StringType,
},
},
},
"name": types.StringType,
},
}, instanceGroups)
diags.Append(igDiags...)
productVersions := make([]*productVersion, len(resp.ProductVersions))
for i, v := range resp.ProductVersions {
productVersions[i] = &productVersion{
Name: types.StringPointerValue(v.Name),
Version: types.StringPointerValue(v.Version),
}
}
var pvDiags diag.Diagnostics
model.ProductVersions, pvDiags = types.SetValueFrom(ctx, types.ObjectType{
AttrTypes: map[string]attr.Type{
"name": types.StringType,
"version": types.StringType,
},
}, productVersions)
diags.Append(pvDiags...)
model.Scale = types.StringValue(string(resp.Shape))
model.Status = types.StringValue(resp.Status)
model.StatusReason = types.StringValue(resp.StatusReason)
Expand Down
Loading

0 comments on commit ed31067

Please sign in to comment.