Skip to content

Commit

Permalink
Linter: fix up linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
briancain committed Jul 17, 2024
1 parent 4831799 commit 4947ab5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
sharedmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models"
"github.com/hashicorp/hcp-sdk-go/clients/cloud-waypoint-service/preview/2023-08-18/client/waypoint_service"
waypointModels "github.com/hashicorp/hcp-sdk-go/clients/cloud-waypoint-service/preview/2023-08-18/models"
waypoint_models "github.com/hashicorp/hcp-sdk-go/clients/cloud-waypoint-service/preview/2023-08-18/models"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
Expand Down Expand Up @@ -47,7 +46,7 @@ type AddOnDefinitionResourceModel struct {
Description types.String `tfsdk:"description"`
ReadmeMarkdownTemplate types.String `tfsdk:"readme_markdown_template"`

TerraformProjectId types.String `tfsdk:"terraform_project_id"`
TerraformProjectID types.String `tfsdk:"terraform_project_id"`
TerraformCloudWorkspace *tfcWorkspace `tfsdk:"terraform_cloud_workspace_details"`
TerraformNoCodeModule *tfcNoCodeModule `tfsdk:"terraform_no_code_module"`
TerraformVariableOptions []*tfcVariableOption `tfsdk:"variable_options"`
Expand Down Expand Up @@ -258,16 +257,16 @@ func (r *AddOnDefinitionResource) Create(ctx context.Context, req resource.Creat
})
}

tfProjId := plan.TerraformProjectId.ValueString()
tfProjID := plan.TerraformProjectID.ValueString()
tfWsName := plan.TerraformCloudWorkspace.Name.ValueString()
if tfWsName == "" {
// NOTE: this field is optional anyways, so if its unset, lets just use
// the template name for it.
tfWsName = plan.Name.ValueString()
}
tfWsDetails := &waypoint_models.HashicorpCloudWaypointTerraformCloudWorkspaceDetails{
tfWsDetails := &waypointModels.HashicorpCloudWaypointTerraformCloudWorkspaceDetails{
Name: tfWsName,
ProjectID: tfProjId,
ProjectID: tfProjID,
}

modelBody := &waypointModels.HashicorpCloudWaypointWaypointServiceCreateAddOnDefinitionBody{
Expand Down Expand Up @@ -508,16 +507,16 @@ func (r *AddOnDefinitionResource) Update(ctx context.Context, req resource.Updat
})
}

tfProjId := plan.TerraformProjectId.ValueString()
tfProjID := plan.TerraformProjectID.ValueString()
tfWsName := plan.TerraformCloudWorkspace.Name.ValueString()
if tfWsName == "" {
// NOTE: this field is optional anyways, so if its unset, lets just use
// the template name for it.
tfWsName = plan.Name.ValueString()
}
tfWsDetails := &waypoint_models.HashicorpCloudWaypointTerraformCloudWorkspaceDetails{
tfWsDetails := &waypointModels.HashicorpCloudWaypointTerraformCloudWorkspaceDetails{
Name: tfWsName,
ProjectID: tfProjId,
ProjectID: tfProjID,
}

// TODO: add support for Tags
Expand Down
10 changes: 5 additions & 5 deletions internal/provider/waypoint/resource_waypoint_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type TemplateResourceModel struct {
Description types.String `tfsdk:"description"`
ReadmeMarkdownTemplate types.String `tfsdk:"readme_markdown_template"`

TerraformProjectId types.String `tfsdk:"terraform_project_id"`
TerraformProjectID types.String `tfsdk:"terraform_project_id"`
TerraformCloudWorkspace *tfcWorkspace `tfsdk:"terraform_cloud_workspace_details"`
TerraformNoCodeModule *tfcNoCodeModule `tfsdk:"terraform_no_code_module"`
TerraformVariableOptions []*tfcVariableOption `tfsdk:"variable_options"`
Expand Down Expand Up @@ -277,7 +277,7 @@ func (r *TemplateResource) Create(ctx context.Context, req resource.CreateReques
})
}

tfProjId := plan.TerraformProjectId.ValueString()
tfProjID := plan.TerraformProjectID.ValueString()
tfWsName := plan.TerraformCloudWorkspace.Name.ValueString()
if tfWsName == "" {
// NOTE: this field is optional anyways, so if its unset, lets just use
Expand All @@ -286,7 +286,7 @@ func (r *TemplateResource) Create(ctx context.Context, req resource.CreateReques
}
tfWsDetails := &waypoint_models.HashicorpCloudWaypointTerraformCloudWorkspaceDetails{
Name: tfWsName,
ProjectID: tfProjId,
ProjectID: tfProjID,
}

modelBody := &waypoint_models.HashicorpCloudWaypointWaypointServiceCreateApplicationTemplateBody{
Expand Down Expand Up @@ -562,7 +562,7 @@ func (r *TemplateResource) Update(ctx context.Context, req resource.UpdateReques
})
}

tfProjId := plan.TerraformProjectId.ValueString()
tfProjID := plan.TerraformProjectID.ValueString()
tfWsName := plan.TerraformCloudWorkspace.Name.ValueString()
if tfWsName == "" {
// NOTE: this field is optional anyways, so if its unset, lets just use
Expand All @@ -571,7 +571,7 @@ func (r *TemplateResource) Update(ctx context.Context, req resource.UpdateReques
}
tfWsDetails := &waypoint_models.HashicorpCloudWaypointTerraformCloudWorkspaceDetails{
Name: tfWsName,
ProjectID: tfProjId,
ProjectID: tfProjID,
}

modelBody := &waypoint_models.HashicorpCloudWaypointWaypointServiceUpdateApplicationTemplateBody{
Expand Down

0 comments on commit 4947ab5

Please sign in to comment.