Skip to content

Commit 78fa918

Browse files
committed
Sync from management repo
1 parent e87db14 commit 78fa918

File tree

11 files changed

+45
-41
lines changed

11 files changed

+45
-41
lines changed

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Build matrix
2626
id: matrix
2727
run: |
28-
DIRS=$(python -c "import json; import glob; print(json.dumps([x.replace('/versions.tf', '') for x in glob.glob('./**/versions.tf', recursive=True)]))")
28+
DIRS=$(python -c "import json; import glob; print(json.dumps([x.replace('/providers.tf', '') for x in glob.glob('./**/providers.tf', recursive=True)]))")
2929
echo "::set-output name=directories::$DIRS"
3030
outputs:
3131
directories: ${{ steps.matrix.outputs.directories }}

.gitignore

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ override.tf.json
2929
# example: *tfplan*
3030

3131
.idea/
32+
.vscode/
3233
.terraform.lock.hcl
3334

3435
# go
@@ -81,15 +82,10 @@ _testmain.go
8182

8283
# Python
8384
# Editors
84-
.vscode/
85-
.idea/
8685

8786
# Vagrant
8887
.vagrant/
8988

90-
# Mac/OSX
91-
.DS_Store
92-
9389
# Windows
9490
Thumbs.db
9591

@@ -99,9 +95,6 @@ __pycache__/
9995
*.py[cod]
10096
*$py.class
10197

102-
# C extensions
103-
*.so
104-
10598
# Distribution / packaging
10699
.Python
107100
build/
@@ -206,9 +199,14 @@ venv.bak/
206199
.dmypy.json
207200
dmypy.json
208201

209-
# ignore test related file(s)
210-
**/test**
211-
**.
212-
213-
# ignore terraform external modules
202+
# Terraform external modules
214203
**/.external_modules
204+
205+
# Test files and directories
206+
**/[Tt]est/*
207+
**/[Tt]ests/*
208+
**/*[Tt]est*/*
209+
**/*[Tt]ests*/*
210+
211+
# remote_backend.tf file
212+
**/remote_backend.tf

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
repos:
2-
- repo: git://github.com/antonbabenko/pre-commit-terraform
2+
- repo: https://github.com/antonbabenko/pre-commit-terraform
33
rev: v1.60.0
44
hooks:
55
- id: terraform_fmt

README.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@
1313
<img src="https://img.shields.io/twitter/follow/varuntomar2019?style=social&logo=twitter"></a>
1414
</p>
1515

16-
# Terraform module for [AWS CloudWatch Events](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html)
16+
## Terraform module for [AWS CloudWatch Events](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html)
1717

18-
## Versions
18+
### Versions
1919

2020
- Module tested for Terraform 1.0.1.
21-
- AWS provider version [3.63](https://registry.terraform.io/providers/hashicorp/aws/latest)
21+
- AWS provider version [3.74](https://registry.terraform.io/providers/hashicorp/aws/latest)
2222
- `main` branch: Provider versions not pinned to keep up with Terraform releases.
2323
- `tags` releases: Tags are pinned with versions (use <a href="https://github.com/tomarv2/terraform-aws-cloudwatch-events/tags" alt="GitHub tag">
2424
<img src="https://img.shields.io/github/v/tag/tomarv2/terraform-aws-cloudwatch-events" /></a>).
2525

2626

27-
## Usage
27+
### Usage
2828

29-
### Option 1:
29+
#### Option 1:
3030

3131
```
3232
terrafrom init
@@ -36,9 +36,9 @@ terraform destroy -var='teamid=tryme' -var='prjid=project1'
3636
```
3737
**Note:** With this option please take care of remote state storage
3838

39-
### Option 2:
39+
#### Option 2:
4040

41-
#### Recommended method (stores remote state in S3 using `prjid` and `teamid` to create directory structure):
41+
##### Recommended method (stores remote state in S3 using `prjid` and `teamid` to create directory structure):
4242

4343
- Create python 3.8+ virtual environment
4444
```
@@ -84,23 +84,20 @@ tf -c=aws apply -var='teamid=foo' -var='prjid=bar'
8484
tf -c=aws destroy -var='teamid=foo' -var='prjid=bar'
8585
```
8686

87-
**NOTE:**
88-
89-
- Read more on [tfremote](https://github.com/tomarv2/tfremote)
90-
---
87+
**Note:** Read more on [tfremote](https://github.com/tomarv2/tfremote)
9188

9289
## Requirements
9390

9491
| Name | Version |
9592
|------|---------|
9693
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.1 |
97-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.63 |
94+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.74 |
9895

9996
## Providers
10097

10198
| Name | Version |
10299
|------|---------|
103-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.63 |
100+
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 3.74 |
104101

105102
## Modules
106103

@@ -117,26 +114,23 @@ No modules.
117114

118115
| Name | Description | Type | Default | Required |
119116
|------|-------------|------|---------|:--------:|
120-
| <a name="input_aws_region"></a> [aws\_region](#input\_aws\_region) | aws region to deploy resources | `string` | `"us-west-2"` | no |
121117
| <a name="input_branch"></a> [branch](#input\_branch) | branch to use for cicd | `string` | `"main"` | no |
122118
| <a name="input_custom_input"></a> [custom\_input](#input\_custom\_input) | custom input to be included in generated events | `map(any)` | `null` | no |
123119
| <a name="input_deploy_event_rule"></a> [deploy\_event\_rule](#input\_deploy\_event\_rule) | Feature flag, true or false | `bool` | `true` | no |
124120
| <a name="input_deploy_event_target"></a> [deploy\_event\_target](#input\_deploy\_event\_target) | Feature flag, true or false | `bool` | `true` | no |
125121
| <a name="input_description"></a> [description](#input\_description) | description for the cloudwatch event | `string` | `null` | no |
126122
| <a name="input_name"></a> [name](#input\_name) | Cloudwatch event rule name | `string` | `null` | no |
127123
| <a name="input_prjid"></a> [prjid](#input\_prjid) | Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply' | `string` | n/a | yes |
128-
| <a name="input_profile"></a> [profile\_to\_use](#input\_profile\_to\_use) | Getting values from ~/.aws/credentials | `string` | `"default"` | no |
129124
| <a name="input_schedule"></a> [schedule](#input\_schedule) | schedule for the cloudwatch event | `string` | `"rate(1 day)"` | no |
130125
| <a name="input_service_role"></a> [service\_role](#input\_service\_role) | service role to be used by cicd | `string` | `null` | no |
131126
| <a name="input_suffix"></a> [suffix](#input\_suffix) | suffix to be added to cloudwatch rule name | `string` | `"rule"` | no |
132127
| <a name="input_target_arn"></a> [target\_arn](#input\_target\_arn) | target arn | `string` | n/a | yes |
133-
| <a name="input_target_name"></a> [target\_name](#input\_target\_name) | Cloudwatch target name | `string` | `null` | no |
134128
| <a name="input_teamid"></a> [teamid](#input\_teamid) | Name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply' | `string` | n/a | yes |
135129
| <a name="input_timeout"></a> [timeout](#input\_timeout) | timeout for cloudwatch event | `number` | `60` | no |
136130

137131
## Outputs
138132

139133
| Name | Description |
140134
|------|-------------|
141-
| <a name="output_cloudwatch_event_rule_arn"></a> [cloudwatch\_event\_rule\_arn](#output\_cloudwatch\_event\_rule\_arn) | The cloudwatch event rule arn. |
142-
| <a name="output_cloudwatch_event_target_arn"></a> [cloudwatch\_event\_target\_arn](#output\_cloudwatch\_event\_target\_arn) | The cloudwatch event target arn. |
135+
| <a name="output_cloudwatch_event_rule_arn"></a> [cloudwatch\_event\_rule\_arn](#output\_cloudwatch\_event\_rule\_arn) | The cloudwatch event rule ARN |
136+
| <a name="output_cloudwatch_event_target_arn"></a> [cloudwatch\_event\_target\_arn](#output\_cloudwatch\_event\_target\_arn) | The cloudwatch event target ARN |

examples/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ terraform {
22
required_version = ">= 1.0.1"
33
required_providers {
44
aws = {
5-
version = "~> 3.63"
5+
version = "~> 3.74"
66
}
77
}
88
}
99

1010
provider "aws" {
11-
region = "us-west-2"
11+
region = var.region
1212
}
1313

1414
module "cloudwatch_event" {

examples/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ variable "prjid" {
77
description = "Name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply'"
88
type = string
99
}
10+
11+
variable "region" {
12+
description = "AWS region to create resources"
13+
default = "us-west-2"
14+
type = string
15+
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ locals {
66
resource "aws_cloudwatch_event_rule" "event_rule" {
77
count = var.deploy_event_rule ? 1 : 0
88

9-
name = var.name != null ? var.name : "${var.teamid}-${var.prjid}"
9+
name = var.name != null ? "${var.name}-${var.suffix}" : "${var.teamid}-${var.prjid}-${var.suffix}"
1010
description = var.description == null ? "Terraform managed: ${var.teamid}-${var.prjid}" : var.description
1111
schedule_expression = var.schedule
1212
role_arn = var.service_role

outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
output "cloudwatch_event_rule_arn" {
2-
description = "The cloudwatch event rule arn."
2+
description = "The cloudwatch event rule ARN"
33
value = join("", aws_cloudwatch_event_rule.event_rule.*.arn)
44
}
55

66
output "cloudwatch_event_target_arn" {
7-
description = "The cloudwatch event target arn."
7+
description = "The cloudwatch event target ARN"
88
value = join("", aws_cloudwatch_event_target.event_target_input_type.*.arn)
99
}

versions.tf renamed to providers.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_version = ">= 1.0.1"
33
required_providers {
44
aws = {
5-
version = "~> 3.63"
5+
version = "~> 3.74"
66
}
77
}
88
}

locals.tf renamed to tags.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ locals {
22
shared_tags = tomap(
33
{
44
"Name" = "${var.teamid}-${var.prjid}",
5-
"team" = var.teamid,
6-
"project" = var.prjid
5+
"Team" = var.teamid,
6+
"Project" = var.prjid
77
}
88
)
99
}

0 commit comments

Comments
 (0)