Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions resources/datahub/resource_aws_datahub.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,22 @@ import (
var (
_ resource.ResourceWithConfigure = &awsDatahubResource{}
_ resource.ResourceWithImportState = &awsDatahubResource{}
_ resource.ResourceWithModifyPlan = &awsDatahubResource{}
)

type awsDatahubResource struct {
client *cdp.Client
}

func (r *awsDatahubResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
if !req.State.Raw.IsNull() {
resp.Diagnostics.AddError(
"Resource Update Considerations",
"Due to provider limitations of this technical preview, modifications are not possible. "+
"Use the web interface or the CLI to update this resource.")
}
}

func (r *awsDatahubResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
}
Expand Down
10 changes: 10 additions & 0 deletions resources/datahub/resource_azure_datahub.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,22 @@ import (
var (
_ resource.ResourceWithConfigure = &azureDatahubResource{}
_ resource.ResourceWithImportState = &azureDatahubResource{}
_ resource.ResourceWithModifyPlan = &azureDatahubResource{}
)

type azureDatahubResource struct {
client *cdp.Client
}

func (r *azureDatahubResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
if !req.State.Raw.IsNull() {
resp.Diagnostics.AddError(
"Resource Update Considerations",
"Due to provider limitations of this technical preview, modifications are not possible. "+
"Use the web interface or the CLI to update this resource.")
}
}

func (r *azureDatahubResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
}
Expand Down
10 changes: 10 additions & 0 deletions resources/datahub/resource_gcp_datahub.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,22 @@ import (
var (
_ resource.ResourceWithConfigure = &gcpDatahubResource{}
_ resource.ResourceWithImportState = &gcpDatahubResource{}
_ resource.ResourceWithModifyPlan = &gcpDatahubResource{}
)

type gcpDatahubResource struct {
client *cdp.Client
}

func (r *gcpDatahubResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
if !req.State.Raw.IsNull() {
resp.Diagnostics.AddError(
"Resource Update Considerations",
"Due to provider limitations of this technical preview, modifications are not possible. "+
"Use the web interface or the CLI to update this resource.")
}
}

func (r *gcpDatahubResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
}
Expand Down
10 changes: 10 additions & 0 deletions resources/datalake/resource_aws_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,22 @@ import (
var (
_ resource.ResourceWithConfigure = &awsDatalakeResource{}
_ resource.ResourceWithImportState = &awsDatalakeResource{}
_ resource.ResourceWithModifyPlan = &awsDatalakeResource{}
)

type awsDatalakeResource struct {
client *cdp.Client
}

func (r *awsDatalakeResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
if !req.State.Raw.IsNull() {
resp.Diagnostics.AddError(
"Resource Update Considerations",
"Due to provider limitations of this technical preview, modifications are not possible. "+
"Use the web interface or the CLI to update this resource.")
}
}

func (r *awsDatalakeResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
}
Expand Down
10 changes: 10 additions & 0 deletions resources/datalake/resource_azure_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,22 @@ import (
var (
_ resource.ResourceWithConfigure = &azureDatalakeResource{}
_ resource.ResourceWithImportState = &azureDatalakeResource{}
_ resource.ResourceWithModifyPlan = &azureDatalakeResource{}
)

type azureDatalakeResource struct {
client *cdp.Client
}

func (r *azureDatalakeResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
if !req.State.Raw.IsNull() {
resp.Diagnostics.AddError(
"Resource Update Considerations",
"Due to provider limitations of this technical preview, modifications are not possible. "+
"Use the web interface or the CLI to update this resource.")
}
}

func (r *azureDatalakeResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
}
Expand Down
10 changes: 10 additions & 0 deletions resources/datalake/resource_gcp_datalake.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,22 @@ import (
var (
_ resource.ResourceWithConfigure = &gcpDatalakeResource{}
_ resource.ResourceWithImportState = &gcpDatalakeResource{}
_ resource.ResourceWithModifyPlan = &gcpDatalakeResource{}
)

type gcpDatalakeResource struct {
client *cdp.Client
}

func (r *gcpDatalakeResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
if !req.State.Raw.IsNull() {
resp.Diagnostics.AddError(
"Resource Update Considerations",
"Due to provider limitations of this technical preview, modifications are not possible. "+
"Use the web interface or the CLI to update this resource.")
}
}

func (r *gcpDatalakeResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
}
Expand Down
16 changes: 12 additions & 4 deletions resources/environments/converter_freeipa.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,18 @@ func FreeIpaResponseToModel(ipaResp *environmentsmodels.FreeipaDetails, model *t
ipaInstances, instDiags = types.SetValueFrom(ctx, FreeIpaInstanceType, instSet)
diags.Append(instDiags...)

instanceCount, countErr := ConvertIntToInt32IfPossible(len(ipaResp.Instances))
if countErr != nil {
diags.AddWarning(fmt.Sprintf("Unable to convert the numerical value of the length of the instances slice. Fallbacking to %d", ipaResp.InstanceCountByGroup), countErr.Error())
instanceCount = types.Int32Value(ipaResp.InstanceCountByGroup)
var instanceCount basetypes.Int32Value
if val, ok := model.Attributes()["instance_count_by_group"]; ok {
if val.IsNull() {
var countErr error
instanceCount, countErr = ConvertIntToInt32IfPossible(len(ipaResp.Instances))
if countErr != nil {
diags.AddWarning(fmt.Sprintf("Unable to convert the numerical value of the length of the instances slice. Fallbacking to %d", ipaResp.InstanceCountByGroup), countErr.Error())
instanceCount = types.Int32Value(ipaResp.InstanceCountByGroup)
}
} else {
instanceCount = val.(basetypes.Int32Value)
}
}
var ipaDiags diag.Diagnostics
*model, ipaDiags = types.ObjectValueFrom(ctx, FreeIpaDetailsType.AttrTypes, &FreeIpaDetails{
Expand Down
2 changes: 1 addition & 1 deletion resources/environments/converter_gcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func createFilledGcpEnvironmentResourceModel() *gcpEnvironmentResourceModel {
var elems []attr.Value
instances, _ := types.SetValue(FreeIpaInstanceType, elems)
freeIpaObj, _ := basetypes.NewObjectValue(FreeIpaDetailsType.AttrTypes, map[string]attr.Value{
"instance_count_by_group": types.Int64Value(123),
"instance_count_by_group": types.Int32Value(123),
"recipes": createSetOfString(),
"instance_type": types.StringValue("someInstanceType"),
"catalog": types.StringValue("someCatalog"),
Expand Down
10 changes: 10 additions & 0 deletions resources/environments/resource_aws_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
var (
_ resource.ResourceWithConfigure = &awsEnvironmentResource{}
_ resource.ResourceWithImportState = &awsEnvironmentResource{}
_ resource.ResourceWithModifyPlan = &awsEnvironmentResource{}
)

type awsEnvironmentResource struct {
Expand All @@ -54,6 +55,15 @@ func (r *awsEnvironmentResource) Configure(_ context.Context, req resource.Confi
r.client = utils.GetCdpClientForResource(req, resp)
}

func (r *awsEnvironmentResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
if !req.State.Raw.IsNull() {
resp.Diagnostics.AddWarning(
"Resource Update Considerations",
"Due to provider limitations of this technical preview resource modifications are limited to enabling compute clusters. "+
"Use the web interface or the CLI to update this resource.")
}
}

func (r *awsEnvironmentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var data awsEnvironmentResourceModel
diags := req.Plan.Get(ctx, &data)
Expand Down
10 changes: 10 additions & 0 deletions resources/environments/resource_azure_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
var (
_ resource.ResourceWithConfigure = &azureEnvironmentResource{}
_ resource.ResourceWithImportState = &azureEnvironmentResource{}
_ resource.ResourceWithModifyPlan = &azureEnvironmentResource{}
)

type azureEnvironmentResource struct {
Expand All @@ -55,6 +56,15 @@ func (r *azureEnvironmentResource) Configure(_ context.Context, req resource.Con
r.client = utils.GetCdpClientForResource(req, resp)
}

func (r *azureEnvironmentResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
if !req.State.Raw.IsNull() {
resp.Diagnostics.AddWarning(
"Resource Update Considerations",
"Due to provider limitations of this technical preview resource modifications are limited to enabling compute clusters. "+
"Use the web interface or the CLI to update this resource.")
}
}

func (r *azureEnvironmentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var data azureEnvironmentResourceModel
diags := req.Plan.Get(ctx, &data)
Expand Down
10 changes: 10 additions & 0 deletions resources/environments/resource_gcp_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
var (
_ resource.ResourceWithConfigure = &gcpEnvironmentResource{}
_ resource.ResourceWithImportState = &gcpEnvironmentResource{}
_ resource.ResourceWithModifyPlan = &gcpEnvironmentResource{}
)

type gcpEnvironmentResource struct {
Expand All @@ -52,6 +53,15 @@ func (r *gcpEnvironmentResource) Configure(_ context.Context, req resource.Confi
r.client = utils.GetCdpClientForResource(req, resp)
}

func (r *gcpEnvironmentResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
if !req.State.Raw.IsNull() {
resp.Diagnostics.AddWarning(
"Resource Update Considerations",
"Due to provider limitations of this technical preview resource modifications are limited to enabling compute clusters. "+
"Use the web interface or the CLI to update this resource.")
}
}

func (r *gcpEnvironmentResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var data gcpEnvironmentResourceModel
diags := req.Plan.Get(ctx, &data)
Expand Down
2 changes: 1 addition & 1 deletion resources/environments/schema_environment_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ var FreeIpaConfigSchema = schema.SingleNestedAttribute{
"os": schema.StringAttribute{
Computed: true,
},
"instance_count_by_group": schema.Int64Attribute{
"instance_count_by_group": schema.Int32Attribute{
Computed: true,
},
"instance_type": schema.StringAttribute{
Expand Down
2 changes: 1 addition & 1 deletion resources/environments/tftypes_freeipa.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ var FreeIpaDetailsType = types.ObjectType{
"catalog": types.StringType,
"image_id": types.StringType,
"os": types.StringType,
"instance_count_by_group": types.Int64Type,
"instance_count_by_group": types.Int32Type,
"instance_type": types.StringType,
"instances": types.SetType{
ElemType: FreeIpaInstanceType,
Expand Down
Loading