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

Adding in support for a "No Project" setting for gcp:project #2653

Closed
wants to merge 3 commits into from

Conversation

rshade
Copy link
Contributor

@rshade rshade commented Nov 18, 2024

fixes #1168

@rshade rshade force-pushed the rshade/support-no-gcp_project branch from 2c05a7f to 4e1d52b Compare November 18, 2024 21:46
@rshade rshade changed the title Adding in support for a "No Project" setting for gcp:project, fixes 1168 Adding in support for a "No Project" setting for gcp:project, fixes #1168 Nov 18, 2024
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

Maintainer note: consult the runbook for dealing with any breaking changes.

Copy link
Contributor

@guineveresaenger guineveresaenger left a comment

Choose a reason for hiding this comment

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

Thank you for this pull request, Richard! 💟

In addition to my nits 😅 would you please add to the PR description:

  • briefly describe the change (what)
  • what this change is addressing (why)
  • how it is addressing the issue (how)

provider/provider_yaml_test.go Outdated Show resolved Hide resolved
provider/resources.go Outdated Show resolved Hide resolved
provider/resources.go Outdated Show resolved Hide resolved
Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

I like DisableGlobalProjectWarning much more then project: "No Project".

Can you please link the issue you are addressing and explain your fix in the PR body. If users see that the underlying issue is fixed, they should understand at minimum how to apply the fix for themselves.

provider/resources.go Outdated Show resolved Hide resolved
@rshade
Copy link
Contributor Author

rshade commented Nov 19, 2024

I like DisableGlobalProjectWarning much more then project: "No Project".

Can you please link the issue you are addressing and explain your fix in the PR body. If users see that the underlying issue is fixed, they should understand at minimum how to apply the fix for themselves.

Absolutely, will do.

@rshade rshade force-pushed the rshade/support-no-gcp_project branch 4 times, most recently from 0416cd6 to 642c6b8 Compare November 19, 2024 22:29
@iwahbe iwahbe changed the title Adding in support for a "No Project" setting for gcp:project, fixes #1168 Adding in support for a "No Project" setting for gcp:project Nov 20, 2024
provider/resources.go Outdated Show resolved Hide resolved
@rshade rshade force-pushed the rshade/support-no-gcp_project branch from 642c6b8 to 5f715d4 Compare November 20, 2024 16:08
@rshade rshade force-pushed the rshade/support-no-gcp_project branch from 1313c75 to 152540b Compare November 20, 2024 17:17
@rshade rshade force-pushed the rshade/support-no-gcp_project branch from 152540b to 647c9ff Compare November 20, 2024 19:01
@@ -169,6 +169,10 @@ const (
gcpWorkstations = "Workstations" // Workstations
)

// When `gcp:project` is set to noProjectMarker, we don't warn that a global project is missing
// and we don't try to validate the project.
const noProjectMarker = "DisableGlobalProjectWarning"
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a bit late to the party here but should we perhaps add a new config to disable the warning instead? That seems like a nicer UX for users than a magic string in place of the project config and a bit easier to discover.

e.g.

So instead of:

gcp.Provider(project="DisableGlobalProjectWarning")

users would use

gcp.Provider(disable_global_project_warning=true)

You can define that here:

"skipRegionValidation": {

We have an existing config we've added to disable another similar check.

Copy link
Contributor

@VenelinMartinov VenelinMartinov Nov 20, 2024

Choose a reason for hiding this comment

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

The benefit of this is that it would automatically get added to our docs etc. It would also be discoverable as a property on the ProviderArgs.

It might also work better with other things in the provider as I do not know all the places where the project is used - setting it to an invalid string might interact in odd ways with other things.

Copy link
Contributor

Choose a reason for hiding this comment

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

@rshade LMK what you think, also happy to help with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@iwahbe @guineveresaenger thoughts? I am good any way we do it.

Copy link
Member

Choose a reason for hiding this comment

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

This is definitely better.

gcp.Provider(disable_global_project_warning=true)

When I saw DisableGlobalProjectWarning I initially assumed that ☝️ is what was meant (which I then promptly forgot to right down when I saw the code ☹️).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

excellent thank you @VenelinMartinov @iwahbe I will get that put in on Monday.

@VenelinMartinov
Copy link
Contributor

@rshade have you had a chance to look at this again? Happy to help push this over the line!

@rshade
Copy link
Contributor Author

rshade commented Dec 11, 2024

Closing in favor of #2701

@rshade rshade closed this Dec 11, 2024
@rshade rshade deleted the rshade/support-no-gcp_project branch December 11, 2024 13:56
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.

Remove "unable to detect a global setting for GCP Project" warning.
4 participants