2020-05-14 11:48:29 -07:00
# Google Cloud Source Repository Module
2022-06-08 02:34:08 -07:00
This module allows managing a single Cloud Source Repository, including IAM bindings and basic Cloud Build triggers.
2020-05-14 11:48:29 -07:00
## Examples
2022-06-08 02:34:08 -07:00
### Repository with IAM
2020-05-14 11:48:29 -07:00
```hcl
module "repo" {
2022-09-06 08:46:09 -07:00
source = "./fabric/modules/source-repository"
2020-05-14 11:48:29 -07:00
project_id = "my-project"
name = "my-repo"
2020-11-04 23:58:05 -08:00
iam = {
2020-05-14 11:48:29 -07:00
"roles/source.reader" = ["user:foo@example.com"]
}
}
2022-01-28 11:15:35 -08:00
# tftest modules=1 resources=2
2020-05-14 11:48:29 -07:00
```
2022-06-08 02:34:08 -07:00
### Repository with Cloud Build trigger
```hcl
module "repo" {
2022-09-06 08:46:09 -07:00
source = "./fabric/modules/source-repository"
2022-06-08 02:34:08 -07:00
project_id = "my-project"
name = "my-repo"
triggers = {
foo = {
2022-12-16 03:53:56 -08:00
filename = "ci/workflow-foo.yaml"
included_files = ["**/*tf"]
2022-06-08 02:34:08 -07:00
service_account = null
substitutions = {
BAR = 1
}
template = {
branch_name = "main"
2022-12-16 03:53:56 -08:00
project_id = null
tag_name = null
2022-06-08 02:34:08 -07:00
}
}
}
}
# tftest modules=1 resources=2
```
<!-- TFDOC OPTS files:1 -->
2020-05-14 11:48:29 -07:00
<!-- BEGIN TFDOC -->
2021-12-20 23:51:51 -08:00
2022-06-08 02:34:08 -07:00
## Files
| name | description | resources |
|---|---|---|
| [iam.tf ](./iam.tf ) | IAM resources. | < code > google_sourcerepo_repository_iam_binding</ code > · < code > google_sourcerepo_repository_iam_member</ code > |
| [main.tf ](./main.tf ) | Module-level locals and resources. | < code > google_cloudbuild_trigger</ code > · < code > google_sourcerepo_repository</ code > |
| [outputs.tf ](./outputs.tf ) | Module outputs. | |
| [variables.tf ](./variables.tf ) | Module variables. | |
| [versions.tf ](./versions.tf ) | Version pins. | |
2020-05-14 11:48:29 -07:00
## Variables
| name | description | type | required | default |
2021-12-20 23:51:51 -08:00
|---|---|:---:|:---:|:---:|
2022-06-08 02:34:08 -07:00
| [name ](variables.tf#L44 ) | Repository name. | < code > string</ code > | ✓ | |
| [project_id ](variables.tf#L49 ) | Project used for resources. | < code > string</ code > | ✓ | |
| [group_iam ](variables.tf#L17 ) | Authoritative IAM binding for organization groups, in {GROUP_EMAIL => [ROLES]} format. Group emails need to be static. Can be used in combination with the `iam` variable. | < code > map( list( string)) </ code > | | < code > {} </ code > |
| [iam ](variables.tf#L24 ) | IAM bindings in {ROLE => [MEMBERS]} format. | < code > map( list( string)) </ code > | | < code > {} </ code > |
| [iam_additive ](variables.tf#L31 ) | IAM additive bindings in {ROLE => [MEMBERS]} format. | < code > map( list( string)) </ code > | | < code > {} </ code > |
| [iam_additive_members ](variables.tf#L38 ) | IAM additive bindings in {MEMBERS => [ROLE]} format. This might break if members are dynamic values. | < code > map( list( string)) </ code > | | < code > {} </ code > |
| [triggers ](variables.tf#L54 ) | Cloud Build triggers. | < code title = "map(object({ filename = string included_files = list(string) service_account = string substitutions = map(string) template = object({ branch_name = string project_id = string tag_name = string }) }))" > map( object({…})) </ code > | | < code > {} </ code > |
2020-05-14 11:48:29 -07:00
## Outputs
| name | description | sensitive |
|---|---|:---:|
2022-01-22 04:34:35 -08:00
| [id ](outputs.tf#L17 ) | Repository id. | |
2022-06-08 02:34:08 -07:00
| [name ](outputs.tf#L22 ) | Repository name. | |
| [url ](outputs.tf#L27 ) | Repository URL. | |
2021-12-20 23:51:51 -08:00
2020-05-14 11:48:29 -07:00
<!-- END TFDOC -->