Skip to content

Commit

Permalink
Rename waypoint templates resource (#861)
Browse files Browse the repository at this point in the history
* wp: Rename app template files to template.

* wp: Rename template structs.

* wp: Rename template in resource & resource test.

* wp: Rename template in data source & tests.

* wp: Template data source test renaming.

* wp: Rename template in app data source and resource.

* wp: Rename template in app resource.

* wp: Rename template in add-ons resources.

* wp: Rename template in comments.

* wp: Rename template docs.

* wp: Changelog.
  • Loading branch information
paladin-devops committed Jun 25, 2024
1 parent 9f86fb0 commit 11d4246
Show file tree
Hide file tree
Showing 23 changed files with 191 additions and 187 deletions.
4 changes: 4 additions & 0 deletions .changelog/861.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:breaking-change
waypoint: Rename `hcp_waypoint_application_template` resource and data source to
`hcp_waypoint_template`.
```
2 changes: 1 addition & 1 deletion docs/data-sources/waypoint_add_on_definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The Waypoint Add-on Definition data source retrieves information on a given Add-
- `summary` (String) A short summary of the Add-on Definition.
- `terraform_cloud_workspace_details` (Attributes) Terraform Cloud Workspace details. (see [below for nested schema](#nestedatt--terraform_cloud_workspace_details))
- `terraform_no_code_module` (Attributes) Terraform Cloud no-code Module details. (see [below for nested schema](#nestedatt--terraform_no_code_module))
- `variable_options` (Attributes List) List of variable options for the template (see [below for nested schema](#nestedatt--variable_options))
- `variable_options` (Attributes List) List of variable options for the Add-on Definition. (see [below for nested schema](#nestedatt--variable_options))

<a id="nestedatt--terraform_cloud_workspace_details"></a>
### Nested Schema for `terraform_cloud_workspace_details`
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/waypoint_application.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ The Waypoint Application data source retrieves information on a given Applicatio

### Read-Only

- `application_template_id` (String) ID of the Application Template this Application is based on.
- `application_template_name` (String) Name of the Application Template this Application is based on.
- `namespace_id` (String) Internal Namespace ID.
- `organization_id` (String) The ID of the HCP organization where the Waypoint Application is located.
- `readme_markdown` (String) Instructions for using the Application (markdown format supported).
- `template_id` (String) ID of the Template this Application is based on.
- `template_name` (String) Name of the Template this Application is based on.

<a id="nestedatt--input_variables"></a>
### Nested Schema for `input_variables`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
---
page_title: "hcp_waypoint_application_template Data Source - terraform-provider-hcp"
page_title: "hcp_waypoint_template Data Source - terraform-provider-hcp"
subcategory: "HCP Waypoint"
description: |-
The Waypoint Template data source retrieves information on a given Application Template.
The Waypoint Template data source retrieves information on a given Template.
---

# hcp_waypoint_application_template `Data Source`
# hcp_waypoint_template `Data Source`

-> **Note:** HCP Waypoint is currently in public beta.

The Waypoint Template data source retrieves information on a given Application Template.
The Waypoint Template data source retrieves information on a given Template.

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `id` (String) The ID of the Application Template.
- `name` (String) The name of the Application Template.
- `project_id` (String) The ID of the HCP project where the Waypoint Application Template is located.
- `id` (String) The ID of the Template.
- `name` (String) The name of the Template.
- `project_id` (String) The ID of the HCP project where the Waypoint Template is located.

### Read-Only

- `description` (String) A description of the template, along with when and why it should be used, up to 500 characters
- `labels` (List of String) List of labels attached to this Application Template.
- `organization_id` (String) The ID of the HCP organization where the Waypoint Application Template is located.
- `labels` (List of String) List of labels attached to this Template.
- `organization_id` (String) The ID of the HCP organization where the Waypoint Template is located.
- `readme_markdown_template` (String) Instructions for using the template (markdown format supported)
- `summary` (String) A brief description of the template, up to 110 characters
- `terraform_cloud_workspace_details` (Attributes) Terraform Cloud Workspace details (see [below for nested schema](#nestedatt--terraform_cloud_workspace_details))
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/waypoint_add_on_definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Waypoint Add-on Definition resource
- `labels` (List of String) List of labels attached to this Add-on Definition.
- `project_id` (String) The ID of the HCP project where the Waypoint Add-on Definition is located.
- `readme_markdown_template` (String) The markdown template for the Add-on Definition README.
- `variable_options` (Attributes Set) List of variable options for the template (see [below for nested schema](#nestedatt--variable_options))
- `variable_options` (Attributes Set) List of variable options for the Add-on Definition. (see [below for nested schema](#nestedatt--variable_options))

### Read-Only

Expand Down
6 changes: 3 additions & 3 deletions docs/resources/waypoint_application.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ The Waypoint Application resource managed the lifecycle of an Application that's

### Required

- `application_template_id` (String) ID of the Application Template this Application is based on.
- `name` (String) The name of the Application.
- `template_id` (String) ID of the Template this Application is based on.

### Optional

- `application_input_variables` (Attributes Set) Input variables set for the application. (see [below for nested schema](#nestedatt--application_input_variables))
- `project_id` (String) The ID of the HCP project where the Waypoint Application is located.
- `readme_markdown` (String) Instructions for using the Application (markdown format supported). Note: this is a base64 encoded string, and can only be set in configuration after initial creation. The initial version of the README is generated from the README Template from source Application Template.
- `readme_markdown` (String) Instructions for using the Application (markdown format supported). Note: this is a base64 encoded string, and can only be set in configuration after initial creation. The initial version of the README is generated from the README Template from source Template.

### Read-Only

- `application_template_name` (String) Name of the Application Template this Application is based on.
- `id` (String) The ID of the Application.
- `namespace_id` (String) Internal Namespace ID.
- `organization_id` (String) The ID of the HCP organization where the Waypoint Application is located.
- `template_input_variables` (Attributes Set) Input variables set for the application. (see [below for nested schema](#nestedatt--template_input_variables))
- `template_name` (String) Name of the Template this Application is based on.

<a id="nestedatt--application_input_variables"></a>
### Nested Schema for `application_input_variables`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
---
page_title: "hcp_waypoint_application_template Resource - terraform-provider-hcp"
page_title: "hcp_waypoint_template Resource - terraform-provider-hcp"
subcategory: "HCP Waypoint"
description: |-
Waypoint Application Template resource
Waypoint Template resource
---

# hcp_waypoint_application_template `Resource`
# hcp_waypoint_template `Resource`

-> **Note:** HCP Waypoint is currently in public beta.

Waypoint Application Template resource
Waypoint Template resource

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the Application Template.
- `name` (String) The name of the Template.
- `summary` (String) A brief description of the template, up to 110 characters
- `terraform_cloud_workspace_details` (Attributes) Terraform Cloud Workspace details (see [below for nested schema](#nestedatt--terraform_cloud_workspace_details))
- `terraform_no_code_module` (Attributes) Terraform Cloud No-Code Module details (see [below for nested schema](#nestedatt--terraform_no_code_module))

### Optional

- `description` (String) A description of the template, along with when and why it should be used, up to 500 characters
- `labels` (List of String) List of labels attached to this Application Template.
- `project_id` (String) The ID of the HCP project where the Waypoint Application Template is located.
- `labels` (List of String) List of labels attached to this Template.
- `project_id` (String) The ID of the HCP project where the Waypoint Template is located.
- `readme_markdown_template` (String) Instructions for using the template (markdown format supported
- `variable_options` (Attributes Set) List of variable options for the template (see [below for nested schema](#nestedatt--variable_options))

### Read-Only

- `id` (String) The ID of the Application Template.
- `organization_id` (String) The ID of the HCP organization where the Waypoint Application Template is located.
- `id` (String) The ID of the Template.
- `organization_id` (String) The ID of the HCP organization where the Waypoint Template is located.

<a id="nestedatt--terraform_cloud_workspace_details"></a>
### Nested Schema for `terraform_cloud_workspace_details`
Expand Down
4 changes: 2 additions & 2 deletions internal/clients/waypoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func GetAction(ctx context.Context, client *Client, loc *sharedmodels.HashicorpC
return getResp.GetPayload().ActionConfig, nil
}

// GetApplicationTemplateByName will retrieve an application template by name
// 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 {
Expand All @@ -66,7 +66,7 @@ func GetApplicationTemplateByName(ctx context.Context, client *Client, loc *shar
return getResp.GetPayload().ApplicationTemplate, nil
}

// GetApplicationTemplateByID will retrieve an application template by ID
// 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 {
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (p *ProviderFramework) Resources(ctx context.Context) []func() resource.Res
// Waypoint
waypoint.NewActionResource,
waypoint.NewApplicationResource,
waypoint.NewApplicationTemplateResource,
waypoint.NewTemplateResource,
waypoint.NewAddOnResource,
waypoint.NewAddOnDefinitionResource,
waypoint.NewTfcConfigResource,
Expand All @@ -181,7 +181,7 @@ func (p *ProviderFramework) DataSources(ctx context.Context) []func() datasource
// Waypoint
waypoint.NewActionDataSource,
waypoint.NewApplicationDataSource,
waypoint.NewApplicationTemplateDataSource,
waypoint.NewTemplateDataSource,
waypoint.NewAddOnDataSource,
waypoint.NewAddOnDefinitionDataSource,
}, packer.DataSourceSchemaBuilders...)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (d *DataSourceAddOnDefinition) Schema(ctx context.Context, req datasource.S
},
"variable_options": schema.ListNestedAttribute{
Computed: true,
Description: "List of variable options for the template",
Description: "List of variable options for the Add-on Definition.",
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"name": &schema.StringAttribute{
Expand Down
24 changes: 12 additions & 12 deletions internal/provider/waypoint/data_source_waypoint_application.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ func (d *DataSourceApplication) Schema(ctx context.Context, req datasource.Schem
Computed: true,
Description: "Instructions for using the Application (markdown format supported).",
},
"application_template_id": schema.StringAttribute{
"template_id": schema.StringAttribute{
Computed: true,
Description: "ID of the Application Template this Application is based on.",
Description: "ID of the Template this Application is based on.",
},
"application_template_name": schema.StringAttribute{
"template_name": schema.StringAttribute{
Computed: true,
Description: "Name of the Application Template this Application is based on.",
Description: "Name of the Template this Application is based on.",
},
"namespace_id": schema.StringAttribute{
Computed: true,
Expand Down Expand Up @@ -122,14 +122,14 @@ func (d *DataSourceApplication) Configure(ctx context.Context, req datasource.Co

// ApplicationDataSourceModel describes the data source data model
type ApplicationDataSourceModel struct {
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ProjectID types.String `tfsdk:"project_id"`
OrgID types.String `tfsdk:"organization_id"`
ReadmeMarkdown types.String `tfsdk:"readme_markdown"`
ApplicationTemplateID types.String `tfsdk:"application_template_id"`
ApplicationTemplateName types.String `tfsdk:"application_template_name"`
NamespaceID types.String `tfsdk:"namespace_id"`
ID types.String `tfsdk:"id"`
Name types.String `tfsdk:"name"`
ProjectID types.String `tfsdk:"project_id"`
OrgID types.String `tfsdk:"organization_id"`
ReadmeMarkdown types.String `tfsdk:"readme_markdown"`
TemplateID types.String `tfsdk:"template_id"`
TemplateName types.String `tfsdk:"template_name"`
NamespaceID types.String `tfsdk:"namespace_id"`

// deferred for now
// Tags types.List `tfsdk:"tags"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

func TestAccWaypoint_Application_DataSource_basic(t *testing.T) {
// this is only used to verify the app template gets cleaned up in the end
// this is only used to verify the template gets cleaned up in the end
// of the test, and not used for any other purpose at this time
var applicationModel waypoint.ApplicationResourceModel
resourceName := "hcp_waypoint_application.test"
Expand All @@ -27,14 +27,14 @@ func TestAccWaypoint_Application_DataSource_basic(t *testing.T) {
CheckDestroy: testAccCheckWaypointApplicationDestroy(t, &applicationModel),
Steps: []resource.TestStep{
{
// establish the base app template and application
// establish the base template and application
Config: testApplicationConfig(templateName, applicationName),
Check: resource.ComposeTestCheckFunc(
testAccCheckWaypointApplicationExists(t, resourceName, &applicationModel),
),
},
{
// add a data source config to read the app template
// add a data source config to read the template
Config: testDataApplicationConfig(templateName, applicationName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(dataSourceName, "name", applicationName),
Expand All @@ -45,7 +45,7 @@ func TestAccWaypoint_Application_DataSource_basic(t *testing.T) {
}

func TestAccWaypoint_Application_DataSource_WithInputVars(t *testing.T) {
// this is only used to verify the app template gets cleaned up in the end
// this is only used to verify the template gets cleaned up in the end
// of the test, and not used for any other purpose at this time
var applicationModel waypoint.ApplicationResourceModel
resourceName := "hcp_waypoint_application.test_var_opts"
Expand All @@ -59,14 +59,14 @@ func TestAccWaypoint_Application_DataSource_WithInputVars(t *testing.T) {
CheckDestroy: testAccCheckWaypointApplicationDestroy(t, &applicationModel),
Steps: []resource.TestStep{
{
// establish the base app template and application
// establish the base template and application
Config: testApplicationWithInputVarsConfig(templateName, applicationName),
Check: resource.ComposeTestCheckFunc(
testAccCheckWaypointApplicationExists(t, resourceName, &applicationModel),
),
},
{
// add a data source config to read the app template
// add a data source config to read the template
Config: testDataApplicationWithInputVarsConfig(templateName, applicationName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(dataSourceName, "name", applicationName),
Expand Down
Loading

0 comments on commit 11d4246

Please sign in to comment.