I have an image in the container registry of say "Project A" and want to copy it over to the container registry of "Project B". How do I do it using terraform ?
Copy container image from one Google project to another using terraform
1.4k Views Asked by mzafer At
1
There are 1 best solutions below
Related Questions in GOOGLE-CLOUD-PLATFORM
- Why do I need to wait to reaccess to Firestore database even though it has already done before?
- Unable to call datastore using GCP service account key json
- Troubleshooting Airflow Task Failures: Slack Notification Timeout
- GoogleCloud Error: Not Found The requested URL was not found on this server
- Kubernetes cluster on GCE connection refused error
- Best way to upload images to Google Cloud Storage?
- Permission 'storage.buckets.get' denied on resource (or it may not exist)
- Google Datastream errors on larger MySQL tables
- Can anyone explain the output of apache-beam streaming pipeline with Fixed Window of 60 seconds?
- Parametrizing backend in terraform on gcp
- Nonsense error using a Python Google Cloud Function
- Unable to deploy to GAE from Github Actions
- Assigned A record for Subdomain in Cloud DNS to Compute Engine VM instance but not propagated/resolved yet
- Task failure in DataprocCreateClusterOperator when i add metadata
- How can I get the long running operation with google.api_core.operations_v1.AbstractOperationsClient
Related Questions in TERRAFORM
- Why does terraform aws_cognito_user_pool always show as "updated in-place" on every single terraform plan?
- Terraform - loop over complex data in data source
- Terraform cidrsubnets
- Encountered an error (ServiceUnavailable) from host runtime on Azure Function App
- Problem to add service principal permissions with terraform
- Multiple resources for the depends_on dependencies is throwing an Error
- Parametrizing backend in terraform on gcp
- AWS EKS Fargate pod scheduling issue with Prometheus deployment
- Terraform valdiate that one of N variables is set to "true"
- How to assign a value to a string variable, that includes embedded '=' in the value
- Terraform loop over Map variable to provision multiple Databricks catalogs
- Terraform OCI error when creating Network Load Balancer
- logiapp teams api connection terraform user sign in
- Difference between google_project_iam_* and other google_*_iam_* resources
- JSON representation of the current Terraform configuration
Related Questions in TERRAFORM-PROVIDER-GCP
- Difference between google_project_iam_* and other google_*_iam_* resources
- Permissions issue for google cloud build terraform
- How to release terraform state lock file from GCP backend when using automation for deployment
- Terraform - Google cloud - create multiple service accounts with multiple roles
- How to resolve terraform message: 'google_compute_ssl_certificate.xxx must be replace'?
- GCP IP address range
- Provision Google Cloud Composer 2 with Terraform
- how to disable soft delete from a GCS bucket
- What is the equivalent of this gcloud add-iam-policy-binding in terraform?
- GCP VPC SC No Matching Access Level for FetchUserPreference Method
- 502 "failed_to_pick_backend" when using PSC backend with Classic Load Balancer
- GKE Autopilote EgressNATPolicy with terraform
- Terraform Script to copy Big query dataset to GCS Bucket
- Using HEREDOC in Terraform config always triggers update
- Trouble with Terraform Provisioner File: Copying File to GCP VM
Related Questions in GOOGLE-CONTAINER-REGISTRY
- Unauthenticated requests do not have permission "artifactregistry.repositories.uploadArtifacts" on resource "projects/gcp-devops-415915
- Best Practices for Migrating Docker Images from Google Container Registry (GCR) to Artifact Registry with High Volume of Tags
- GCP Cloud Run container stalls when using Cloud Build to deploy with tag "latest" and same image name
- New GKE nodes are unable to pull images from Container Registry on Google Cloud Platform
- How to stop google cloud artifacts from affecting my firebase storage usage?
- Transitioning from Google Container Registry to Google Artifact Registry for Python App Deployment on Google App Engine
- Error code 13 while deploying google cloud function (terraform) from dev to qa
- Different behavior on Google Container Registry vs Google Artifact Registry (breaking change)
- GCP App Engine Custom Runtime Image location
- What is the appropriate role for container registry in order to push and pull docker images from the GCR?
- is it necessary to migarte the images from Container Registry to Artifact Registry
- I want to fix security vulnerability in my docker image
- How to set Container build path in Cloud Function?
- How to pass env variables and arguments while building cloud build docker images?
- Google Cloud Run
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I don't think you should, but that does not mean you can't.
Don't Terraform is an excellent tool to manage infrastructure with; it's not great for interacting with data or application code. The line between these two can be hard to draw, especially with GCP's high-level services like AppEngine, Cloud Run, ..., but imo, where a container registry can be treated as infrastructure, a container image should be treated as data (or code), and not be managed in Terraform. Don't do it!
But I really want to... Hey, who am I to judge? Maybe there's something about your particular problem that I don't know about. There's no GCP resources for copying or interacting with images, but you can interact with GCR as generic container registries. You can use the community module
neomantra/mirror/docker. Its sources are pretty easy to read and adapt; it uses thedocker_imageresource to pull the remote image to your local machine, followed by a well-timedlocal-exectodocker pushthe image to its destination.Example usage:
You can optionally use the data resource
google_container_registry_imagefor constructing the handles to the images in Container Registry.Fyi, if you're migrating, consider migrating to Artifact Registry, as Google is deprecating the Container Registry in favor of the Artifact Registry.