|
@@ -46,22 +46,31 @@ resource "aws_codebuild_project" "this" {
|
|
|
tags = merge(var.standard_tags, var.tags)
|
|
|
}
|
|
|
|
|
|
-#resource "aws_codebuild_webhook" "this" {
|
|
|
-# project_name = var.name
|
|
|
-# branch_filter = var.webhook_branch_filter
|
|
|
-#
|
|
|
-# depends_on = [ aws_codebuild_project.this ]
|
|
|
-#}
|
|
|
+locals {
|
|
|
+ webhooks = var.enable_webhooks ? local.splunk_server_types : []
|
|
|
+}
|
|
|
+
|
|
|
+resource "aws_codebuild_webhook" "this" {
|
|
|
+ #for_each = local.splunk_server_types
|
|
|
+ for_each = local.webhooks
|
|
|
+
|
|
|
+ project_name = aws_codebuild_project.this[each.value].name
|
|
|
+ branch_filter = var.webhook_branch_filter
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
-#resource "github_repository_webhook" "this" {
|
|
|
-# active = true
|
|
|
-# events = ["push"]
|
|
|
-# repository = data.github_repository.this.name
|
|
|
-#
|
|
|
-# configuration {
|
|
|
-# url = aws_codebuild_webhook.this.payload_url
|
|
|
-# secret = aws_codebuild_webhook.this.secret
|
|
|
-# content_type = "json"
|
|
|
-# insecure_ssl = false
|
|
|
-# }
|
|
|
-#}
|
|
|
+resource "github_repository_webhook" "this" {
|
|
|
+ #for_each = local.splunk_server_types
|
|
|
+ for_each = local.webhooks
|
|
|
+
|
|
|
+ active = true
|
|
|
+ events = ["push"]
|
|
|
+ repository = data.github_repository.this.name
|
|
|
+
|
|
|
+ configuration {
|
|
|
+ url = aws_codebuild_webhook.this[each.value].payload_url
|
|
|
+ secret = aws_codebuild_webhook.this[each.value].secret
|
|
|
+ content_type = "json"
|
|
|
+ insecure_ssl = false
|
|
|
+ }
|
|
|
+}
|