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.36k stars 1.75k forks source link

It's not possible to configure or import cloudbuuild pubsub based trigger if it connected to bitbucket CLOUD resource. #19054

Open constin opened 3 months ago

constin commented 3 months ago

Community Note

Description

bitbucket_cloud_config are now available for google_cloudbuild_trigger resource in version 5.34.0

For normal trigger you can configure google_cloudbuildv2_connection with bitbucket_cloud_config, then google_cloudbuildv2_repository with parent_connection to google_cloudbuildv2_connection , and then

google_cloudbuild_trigger with repository_event_config connected to google_cloudbuildv2_repository. all works perfect.

But if you want to configure google_cloudbuild_trigger scheduled by pubsub. you need to configure source_to_build block in google_cloudbuild_trigger.

source_to_build accept only ["UNKNOWN" "CLOUD_SOURCE_REPOSITORIES" "GITHUB" "BITBUCKET_SERVER"] values , nothing about bitbucket CLOUD.

I created pubsub cloud built trigger connected to bitbucket cloud repo in GUI. And then I tried to import it to terraform and got this error:

Planning failed. Terraform encountered an error while generating this plan.

â•·
│ Error: expected source_to_build.0.repo_type to be one of ["UNKNOWN" "CLOUD_SOURCE_REPOSITORIES" "GITHUB" "BITBUCKET_SERVER"], got 
│ 
│   with google_cloudbuild_trigger.default,
│   on generated.tf line 48:
│   (source code not available)

New or Affected Resource(s)

Potential Terraform Configuration

References

No response

b/359238028

constin commented 3 months ago

update: it works with repo_type = "UNKNOWN"