I am trying to automate the project & resources creation, along with automating the triggers for cloud build using terraform. To use cloud build triggers I will have to mirror the bit-bucket repo into source repo of GCP.
I am using the below to create a source project https://www.terraform.io/docs/providers/google/r/cloudbuild_trigger.html, but there is no option to set mirror.
Upon digging the APIs of GCP (https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos/create), I can see a mirrorConfig option but the docs says it is in read-only mode. When I set the mirrorConfig for the API I get the below error.
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "repo.mirror_config",
"description": "mirror_config is a read-only field and must not be set"
}
]
}
Is there a way to automate repo mirroring from bit-bucket to source repository in GCP using terraform? If not is there any alternate way/tool for achieving this?