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

Failing test(s): TestAccBigQueryJob_bigqueryJobCopy* #17892

Comments

@rileykarson
Copy link
Collaborator

rileykarson commented Apr 17, 2024

Impacted tests

  • TestAccBigQueryJob_bigqueryJobCopyExample
  • TestAccBigQueryJob_bigqueryJobCopyTableReferenceExample

Affected Resource(s)

  • google_bigquery_job

Failure rates

  • 100% since 2024-04-17

Message(s)

Error: Invalid count argument
          on /opt/teamcity-agent/temp/buildTmp/plugintest2020011704/work2738438235/terraform_plugin_test.tf line 4, in resource "google_bigquery_table" "source":
           4:   count = length(google_bigquery_dataset.source)
        The "count" value depends on resource attributes that cannot be determined
        until apply, so Terraform cannot predict how many instances will be created.
        To work around this, use the -target argument to first apply only the
        resources that the count depends on.

Nightly build test history

b/336319185

@rileykarson rileykarson changed the title Failing test(s): TestAccWhatever Failing test(s): TestAccBigQueryJob_bigqueryJobCopy* Apr 17, 2024
@github-actions github-actions bot added forward/review In review; remove label to forward service/bigquery labels Apr 17, 2024
@rileykarson
Copy link
Collaborator Author

This appears to have started failing based on a Terraform Core upgrade. I suspect it's just an issue with the test configuration where an earlier version of Core was less strict (but the actual behaviour was undefined).

@melinath melinath modified the milestones: Near-Term Goals, Goals Apr 22, 2024
@melinath melinath removed the forward/review In review; remove label to forward label Apr 22, 2024
@wj-chen
Copy link

wj-chen commented Apr 22, 2024

I can repro locally. Adding depends_on didn't help. I'm guessing -target happens on the test setup side. Still investigating.

@rileykarson
Copy link
Collaborator Author

The issue here has to do with unknown values: https://developer.hashicorp.com/terraform/language/expressions/references#values-not-yet-known. Googling the error shows a lot of other results, as it's not really resource or provider specific.

The guidance to use -target only works interactively. You would replicate that in a test by breaking the Config step in two, applying dependencies first and then the remainder of the resources afterwards.

However, what I'd actually recommend here is storing the count value in a locals block and referencing it from both count fields, since we always want the count to be the same between the two resources. If that doesn't work, I'd just hardcode as 2 in both spots.

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.