-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add support for shared VPC #572
Conversation
return nil | ||
} | ||
} | ||
return fmt.Errorf("%s is not a service project of %s", serviceProject, hostProject) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the result is on the second page of results?
|
||
func isDisabledXpnResourceError(err error) bool { | ||
if gerr, ok := err.(*googleapi.Error); ok { | ||
if gerr.Code == 400 && len(gerr.Errors) > 0 && gerr.Errors[0].Reason == "invalidResourceUsage" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment as to why this error is special?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
resource "google_compute_shared_vpc_host_project" "host" { | ||
project = "${google_project.host.project_id}" | ||
depends_on = ["google_project_services.host", "google_project_services.service"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the service project depend on the service apis being enabled, not the host?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the host project was depending on compute apis enabled for both project, then having the service project depends on the host project being set up worked. But you are right, we can start enabling XPN for the host project before we are done updating the google services for the service project. It should be slightly faster. I updated the dependencies to reflect this.
page_title: "Google: google_compute_shared_vpc_host_project" | ||
sidebar_current: "docs-google-compute-shared-vpc-host-project" | ||
description: |- | ||
Allows enablig and disabling Shared VPC for the host Google Cloud Platform project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: enabling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
# google\_compute\_shared\_vpc\_host\_project | ||
|
||
Allows enablig and disabling Shared VPC for the host Google Cloud Platform project. For more information see |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
page_title: "Google: google_compute_shared_vpc_service_project" | ||
sidebar_current: "docs-google-compute-shared-vpc-service-project" | ||
description: |- | ||
Allows enablig and disabling Shared VPC for a service Google Cloud Platform project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here and line 11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
"os" | ||
) | ||
|
||
func TestAccComputeSharedVpc_basic(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also check that delete works? 5f9ef48 may be of use here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
TF_ACC=1 go test ./google -v -run TestAccComputeSharedVpc_basic -timeout 120m
=== RUN TestAccComputeSharedVpc_basic
--- PASS: TestAccComputeSharedVpc_basic (164.84s)
PASS |
* Add VPC host project resource * Add VPC service project resource * Add combined acceptance test for shared VPC * Add docs for shared VPC * Increase deadline for project services operation
* Add VPC host project resource * Add VPC service project resource * Add combined acceptance test for shared VPC * Add docs for shared VPC * Increase deadline for project services operation
* Add VPC host project resource * Add VPC service project resource * Add combined acceptance test for shared VPC * Add docs for shared VPC * Increase deadline for project services operation
<!-- This change is generated by MagicModules. --> /cc @drebes
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
Fixes #452
Introduced two new sources:
google_compute_shared_vpc_host_project
google_compute_shared_vpc_service_project
TF_ACC=1 go test ./google -v -run TestAccComputeSharedVpc_basic -timeout 120m === RUN TestAccComputeSharedVpc_basic --- PASS: TestAccComputeSharedVpc_basic (176.18s) PASS