Skip to content
Merged
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
4 changes: 4 additions & 0 deletions .changelog/1208.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:deprecation
The following attribute is deprecated for Waypoint the add-on resource and data source:
- `hcp_waypoint_add_on_created_by`
```
2 changes: 1 addition & 1 deletion docs/data-sources/waypoint_add_on.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The Waypoint Add-on data source retrieves information on a given Add-on.
### Read-Only

- `application_id` (String) The ID of the Application that this Add-on is created for.
- `created_by` (String) The user who created the Add-on.
- `created_by` (String, Deprecated) The user who created the Add-on.
- `definition_id` (String) The ID of the Add-on Definition that this Add-on is created from.
- `description` (String) A longer description of the Add-on.
- `install_count` (Number) The number of installed Add-ons for the same Application that share the same Add-on Definition.
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/waypoint_add_on.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Waypoint Add-on resource
### Read-Only

- `add_on_definition_input_variables` (Attributes Set) Input variables set for the add-on definition. (see [below for nested schema](#nestedatt--add_on_definition_input_variables))
- `created_by` (String) The user who created the Add-on.
- `created_by` (String, Deprecated) The user who created the Add-on.
- `description` (String) A longer description of the Add-on.
- `id` (String) The ID of the Add-on.
- `install_count` (Number) The number of installed Add-ons for the same Application that share the same Add-on Definition.
Expand Down
4 changes: 2 additions & 2 deletions internal/clients/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ import (
cloud_vault_secrets "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-secrets/stable/2023-11-28/client"
"github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-secrets/stable/2023-11-28/client/secret_service"

cloud_waypoint "github.com/hashicorp/hcp-sdk-go/clients/cloud-waypoint-service/preview/2023-08-18/client"
"github.com/hashicorp/hcp-sdk-go/clients/cloud-waypoint-service/preview/2023-08-18/client/waypoint_service"
cloud_waypoint "github.com/hashicorp/hcp-sdk-go/clients/cloud-waypoint-service/preview/2024-11-22/client"
"github.com/hashicorp/hcp-sdk-go/clients/cloud-waypoint-service/preview/2024-11-22/client/waypoint_service"

cloud_log_service "github.com/hashicorp/hcp-sdk-go/clients/cloud-log-service/preview/2021-03-30/client"
"github.com/hashicorp/hcp-sdk-go/clients/cloud-log-service/preview/2021-03-30/client/log_service"
Expand Down
121 changes: 33 additions & 88 deletions internal/clients/waypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,18 @@ import (
"context"

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"
waypoint_models "github.com/hashicorp/hcp-sdk-go/clients/cloud-waypoint-service/preview/2023-08-18/models"
"github.com/hashicorp/hcp-sdk-go/clients/cloud-waypoint-service/preview/2024-11-22/client/waypoint_service"
waypoint_models "github.com/hashicorp/hcp-sdk-go/clients/cloud-waypoint-service/preview/2024-11-22/models"
)

// getNamespaceByLocation will retrieve a namespace by location information
// provided by HCP
func getNamespaceByLocation(_ context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation) (*waypoint_models.HashicorpCloudWaypointNamespace, error) {
namespaceParams := &waypoint_service.WaypointServiceGetNamespaceParams{
LocationOrganizationID: loc.OrganizationID,
LocationProjectID: loc.ProjectID,
}
// get namespace
ns, err := client.Waypoint.WaypointServiceGetNamespace(namespaceParams, nil)
if err != nil {
return nil, err
}
return ns.GetPayload().Namespace, nil
}

// GetAction will retrieve an Action using the provided ID by default
// or by name if the ID is not provided
func GetAction(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, actionID string, actionName string) (*waypoint_models.HashicorpCloudWaypointActionConfig, error) {
ns, err := getNamespaceByLocation(ctx, client, loc)
if err != nil {
return nil, err
}

params := &waypoint_service.WaypointServiceGetActionConfigParams{
ActionID: &actionID,
ActionName: &actionName,
NamespaceID: ns.ID,
ActionID: &actionID,
ActionName: &actionName,
NamespaceLocationOrganizationID: loc.OrganizationID,
NamespaceLocationProjectID: loc.ProjectID,
}

getResp, err := client.Waypoint.WaypointServiceGetActionConfig(params, nil)
Expand All @@ -49,14 +30,10 @@ func GetAction(ctx context.Context, client *Client, loc *sharedmodels.HashicorpC

// GetApplicationTemplateByName will retrieve a template by name
func GetApplicationTemplateByName(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appName string) (*waypoint_models.HashicorpCloudWaypointApplicationTemplate, error) {
ns, err := getNamespaceByLocation(ctx, client, loc)
if err != nil {
return nil, err
}

params := &waypoint_service.WaypointServiceGetApplicationTemplate2Params{
ApplicationTemplateName: appName,
NamespaceID: ns.ID,
ApplicationTemplateName: appName,
NamespaceLocationOrganizationID: loc.OrganizationID,
NamespaceLocationProjectID: loc.ProjectID,
}

getResp, err := client.Waypoint.WaypointServiceGetApplicationTemplate2(params, nil)
Expand All @@ -68,14 +45,10 @@ func GetApplicationTemplateByName(ctx context.Context, client *Client, loc *shar

// GetApplicationTemplateByID will retrieve a template by ID
func GetApplicationTemplateByID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appID string) (*waypoint_models.HashicorpCloudWaypointApplicationTemplate, error) {
ns, err := getNamespaceByLocation(ctx, client, loc)
if err != nil {
return nil, err
}

params := &waypoint_service.WaypointServiceGetApplicationTemplateParams{
ApplicationTemplateID: appID,
NamespaceID: ns.ID,
ApplicationTemplateID: appID,
NamespaceLocationOrganizationID: loc.OrganizationID,
NamespaceLocationProjectID: loc.ProjectID,
}

getResp, err := client.Waypoint.WaypointServiceGetApplicationTemplate(params, nil)
Expand All @@ -87,14 +60,10 @@ func GetApplicationTemplateByID(ctx context.Context, client *Client, loc *shared

// GetAddOnDefinitionByName will retrieve an add-on definition by name
func GetAddOnDefinitionByName(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, defName string) (*waypoint_models.HashicorpCloudWaypointAddOnDefinition, error) {
ns, err := getNamespaceByLocation(ctx, client, loc)
if err != nil {
return nil, err
}

params := &waypoint_service.WaypointServiceGetAddOnDefinition2Params{
AddOnDefinitionName: defName,
NamespaceID: ns.ID,
AddOnDefinitionName: defName,
NamespaceLocationOrganizationID: loc.OrganizationID,
NamespaceLocationProjectID: loc.ProjectID,
}

getResp, err := client.Waypoint.WaypointServiceGetAddOnDefinition2(params, nil)
Expand All @@ -106,14 +75,10 @@ func GetAddOnDefinitionByName(ctx context.Context, client *Client, loc *sharedmo

// GetAddOnDefinitionByID will retrieve an add-on definition by ID
func GetAddOnDefinitionByID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, defID string) (*waypoint_models.HashicorpCloudWaypointAddOnDefinition, error) {
ns, err := getNamespaceByLocation(ctx, client, loc)
if err != nil {
return nil, err
}

params := &waypoint_service.WaypointServiceGetAddOnDefinitionParams{
AddOnDefinitionID: defID,
NamespaceID: ns.ID,
AddOnDefinitionID: defID,
NamespaceLocationOrganizationID: loc.OrganizationID,
NamespaceLocationProjectID: loc.ProjectID,
}

getResp, err := client.Waypoint.WaypointServiceGetAddOnDefinition(params, nil)
Expand All @@ -125,14 +90,10 @@ func GetAddOnDefinitionByID(ctx context.Context, client *Client, loc *sharedmode

// GetApplicationByName will retrieve an application by name
func GetApplicationByName(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appName string) (*waypoint_models.HashicorpCloudWaypointApplication, error) {
ns, err := getNamespaceByLocation(ctx, client, loc)
if err != nil {
return nil, err
}

params := &waypoint_service.WaypointServiceGetApplication2Params{
ApplicationName: appName,
NamespaceID: ns.ID,
ApplicationName: appName,
NamespaceLocationOrganizationID: loc.OrganizationID,
NamespaceLocationProjectID: loc.ProjectID,
}

getResp, err := client.Waypoint.WaypointServiceGetApplication2(params, nil)
Expand All @@ -144,14 +105,10 @@ func GetApplicationByName(ctx context.Context, client *Client, loc *sharedmodels

// GetApplicationByID will retrieve an application by ID
func GetApplicationByID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, appID string) (*waypoint_models.HashicorpCloudWaypointApplication, error) {
ns, err := getNamespaceByLocation(ctx, client, loc)
if err != nil {
return nil, err
}

params := &waypoint_service.WaypointServiceGetApplicationParams{
ApplicationID: appID,
NamespaceID: ns.ID,
ApplicationID: appID,
NamespaceLocationOrganizationID: loc.OrganizationID,
NamespaceLocationProjectID: loc.ProjectID,
}

getResp, err := client.Waypoint.WaypointServiceGetApplication(params, nil)
Expand All @@ -163,14 +120,10 @@ func GetApplicationByID(ctx context.Context, client *Client, loc *sharedmodels.H

// GetAddOnByName will retrieve an add-on by name
func GetAddOnByName(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, defName string) (*waypoint_models.HashicorpCloudWaypointAddOn, error) {
ns, err := getNamespaceByLocation(ctx, client, loc)
if err != nil {
return nil, err
}

params := &waypoint_service.WaypointServiceGetAddOn2Params{
AddOnName: defName,
NamespaceID: ns.ID,
AddOnName: defName,
NamespaceLocationOrganizationID: loc.OrganizationID,
NamespaceLocationProjectID: loc.ProjectID,
}

getResp, err := client.Waypoint.WaypointServiceGetAddOn2(params, nil)
Expand All @@ -182,14 +135,10 @@ func GetAddOnByName(ctx context.Context, client *Client, loc *sharedmodels.Hashi

// GetAddOnByID will retrieve an add-on by ID
func GetAddOnByID(ctx context.Context, client *Client, loc *sharedmodels.HashicorpCloudLocationLocation, defID string) (*waypoint_models.HashicorpCloudWaypointAddOn, error) {
ns, err := getNamespaceByLocation(ctx, client, loc)
if err != nil {
return nil, err
}

params := &waypoint_service.WaypointServiceGetAddOnParams{
AddOnID: defID,
NamespaceID: ns.ID,
AddOnID: defID,
NamespaceLocationOrganizationID: loc.OrganizationID,
NamespaceLocationProjectID: loc.ProjectID,
}

getResp, err := client.Waypoint.WaypointServiceGetAddOn(params, nil)
Expand All @@ -200,14 +149,10 @@ func GetAddOnByID(ctx context.Context, client *Client, loc *sharedmodels.Hashico
}

func GetInputVariables(ctx context.Context, client *Client, workspaceName string, loc *sharedmodels.HashicorpCloudLocationLocation) ([]*waypoint_models.HashicorpCloudWaypointInputVariable, error) {
ns, err := getNamespaceByLocation(ctx, client, loc)
if err != nil {
return nil, err
}

params := &waypoint_service.WaypointServiceGetTFRunStatusParams{
WorkspaceName: workspaceName,
NamespaceID: ns.ID,
WorkspaceName: workspaceName,
NamespaceLocationOrganizationID: loc.OrganizationID,
NamespaceLocationProjectID: loc.ProjectID,
}

getResp, err := client.Waypoint.WaypointServiceGetTFRunStatus(params, nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"

sharedmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models"
waypoint_models "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/2024-11-22/models"
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down
9 changes: 5 additions & 4 deletions internal/provider/waypoint/data_source_waypoint_add_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strconv"

sharedmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models"
waypoint_models "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/2024-11-22/models"
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -105,8 +105,9 @@ func (d *DataSourceAddOn) Schema(ctx context.Context, req datasource.SchemaReque
ElementType: types.StringType,
},
"created_by": schema.StringAttribute{
Description: "The user who created the Add-on.",
Computed: true,
Description: "The user who created the Add-on.",
Computed: true,
DeprecationMessage: "This attribute is deprecated and will be removed in a future version of the provider.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

},
"install_count": schema.Int64Attribute{
Description: "The number of installed Add-ons for the same Application that share the same " +
Expand Down Expand Up @@ -256,7 +257,7 @@ func (d *DataSourceAddOn) Read(ctx context.Context, req datasource.ReadRequest,
state.ReadmeMarkdown = types.StringNull()
}

state.CreatedBy = types.StringValue(addOn.CreatedBy)
state.CreatedBy = types.StringNull()

// If we can process status as an int64, add it to the plan
statusNum, err := strconv.ParseInt(addOn.Count, 10, 64)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"

sharedmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models"
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/2024-11-22/models"
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down Expand Up @@ -198,7 +198,7 @@ func (d *DataSourceAddOnDefinition) Read(ctx context.Context, req datasource.Rea
ProjectID: projectID,
}

var definition *waypointModels.HashicorpCloudWaypointAddOnDefinition
var definition *waypoint_models.HashicorpCloudWaypointAddOnDefinition
var err error

if state.ID.IsNull() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"

sharedmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models"
waypoint_models "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/2024-11-22/models"
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"

sharedmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models"
waypoint_models "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/2024-11-22/models"
"github.com/hashicorp/terraform-plugin-framework-validators/datasourcevalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
Expand Down
Loading