Skip to content

Commit 39c0b08

Browse files
sfloresksfloresk
andauthored
Add initial files and examples (#2)
* Add initial code, docs and example --------- Co-authored-by: sfloresk <[email protected]>
1 parent 2a28e1d commit 39c0b08

File tree

16 files changed

+796
-43
lines changed

16 files changed

+796
-43
lines changed

.config/.tflint.hcl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,12 @@ rule "terraform_standard_module_structure" {
6464
rule "terraform_workspace_remote" {
6565
enabled = true
6666
}
67+
68+
69+
## Custom rules
70+
71+
# Disabling rule for invalid runtime since is flagging nodejs20.x as invalid, but it is a valid runtime
72+
# https://docs.aws.amazon.com/lambda/latest/api/API_CreateFunction.html#API_CreateFunction_RequestSyntax
73+
rule "aws_lambda_function_invalid_runtime"{
74+
enabled = false
75+
}

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,7 @@ go.mod
4343
go.sum
4444

4545
# Terraform tests
46-
tests/*.auto.tfvars
46+
tests/*.auto.tfvars
47+
.env
48+
examples/basic/.terraform
49+
examples/basic/src/

.header.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Terraform Module Project
1+
# AWS Lambda Power Tuning Terraform module
22

3-
:no_entry_sign: Do not edit this readme.md file. To learn how to change this content and work with this repository, refer to CONTRIBUTING.md
4-
5-
## Readme Content
6-
7-
This file will contain any instructional information about this module.
3+
Terraform module to automate the deployment of the [Lambda power tuning solution](https://github.com/alexcasalboni/aws-lambda-power-tuning)

README.md

Lines changed: 68 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,88 @@
11
<!-- BEGIN_TF_DOCS -->
2-
# Terraform Module Project
2+
# AWS Lambda Power Tuning Terraform module
33

4-
:no_entry_sign: Do not edit this readme.md file. To learn how to change this content and work with this repository, refer to CONTRIBUTING.md
5-
6-
## Readme Content
7-
8-
This file will contain any instructional information about this module.
4+
Terraform module to automate the deployment of the [Lambda power tuning solution](https://github.com/alexcasalboni/aws-lambda-power-tuning)
95

106
## Requirements
117

8+
| Name | Version |
9+
|------|---------|
10+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
11+
| <a name="requirement_archive"></a> [archive](#requirement\_archive) | >= 2.4.2 |
12+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.26 |
13+
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.2.2 |
14+
1215
## Providers
1316

14-
No providers.
17+
| Name | Version |
18+
|------|---------|
19+
| <a name="provider_archive"></a> [archive](#provider\_archive) | >= 2.4.2 |
20+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.26 |
21+
| <a name="provider_terraform"></a> [terraform](#provider\_terraform) | n/a |
1522

1623
## Modules
1724

1825
No modules.
1926

2027
## Resources
2128

22-
No resources.
29+
| Name | Type |
30+
|------|------|
31+
| [aws_iam_policy.cleaner_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
32+
| [aws_iam_policy.executor_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
33+
| [aws_iam_policy.initializer_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
34+
| [aws_iam_policy.optimizer_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
35+
| [aws_iam_policy_attachment.cleaner_attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy_attachment) | resource |
36+
| [aws_iam_policy_attachment.execute_attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy_attachment) | resource |
37+
| [aws_iam_policy_attachment.executor_attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy_attachment) | resource |
38+
| [aws_iam_policy_attachment.initializer_attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy_attachment) | resource |
39+
| [aws_iam_policy_attachment.optimizer_attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy_attachment) | resource |
40+
| [aws_iam_policy_attachment.sfn_attach](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy_attachment) | resource |
41+
| [aws_iam_role.analyzer_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
42+
| [aws_iam_role.cleaner_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
43+
| [aws_iam_role.executor_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
44+
| [aws_iam_role.initializer_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
45+
| [aws_iam_role.optimizer_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
46+
| [aws_iam_role.sfn_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
47+
| [aws_lambda_function.analyzer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
48+
| [aws_lambda_function.cleaner](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
49+
| [aws_lambda_function.executor](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
50+
| [aws_lambda_function.initializer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
51+
| [aws_lambda_function.optimizer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) | resource |
52+
| [aws_lambda_layer_version.lambda_layer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_layer_version) | resource |
53+
| [aws_sfn_state_machine.state_machine](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sfn_state_machine) | resource |
54+
| [terraform_data.always_replace](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/resources/data) | resource |
55+
| [terraform_data.build_layer](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/resources/data) | resource |
56+
| [archive_file.app](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
57+
| [archive_file.layer](https://registry.terraform.io/providers/hashicorp/archive/latest/docs/data-sources/file) | data source |
58+
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
59+
| [aws_iam_policy.analyzer_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy) | data source |
60+
| [aws_iam_policy.sfn_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy) | data source |
61+
| [aws_iam_policy_document.cleaner](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
62+
| [aws_iam_policy_document.executor](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
63+
| [aws_iam_policy_document.initializer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
64+
| [aws_iam_policy_document.lambda](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
65+
| [aws_iam_policy_document.optimizer](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
66+
| [aws_iam_policy_document.sfn](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
2367

2468
## Inputs
2569

26-
No inputs.
70+
| Name | Description | Type | Default | Required |
71+
|------|-------------|------|---------|:--------:|
72+
| <a name="input_lambda_function_prefix"></a> [lambda\_function\_prefix](#input\_lambda\_function\_prefix) | Prefix used for the names of Lambda functions, Step Functions state machines, IAM roles, and IAM policies. | `string` | `"lambda_power_tuning"` | no |
73+
| <a name="input_permissions_boundary"></a> [permissions\_boundary](#input\_permissions\_boundary) | ARN of the policy that is used to set the permissions boundary for the role. | `string` | `null` | no |
74+
| <a name="input_role_path_override"></a> [role\_path\_override](#input\_role\_path\_override) | IAM Role path to use for each Lambda function's role, instead of the default path /lambda\_power\_tuning/ (see variable lambda\_function\_prefix). | `string` | `""` | no |
75+
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to assign to the resources. | `map(string)` | <pre>{<br> "app": "lambda_power_tuning"<br>}</pre> | no |
76+
| <a name="input_vpc_security_group_ids"></a> [vpc\_security\_group\_ids](#input\_vpc\_security\_group\_ids) | List of security group ids when Lambda Function should run in the VPC. | `list(string)` | `null` | no |
77+
| <a name="input_vpc_subnet_ids"></a> [vpc\_subnet\_ids](#input\_vpc\_subnet\_ids) | List of subnet ids when Lambda Function should run in the VPC. Usually private or intra subnets. | `list(string)` | `null` | no |
2778

2879
## Outputs
2980

30-
No outputs.
31-
<!-- END_TF_DOCS -->
81+
| Name | Description |
82+
|------|-------------|
83+
| <a name="output_analyzer_function"></a> [analyzer\_function](#output\_analyzer\_function) | Analyzer lambda function ARN |
84+
| <a name="output_cleaner_function"></a> [cleaner\_function](#output\_cleaner\_function) | Cleaner lambda function ARN |
85+
| <a name="output_executor_function"></a> [executor\_function](#output\_executor\_function) | Executor lambda function ARN |
86+
| <a name="output_initializer_function"></a> [initializer\_function](#output\_initializer\_function) | Initializer lambda function ARN |
87+
| <a name="output_optimizer_function"></a> [optimizer\_function](#output\_optimizer\_function) | optimizer lambda function ARN |
88+
<!-- END_TF_DOCS -->

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.0.0
1+
v0.0.1

examples/basic/.header.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Basic example
2+
3+
Terraform example that deploys the [Lambda power tuning solution](https://github.com/alexcasalboni/aws-lambda-power-tuning) using the terraform module aws-lambda-power-tuning

examples/basic/README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
<!-- BEGIN_TF_DOCS -->
2+
# Basic example
3+
4+
Terraform example that deploys the [Lambda power tuning solution](https://github.com/alexcasalboni/aws-lambda-power-tuning) using the terraform module aws-lambda-power-tuning
5+
26
## Requirements
37

48
| Name | Version |
59
|------|---------|
6-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14.0 |
7-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.72.0 |
8-
| <a name="requirement_awscc"></a> [awscc](#requirement\_awscc) | >= 0.11.0 |
10+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
11+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.26 |
912

1013
## Providers
1114

1215
No providers.
1316

1417
## Modules
1518

16-
No modules.
19+
| Name | Source | Version |
20+
|------|--------|---------|
21+
| <a name="module_aws_power_tuning"></a> [aws\_power\_tuning](#module\_aws\_power\_tuning) | ../../ | n/a |
1722

1823
## Resources
1924

@@ -25,5 +30,11 @@ No inputs.
2530

2631
## Outputs
2732

28-
No outputs.
33+
| Name | Description |
34+
|------|-------------|
35+
| <a name="output_analyzer_function_arn"></a> [analyzer\_function\_arn](#output\_analyzer\_function\_arn) | Analyzer lambda function ARN |
36+
| <a name="output_cleaner_function_arn"></a> [cleaner\_function\_arn](#output\_cleaner\_function\_arn) | Cleaner lambda function ARN |
37+
| <a name="output_executor_function_arn"></a> [executor\_function\_arn](#output\_executor\_function\_arn) | Executor lambda function ARN |
38+
| <a name="output_initializer_function_arn"></a> [initializer\_function\_arn](#output\_initializer\_function\_arn) | Initializer lambda function ARN |
39+
| <a name="output_optimizer_function_arn"></a> [optimizer\_function\_arn](#output\_optimizer\_function\_arn) | optimizer lambda function ARN |
2940
<!-- END_TF_DOCS -->

examples/basic/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@
33
# per use-case. The code below should not be copied directly but referenced in order
44
# to build your own root module that invokes this module
55
#####################################################################################
6+
provider "aws" {
7+
region = "us-west-2"
8+
}
9+
10+
module "aws_power_tuning" {
11+
source = "../../"
12+
}

examples/basic/outputs.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
output "analyzer_function_arn" {
2+
description = "Analyzer lambda function ARN"
3+
value = try(module.aws_power_tuning.analyzer_function, null)
4+
}
5+
6+
output "cleaner_function_arn" {
7+
description = "Cleaner lambda function ARN"
8+
value = try(module.aws_power_tuning.cleaner_function.arn, null)
9+
}
10+
11+
output "executor_function_arn" {
12+
description = "Executor lambda function ARN"
13+
value = try(module.aws_power_tuning.executor_function, null)
14+
}
15+
16+
output "initializer_function_arn" {
17+
description = "Initializer lambda function ARN"
18+
value = try(module.aws_power_tuning.initializer_function, null)
19+
}
20+
21+
output "optimizer_function_arn" {
22+
description = "optimizer lambda function ARN"
23+
value = try(module.aws_power_tuning.optimizer_function, null)
24+
}

examples/basic/providers.tf

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
terraform {
2-
required_version = ">= 0.14.0"
2+
required_version = ">= 1.0"
3+
34
required_providers {
45
aws = {
56
source = "hashicorp/aws"
6-
version = ">= 3.72.0"
7-
}
8-
awscc = {
9-
source = "hashicorp/awscc"
10-
version = ">= 0.11.0"
7+
version = ">= 5.26"
118
}
129
}
1310
}
14-
15-
provider "awscc" {
16-
user_agent = [{
17-
product_name = "terraform-awscc-"
18-
product_version = "0.0.1"
19-
comment = "V1/AWS-D69B4015/<github repo id>"
20-
}]
21-
}

0 commit comments

Comments
 (0)