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

Add google_composer_environment data source #4238

Merged
merged 5 commits into from
Nov 30, 2020

Conversation

KernelPryanic
Copy link
Contributor

@KernelPryanic KernelPryanic commented Nov 16, 2020

Resolved hashicorp/terraform-provider-google#7826

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

composer: added datasource for `google_composer_environment`

@google-cla
Copy link

google-cla bot commented Nov 16, 2020

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no label Nov 16, 2020
@modular-magician
Copy link
Collaborator

Hello! I am a robot who works on Magic Modules PRs.

I have detected that you are a community contributor, so your PR will be assigned to someone with a commit-bit on this repo for initial review.

Thanks for your contribution! A human will be with you soon.

@ScottSuarez\melinath, please review this PR or find an appropriate assignee.

@KernelPryanic
Copy link
Contributor Author

@googlebot I signed it!

@google-cla google-cla bot added cla: yes and removed cla: no labels Nov 16, 2020
@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 167 insertions(+))
Terraform Beta: Diff ( 5 files changed, 167 insertions(+))

@nat-henderson
Copy link
Contributor

Looks great, let me get the tests run. /gcbrun.

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=158233"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 167 insertions(+))
Terraform Beta: Diff ( 5 files changed, 167 insertions(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccDataSourceComposerEnvironment_basic|TestAccDataSourceSpannerInstance_basic|TestAccApiGatewayApiConfigIamBindingGenerated|TestAccApiGatewayApiConfigIamMemberGenerated|TestAccApiGatewayApiConfigIamPolicyGenerated|TestAccApiGatewayGatewayIamBindingGenerated|TestAccApiGatewayGatewayIamMemberGenerated|TestAccApiGatewayGatewayIamPolicyGenerated|TestAccApiGatewayApiConfig_apigatewayApiConfigBasicExample|TestAccApiGatewayApiConfig_apigatewayApiConfigBasicExampleUpdated|TestAccApiGatewayGateway_apigatewayGatewayBasicExample|TestAccApiGatewayGateway_apigatewayGatewayBasicExampleUpdated|TestAccActiveDirectoryDomainTrust_activeDirectoryDomainTrustBasicExample|TestAccBigqueryDataTransferConfig|TestAccComposerEnvironment_withUpdateOnCreate|TestAccFilestoreInstance_filestoreInstanceBasicExample|TestAccFilestoreInstance_update|TestAccLoggingOrganizationSink_described|TestAccLoggingOrganizationSink_disabled|TestAccOSLoginSSHPublicKey_osLoginSshKeyExpiry You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=158242"

@KernelPryanic
Copy link
Contributor Author

@ndmckinley please take a look at the PR if you have spare time :)

@nat-henderson
Copy link
Contributor

Were you able to get the new test to pass on your machine?

------- Stdout: -------
=== RUN   TestAccDataSourceComposerEnvironment_basic
=== PAUSE TestAccDataSourceComposerEnvironment_basic
=== CONT  TestAccDataSourceComposerEnvironment_basic
TestAccDataSourceComposerEnvironment_basic: provider_test.go:266: Step 1/1 error: Error running pre-apply refresh: 2020/11/16 23:15:31 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
Error: "name" ("data_google_composer_environment_test") doesn't match regexp "^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$"
on config710596132/terraform_plugin_test.tf line 3, in data "google_composer_environment" "composer_env":
3:   name = "data_google_composer_environment_test"
--- FAIL: TestAccDataSourceComposerEnvironment_basic (3.56s)
FAIL

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 167 insertions(+))
Terraform Beta: Diff ( 5 files changed, 167 insertions(+))

@KernelPryanic
Copy link
Contributor Author

KernelPryanic commented Nov 18, 2020

Were you able to get the new test to pass on your machine?

------- Stdout: -------
=== RUN   TestAccDataSourceComposerEnvironment_basic
=== PAUSE TestAccDataSourceComposerEnvironment_basic
=== CONT  TestAccDataSourceComposerEnvironment_basic
TestAccDataSourceComposerEnvironment_basic: provider_test.go:266: Step 1/1 error: Error running pre-apply refresh: 2020/11/16 23:15:31 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.10.0
Error: "name" ("data_google_composer_environment_test") doesn't match regexp "^(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)$"
on config710596132/terraform_plugin_test.tf line 3, in data "google_composer_environment" "composer_env":
3:   name = "data_google_composer_environment_test"
--- FAIL: TestAccDataSourceComposerEnvironment_basic (3.56s)
FAIL

Oops, sorry, I've changed the name of the test environment after I executed tests on my own environment.

@KernelPryanic
Copy link
Contributor Author

@ndmckinley hey! Could you please take a look when you've got some time?

@nat-henderson
Copy link
Contributor

Ah, thanks for the ping! Let me rerun those. /gcbrun

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=159490"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 167 insertions(+))
Terraform Beta: Diff ( 5 files changed, 167 insertions(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccDataSourceComposerEnvironment_basic|TestAccDataSourceSpannerInstance_basic|TestAccApiGatewayApiConfigIamBindingGenerated|TestAccApiGatewayApiConfigIamMemberGenerated|TestAccApiGatewayApiConfigIamPolicyGenerated|TestAccApiGatewayGatewayIamBindingGenerated|TestAccApiGatewayGatewayIamMemberGenerated|TestAccApiGatewayGatewayIamPolicyGenerated|TestAccApiGatewayApiConfig_apigatewayApiConfigBasicExample|TestAccApiGatewayApiConfig_apigatewayApiConfigBasicExampleUpdated|TestAccApiGatewayGateway_apigatewayGatewayBasicExample|TestAccApiGatewayGateway_apigatewayGatewayBasicExampleUpdated|TestAccActiveDirectoryDomainTrust_activeDirectoryDomainTrustBasicExample|TestAccBigqueryDataTransferConfig|TestAccComposerEnvironment_withUpdateOnCreate|TestAccComputeTargetInstance_targetInstanceCustomNetworkExample|TestAccFilestoreInstance_filestoreInstanceBasicExample|TestAccFilestoreInstance_update|TestAccProjectIamCustomRole_basic|TestAccLoggingOrganizationSink_described|TestAccLoggingOrganizationSink_disabled|TestAccOSLoginSSHPublicKey_osLoginSshKeyExpiry|TestAccSpannerDatabase_basic|TestAccStorageBucket_cors You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=159495"

@nat-henderson
Copy link
Contributor

@ndmckinley hey! Could you please take a look when you've got some time?

Hey, sorry:

------- Stdout: -------
=== RUN   TestAccDataSourceComposerEnvironment_basic
=== PAUSE TestAccDataSourceComposerEnvironment_basic
=== CONT  TestAccDataSourceComposerEnvironment_basic
TestAccDataSourceComposerEnvironment_basic: testing_new_config.go:71: no "id" found in attributes
TestAccDataSourceComposerEnvironment_basic: testing_new.go:48: no "id" found in attributes
--- FAIL: TestAccDataSourceComposerEnvironment_basic (7.41s)
FAIL

@KernelPryanic
Copy link
Contributor Author

KernelPryanic commented Nov 24, 2020

@ndmckinley hm, that's weird, locally tests are passing

==> Checking source code against gofmt...
==> Checking that code complies with gofmt requirements...
go generate  ./...
TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test ./google -v -run=TestAccDataSourceComposerEnvironment_basic -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google/version.ProviderVersion=acc"
=== RUN   TestAccDataSourceComposerEnvironment_basic
=== PAUSE TestAccDataSourceComposerEnvironment_basic
=== CONT  TestAccDataSourceComposerEnvironment_basic
--- PASS: TestAccDataSourceComposerEnvironment_basic (6.62s)
PASS
ok  	github.com/hashicorp/terraform-provider-google/google	6.638s

Also I found some weird issue with composer environment creation when I was trying to use data-google-composer-environment-test name for the environment, so I've changed the name of test env once again.

Use of this bucket name is restricted: 'us-central1-data-google-com-cb1e6a07-bucket'

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 167 insertions(+))
Terraform Beta: Diff ( 5 files changed, 167 insertions(+))

@nat-henderson
Copy link
Contributor

Let's try one more time. If it fails again I'll go ahead and run it locally and try to debug. /gcbrun

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=159684"

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 167 insertions(+))
Terraform Beta: Diff ( 5 files changed, 167 insertions(+))

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccDataSourceComposerEnvironment_basic|TestAccDataSourceSpannerInstance_basic|TestAccActiveDirectoryDomainTrust_activeDirectoryDomainTrustBasicExample|TestAccBigqueryDataTransferConfig|TestAccComposerEnvironment_withUpdateOnCreate|TestAccFilestoreInstance_filestoreInstanceBasicExample|TestAccFilestoreInstance_update|TestAccOSLoginSSHPublicKey_osLoginSshKeyExpiry You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=159689"

@nat-henderson
Copy link
Contributor

Same problem unfortunately! I'll clone it locally and see what I can see.

@nat-henderson
Copy link
Contributor

Same thing happens on my machine, exact same. Never seen this error before, but it only happens on your PR. The tests are passing for you?

@nat-henderson
Copy link
Contributor

Okay, our theory is that the issue is that the config does not create the resource that the data source reads. Take a look at https://github.com/GoogleCloudPlatform/magic-modules/blob/master/third_party/terraform/tests/data_source_cloud_run_service_test.go#L53, for example, where the data source reads from a resource that is also created. We think it's passing for you since that resource exists in your environment (but not in ours), and we think the error message is just confusing and if that resolves your problem we'll ask HashiCorp to edit it to make it clearer.

@KernelPryanic
Copy link
Contributor Author

@ndmckinley Gotcha, didn't know how they are hooked up, thank you! Updated the PR.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 202 insertions(+))
Terraform Beta: Diff ( 5 files changed, 202 insertions(+))

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 208 insertions(+))
Terraform Beta: Diff ( 5 files changed, 208 insertions(+))

@KernelPryanic
Copy link
Contributor Author

@ndmckinley hey) Could you please take a look and run /gcbrun if you've got a time?

@nat-henderson
Copy link
Contributor

Hi there - /gcbrun - thanks, we were off for the thanksgiving holiday. :)

@modular-magician
Copy link
Collaborator

I have triggered VCR tests based on this PR's diffs. See the results here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=160653"

@KernelPryanic
Copy link
Contributor Author

KernelPryanic commented Nov 30, 2020

Ah, right, happy belated thanksgiving! :)

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 5 files changed, 208 insertions(+))
Terraform Beta: Diff ( 5 files changed, 208 insertions(+))

@nat-henderson
Copy link
Contributor

Looks good to me!

@modular-magician
Copy link
Collaborator

I have triggered VCR tests in RECORDING mode for the following tests that failed during VCR: TestAccDataSourceComposerEnvironment_basic|TestAccDataSourceSpannerInstance_basic|TestAccActiveDirectoryDomainTrust_activeDirectoryDomainTrustBasicExample|TestAccBigqueryDataTransferConfig|TestAccComposerEnvironment_withUpdateOnCreate|TestAccContainerNodePool_basic|TestAccContainerNodePool_nodeLocations|TestAccContainerNodePool_maxPodsPerNode|TestAccContainerNodePool_withInvalidUpgradeSettings|TestAccContainerNodePool_withNodeConfig|TestAccContainerNodePool_withKubeletConfig|TestAccContainerNodePool_withGPU|TestAccContainerNodePool_withLinuxNodeConfig|TestAccContainerNodePool_withNodeConfigScopeAlias|TestAccContainerNodePool_withUpgradeSettings|TestAccContainerNodePool_regionalAutoscaling|TestAccContainerNodePool_withWorkloadIdentityConfig|TestAccContainerNodePool_withSandboxConfig|TestAccContainerNodePool_withManagement|TestAccContainerNodePool_regionalClusters|TestAccContainerNodePool_resize|TestAccContainerNodePool_shieldedInstanceConfig|TestAccContainerNodePool_autoscaling|TestAccContainerNodePool_012_ConfigModeAttr|TestAccContainerNodePool_EmptyGuestAccelerator|TestAccFilestoreInstance_filestoreInstanceBasicExample|TestAccFilestoreInstance_update|TestAccOSLoginSSHPublicKey_osLoginSshKeyExpiry You can view the result here: "https://ci-oss.hashicorp.engineering/viewQueued.html?itemId=160656"

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

Successfully merging this pull request may close these issues.

Add data source for Composer environment
3 participants