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

providers/google: Add subnetwork_project field to enable cross-project networking in instance templates #11110

Merged
merged 5 commits into from
Jan 12, 2017
Merged

providers/google: Add subnetwork_project field to enable cross-project networking in instance templates #11110

merged 5 commits into from
Jan 12, 2017

Conversation

zbikmarc
Copy link
Contributor

@zbikmarc zbikmarc commented Jan 9, 2017

This change allows to use XPN feature with instance templates. It is an extension of #9662

One thing which is currently missing is showing subnetwork project in terraform show.

@zbikmarc
Copy link
Contributor Author

zbikmarc commented Jan 9, 2017

I do not know how to pass GOOGLE_XPN_HOST_PROJECT to travis.

func TestAccComputeInstanceTemplate_subnet_xpn(t *testing.T) {
var instanceTemplate compute.InstanceTemplate
var xpn_host = os.Getenv("GOOGLE_XPN_HOST_PROJECT")
if xpn_host == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you omit this check, then the travis build will pass - we have this already setup with the correct parameter

@stack72
Copy link
Contributor

stack72 commented Jan 9, 2017

Hi @zbikmarc

Thanks for the work here - I made a comment inline to remove the check for the XPN project - we have that handled in the provider tests

That will make the build pass

Paul

@stack72
Copy link
Contributor

stack72 commented Jan 9, 2017

Hi @zbikmarc

make fmt will now fix the build in this case

P.

@zbikmarc
Copy link
Contributor Author

zbikmarc commented Jan 9, 2017

I hope this time everything will be ok ;)

@stack72
Copy link
Contributor

stack72 commented Jan 9, 2017

Hi @zbikmarc

thanks for the work here so far, unfortunately, the test doesn't pass:

=== RUN   TestAccComputeInstanceTemplate_subnet_xpn
--- FAIL: TestAccComputeInstanceTemplate_subnet_xpn (77.45s)
	testing.go:265: Step 0 error: After applying this step, the plan was not empty:

		DIFF:

		DESTROY/CREATE: google_compute_instance_template.foobar
		  automatic_restart:                      "true" => "true"
		  can_ip_forward:                         "false" => "false"
		  disk.#:                                 "1" => "1"
		  disk.0.auto_delete:                     "true" => "true"
		  disk.0.boot:                            "true" => "true"
		  disk.0.disk_size_gb:                    "10" => "10"
		  disk.0.disk_type:                       "pd-standard" => "<computed>"
		  disk.0.interface:                       "SCSI" => "<computed>"
		  disk.0.mode:                            "READ_WRITE" => "<computed>"
		  disk.0.source_image:                    "debian-8-jessie-v20160803" => "debian-8-jessie-v20160803"
		  disk.0.type:                            "PERSISTENT" => "<computed>"
		  machine_type:                           "n1-standard-1" => "n1-standard-1"
		  metadata.%:                             "1" => "1"
		  metadata.foo:                           "bar" => "bar"
		  metadata_fingerprint:                   "EEf91SmZULE=" => "<computed>"
		  name:                                   "instance-test-4y3k6d04n8" => "instance-test-4y3k6d04n8"
		  network_interface.#:                    "1" => "1"
		  network_interface.0.network:            "network-y9dm32zelq" => "<computed>"
		  network_interface.0.subnetwork:         "subnetwork-2hhijid3f1" => "subnetwork-2hhijid3f1"
		  network_interface.0.subnetwork_project: "" => "xpn-hc-terraform-testing" (forces new resource)
		  project:                                "hc-terraform-testing" => "<computed>"
		  region:                                 "us-central1" => "us-central1"
		  scheduling.#:                           "1" => "<computed>"
		  self_link:                              "https://www.googleapis.com/compute/v1/projects/hc-terraform-testing/global/instanceTemplates/instance-test-4y3k6d04n8" => "<computed>"
		  tags_fingerprint:                       "" => "<computed>"

I believe this is because you are not setting the subnetwork_project id in the Read func - I am not 100% sure this is the case, but though i'd make a suggestions

Thanks

Paul

@stack72 stack72 added the waiting-response An issue/pull request is waiting for a response from the community label Jan 9, 2017
@zbikmarc
Copy link
Contributor Author

zbikmarc commented Jan 10, 2017

I added subnetwork_project to Read.
I tried to run tests locally but my google cloud account is too limited to perform those tests.

@zbikmarc
Copy link
Contributor Author

@stack72
Are tests passing now?

@stack72
Copy link
Contributor

stack72 commented Jan 12, 2017

Nice work @zbikmarc :)

% make testacc TEST=./builtin/providers/google TESTARGS='-run=TestAccComputeInstanceTemplate_subnet_xpn'                    ✭
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/01/12 16:02:01 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/google -v -run=TestAccComputeInstanceTemplate_subnet_xpn -timeout 120m
=== RUN   TestAccComputeInstanceTemplate_subnet_xpn
--- PASS: TestAccComputeInstanceTemplate_subnet_xpn (114.06s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/google	114.076s

@stack72 stack72 merged commit 77037be into hashicorp:master Jan 12, 2017
@ghost
Copy link

ghost commented Apr 18, 2020

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement provider/google-cloud waiting-response An issue/pull request is waiting for a response from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants