Skip to content

googleSourcerepoRepository

A repository (or repo) is a Git repository storing versioned source content.

To get more information about Repository, see:

Example Usage - Sourcerepo Repository Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.sourcerepoRepository.SourcerepoRepository(this, "my-repo", {
  name: "my/repository",
});

Example Usage - Sourcerepo Repository Full

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googlePubsubTopicTopic = new google.pubsubTopic.PubsubTopic(
  this,
  "topic",
  {
    name: "my-topic",
  }
);
const googleServiceAccountTestAccount =
  new google.serviceAccount.ServiceAccount(this, "test_account", {
    account_id: "my-account",
    display_name: "Test Service Account",
  });
new google.sourcerepoRepository.SourcerepoRepository(this, "my-repo", {
  name: "my-repository",
  pubsub_configs: [
    {
      message_format: "JSON",
      service_account_email: googleServiceAccountTestAccount.email,
      topic: googlePubsubTopicTopic.id,
    },
  ],
});

Argument Reference

The following arguments are supported:

  • name - (Required) Resource name of the repository, of the form {{repo}}. The repo name may contain slashes. eg, name/with/slash

  • pubsubConfigs - (Optional) How this repository publishes a change in the repository through Cloud Pub/Sub. Keyed by the topic names. Structure is documented below.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The pubsubConfigs block supports:

  • topic - (Required) The identifier for this object. Format specified above.

  • messageFormat - (Required) The format of the Cloud Pub/Sub messages.

    • PROTOBUF: The message payload is a serialized protocol buffer of SourceRepoEvent.
    • JSON: The message payload is a JSON string of SourceRepoEvent. Possible values are protobuf and json.
  • serviceAccountEmail - (Optional) Email address of the service account used for publishing Cloud Pub/Sub messages. This service account needs to be in the same project as the PubsubConfig. When added, the caller needs to have iam.serviceAccounts.actAs permission on this service account. If unspecified, it defaults to the compute engine default service account.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/repos/{{name}}

  • url - URL to clone the repository from Google Cloud Source Repositories.

  • size - The disk usage of the repo, in bytes.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Repository can be imported using any of these accepted formats:

$ terraform import google_sourcerepo_repository.default projects/{{project}}/repos/{{name}}
$ terraform import google_sourcerepo_repository.default {{name}}

User Project Overrides

This resource supports User Project Overrides.