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

Setup conflict checks for variable secret/non-secret attributes in VG #881

Closed
wants to merge 1 commit into from

Conversation

AlexPykavy
Copy link
Contributor

@AlexPykavy AlexPykavy commented Sep 8, 2023

To throw an error if the value attribute is used when secret was expected, and vice versa.

All Submissions:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My code follows the code style of this project.
  • I ran lint checks locally prior to submission.
  • Have you checked to ensure there aren't other open PRs for the same update/change?

What about the current behavior has changed?

Issue Number:

Does this introduce a change to go.mod, go.sum or vendor/?

  • Yes
  • No

Does this introduce a breaking change?

  • Yes
  • No

Any relevant logs, error output, etc?

(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)

Other information

To throw an error if the `value` attribute is used
when secret was expected, and vice versa.
@@ -108,20 +108,20 @@ func ResourceVariableGroup() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Default: "",
ConflictsWith: []string{vgKeyVault},
ConflictsWith: []string{vgKeyVault, vgIsSecret, secretVgValue},
Copy link
Collaborator

Choose a reason for hiding this comment

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

value, secret_value, is_secret all have default values, the constraint will always be valid, internal check will always failed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are absolutely right. Moreover, referencing objects in the Set is not supported in ConflictsWith at the moment. I have another idea how to achieve this but it will be more dangerous and deserves a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants