-
Notifications
You must be signed in to change notification settings - Fork 61
fix(terraform): fix tf apply failures #305
Conversation
# Need to enable Artifact Registry service before repository creation. | ||
google_project_service.artifactregistry | ||
# Need to ensure Artifact Registry API is enabled first. | ||
time_sleep.wait_for_artifactregistry |
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 provide more info here? I used to have a retry for artifact registry because the beta depends-upon wasn't working, but the last I checked, it had been fixed.
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.
Is the comment above (lines 61 and 62) enough?
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.
I'm looking around for an explanation or at least a bug filed against Terraform. the depends_on
function is supposed to cover this, so I think we need to explain why it doesn't and include some kind of note about updating it when it does work.
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.
This is the PR that Adam did before to fix this problem: #165
It's possible that the depends_on cloudbuild that you added in the other block might be enough to (weirdly) fix this?
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.
I wonder if the cloudbuild
dependency is (effectively) async, and signals completion too early (i.e. before the API enablement is actually complete).
A sufficient timeout would solve that issue, which explains why this works.
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.
+1 to Dina's comment, I don't see any dependency on Cloud Build here, seems like a fairly clean "Artifact Registry resource automatically has a dependency on the service" bug. We should have a TODO linking to an upstream issue when something that's meant to be a key value of Terraform isn't working.
I'm able to replicate the error if I run the setup script with |
Oh, I see, you're running the script from You have:
But, I think we also need:
|
@dinagraves that removal is fixed in #303 - we can rebase this on top of that (once it's merged) and see if it works. |
I tried #303 without this - no dice there. (Perhaps this should be filed as a Terraform provider bug, too?) |
From @dinagraves
|
Dina - I tried replacing |
Hrm, are you using your Mac? Cloud Shell? This seems like it must be an environment issue. |
I tested this on my work Mac. |
If nobody else can replicate the problem and it's only encountered when using the "clean terraform runner", which as previously discussed is an edge case convenience, then I'm against an awkward workaround that adds complexity to the terraform definition. Instead, let's plan on arranging some pairs troubleshooting time to see if we can isolate the problem and get a more specific fix. |
@grayside (in chat) suggested adding I'm reopening this PR to track that work, and will update the code itself if that approach works. |
@grayside I've tried this a dozen different ways with lots of explicit compound |
@grayside approved internally, given that b/217779689 was filed. |
Fixes issues discovered during work on #304