{"id":21431932,"url":"https://github.com/mikaeelkhalid/gcp-cloudbuild-gitlab-terraform","last_synced_at":"2026-05-20T02:44:49.546Z","repository":{"id":193406853,"uuid":"688749541","full_name":"mikaeelkhalid/gcp-cloudbuild-gitlab-terraform","owner":"mikaeelkhalid","description":"This Terraform configuration sets up Google Cloud Build to trigger builds from a GitLab repository and store built Docker images to the Google Artifact Registry.","archived":false,"fork":false,"pushed_at":"2023-09-11T08:59:45.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T08:41:56.869Z","etag":null,"topics":["cicd","cloudbuild","gcp","gitlab","terraform"],"latest_commit_sha":null,"homepage":"","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikaeelkhalid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-08T02:54:39.000Z","updated_at":"2023-09-08T04:00:30.000Z","dependencies_parsed_at":"2023-09-08T04:10:34.484Z","dependency_job_id":null,"html_url":"https://github.com/mikaeelkhalid/gcp-cloudbuild-gitlab-terraform","commit_stats":null,"previous_names":["mikaeelkhalid/gcp-cloudbuild-gitlab-terraform"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikaeelkhalid%2Fgcp-cloudbuild-gitlab-terraform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikaeelkhalid%2Fgcp-cloudbuild-gitlab-terraform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikaeelkhalid%2Fgcp-cloudbuild-gitlab-terraform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikaeelkhalid%2Fgcp-cloudbuild-gitlab-terraform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikaeelkhalid","download_url":"https://codeload.github.com/mikaeelkhalid/gcp-cloudbuild-gitlab-terraform/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243945032,"owners_count":20372887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cicd","cloudbuild","gcp","gitlab","terraform"],"created_at":"2024-11-22T23:15:31.276Z","updated_at":"2026-05-20T02:44:49.519Z","avatar_url":"https://github.com/mikaeelkhalid.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GCP Cloud Build with GitLab Integration using Terraform\n\n[![Mikaeel Khalid](https://badgen.now.sh/badge/by/mikaeelkhalid/purple)](https://github.com/mikaeelkhalid)\n\nThis Terraform configuration sets up Google Cloud Build to trigger builds from a GitLab repository and store built Docker images to the Google Artifact Registry.\n\n## Resources\n\n1. **Google Artifact Registry Repository**: A repository in Google Artifact Registry where Docker images are stored.\n2. **Google Cloud Build IAM roles**: Grants the necessary permissions to the Cloud Build service account for pushing images to Artifact Registry and accessing secrets.\n\n3. **Google Cloud Build Connection**: Establishes a connection to the GitLab repository, allowing Cloud Build to listen for events like push or merge requests.\n\n4. **Google Cloud Build Trigger**: This defines the conditions under which Cloud Build should trigger a build. Currently, it triggers on a push event to a specific branch of the GitLab repository.\n\n## File Structure\n\n```\n.\n├── artifact-registry.tf          # Google Artifact Registry configuration\n├── cloud-build.tf                # Google Cloud Build and GitLab integration\n├── provider.tf                   # Provider and Terraform settings\n├── variables.tf                  # Variable declarations\n└── README.md                     # Documentation\n```\n\n## Prerequisites\n\n- **Google Cloud SDK**: Ensure you have the [Google Cloud SDK](https://cloud.google.com/sdk/docs/install) installed and initialized.\n- **Terraform**: You should have [Terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli) (version ~\u003e 1.0.0) installed.\n- **GitLab Repository**: You need a GitLab repository that you want to integrate with Google Cloud Build.\n- **GitLab API Tokens**: Make sure to generate API tokens from GitLab for authentication.\n\n- **Google Cloud Project**: A Google Cloud Project set up with billing enabled is required.\n\n- **Enabled APIs**: The Artifact Registry, Cloud Build, and Secret Manager APIs should be enabled on your Google Cloud Project.\n\n## Get Started\n\n1. **Clone the Repository**:\n\n   ```bash\n   git clone https://github.com/mikaeelkhalid/gcp-cloudbuild-gitlab-terraform.git\n   cd gcp-cloudbuild-gitlab-terraform\n   ```\n\n2. **Update Variables**: Modify the `variables.tf` file with your specific values. You can also set them using environment variables or via the command line.\n\n3. **Initialize Terraform**:\n\n   ```bash\n   terraform init\n   ```\n\n4. **Plan \u0026 Apply**:\n\n   ```bash\n   terraform plan\n   terraform apply\n   ```\n\n5. **Clean Up**: To destroy the resources when you're done:\n\n   ```bash\n   terraform destroy\n   ```\n\nRemember to validate your configuration and take necessary precautions, especially when working in production environments.\n\n## Contributing\n\nFeel free to raise issues or pull requests if you'd like to improve the configurations or add more features.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikaeelkhalid%2Fgcp-cloudbuild-gitlab-terraform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikaeelkhalid%2Fgcp-cloudbuild-gitlab-terraform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikaeelkhalid%2Fgcp-cloudbuild-gitlab-terraform/lists"}