Skip to content

Commit

Permalink
Merge pull request #1 from pbs/chore/template_updates
Browse files Browse the repository at this point in the history
Template Updates
  • Loading branch information
yhakbar authored Jul 8, 2022
2 parents 1abcc17 + 4e7e5ad commit 328f812
Show file tree
Hide file tree
Showing 23 changed files with 251 additions and 135 deletions.
1 change: 0 additions & 1 deletion .golang-pkgs
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
github.com/terraform-docs/[email protected]
github.com/gruntwork-io/[email protected]
github.com/stretchr/[email protected]
29 changes: 15 additions & 14 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
plugin "aws" {
enabled = true
version = "0.9.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
enabled = true
version = "0.14.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}

rule "terraform_deprecated_interpolation" {
enabled = true
enabled = true
}
rule "terraform_deprecated_index" {
enabled = true
enabled = true
}
rule "terraform_unused_declarations" {
enabled = true
enabled = true
}
rule "terraform_comment_syntax" {
enabled = true
enabled = true
}
rule "terraform_documented_outputs" {
enabled = true
enabled = true
}
rule "terraform_documented_variables" {
enabled = true
enabled = true
}
rule "terraform_typed_variables" {
enabled = true
enabled = true
}
rule "terraform_module_pinned_source" {
enabled = true
enabled = true
}
rule "terraform_naming_convention" {
enabled = true
enabled = true
}
rule "terraform_required_version" {
enabled = true
enabled = true
}
rule "terraform_required_providers" {
enabled = true
enabled = true
}
rule "terraform_unused_required_providers" {
enabled = true
enabled = true
}
rule "terraform_workspace_remote" {
enabled = true
enabled = true
}
10 changes: 5 additions & 5 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform 1.1.7
golang 1.17.6
terraform 1.2.4
golang 1.18.3
ripgrep 13.0.0
tflint 0.34.1
github-cli 2.7.0
fd 8.3.2
tflint 0.38.1
github-cli 2.13.0
fd 8.4.0
terraform-docs 0.16.0
8 changes: 4 additions & 4 deletions README-HEADER.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# PBS TF lambda cron module
# PBS TF Lambda Cron Module

## Installation

### Using the Repo Source

Use this URL for the source of the module. See the usage examples below for more details.

```hcl
module "lambda-cron" {
source = "github.com/pbs/terraform-aws-lambda-cron-module?ref=x.y.z"
}
github.com/pbs/terraform-aws-lambda-cron-module?ref=x.y.z
```

### Alternative Installation Methods
Expand Down
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# PBS TF lambda cron module
# PBS TF Lambda Cron Module

## Installation

### Using the Repo Source

Use this URL for the source of the module. See the usage examples below for more details.

```hcl
module "lambda-cron" {
source = "github.com/pbs/terraform-aws-lambda-cron-module?ref=0.0.1"
}
github.com/pbs/terraform-aws-lambda-cron-module?ref=x.y.z
```

### Alternative Installation Methods
Expand All @@ -22,7 +22,7 @@ Integrate this module like so:

```hcl
module "lambda-cron" {
source = "github.com/pbs/terraform-aws-lambda-cron-module?ref=0.0.1"
source = "github.com/pbs/terraform-aws-lambda-cron-module?ref=x.y.z"
# Required Parameters
handler = "main"
Expand All @@ -44,7 +44,7 @@ module "lambda-cron" {

If this repo is added as a subtree, then the version of the module should be close to the version shown here:

`0.0.1`
`x.y.z`

Note, however that subtrees can be altered as desired within repositories.

Expand All @@ -67,13 +67,13 @@ Below is automatically generated documentation on this Terraform module using [t

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.5.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.22.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_lambda"></a> [lambda](#module\_lambda) | github.com/pbs/terraform-aws-lambda-module | 0.0.2 |
| <a name="module_lambda"></a> [lambda](#module\_lambda) | github.com/pbs/terraform-aws-lambda-module | 0.0.4 |

## Resources

Expand All @@ -87,31 +87,39 @@ Below is automatically generated documentation on this Terraform module using [t

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_environment"></a> [environment](#input\_environment) | Environment (sharedtools, dev, staging, prod) | `string` | n/a | yes |
| <a name="input_environment"></a> [environment](#input\_environment) | Environment (sharedtools, dev, staging, qa, prod) | `string` | n/a | yes |
| <a name="input_filename"></a> [filename](#input\_filename) | Filename for the artifact to use for the Lambda | `string` | n/a | yes |
| <a name="input_handler"></a> [handler](#input\_handler) | Cloudwatch event pattern | `string` | n/a | yes |
| <a name="input_organization"></a> [organization](#input\_organization) | Organization using this module. Used to prefix tags so that they are easily identified as being from your organization | `string` | n/a | yes |
| <a name="input_product"></a> [product](#input\_product) | Tag used to group resources according to product | `string` | n/a | yes |
| <a name="input_repo"></a> [repo](#input\_repo) | Tag used to point to the repo using this module | `string` | n/a | yes |
| <a name="input_runtime"></a> [runtime](#input\_runtime) | Runtime for the lambda function | `string` | n/a | yes |
| <a name="input_add_vpc_config"></a> [add\_vpc\_config](#input\_add\_vpc\_config) | Add VPC configuration to the Lambda function | `bool` | `false` | no |
| <a name="input_architectures"></a> [architectures](#input\_architectures) | Architectures to target for the Lambda function | `list(string)` | <pre>[<br> "x86_64"<br>]</pre> | no |
| <a name="input_cron"></a> [cron](#input\_cron) | (optional) cron controlling schedule of task. Is set to 07:00 GMT (02:00 EST) by default. | `string` | `"00 7 * * ? *"` | no |
| <a name="input_environment_vars"></a> [environment\_vars](#input\_environment\_vars) | Map of environment variables for the Lambda. If null, defaults to setting an SSM\_PATH based on the environment and name of the function. Set to {} if you would like for there to be no environment variables present. This is important if you are creating a Lambda@Edge. | `map(any)` | `null` | no |
| <a name="input_event_rule_description"></a> [event\_rule\_description](#input\_event\_rule\_description) | Value to use for the CloudWatch Event Rule. Will default to name if not defined. | `string` | `null` | no |
| <a name="input_event_rule_name"></a> [event\_rule\_name](#input\_event\_rule\_name) | Name of the CloudWatch Event Rule. Will default to name if not defined. | `string` | `null` | no |
| <a name="input_file_system_config"></a> [file\_system\_config](#input\_file\_system\_config) | File system configuration for the Lambda function | `map(any)` | `null` | no |
| <a name="input_is_enabled"></a> [is\_enabled](#input\_is\_enabled) | (optional) whether the rule is enabled. Is set to true by default. | `bool` | `true` | no |
| <a name="input_lambda_description"></a> [lambda\_description](#input\_lambda\_description) | Description for this lambda function | `string` | `null` | no |
| <a name="input_lambda_insights_version"></a> [lambda\_insights\_version](#input\_lambda\_insights\_version) | Lambda layer version for the LambdaInsightsExtension layer | `number` | `14` | no |
| <a name="input_lambda_insights_version"></a> [lambda\_insights\_version](#input\_lambda\_insights\_version) | Lambda layer version for the LambdaInsightsExtension layer | `number` | `null` | no |
| <a name="input_lambda_name"></a> [lambda\_name](#input\_lambda\_name) | Name of the Lambda function | `string` | `null` | no |
| <a name="input_layers"></a> [layers](#input\_layers) | Lambda layers to apply to function. If null, a Lambda Layer extension is added by default. | `list(string)` | `null` | no |
| <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | Number of days to retain CloudWatch Log entries | `number` | `7` | no |
| <a name="input_memory_size"></a> [memory\_size](#input\_memory\_size) | Amount of memory in MB your Lambda Function can use at runtime | `number` | `128` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the Lambda Cron Module. If null, will default to product. | `string` | `null` | no |
| <a name="input_permissions_boundary_arn"></a> [permissions\_boundary\_arn](#input\_permissions\_boundary\_arn) | ARN of the permissions boundary to use on the role created for this lambda | `string` | `null` | no |
| <a name="input_policy_json"></a> [policy\_json](#input\_policy\_json) | Policy JSON. If null, default policy granting access to SSM and cloudwatch logs is used | `string` | `null` | no |
| <a name="input_publish"></a> [publish](#input\_publish) | Whether to publish creation/change as new Lambda Function Version | `bool` | `true` | no |
| <a name="input_role_arn"></a> [role\_arn](#input\_role\_arn) | ARN of the role to be used for this Lambda | `string` | `null` | no |
| <a name="input_security_group_id"></a> [security\_group\_id](#input\_security\_group\_id) | Security group ID. If null, one will be created. | `string` | `null` | no |
| <a name="input_subnets"></a> [subnets](#input\_subnets) | Subnets to use for the Lambda function. Ignored if add\_vpc\_config is false. If null, one will be looked up based on environment tag. | `list(string)` | `null` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | Extra tags | `map(string)` | `{}` | no |
| <a name="input_timeout"></a> [timeout](#input\_timeout) | Timeout in seconds of the Lambda | `number` | `3` | no |
| <a name="input_tracing_config_mode"></a> [tracing\_config\_mode](#input\_tracing\_config\_mode) | Tracing config mode for X-Ray integration on Lambda | `string` | `"Active"` | no |
| <a name="input_use_prefix"></a> [use\_prefix](#input\_use\_prefix) | Use prefix for resources instead of explicitly defining whole name where possible | `bool` | `true` | no |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC ID. If null, one will be looked up based on environment tag. | `string` | `null` | no |

## Outputs

Expand Down
2 changes: 1 addition & 1 deletion docs/module/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# lambda cron module
# Lambda Cron Module

This directory will be used for any documentation that is unique to this module.
2 changes: 2 additions & 0 deletions examples/arm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
backend.tf
provider.tf
10 changes: 10 additions & 0 deletions examples/arm/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions examples/arm/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module "lambda_cron" {
source = "../.."

handler = "main"
filename = "../artifacts/handler.zip"
runtime = "go1.x"

architectures = ["arm64"]

environment = var.environment
product = var.product
repo = var.repo
organization = var.organization
}
9 changes: 9 additions & 0 deletions examples/arm/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
output "lambda_arn" {
description = "Lambda ARN"
value = module.lambda_cron.lambda_arn
}

output "cron" {
description = "Cron"
value = module.lambda_cron.cron
}
9 changes: 9 additions & 0 deletions examples/arm/sample-backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# terraform {
# backend "s3" {
# bucket = "my-bucket-tfstate"
# key = "example-terraform-aws-lambda-cron-arm"
# profile = "my-profile"
# region = "us-east-1"
# dynamodb_table = "terraform-lock"
# }
# }
12 changes: 12 additions & 0 deletions examples/arm/sample-provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# provider "aws" {
# region = "us-east-1"
# profile = "my-profile"
# default_tags {
# tags = {
# product = var.product
# environment = var.environment
# repo = var.repo
# organization = var.organization
# }
# }
# }
45 changes: 45 additions & 0 deletions examples/arm/tags.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
variable "environment" {
description = "Environment (sharedtools, dev, staging, prod)"
type = string

default = "sharedtools"

validation {
condition = contains(["sharedtools", "dev", "staging", "prod"], var.environment)
error_message = "The environment variable must be one of [sharedtools, dev, staging, prod]."
}
}

variable "product" {
description = "Tag used to group resources according to application"

default = "ex-tf-lambda-cron-arm"

validation {
condition = can(regex("[a-z\\-]+", var.product))
error_message = "The product variable violates approved regex."
}
}

variable "repo" {
description = "Tag used to point to the repo using this module"

default = "https://github.com/pbs/terraform-lambda-cron-module.git"

validation {
condition = can(regex("(?:git|ssh|https?|git@[-\\w.]+):(\\/\\/)?(.*?)(\\.git)(\\/?|\\#[-\\d\\w._]+?)$", var.repo))
error_message = "The repo variable violates approved regex."
}
}

variable "organization" {
description = "Organization using this module. Used to prefix tags so that they are easily identified as being from your organization"
type = string

default = "example"

validation {
condition = can(regex("[a-z\\-]+", var.organization))
error_message = "The organization variable violates approved regex."
}
}
2 changes: 2 additions & 0 deletions examples/basic/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
backend.tf
provider.tf
16 changes: 2 additions & 14 deletions examples/basic/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
go 1.18

use ./tests
Loading

0 comments on commit 328f812

Please sign in to comment.