Inconsistent expectation of either "projects/[PROJECT_ID]" or "[PROJECT_ID]" as project_id
argument of different resources.
#11541
Labels
Milestone
Community Note
Description
The
google_project
resource has anid
attribute that returns an identifier for the created project inprojects/{{project}}
format.One could legitimately expect to be able to pass this attribute unchanged to any other resource that require a
project_id
, however this doesn't seem to work consistently.For many (but not all) resources, the GCP API call fails with errors such as :
In order to work around this, we started using
trimprefix(google_project.my_project.id, "projects/")
as theproject
argument for the affected resources, until we realised that a resource's input args are also copied as outputs, and so usingproject = google_project.my_project.project_id
in the referring resource's definition works just as well.I suppose we could simply use
.project_id
everywhere instead of.id
, but I'm not sure if some of the resources that do currently accept a "fully qualified" project ID as an argument would then start failing (or behaving subtly differently, or become tainted) if passed a "short" project ID instead.Either way, there's definitely an inconsistency here which may well be at the API level, but I wonder if there's a way the provider could help smooth this out and make the call with the correct format expected for a particular endpoint ?
New or Affected Resource(s)
Some examples of resources that do work with a
project
argument inprojects/{{project}}
format :Some examples of resources that fail to apply with a
project
argument inprojects/{{project}}
format :References
Another issue where this caused confusion :
The text was updated successfully, but these errors were encountered: