Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WAYP-3107] Add module ID to Waypoint resources #1146

Merged
merged 5 commits into from
Dec 19, 2024
Merged

Conversation

paladin-devops
Copy link
Contributor

@paladin-devops paladin-devops commented Dec 4, 2024

BREAKING CHANGE: The no-code module ID is required when creating a template or add-on definition for Waypoint.

This PR also contains a fix for the add-on definition data source, for reading the execution mode.

🛠️ Description

🏗️ Acceptance tests

  • Are there any feature flags that are required to use this functionality?
  • Have you added an acceptance test for the functionality being added?
  • Have you run the acceptance tests on this branch?

Output from acceptance testing:

$ make testacc TESTARGS="-run=TestAccWaypoint"
==> Checking that code complies with gofmt requirements...
golangci-lint run --config ./golangci-config.yml 
TF_ACC=1 go test ./internal/... -v -run=TestAccWaypoint -timeout 360m -parallel=10
?   	github.com/hashicorp/terraform-provider-hcp/internal/clients/iampolicy	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/clients/packerv2	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/customdiags	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/clients	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/consul	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/hcpvalidator	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/input	(cached) [no tests to run]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/acctest	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/customtypes	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider	(cached) [no tests to run]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/iam/helper	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/modifiers	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/testutils	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/testutils/configbuilder	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/testutils/configbuilder/packerconfig	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/testutils/testcheck	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/testutils/testclient	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/utils	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/utils/base	[no test files]
?   	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/utils/location	[no test files]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/iam	0.609s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/logstreaming	0.610s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/datasources/artifact	0.762s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/datasources/version	0.814s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/packer/resources/bucket	0.949s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/resourcemanager	0.500s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/vaultradar	0.578s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/vaultsecrets	0.654s [no tests to run]
=== RUN   TestAccWaypoint_Action_DataSource_basic
    data_source_waypoint_action_test.go:20: Waypoint Action tests skipped unless env 'HCP_WAYP_ACTION_TEST' set
--- SKIP: TestAccWaypoint_Action_DataSource_basic (0.00s)
=== RUN   TestAccWaypointData_Add_On_Definition_basic
--- PASS: TestAccWaypointData_Add_On_Definition_basic (8.91s)
=== RUN   TestAccWaypointData_Add_On_basic
--- PASS: TestAccWaypointData_Add_On_basic (18.69s)
=== RUN   TestAccWaypoint_AddOn_DataSource_WithInputVars
--- PASS: TestAccWaypoint_AddOn_DataSource_WithInputVars (18.07s)
=== RUN   TestAccWaypoint_Application_DataSource_basic
--- PASS: TestAccWaypoint_Application_DataSource_basic (11.88s)
=== RUN   TestAccWaypoint_Application_DataSource_WithInputVars
--- PASS: TestAccWaypoint_Application_DataSource_WithInputVars (11.45s)
=== RUN   TestAccWaypointData_Template_basic
--- PASS: TestAccWaypointData_Template_basic (8.76s)
=== RUN   TestAccWaypointData_template_with_variable_options
--- PASS: TestAccWaypointData_template_with_variable_options (5.53s)
=== RUN   TestAccWaypoint_Action_basic
    resource_waypoint_action_test.go:25: Waypoint Action tests skipped unless env 'HCP_WAYP_ACTION_TEST' set
--- SKIP: TestAccWaypoint_Action_basic (0.00s)
=== RUN   TestAccWaypoint_Add_On_Definition_basic
--- PASS: TestAccWaypoint_Add_On_Definition_basic (5.91s)
=== RUN   TestAccWaypoint_Add_On_basic
--- PASS: TestAccWaypoint_Add_On_basic (8.94s)
=== RUN   TestAccWaypoint_AddOnInputVariables
--- PASS: TestAccWaypoint_AddOnInputVariables (8.81s)
=== RUN   TestAccWaypoint_AddOnInputVariables_OnDefinition
--- PASS: TestAccWaypoint_AddOnInputVariables_OnDefinition (9.43s)
=== RUN   TestAccWaypoint_Application_basic
--- PASS: TestAccWaypoint_Application_basic (7.40s)
=== RUN   TestAccWaypoint_ApplicationInputVariables
--- PASS: TestAccWaypoint_ApplicationInputVariables (5.71s)
=== RUN   TestAccWaypoint_ApplicationInputVariables_OnTemplate
--- PASS: TestAccWaypoint_ApplicationInputVariables_OnTemplate (6.21s)
=== RUN   TestAccWaypoint_Template_basic
--- PASS: TestAccWaypoint_Template_basic (6.48s)
=== RUN   TestAccWaypoint_template_with_variable_options
--- PASS: TestAccWaypoint_template_with_variable_options (3.11s)
=== RUN   TestAccWaypointTfcConfig_basic
    resource_waypoint_tfc_config_test.go:25: Skipping nonfunctional TFC Config test
--- SKIP: TestAccWaypointTfcConfig_basic (0.00s)
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/waypoint	145.925s
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/webhook	0.836s [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/provider/webhook/validator	(cached) [no tests to run]
testing: warning: no tests to run
PASS
ok  	github.com/hashicorp/terraform-provider-hcp/internal/providersdkv2	0.724s [no tests to run]

...

@paladin-devops paladin-devops self-assigned this Dec 4, 2024
@paladin-devops paladin-devops marked this pull request as ready for review December 5, 2024 19:15
@paladin-devops paladin-devops requested review from a team as code owners December 5, 2024 19:15
@pierluc-codes
Copy link
Contributor

@paladin-devops I know we are pre 1.0.0, but it the breaking change necessary?

@paladin-devops
Copy link
Contributor Author

@pierluc-codes I classified this as a breaking change because I added a new required attribute to two resources, is that an appropriate classification or should this just be a "feature" update?

@pierluc-codes
Copy link
Contributor

pierluc-codes commented Dec 5, 2024

it is correct. I am asking if pushing this breaking change worth breaking the customer terraform files and what are the benefit of doing so.

@paladin-devops
Copy link
Contributor Author

paladin-devops commented Dec 5, 2024

@pierluc-codes The module ID will be the "canonical way" to reference no-code modules in Waypoint templates and add-on definitions. The module source, a separate attribute, will be used not for the creation of any resources but really just for informational purposes to the user. Aside from this, on the backend one of the benefits of doing this is reducing unnecessary/redundant API calls to HCP Terraform, while the user already has the module ID available.

teresamychu
teresamychu previously approved these changes Dec 5, 2024
Copy link

@teresamychu teresamychu left a comment

Choose a reason for hiding this comment

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

LGTM! Pretty straighforward!

pierluc-codes
pierluc-codes previously approved these changes Dec 11, 2024
@paladin-devops
Copy link
Contributor Author

In a future PR we should include examples of the template + add-on definition resources (and others) under examples/. I will look into that as a follow up to merging this.

@pierluc-codes @teresamychu I'm requesting your re-review as I needed to rebase to address a merge conflict on go.mod which is now resolved.

@paladin-devops paladin-devops merged commit aa76e2d into main Dec 19, 2024
6 checks passed
@paladin-devops paladin-devops deleted the WAYP-3107 branch December 19, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants