First, Terraform notion of google_container_registry_repository
seems incomplete, because it represents only "root repositories" :
gcr.io/[PROJECT_ID]
[REGION].gcr.io/[PROJECT_ID]
, where [REGION]
can be us
, eu
or asia
Whereas "repository" (in GCP terminology) can also refer to :
[REGION].gcr.io/[PROJECT_ID]/my-repo
[REGION].gcr.io/[PROJECT_ID]/my-repo/my-sub-repo
- ...
There is no notion of these types of repositories in Terraform data source.
That being said :
- "root repositories" cannot be created and are managed by Google (if a new region
xy
appears, then xy.gcr.io
will be created by Google)
- other repositories used to order images (for example, a repository per developer or per project) seems kind of an abstract notion, more something like directories in Google Cloud Storage. They are created "on-the-fly" when you push an image, and they do not exist if there is no image in it. To complete the analogy between GCS directories and GCR repositories, note that there are also no
google_storage_bucket_directory
resources
For the latter kind of repositories (my-repo
, my-repo/my-subrepo
), the underlying storage bucket cannot be configured : it will always be artifacts.[PROJECT-ID].appspot.com
or [REGION].artifacts.[PROJECT-ID].appspot.com
, depending of the "root repository". There is no way to isolate different repositories in different buckets.
So in conclusion : you cannot create a GCR repository, whether it be with Terraform, with gcloud
, from the web UI, etc.