From 2581529f5d4da6a9ae928d4698da1d91cb0109c5 Mon Sep 17 00:00:00 2001 From: Dana Fallon <8871189+danafallon@users.noreply.github.com> Date: Tue, 30 Jul 2024 16:24:47 -0700 Subject: [PATCH] Don't need lastUpdatedAt or hasUndeployedChanges, they just create false positives in tf plan --- internal/provider/deployment_resource.go | 12 +++++------- internal/provider/destination_resource.go | 1 - .../provider/models/deployment_api_model.go | 18 ++++++++---------- .../models/deployment_resource_model.go | 18 ++++++++---------- .../provider/models/destination_api_model.go | 1 - .../models/destination_resource_model.go | 1 - .../provider/models/translate_deployment.go | 14 +++++--------- .../provider/models/translate_destination.go | 2 -- 8 files changed, 26 insertions(+), 41 deletions(-) diff --git a/internal/provider/deployment_resource.go b/internal/provider/deployment_resource.go index 435bbda..b8b95d2 100644 --- a/internal/provider/deployment_resource.go +++ b/internal/provider/deployment_resource.go @@ -44,13 +44,11 @@ func (r *DeploymentResource) Schema(ctx context.Context, req resource.SchemaRequ resp.Schema = schema.Schema{ MarkdownDescription: "Artie Deployment resource", Attributes: map[string]schema.Attribute{ - "uuid": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}}, - "company_uuid": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}}, - "name": schema.StringAttribute{Required: true}, - "status": schema.StringAttribute{Computed: true, Optional: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}}, - "destination_uuid": schema.StringAttribute{Computed: true, Optional: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}}, - "last_updated_at": schema.StringAttribute{Computed: true}, - "has_undeployed_changes": schema.BoolAttribute{Computed: true}, + "uuid": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}}, + "company_uuid": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}}, + "name": schema.StringAttribute{Required: true}, + "status": schema.StringAttribute{Computed: true, Optional: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}}, + "destination_uuid": schema.StringAttribute{Computed: true, Optional: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}}, "source": schema.SingleNestedAttribute{ Required: true, Attributes: map[string]schema.Attribute{ diff --git a/internal/provider/destination_resource.go b/internal/provider/destination_resource.go index f142dac..76ce718 100644 --- a/internal/provider/destination_resource.go +++ b/internal/provider/destination_resource.go @@ -46,7 +46,6 @@ func (r *DestinationResource) Schema(ctx context.Context, req resource.SchemaReq "ssh_tunnel_uuid": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}}, "name": schema.StringAttribute{Required: true}, "label": schema.StringAttribute{Optional: true}, - "last_updated_at": schema.StringAttribute{Computed: true, PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}}, "config": schema.SingleNestedAttribute{ Required: true, Attributes: map[string]schema.Attribute{ diff --git a/internal/provider/models/deployment_api_model.go b/internal/provider/models/deployment_api_model.go index f65e950..3e81364 100644 --- a/internal/provider/models/deployment_api_model.go +++ b/internal/provider/models/deployment_api_model.go @@ -5,16 +5,14 @@ type DeploymentAPIResponse struct { } type DeploymentAPIModel struct { - UUID string `json:"uuid"` - CompanyUUID string `json:"companyUUID"` - Name string `json:"name"` - Status string `json:"status"` - LastUpdatedAt string `json:"lastUpdatedAt"` - DestinationUUID string `json:"destinationUUID"` - HasUndeployedChanges bool `json:"hasUndeployedChanges"` - Source SourceAPIModel `json:"source"` - AdvancedSettings *DeploymentAdvancedSettingsAPIModel `json:"advancedSettings"` - DestinationConfig DestinationConfigAPIModel `json:"uniqueConfig"` + UUID string `json:"uuid"` + CompanyUUID string `json:"companyUUID"` + Name string `json:"name"` + Status string `json:"status"` + DestinationUUID string `json:"destinationUUID"` + Source SourceAPIModel `json:"source"` + AdvancedSettings *DeploymentAdvancedSettingsAPIModel `json:"advancedSettings"` + DestinationConfig DestinationConfigAPIModel `json:"uniqueConfig"` } type SourceAPIModel struct { diff --git a/internal/provider/models/deployment_resource_model.go b/internal/provider/models/deployment_resource_model.go index fd29fe6..8eaf533 100644 --- a/internal/provider/models/deployment_resource_model.go +++ b/internal/provider/models/deployment_resource_model.go @@ -3,16 +3,14 @@ package models import "github.com/hashicorp/terraform-plugin-framework/types" type DeploymentResourceModel struct { - UUID types.String `tfsdk:"uuid"` - CompanyUUID types.String `tfsdk:"company_uuid"` - Name types.String `tfsdk:"name"` - Status types.String `tfsdk:"status"` - LastUpdatedAt types.String `tfsdk:"last_updated_at"` - DestinationUUID types.String `tfsdk:"destination_uuid"` - HasUndeployedChanges types.Bool `tfsdk:"has_undeployed_changes"` - Source *SourceModel `tfsdk:"source"` - AdvancedSettings *DeploymentAdvancedSettingsModel `tfsdk:"advanced_settings"` - DestinationConfig *DeploymentDestinationConfigModel `tfsdk:"destination_config"` + UUID types.String `tfsdk:"uuid"` + CompanyUUID types.String `tfsdk:"company_uuid"` + Name types.String `tfsdk:"name"` + Status types.String `tfsdk:"status"` + DestinationUUID types.String `tfsdk:"destination_uuid"` + Source *SourceModel `tfsdk:"source"` + AdvancedSettings *DeploymentAdvancedSettingsModel `tfsdk:"advanced_settings"` + DestinationConfig *DeploymentDestinationConfigModel `tfsdk:"destination_config"` } type SourceModel struct { diff --git a/internal/provider/models/destination_api_model.go b/internal/provider/models/destination_api_model.go index 8c9e308..409fcac 100644 --- a/internal/provider/models/destination_api_model.go +++ b/internal/provider/models/destination_api_model.go @@ -5,7 +5,6 @@ type DestinationAPIModel struct { CompanyUUID string `json:"companyUUID"` Name string `json:"name"` Label string `json:"label"` - LastUpdatedAt string `json:"lastUpdatedAt"` SSHTunnelUUID string `json:"sshTunnelUUID"` Config DestinationSharedConfigAPIModel `json:"sharedConfig"` } diff --git a/internal/provider/models/destination_resource_model.go b/internal/provider/models/destination_resource_model.go index 9ab0b27..1541d88 100644 --- a/internal/provider/models/destination_resource_model.go +++ b/internal/provider/models/destination_resource_model.go @@ -8,7 +8,6 @@ type DestinationResourceModel struct { SSHTunnelUUID types.String `tfsdk:"ssh_tunnel_uuid"` Name types.String `tfsdk:"name"` Label types.String `tfsdk:"label"` - LastUpdatedAt types.String `tfsdk:"last_updated_at"` Config *DestinationSharedConfigModel `tfsdk:"config"` } diff --git a/internal/provider/models/translate_deployment.go b/internal/provider/models/translate_deployment.go index 67e4d0c..0fca7ed 100644 --- a/internal/provider/models/translate_deployment.go +++ b/internal/provider/models/translate_deployment.go @@ -10,8 +10,6 @@ func DeploymentAPIToResourceModel(apiModel DeploymentAPIModel, resourceModel *De resourceModel.CompanyUUID = types.StringValue(apiModel.CompanyUUID) resourceModel.Name = types.StringValue(apiModel.Name) resourceModel.Status = types.StringValue(apiModel.Status) - resourceModel.LastUpdatedAt = types.StringValue(apiModel.LastUpdatedAt) - resourceModel.HasUndeployedChanges = types.BoolValue(apiModel.HasUndeployedChanges) resourceModel.DestinationUUID = types.StringValue(apiModel.DestinationUUID) tables := []TableModel{} @@ -158,13 +156,11 @@ func DeploymentResourceToAPIModel(resourceModel DeploymentResourceModel) Deploym } return DeploymentAPIModel{ - UUID: resourceModel.UUID.ValueString(), - CompanyUUID: resourceModel.CompanyUUID.ValueString(), - Name: resourceModel.Name.ValueString(), - Status: resourceModel.Status.ValueString(), - LastUpdatedAt: resourceModel.LastUpdatedAt.ValueString(), - HasUndeployedChanges: resourceModel.HasUndeployedChanges.ValueBool(), - DestinationUUID: resourceModel.DestinationUUID.ValueString(), + UUID: resourceModel.UUID.ValueString(), + CompanyUUID: resourceModel.CompanyUUID.ValueString(), + Name: resourceModel.Name.ValueString(), + Status: resourceModel.Status.ValueString(), + DestinationUUID: resourceModel.DestinationUUID.ValueString(), Source: SourceAPIModel{ Name: resourceModel.Source.Name.ValueString(), Config: SourceConfigAPIModel{ diff --git a/internal/provider/models/translate_destination.go b/internal/provider/models/translate_destination.go index 5716add..0a00fc6 100644 --- a/internal/provider/models/translate_destination.go +++ b/internal/provider/models/translate_destination.go @@ -10,7 +10,6 @@ func DestinationAPIToResourceModel(apiModel DestinationAPIModel, resourceModel * resourceModel.CompanyUUID = types.StringValue(apiModel.CompanyUUID) resourceModel.Name = types.StringValue(apiModel.Name) resourceModel.Label = types.StringValue(apiModel.Label) - resourceModel.LastUpdatedAt = types.StringValue(apiModel.LastUpdatedAt) resourceModel.SSHTunnelUUID = types.StringValue(apiModel.SSHTunnelUUID) resourceModel.Config = &DestinationSharedConfigModel{ @@ -41,7 +40,6 @@ func DestinationResourceToAPIModel(resourceModel DestinationResourceModel) Desti CompanyUUID: resourceModel.CompanyUUID.ValueString(), Name: resourceModel.Name.ValueString(), Label: resourceModel.Label.ValueString(), - LastUpdatedAt: resourceModel.LastUpdatedAt.ValueString(), SSHTunnelUUID: sshTunnelUUID, Config: DestinationSharedConfigAPIModel{ Host: resourceModel.Config.Host.ValueString(),