question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing existing GCP service account violates pulumi id regex.

See original GitHub issue

I’m attempting to import an existing service account in GCP. The service account is created by default when enabling the Cloud Build api. The id of my default service account is 418715367700-compute. Attempting to set that value in go returns the following error:

Diagnostics:
  gcp:serviceAccount:Account (cloud-build):
    error: gcp:serviceAccount/account:Account resource 'cloud-build' has a problem: "account_id" ("418715367700-compute") doesn't match regexp "^[a-z](?:[-a-z0-9]{4,28}[a-z0-9])$"
    error: Preview failed: one or more inputs failed to validate

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
aryehbcommented, Sep 29, 2022

This appears to still be an issue.

#361 is marked as fixing this issue, and this issue was closed as a result, but I believe that is a mistake, as I commented there. #361 fixes #359, and this issue is unrelated and should be re-opened.
@stack72 Can you confirm and re-open?

Are you certain that 418715367700-compute isn’t the name of the service account and it actually has some other ID? Otherwise, I don’t think the Google API would’ve let you create this in the first place?

The ID for the default service account for Compute Engine is {NUMERIC_PROJECT_ID}-compute, and is auto-generated by GCP.

It appears the GCP Terraform provider has the same issue. There’s a dedicated resource mentioned in a comment on that issue for the default Compute Engine service account (resource, source), which I presume doesn’t have the regular restrictions.

Pulumi has a dedicated function for returning the default service account. However, I can’t find a corresponding resource in the Pulumi documentation.

0reactions
mezhakacommented, Oct 21, 2022

@mezhaka Did you try using google_compute_default_service_account instead?

Oh! I did not know about that. It did help. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

gcp.serviceAccount.Account - Pulumi
Documentation for the gcp.serviceAccount.Account resource with examples, input properties, output properties, lookup functions, and supporting types.
Read more >
gcp.serviceAccount.IAMBinding - Pulumi
Documentation for the gcp.serviceAccount.IAMBinding resource with examples, input properties, output properties, lookup functions, and supporting types.
Read more >
Integrating Google Cloud Build | CI/CD - Pulumi
You can do this by navigating to the IAM tab in the GCP Console. Cloud Build service account. If you do not grant...
Read more >
gcp.logging.Metric - Pulumi
Documentation for the gcp.logging.Metric resource with examples, input properties, output properties, lookup functions, and supporting types.
Read more >
Installation & Configuration Service Account - Pulumi
Provides an overview of how set up a Google Cloud Platform Service Account with Pulumi.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found