Skip to content

Commit

Permalink
CDPCP-14056 - Remove completely the option from the Terraform provide…
Browse files Browse the repository at this point in the history
…r of provisioning environment(s) with new network created by Cloudera
  • Loading branch information
gregito committed Feb 28, 2025
1 parent 73e4d5f commit 0f12262
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 54 deletions.
4 changes: 2 additions & 2 deletions docs/resources/environments_aws_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ resource "cdp_environments_aws_environment" "example" {
security_access = {
cidr = "0.0.0.0/0"
}
network_cidr = "10.10.0.0/16"
authentication = {
public_key_id = "my-key"
}
log_storage = {
storage_location_base = "s3a://storage-bucket/location"
instance_profile = "arn:aws:iam::11111111111:instance-profile/storage-instance-profile"
}
vpc_id = "vpc-1"
subnet_ids = [ "<env-subnet-1>", "<env-subnet-2>", "<env-subnet-3>" ]
}
output "environment_name" {
Expand Down Expand Up @@ -89,7 +90,6 @@ output "crn" {

- `crn` (String)
- `id` (String) The ID of this resource.
- `network_cidr` (String, Deprecated)
- `report_deployment_logs` (Boolean, Deprecated) [Deprecated] When true, this will report additional diagnostic information back to Cloudera.
- `status` (String)
- `status_reason` (String)
Expand Down
11 changes: 1 addition & 10 deletions docs/resources/environments_azure_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ output "crn" {

- `crn` (String)
- `id` (String) The ID of this resource.
- `new_network_params` (Attributes, Deprecated) (see [below for nested schema](#nestedatt--new_network_params))
- `report_deployment_logs` (Boolean) [Deprecated] When true, this will report additional diagnostic information back to Cloudera.
- `status` (String)
- `status_reason` (String)
Expand Down Expand Up @@ -193,12 +192,4 @@ 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.


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

Required:

- `network_cidr` (String)
- `polling_timeout` (Number) Timeout value in minutes that specifies for how long should the polling go for resource creation/deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ resource "cdp_environments_aws_environment" "example" {
security_access = {
cidr = "0.0.0.0/0"
}
network_cidr = "10.10.0.0/16"
authentication = {
public_key_id = "my-key"
}
log_storage = {
storage_location_base = "s3a://storage-bucket/location"
instance_profile = "arn:aws:iam::11111111111:instance-profile/storage-instance-profile"
}
vpc_id = "vpc-1"
subnet_ids = [ "<env-subnet-1>", "<env-subnet-2>", "<env-subnet-3>" ]
}

output "environment_name" {
Expand Down
2 changes: 0 additions & 2 deletions resources/environments/model_aws_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ type awsEnvironmentResourceModel struct {

LogStorage *AWSLogStorage `tfsdk:"log_storage"`

NetworkCidr types.String `tfsdk:"network_cidr"`

ProxyConfigName types.String `tfsdk:"proxy_config_name"`

Region types.String `tfsdk:"region"`
Expand Down
4 changes: 0 additions & 4 deletions resources/environments/model_azure_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,3 @@ type azureLogStorage struct {

BackupStorageLocationBase types.String `tfsdk:"backup_storage_location_base"`
}

type newNetworkParams struct {
NetworkCidr types.String `tfsdk:"network_cidr"`
}
1 change: 0 additions & 1 deletion resources/environments/resource_aws_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ func toAwsEnvironmentResource(ctx context.Context, env *environmentsmodels.Envir
diags.Append(*FreeIpaResponseToModel(env.Freeipa, &model.FreeIpa, ctx)...)
if env.Network != nil {
model.EndpointAccessGatewayScheme = types.StringValue(env.Network.EndpointAccessGatewayScheme)
model.NetworkCidr = types.StringValue(env.Network.NetworkCidr)
if env.Network.EndpointAccessGatewaySubnetIds != nil {
var eagSubnetids types.Set
if len(env.Network.EndpointAccessGatewaySubnetIds) > 0 {
Expand Down
5 changes: 0 additions & 5 deletions resources/environments/resource_azure_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@ func toAzureEnvironmentResource(ctx context.Context, env *environmentsmodels.Env
diags.Append(*FreeIpaResponseToModel(env.Freeipa, &model.FreeIpa, ctx)...)
if env.Network != nil {
var npDiags diag.Diagnostics
model.NewNetworkParams, npDiags = types.ObjectValueFrom(ctx, map[string]attr.Type{
"network_cidr": types.StringType,
}, &newNetworkParams{
NetworkCidr: types.StringValue(env.Network.NetworkCidr),
})
if env.Network.EndpointAccessGatewaySubnetIds != nil {
var gatewaySubnetIds types.Set
if len(env.Network.EndpointAccessGatewaySubnetIds) > 0 {
Expand Down
10 changes: 0 additions & 10 deletions resources/environments/schema_aws_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,6 @@ var AwsEnvironmentSchema = schema.Schema{
boolplanmodifier.UseStateForUnknown(),
},
},
"network_cidr": schema.StringAttribute{
DeprecationMessage: "New network creation by specifying network_cidr is deprecated and should not be used anymore.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"proxy_config_name": schema.StringAttribute{
Optional: true,
Computed: true,
Expand Down Expand Up @@ -311,9 +304,6 @@ func ToAwsEnvironmentRequest(ctx context.Context, model *awsEnvironmentResourceM
BackupStorageLocationBase: model.LogStorage.BackupStorageLocationBase.ValueString(),
}
}
if !model.NetworkCidr.IsNull() && !model.NetworkCidr.IsUnknown() {
res.NetworkCidr = model.NetworkCidr.ValueString()
}
res.ProxyConfigName = model.ProxyConfigName.ValueString()
res.Region = model.Region.ValueStringPointer()
res.S3GuardTableName = model.S3GuardTableName.ValueString()
Expand Down
19 changes: 0 additions & 19 deletions resources/environments/schema_azure_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,6 @@ var AzureEnvironmentSchema = schema.Schema{
},
},
},
"new_network_params": schema.SingleNestedAttribute{
DeprecationMessage: "New network creation is deprecated and should not be used anymore.",
Computed: true,
PlanModifiers: []planmodifier.Object{
objectplanmodifier.UseStateForUnknown(),
},
Attributes: map[string]schema.Attribute{
"network_cidr": schema.StringAttribute{
Required: true,
},
},
},
"proxy_config_name": schema.StringAttribute{
Optional: true,
},
Expand Down Expand Up @@ -344,13 +332,6 @@ func ToAzureEnvironmentRequest(ctx context.Context, model *azureEnvironmentResou
BackupStorageLocationBase: model.LogStorage.BackupStorageLocationBase.ValueString(),
}
}
if !model.NewNetworkParams.IsNull() && !model.NewNetworkParams.IsUnknown() {
var newNetworkParams newNetworkParams
model.NewNetworkParams.As(ctx, &newNetworkParams, basetypes.ObjectAsOptions{UnhandledNullAsEmpty: true, UnhandledUnknownAsEmpty: true})
req.NewNetworkParams = &environmentsmodels.CreateAzureEnvironmentRequestNewNetworkParams{
NetworkCidr: newNetworkParams.NetworkCidr.ValueStringPointer(),
}
}
req.ProxyConfigName = model.ProxyConfigName.ValueString()
req.PublicKey = model.PublicKey.ValueStringPointer()
req.Region = model.Region.ValueStringPointer()
Expand Down

0 comments on commit 0f12262

Please sign in to comment.