generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Waypoint application input vars (#833)
* [WAYP-2173] waypoint: Add input vars to application resource. * [WAYP-2173] waypoint: Support input variables on template resource and data source. * waypoint: Fix application schema. * waypoint: Fix template schema and regen docs. * waypoint: Add changelog. * waypoint: Fix applications and templates issues. * Add variable type to application input vars * Set variable options on a template to be computed * Enforce uniqueness in a template's variable options, if provided * Add acceptance test for templates where a template is user editable, instead of using variable options * waypoint: Omit special variable from app input vars. This commit updates Waypoint application creation to omit the `waypoint_application` input variable from the variables returned to the provider from HCP Waypoint. This variable is implicitly set by the service, and is never expected to be in the config. Since it's not in the config, but is returned by the API, if it is added to the state, Terraform errors since the config and state don't match, even though that is expected. Another change in this PR is that the type of the input variable for an application is set in the state based on what is in the config, NOT the API response. This is because the API presently does not return the type of the variable. If and when that changes, this can be undone (as noted in the comment with this change). * waypoint: Add test case for applications w/variables. * waypoint: Split template acc test cases. Basic test case is updated to only test basic aspects of a template, not variables with options. That has been split into a new test case. * waypoint: Split template data source acc test cases. * waypoint: Change app input vars to list. * Implement value converter interface for input vars, to use "As" for conversion from a TF value to a struct * Refactor code to read input vars into the plan/state into readInputs function * Set list of input vars to a null list if there are no inputs * Update tests to use corrected variable options * Add variable type to data source schema, though it won't be set yet * waypoint: Add test for app data source with input vars. * waypoint: Docs generation. * waypoint: Add app test. This test simulates a template which sets two variables and an application created using that template. * waypoint: Remove unnecessary list of input vars. The list of input vars removed by this commit is only needed during creation of an app, not a read. * waypoint: Split app and template input vars for an app. This commit splits up the input vars for an application that are set by a template and an app into two separate parts of the schema for the resource. The function readInputs is updated to make the distinction. * waypoint: Change app input vars to a computed set. * waypoint: Update app input and tpl vars to set. Update acc test to test that template vars are set for an application that uses a template which configured a value for an input var. * waypoint: Update app tpl input var type to optional. The variable type for the template-configured input variables of an application is optional. This will remain true unless the API changes to always return a variable's type. * waypoint: Fix waypoint_application data source input vars. The waypoint_application data source was updated to no longer use the `readInputs` method created to help with reading input vars for the waypoint_application resource. Instead it's handled in a loop in the data source's read function, because it doesn't split vars between app and tpl input vars. Tests were also updated accordingly here. * waypoint: Generate docs. * fmt. * Rename Waypoint app data source input vars field. Co-authored-by: Clint <[email protected]> * Set input vars to null set for data source. The set of input vars for the Waypoint application data source should be null if there are not any variables. Co-authored-by: Clint <[email protected]> * Regen Waypoint docs. * Update WP app to always check vars. Doing this is necessary for drift detection. Co-authored-by: Clint <[email protected]> * wp: Apply changes from code review. Co-authored-by: Clint <[email protected]> * wp: Regen docs. * wp: Use ElementsAs for value conversion. This is simpler than implementing the value converter interface. * wp: Fix docs typo. * wp: Fix data source vars test. Typo in new field name "input_variables" was fixed. The # of variables also has changed since `waypoint_application` is counted among the variables. * wp: Fix app vars test. The # of variables has changed since `waypoint_application` is counted among the variables. --------- Co-authored-by: Clint <[email protected]>
- Loading branch information
1 parent
ee8b04a
commit 68a655f
Showing
12 changed files
with
630 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
```release-note:improvement | ||
Add support for input variables to `hcp_waypoint_application` resource and | ||
data source. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.