Skip to content

Commit 5bb738c

Browse files
authored
fix(examples): Standalone example works now
1 parent 6244e9b commit 5bb738c

File tree

3 files changed

+108
-30
lines changed

3 files changed

+108
-30
lines changed

.github/workflows/pr-title.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ jobs:
2929
# Configure that a scope must always be provided.
3030
requireScope: false
3131
# Configure additional validation for the subject based on a regex.
32-
# This example ensures the subject starts with an uppercase character.
33-
subjectPattern: ^[A-Z].+$
32+
# This example ensures the subject starts with a character.
33+
subjectPattern: ^[A-Za-z].+$
3434
# If `subjectPattern` is configured, you can use this property to override
3535
# the default error message that is shown when the pattern doesn't match.
3636
# The variables `subject` and `title` can be used within the message.
3737
subjectPatternError: |
3838
The subject "{subject}" found in the pull request title "{title}"
3939
didn't match the configured pattern. Please ensure that the subject
40-
starts with an uppercase character.
40+
starts with a character.
4141
# For work-in-progress PRs you can typically use draft pull requests
4242
# from Github. However, private repositories on the free plan don't have
4343
# this option and therefore this action allows you to opt-in to using the

examples/standalone/README.md

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,60 @@ resource "random_pet" "run_id" {
3838
}
3939
}
4040
41-
resource "aws_cloudwatch_log_group" "this" {
42-
name = local.naming_prefix
43-
retention_in_days = 1
41+
#---------------------------------------
42+
# Cloudtrail infrastructure - standalone
43+
#---------------------------------------
44+
# S3 bucket
45+
module "logs_bucket" {
46+
source = "trussworks/logs/aws"
47+
version = "~> 14"
48+
49+
s3_bucket_name = local.naming_prefix
50+
51+
allow_cloudtrail = true
52+
force_destroy = true
4453
}
4554
55+
# Cloudtrail
56+
locals {
57+
naming_prefix_cloudtrail = "${local.naming_prefix}-cloudtrail"
58+
}
59+
module "aws_cloudtrail" {
60+
source = "trussworks/cloudtrail/aws"
61+
version = "~> 4"
62+
63+
s3_bucket_name = module.logs_bucket.aws_logs_bucket
64+
65+
trail_name = local.naming_prefix_cloudtrail
66+
iam_policy_name = local.naming_prefix_cloudtrail
67+
iam_role_name = local.naming_prefix_cloudtrail
68+
69+
cloudwatch_log_group_name = local.naming_prefix_cloudtrail
70+
log_retention_days = 30
71+
}
72+
73+
#---------------------------------------
74+
# ClickOps module
75+
#---------------------------------------
4676
module "clickops_notifications" {
47-
source = "../../"
48-
49-
standalone = true
50-
naming_prefix = local.naming_prefix
51-
cloudtrail_log_group = aws_cloudwatch_log_group.this.name
52-
webhook = "https://fake.com"
53-
message_format = "slack"
54-
tags = local.tags
55-
lambda_runtime = "python3.8"
77+
source = "../.."
78+
79+
standalone = true
80+
81+
naming_prefix = local.naming_prefix
82+
83+
webhook = "https://fake.com"
84+
message_format = "slack"
85+
86+
tags = local.tags
87+
88+
# cloudtrail_bucket_name = aws_s3_bucket.clickops_cloudtrail.id
89+
cloudtrail_log_group = local.naming_prefix_cloudtrail
90+
91+
depends_on = [
92+
module.aws_cloudtrail
93+
]
94+
5695
}
5796
```
5897
----
@@ -71,7 +110,9 @@ module "clickops_notifications" {
71110

72111
| Name | Source | Version |
73112
|------|--------|---------|
74-
| <a name="module_clickops_notifications"></a> [clickops\_notifications](#module\_clickops\_notifications) | ../../ | n/a |
113+
| <a name="module_aws_cloudtrail"></a> [aws\_cloudtrail](#module\_aws\_cloudtrail) | trussworks/cloudtrail/aws | ~> 4 |
114+
| <a name="module_clickops_notifications"></a> [clickops\_notifications](#module\_clickops\_notifications) | ../.. | n/a |
115+
| <a name="module_logs_bucket"></a> [logs\_bucket](#module\_logs\_bucket) | trussworks/logs/aws | ~> 14 |
75116

76117
----
77118
### Outputs
@@ -83,7 +124,6 @@ No outputs.
83124

84125
| Name | Version |
85126
|------|---------|
86-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.9.0 |
87127
| <a name="provider_random"></a> [random](#provider\_random) | 3.4.3 |
88128

89129
----
@@ -100,7 +140,6 @@ No outputs.
100140

101141
| Name | Type |
102142
|------|------|
103-
| [aws_cloudwatch_log_group.this](https://registry.terraform.io/providers/hashicorp/aws/4.9.0/docs/resources/cloudwatch_log_group) | resource |
104143
| [random_pet.run_id](https://registry.terraform.io/providers/hashicorp/random/3.4.3/docs/resources/pet) | resource |
105144

106145
----

examples/standalone/main.tf

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,58 @@ resource "random_pet" "run_id" {
3434
}
3535
}
3636

37-
resource "aws_cloudwatch_log_group" "this" {
38-
name = local.naming_prefix
39-
retention_in_days = 1
37+
#---------------------------------------
38+
# Cloudtrail infrastructure - standalone
39+
#---------------------------------------
40+
# S3 bucket
41+
module "logs_bucket" {
42+
source = "trussworks/logs/aws"
43+
version = "~> 14"
44+
45+
s3_bucket_name = local.naming_prefix
46+
47+
allow_cloudtrail = true
48+
force_destroy = true
49+
}
50+
51+
# Cloudtrail
52+
locals {
53+
naming_prefix_cloudtrail = "${local.naming_prefix}-cloudtrail"
54+
}
55+
module "aws_cloudtrail" {
56+
source = "trussworks/cloudtrail/aws"
57+
version = "~> 4"
58+
59+
s3_bucket_name = module.logs_bucket.aws_logs_bucket
60+
61+
trail_name = local.naming_prefix_cloudtrail
62+
iam_policy_name = local.naming_prefix_cloudtrail
63+
iam_role_name = local.naming_prefix_cloudtrail
64+
65+
cloudwatch_log_group_name = local.naming_prefix_cloudtrail
66+
log_retention_days = 30
4067
}
4168

69+
#---------------------------------------
70+
# ClickOps module
71+
#---------------------------------------
4272
module "clickops_notifications" {
43-
source = "../../"
44-
45-
standalone = true
46-
naming_prefix = local.naming_prefix
47-
cloudtrail_log_group = aws_cloudwatch_log_group.this.name
48-
webhook = "https://fake.com"
49-
message_format = "slack"
50-
tags = local.tags
51-
lambda_runtime = "python3.8"
73+
source = "../.."
74+
75+
standalone = true
76+
77+
naming_prefix = local.naming_prefix
78+
79+
webhook = "https://fake.com"
80+
message_format = "slack"
81+
82+
tags = local.tags
83+
84+
# cloudtrail_bucket_name = aws_s3_bucket.clickops_cloudtrail.id
85+
cloudtrail_log_group = local.naming_prefix_cloudtrail
86+
87+
depends_on = [
88+
module.aws_cloudtrail
89+
]
90+
5291
}

0 commit comments

Comments
 (0)