hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.35k stars 1.75k forks source link

Provide external repository mirroring in google_sourcerepo_repository #9155

Open codecycletechnologies opened 3 years ago

codecycletechnologies commented 3 years ago

Community Note

Description

Hello,

Please provide support of adding external repository mirroring through google_sourcerepo_repository resource. https://cloud.google.com/source-repositories/docs/mirroring-a-github-repository

New or Affected Resource(s)

b/359684554

rileykarson commented 3 years ago

Is there a GCP rest API available that exposes this flow?

codecycletechnologies commented 3 years ago

@rileykarson, Please refer to below API detail

https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos/create https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos#Repo

Check mirrorConfig in request object.

rileykarson commented 3 years ago

That field is not actually available in the request object, unfortunately!

How this repository mirrors a repository managed by another service. Read-only field.

codecycletechnologies commented 3 years ago

@rileykarson , Can you please verify the same in https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos/create?apix=true. In this, request body contains selection of mirrorConfig.

rileykarson commented 3 years ago

The "Request Body" section of the page links to the Repo type, which declares the field read-only. The API Explorer allows unspecifiable fields to be specified, unfortunately. If you're able to provision the resource (and the documentation is wrong) please let me know!

On Tue, May 18, 2021 at 9:22 PM Codecycle @.***> wrote:

@rileykarson https://github.com/rileykarson , Can you please verify the same in https://cloud.google.com/source-repositories/docs/reference/rest/v1/projects.repos/create?apix=true. In this, request body contains selection of mirrorConfig.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/hashicorp/terraform-provider-google/issues/9155#issuecomment-843734421, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP36CBTEJH55SAKEZAMFMTTOM4ITANCNFSM445SEVDQ .

codecycletechnologies commented 3 years ago

@rileykarson Hey, we tried but not able to figure out how to solve this. Basically we want to link Github repository to Google cloud repository through terraform. And we think this feature should be there.

ermik commented 3 years ago

Just checked:

{
  "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"
          }
        ]
      },
      {
        "@type": "type.googleapis.com/google.rpc.RequestInfo",
        "requestId": "<PRIVATE>"
      }
    ]
  }
}

There's a feature request tracking allowing this functionality: https://issuetracker.google.com/issues/73122477

If you're interested in this use-case, please vote for it by clicking ⭐ button on the linked page.

ggtisc commented 3 months ago

It looks like until now there isn't any argument to manage external repositories on google_sourcerepo_repository.

roaks3 commented 1 month ago

Note: This was marked as Won't Fix by the service team, likely because Cloud Source Repositories itself is end-of-sale at the moment. We can leave it open to track interest, and the TF provider still supports the resource, but it seems unlikely to be resolved.