Преглед изворни кода

Adds enable_webhook to disable webhook

to be tagged v5.0.12
Brad Poulton пре 3 година
родитељ
комит
dbef54e648
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      base/codebuild_lcp_magic_machine/main.tf

+ 4 - 2
base/codebuild_lcp_magic_machine/main.tf

@@ -81,6 +81,7 @@ resource "aws_codebuild_project" "this" {
 
 resource "aws_codebuild_webhook" "this" {
   # Disable the webhook for now. It is too aggresive when making quick changes.
+  count        = var.enable_webhook == true ? 1 : 0
   project_name = var.name
   filter_group {
     filter {
@@ -97,13 +98,14 @@ resource "aws_codebuild_webhook" "this" {
 }
 
 resource "github_repository_webhook" "this" {
+  count      = var.enable_webhook == true ? 1 : 0
   active     = true
   events     = ["push"]
   repository = data.github_repository.this.name
 
   configuration {
-    url          = aws_codebuild_webhook.this.payload_url
-    secret       = aws_codebuild_webhook.this.secret
+    url          = aws_codebuild_webhook.this[count.index].payload_url
+    secret       = aws_codebuild_webhook.this[count.index].secret
     content_type = "json"
     insecure_ssl = false
   }