Skip to content

Commit 8b1cb1d

Browse files
drselump14cloudpossebotnitrocode
authored
Remove hardcoded github provider (#40)
* Remove detailed github provider * Allow github provider to be injected * Auto Format * Add versions to examples/complete * Update versions.tf * Fix versions * Fix examples/complete for terratest * Add provider injection on example * Remove explicit github provider injection * Fix webhook 404 * Remove providers --------- Co-authored-by: cloudpossebot <[email protected]> Co-authored-by: nitrocode <[email protected]>
1 parent 7ea18d3 commit 8b1cb1d

File tree

12 files changed

+37
-47
lines changed

12 files changed

+37
-47
lines changed

.github/auto-release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ version-resolver:
1717
- 'bugfix'
1818
- 'bug'
1919
- 'hotfix'
20-
- 'no-release'
2120
default: 'minor'
2221

2322
categories:

.github/renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
":preserveSemverRanges"
55
],
66
"labels": ["auto-update"],
7+
"dependencyDashboardAutoclose": true,
78
"enabledManagers": ["terraform"],
89
"terraform": {
910
"ignorePaths": ["**/context.tf", "examples/**"]
1011
}
1112
}
12-

.github/workflows/validate-codeowners.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
steps:
1111
- name: "Checkout source code at current commit"
1212
uses: actions/checkout@v2
13+
# Leave pinned at 0.7.1 until https://github.com/mszostok/codeowners-validator/issues/173 is resolved
1314
- uses: mszostok/[email protected]
1415
if: github.event.pull_request.head.repo.full_name == github.repository
1516
name: "Full check of CODEOWNERS"

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ Available targets:
137137
| Name | Version |
138138
|------|---------|
139139
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
140-
| <a name="requirement_github"></a> [github](#requirement\_github) | 3.0.0 |
140+
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 4.2.0 |
141141
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.2 |
142142

143143
## Providers
144144

145145
| Name | Version |
146146
|------|---------|
147-
| <a name="provider_github"></a> [github](#provider\_github) | 3.0.0 |
147+
| <a name="provider_github"></a> [github](#provider\_github) | >= 4.2.0 |
148148

149149
## Modules
150150

@@ -156,7 +156,7 @@ Available targets:
156156

157157
| Name | Type |
158158
|------|------|
159-
| [github_repository_webhook.default](https://registry.terraform.io/providers/hashicorp/github/3.0.0/docs/resources/repository_webhook) | resource |
159+
| [github_repository_webhook.default](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_webhook) | resource |
160160

161161
## Inputs
162162

@@ -171,10 +171,7 @@ Available targets:
171171
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
172172
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
173173
| <a name="input_events"></a> [events](#input\_events) | A list of events which should trigger the webhook. | `list(string)` | <pre>[<br> "issue_comment",<br> "pull_request",<br> "pull_request_review",<br> "pull_request_review_comment"<br>]</pre> | no |
174-
| <a name="input_github_base_url"></a> [github\_base\_url](#input\_github\_base\_url) | GitHub target API endpoint | `string` | `"https://api.github.com/"` | no |
175-
| <a name="input_github_organization"></a> [github\_organization](#input\_github\_organization) | GitHub organization to use when creating webhooks | `string` | n/a | yes |
176174
| <a name="input_github_repositories"></a> [github\_repositories](#input\_github\_repositories) | List of repository names which should be associated with the webhook | `list(string)` | `[]` | no |
177-
| <a name="input_github_token"></a> [github\_token](#input\_github\_token) | GitHub token used for API access. If not provided, can be sourced from the `GITHUB_TOKEN` environment variable | `string` | `""` | no |
178175
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
179176
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
180177
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
@@ -366,7 +363,7 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
366363

367364
[![README Footer][readme_footer_img]][readme_footer_link]
368365
[![Beacon][beacon]][website]
369-
366+
<!-- markdownlint-disable -->
370367
[logo]: https://cloudposse.com/logo-300x69.svg
371368
[docs]: https://cpco.io/docs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-github-repository-webhooks&utm_content=docs
372369
[website]: https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-github-repository-webhooks&utm_content=website
@@ -397,3 +394,4 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
397394
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/terraform-github-repository-webhooks
398395
[share_email]: mailto:?subject=terraform-github-repository-webhooks&body=https://github.com/cloudposse/terraform-github-repository-webhooks
399396
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/terraform-github-repository-webhooks?pixel&cs=github&cm=readme&an=terraform-github-repository-webhooks
397+
<!-- markdownlint-restore -->

docs/terraform.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
| Name | Version |
55
|------|---------|
66
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
7-
| <a name="requirement_github"></a> [github](#requirement\_github) | 3.0.0 |
7+
| <a name="requirement_github"></a> [github](#requirement\_github) | >= 4.2.0 |
88
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.2 |
99

1010
## Providers
1111

1212
| Name | Version |
1313
|------|---------|
14-
| <a name="provider_github"></a> [github](#provider\_github) | 3.0.0 |
14+
| <a name="provider_github"></a> [github](#provider\_github) | >= 4.2.0 |
1515

1616
## Modules
1717

@@ -23,7 +23,7 @@
2323

2424
| Name | Type |
2525
|------|------|
26-
| [github_repository_webhook.default](https://registry.terraform.io/providers/hashicorp/github/3.0.0/docs/resources/repository_webhook) | resource |
26+
| [github_repository_webhook.default](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_webhook) | resource |
2727

2828
## Inputs
2929

@@ -38,10 +38,7 @@
3838
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
3939
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
4040
| <a name="input_events"></a> [events](#input\_events) | A list of events which should trigger the webhook. | `list(string)` | <pre>[<br> "issue_comment",<br> "pull_request",<br> "pull_request_review",<br> "pull_request_review_comment"<br>]</pre> | no |
41-
| <a name="input_github_base_url"></a> [github\_base\_url](#input\_github\_base\_url) | GitHub target API endpoint | `string` | `"https://api.github.com/"` | no |
42-
| <a name="input_github_organization"></a> [github\_organization](#input\_github\_organization) | GitHub organization to use when creating webhooks | `string` | n/a | yes |
4341
| <a name="input_github_repositories"></a> [github\_repositories](#input\_github\_repositories) | List of repository names which should be associated with the webhook | `list(string)` | `[]` | no |
44-
| <a name="input_github_token"></a> [github\_token](#input\_github\_token) | GitHub token used for API access. If not provided, can be sourced from the `GITHUB_TOKEN` environment variable | `string` | `""` | no |
4542
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
4643
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
4744
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |

examples/complete/fixtures.us-east-2.tfvars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
region = "us-west-1"
22

3-
github_organization = "cloudposse"
3+
owner = "cloudposse"
44

55
github_repositories = ["terraform-github-repository-webhooks"]
66

examples/complete/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ provider "aws" {
22
region = var.region
33
}
44

5+
provider "github" {
6+
owner = var.owner
7+
}
8+
59
module "webhooks" {
610
source = "../../"
711
active = false
8-
github_token = var.github_token
9-
github_organization = var.github_organization
1012
github_repositories = var.github_repositories
1113
webhook_url = var.webhook_url
1214
events = var.events

examples/complete/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ variable "github_token" {
99
description = "GitHub token used for API access. If not provided, can be sourced from the `GITHUB_TOKEN` environment variable"
1010
}
1111

12-
variable "github_organization" {
12+
variable "owner" {
1313
type = string
14-
description = "GitHub organization to use when creating webhooks"
14+
description = "Repo owner"
1515
}
1616

1717
variable "github_repositories" {

examples/complete/versions.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
terraform {
2+
required_version = ">= 0.13.0"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = ">= 2.0"
8+
}
9+
github = {
10+
source = "integrations/github"
11+
version = ">= 4.2.0"
12+
}
13+
local = {
14+
source = "hashicorp/local"
15+
version = ">= 1.2"
16+
}
17+
}
18+
}

main.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
provider "github" {
2-
token = var.github_token != "" ? var.github_token : null
3-
organization = var.github_organization
4-
base_url = var.github_base_url
5-
}
6-
71
resource "github_repository_webhook" "default" {
82
count = module.this.enabled && length(var.github_repositories) > 0 ? length(var.github_repositories) : 0
93

0 commit comments

Comments
 (0)