Skip to content

Commit

Permalink
Update terraform GitHub repository webhooks (#23)
Browse files Browse the repository at this point in the history
* Bump `terraform-github-repository-webhooks` version. Remove unsupported `name` variable

* Rebuild README
  • Loading branch information
aknysh authored May 14, 2019
1 parent 3900b4c commit 38c1896
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ We literally have [*hundreds of terraform modules*][terraform_modules] that are
## Usage


**IMPORTANT:** The `master` branch is used in `source` just as an example. In your code, do not pin to `master` because there may be breaking changes between releases.
Instead pin to the release tag (e.g. `?ref=tags/x.y.z`) of one of our [latest releases](https://github.com/cloudposse/terraform-aws-ecs-codepipeline/releases).



### Trigger on GitHub Push

In this example, we'll trigger the pipeline anytime the `master` branch is updated.
```hcl
module "ecs_push_pipeline" {
source = "git::https://github.com/cloudposse/terraform-aws-ecs-codepipeline.git?ref=tags/0.1.2"
source = "git::https://github.com/cloudposse/terraform-aws-ecs-codepipeline.git?ref=master"
name = "app"
namespace = "eg"
stage = "staging"
Expand All @@ -68,7 +73,7 @@ In this example, we'll trigger anytime a new GitHub release is cut by setting th

```hcl
module "ecs_release_pipeline" {
source = "git::https://github.com/cloudposse/terraform-aws-ecs-codepipeline.git?ref=tags/0.1.2"
source = "git::https://github.com/cloudposse/terraform-aws-ecs-codepipeline.git?ref=master"
name = "app"
namespace = "eg"
stage = "staging"
Expand Down Expand Up @@ -180,7 +185,7 @@ Available targets:
|------|-------------|
| badge_url | The URL of the build badge when badge_enabled is enabled |
| webhook_id | The CodePipeline webhook's ARN. |
| webhook_url | The CodePipeline webhook's URL. POST events to this endpoint to trigger the target. |
| webhook_url | The CodePipeline webhook's URL. POST events to this endpoint to trigger the target |



Expand Down
6 changes: 3 additions & 3 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ usage: |-
In this example, we'll trigger the pipeline anytime the `master` branch is updated.
```hcl
module "ecs_push_pipeline" {
source = "git::https://github.com/cloudposse/terraform-aws-ecs-codepipeline.git?ref=tags/0.1.2"
source = "git::https://github.com/cloudposse/terraform-aws-ecs-codepipeline.git?ref=master"
name = "app"
namespace = "eg"
stage = "staging"
Expand All @@ -83,7 +83,7 @@ usage: |-
```hcl
module "ecs_release_pipeline" {
source = "git::https://github.com/cloudposse/terraform-aws-ecs-codepipeline.git?ref=tags/0.1.2"
source = "git::https://github.com/cloudposse/terraform-aws-ecs-codepipeline.git?ref=master"
name = "app"
namespace = "eg"
stage = "staging"
Expand All @@ -106,7 +106,7 @@ usage: |-
# Example usage
examples: |-
Complete usage can be seen in the [terraform-aws-ecs-web-app](https://github.com/cloudposse/terraform-aws-ecs-web-app/blob/master/main.tf) module.
## Example Buildspec
Here's an example `buildspec.yaml`. Stick this in the root of your project repository.
Expand Down
2 changes: 1 addition & 1 deletion docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
|------|-------------|
| badge_url | The URL of the build badge when badge_enabled is enabled |
| webhook_id | The CodePipeline webhook's ARN. |
| webhook_url | The CodePipeline webhook's URL. POST events to this endpoint to trigger the target. |
| webhook_url | The CodePipeline webhook's URL. POST events to this endpoint to trigger the target |

3 changes: 1 addition & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,13 @@ resource "aws_codepipeline_webhook" "webhook" {
}

module "github_webhooks" {
source = "git::https://github.com/cloudposse/terraform-github-repository-webhooks.git?ref=tags/0.1.1"
source = "git::https://github.com/cloudposse/terraform-github-repository-webhooks.git?ref=tags/0.3.0"
enabled = "${local.enabled && var.webhook_enabled == "true" ? "true" : "false"}"
github_organization = "${var.repo_owner}"
github_repositories = ["${var.repo_name}"]
github_token = "${var.github_oauth_token}"
webhook_url = "${local.webhook_url}"
webhook_secret = "${local.webhook_secret}"
webhook_content_type = "json"
name = "web"
events = ["${var.github_webhook_events}"]
}
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ output "webhook_id" {
}

output "webhook_url" {
description = "The CodePipeline webhook's URL. POST events to this endpoint to trigger the target."
description = "The CodePipeline webhook's URL. POST events to this endpoint to trigger the target"
value = "${local.webhook_url}"
sensitive = true
}

0 comments on commit 38c1896

Please sign in to comment.