File tree Expand file tree Collapse file tree 11 files changed +53
-3
lines changed Expand file tree Collapse file tree 11 files changed +53
-3
lines changed Original file line number Diff line number Diff line change 1+ module "service" {
2+ source = " ../../modules/pagerduty"
3+ service_key = " "
4+ service_name = " testing_disable_tf"
5+ s3_bucket = " wiser-infra-automation"
6+ }
Original file line number Diff line number Diff line change 1+ provider "aws" {
2+ region = " us-west-2"
3+
4+ # Make it faster by skipping something
5+ skip_get_ec2_platforms = true
6+ skip_metadata_api_check = true
7+ skip_region_validation = true
8+ skip_credentials_validation = true
9+ skip_requesting_account_id = true
10+ }
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ module "service" {
22 source = " ../../modules/pagerduty"
33 service_key = " 123456789012"
44 service_name = " test-srv-2"
5- s3_bucket = " wiser-one-ci "
5+ s3_bucket = " wiser-infra-automation "
66}
Original file line number Diff line number Diff line change 11module "channel" {
22 source = " ../../modules/slack"
33 channel_name = " test-srv-1a"
4- s3_bucket = " wiser-one-ci "
4+ s3_bucket = " wiser-infra-automation "
55}
Original file line number Diff line number Diff line change 11module "channel" {
22 source = " ../../modules/slack"
33 channel_name = " test-srv-2"
4- s3_bucket = " wiser-one-ci "
4+ s3_bucket = " wiser-infra-automation "
55}
Original file line number Diff line number Diff line change 1+ module "channel" {
2+ source = " ../../modules/slack"
3+ channel_name = " "
4+ s3_bucket = " wiser-infra-automation"
5+ }
Original file line number Diff line number Diff line change 1+ provider "aws" {
2+ region = " us-west-2"
3+
4+ # Make it faster by skipping something
5+ skip_get_ec2_platforms = true
6+ skip_metadata_api_check = true
7+ skip_region_validation = true
8+ skip_credentials_validation = true
9+ skip_requesting_account_id = true
10+ }
Original file line number Diff line number Diff line change 1+ locals {
2+ enabled = " ${ length (var. service_key ) > 0 ? 1 : 0 } "
3+ }
4+
15data "template_file" "pagerduty_service" {
6+ count = " ${ local . enabled } "
27 template = " ${ file (" ${ path . module } /templates/pagerduty.json" )} "
38
49 vars {
@@ -9,6 +14,7 @@ data "template_file" "pagerduty_service" {
914}
1015
1116resource "aws_s3_bucket_object" "object" {
17+ count = " ${ local . enabled } "
1218 bucket = " ${ var . s3_bucket } "
1319 acl = " bucket-owner-full-control"
1420
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ variable "datadog_default" {
55
66variable "service_key" {
77 description = " PagerDuty service integration key"
8+ default = " "
89}
910
1011variable "service_name" {
Original file line number Diff line number Diff line change 1+ # Expect Slack channel name to be of format: mon-<env>-<service short name>
2+ # Auto disable if:
3+ # Channel name is empty
4+ # Channel name has format mon-<env>-<service short name> but nothing after second -
5+
6+ locals {
7+ enabled = " ${ length (replace (var. channel_name , " /(mon-\\ w+-)(.*)$/" , " $2" )) > 0 ? 1 : 0 } "
8+ }
9+
110data "template_file" "slack_channel" {
11+ count = " ${ local . enabled } "
212 template = " ${ file (" ${ path . module } /templates/slack.json" )} "
313
414 vars {
@@ -7,6 +17,7 @@ data "template_file" "slack_channel" {
717}
818
919resource "aws_s3_bucket_object" "object" {
20+ count = " ${ local . enabled } "
1021 bucket = " ${ var . s3_bucket } "
1122 acl = " bucket-owner-full-control"
1223
You can’t perform that action at this time.
0 commit comments