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

empty shared_vpc issue when using shared_vpc module #480

Closed
des-esseintes opened this issue Oct 20, 2020 · 10 comments
Closed

empty shared_vpc issue when using shared_vpc module #480

des-esseintes opened this issue Oct 20, 2020 · 10 comments

Comments

@des-esseintes
Copy link

Hey team,

I've faced the issue described here: #445 (comment) by @askoriy
Basically shared_vpc module produces errors when shared_vpc is set to an empty value, it's attempting to create resources it should not, e.g. plan looks like:

resource "google_compute_shared_vpc_service_project" "shared_vpc_attachment" {
id              = (known after apply)
service_project = *******
}

this one is missing a required parameter host_project.

Not sure how to actually fix this tbh, I've checked the code and those resources should be omitted if shared_vpc == ""
But I've not spent too much time investigating this, tbh.

@bharathkkb
Copy link
Member

@des-esseintes are you trying to create a regular project?

@des-esseintes
Copy link
Author

not sure what's the definition of 'regular' here :)
i assume yes...
for now the workaround (quite an ugly one, imo) is to use the root module for the projects with no shared_vpcs, but...

@bharathkkb
Copy link
Member

@des-esseintes apologies if I was not clear, what I meant was were you trying to create a project that is not a SVPC host/service project?

  • If you use the shared_vpc module, it will create a service project for you (note: this requires the var. shared_vpc to be set to the host project id)

  • If you use the main module and explicitly set enable_shared_vpc_host_project = true, it will create a host project for you.

  • Finally if you just want a regular project, you just use the main module, which by default creates a regular project.

@des-esseintes
Copy link
Author

oh now i understand

so let me explain.

we had a module, which was using project factory as a submodule. we were on version 7.1. then i started migrating to 9.1 and found out that shared_vpcs no longer exist. after reading the comments in the ticket i mentioned in the topic start, i just changed module to shared_vpcs. that was ok for the projects with shared vpc defined, but started to fail for projects with an empty value.

i'm trying to find a better workaround rather than 2 separate modules, one of which would be using project factory and another one - shared vpcs submodule.

@bharathkkb
Copy link
Member

bharathkkb commented Oct 22, 2020

@des-esseintes got it, we are trying to converge with #446

@des-esseintes
Copy link
Author

oh, thanks! i'll keep an eye on this one :)

@des-esseintes
Copy link
Author

As this one seems to be merged now 0a6b9b9, I think I'm going to test the feature when the next version of the module comes out and report the results here

@bharathkkb
Copy link
Member

@des-esseintes you can also test the release branch now if you are interested. Closing this issue now, feel free to reopen if issue persists.

source = "github.com/terraform-google-modules/terraform-google-project-factory?ref=release-v10.0.0"

@bharathkkb
Copy link
Member

fixed by #446

@des-esseintes
Copy link
Author

working as expected!
thanks!

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

No branches or pull requests

2 participants