Skip to content

Commit a727273

Browse files
authored
docs: Added a note about using with Terraform Cloud Agents (#108)
1 parent 04db4b8 commit a727273

File tree

11 files changed

+56
-15
lines changed

11 files changed

+56
-15
lines changed

.pre-commit-config.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.31.0
3+
rev: v1.41.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs
7+
- id: terraform_tflint
8+
args:
9+
- '--args=--only=terraform_deprecated_interpolation'
10+
- '--args=--only=terraform_deprecated_index'
11+
- '--args=--only=terraform_unused_declarations'
12+
- '--args=--only=terraform_comment_syntax'
13+
- '--args=--only=terraform_documented_outputs'
14+
- '--args=--only=terraform_documented_variables'
15+
- '--args=--only=terraform_typed_variables'
16+
- '--args=--only=terraform_module_pinned_source'
17+
- '--args=--only=terraform_naming_convention'
18+
- '--args=--only=terraform_required_version'
19+
- '--args=--only=terraform_required_providers'
20+
- '--args=--only=terraform_standard_module_structure'
21+
- '--args=--only=terraform_workspace_remote'
722
- repo: git://github.com/pre-commit/pre-commit-hooks
8-
rev: v3.1.0
23+
rev: v3.2.0
924
hooks:
1025
- id: check-merge-conflict

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ module "notify_slack" {
4646

4747
Version 3 uses [Terraform AWS Lambda module](https://github.com/terraform-aws-modules/terraform-aws-lambda) to handle most of heavy-lifting related to Lambda packaging, roles, and permissions, while maintaining the same interface for the user of this module after many of resources will be recreated.
4848

49+
## Using with Terraform Cloud Agents
50+
51+
[Terraform Cloud Agents](https://www.terraform.io/docs/cloud/workspaces/agent.html) are a paid feature, available as part of the Terraform Cloud for Business upgrade package.
52+
53+
This module requires Python 3.8. You can customize [tfc-agent](https://hub.docker.com/r/hashicorp/tfc-agent) to include Python using this sample `Dockerfile`:
54+
55+
```
56+
FROM hashicorp/tfc-agent:latest
57+
RUN apt-get -y update && apt-get -y install python3.8 python3-pip
58+
ENTRYPOINT ["/bin/tfc-agent"]
59+
```
4960

5061
## Use existing SNS topic or create new
5162

@@ -94,12 +105,12 @@ To run the tests:
94105
| create\_sns\_topic | Whether to create new SNS topic | `bool` | `true` | no |
95106
| iam\_role\_boundary\_policy\_arn | The ARN of the policy that is used to set the permissions boundary for the role | `string` | `null` | no |
96107
| iam\_role\_name\_prefix | A unique role name beginning with the specified prefix | `string` | `"lambda"` | no |
97-
| iam\_role\_policy\_name\_prefix | A unique policy name beginning with the specified prefix | `string` | `"lambda-policy-"` | no |
98108
| iam\_role\_tags | Additional tags for the IAM role | `map(string)` | `{}` | no |
99109
| kms\_key\_arn | ARN of the KMS key used for decrypting slack webhook url | `string` | `""` | no |
100110
| lambda\_description | The description of the Lambda function | `string` | `null` | no |
101111
| lambda\_function\_name | The name of the Lambda function to create | `string` | `"notify_slack"` | no |
102112
| lambda\_function\_tags | Additional tags for the Lambda function | `map(string)` | `{}` | no |
113+
| lambda\_role | IAM role attached to the Lambda Function. If this is set then a role will not be created for you. | `string` | `""` | no |
103114
| log\_events | Boolean flag to enabled/disable logging of incoming events | `bool` | `false` | no |
104115
| reserved\_concurrent\_executions | The amount of reserved concurrent executions for this lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations | `number` | `-1` | no |
105116
| slack\_channel | The name of the channel in Slack for notifications | `string` | n/a | yes |

examples/cloudwatch-alerts-to-slack/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,16 @@ Note that this example may create resources which can cost money. Run `terraform
5858
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5959
## Requirements
6060

61-
No requirements.
61+
| Name | Version |
62+
|------|---------|
63+
| terraform | >= 0.13.0, < 0.14 |
64+
| aws | >= 2.35, < 4.0 |
6265

6366
## Providers
6467

6568
| Name | Version |
6669
|------|---------|
67-
| aws | n/a |
70+
| aws | >= 2.35, < 4.0 |
6871

6972
## Inputs
7073

examples/cloudwatch-alerts-to-slack/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module "notify_slack" {
3232
}
3333
}
3434

35-
resource "aws_cloudwatch_metric_alarm" "LambdaDuration" {
35+
resource "aws_cloudwatch_metric_alarm" "lambda_duration" {
3636
alarm_name = "NotifySlackDuration"
3737
comparison_operator = "GreaterThanOrEqualToThreshold"
3838
evaluation_periods = "1"

examples/cloudwatch-alerts-to-slack/variables.tf

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.13.0, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.35, < 4.0"
6+
}
7+
}

examples/notify-slack-simple/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ Note that this example may create resources which can cost money (AWS Elastic IP
2121
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2222
## Requirements
2323

24-
No requirements.
24+
| Name | Version |
25+
|------|---------|
26+
| terraform | >= 0.13.0, < 0.14 |
27+
| aws | >= 2.35, < 4.0 |
2528

2629
## Providers
2730

2831
| Name | Version |
2932
|------|---------|
30-
| aws | n/a |
33+
| aws | >= 2.35, < 4.0 |
3134

3235
## Inputs
3336

examples/notify-slack-simple/variables.tf

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.13.0, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.35, < 4.0"
6+
}
7+
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module "lambda" {
8181
kms_key_arn = var.kms_key_arn
8282
reserved_concurrent_executions = var.reserved_concurrent_executions
8383

84-
// If publish is disabled, there will be "Error adding new Lambda Permission for notify_slack: InvalidParameterValueException: We currently do not support adding policies for $LATEST."
84+
# If publish is disabled, there will be "Error adding new Lambda Permission for notify_slack: InvalidParameterValueException: We currently do not support adding policies for $LATEST."
8585
publish = true
8686

8787
environment_variables = {

0 commit comments

Comments
 (0)