Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
TF 1.0 upgrade (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
Puneeth-n committed Feb 3, 2022
1 parent 42d2d12 commit f2351d3
Show file tree
Hide file tree
Showing 59 changed files with 888 additions and 448 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: test

on:
pull_request:
paths:
- '**/*.tf'
- test/*.go

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM comtravo/terraform:test-workhorse-0.14.11-1.0.0
FROM comtravo/terraform:test-workhorse-1.1.4-1.0.0

WORKDIR /go/src/github.com/comtravo/terraform-modules
COPY . .
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ develop:
@$(DOCKER_COMPOSE_DEVELOP) down -v

generate-docs: fmt lint
$(for module in `find . -type f -name "*.tf" -not -path "*/examples/*" -exec dirname "{}" \; | sort -u`; do cd $module && terraform-docs markdown . > README.md && cd -; done)
for module in `find . -type f -name "*.tf" -not -path "*/examples/*" -not -path "./test" -exec dirname "{}" \; | sort -u`; do cd ${module} && terraform-docs markdown . > README.md && cd -; done

clean-state:
@find . -type f -name 'terraform.tfstate*' | xargs rm -rf
Expand Down
73 changes: 44 additions & 29 deletions alb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,47 +32,62 @@ module "website-alb" {

| Name | Version |
|------|---------|
| terraform | >= 0.13 |
| aws | ~> 3.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.0 |

## Providers

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

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_alb.alb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/alb) | resource |
| [aws_alb_listener.listener_http](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/alb_listener) | resource |
| [aws_alb_listener.listener_https](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/alb_listener) | resource |
| [aws_alb_listener_certificate.additional_certificates](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/alb_listener_certificate) | resource |
| [aws_alb_target_group.dummy_http](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/alb_target_group) | resource |
| [aws_alb_target_group.dummy_https](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/alb_target_group) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| access\_logs | https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb#access_logs | <pre>list(object({<br> enabled = bool<br> bucket = string<br> prefix = string<br> }))</pre> | `[]` | no |
| enable | Enable or Disable module | `bool` | `true` | no |
| enable\_deletion\_protection | Enable or Disable deletion protection | `bool` | `true` | no |
| environment | The environment of the ALB. Used for tagging | `string` | n/a | yes |
| health\_check | Healthcheck for default target groups | `map(string)` | `{}` | no |
| http\_listener\_port | HTTP listener port | `number` | `80` | no |
| https\_listener\_config | List of maps of HTTPS listenr objects | <pre>object({<br> port = string,<br> certificates = list(string),<br> number_of_certificates = number<br> })</pre> | `null` | no |
| idle\_timeout | Idle timeout | `number` | `60` | no |
| internal | Bool flag to indicate whether the ALB is internal or external | `bool` | `true` | no |
| ip\_address\_type | Address type for the ALB. Can be ipv4 or dual | `string` | `"ipv4"` | no |
| name | AWS ALB name | `string` | n/a | yes |
| security\_group\_ids | List of security groups to be associated with the ALB | `list(string)` | n/a | yes |
| subnet\_ids | List of subnets IDs where the ALB would be serving | `list(string)` | n/a | yes |
| timeouts | ALB creation timeouts | <pre>object({<br> create = string,<br> delete = string,<br> update = string<br> })</pre> | <pre>{<br> "create": "10m",<br> "delete": "10m",<br> "update": "10m"<br>}</pre> | no |
| vpc\_id | VPC ID where the ALB needs to be provisioned | `string` | n/a | yes |
| <a name="input_access_logs"></a> [access\_logs](#input\_access\_logs) | https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb#access_logs | <pre>list(object({<br> enabled = bool<br> bucket = string<br> prefix = string<br> }))</pre> | `[]` | no |
| <a name="input_enable"></a> [enable](#input\_enable) | Enable or Disable module | `bool` | `true` | no |
| <a name="input_enable_deletion_protection"></a> [enable\_deletion\_protection](#input\_enable\_deletion\_protection) | Enable or Disable deletion protection | `bool` | `true` | no |
| <a name="input_environment"></a> [environment](#input\_environment) | The environment of the ALB. Used for tagging | `string` | n/a | yes |
| <a name="input_health_check"></a> [health\_check](#input\_health\_check) | Healthcheck for default target groups | `map(string)` | `{}` | no |
| <a name="input_http_listener_port"></a> [http\_listener\_port](#input\_http\_listener\_port) | HTTP listener port | `number` | `80` | no |
| <a name="input_https_listener_config"></a> [https\_listener\_config](#input\_https\_listener\_config) | List of maps of HTTPS listenr objects | <pre>object({<br> port = string,<br> certificates = list(string),<br> number_of_certificates = number<br> })</pre> | `null` | no |
| <a name="input_idle_timeout"></a> [idle\_timeout](#input\_idle\_timeout) | Idle timeout | `number` | `60` | no |
| <a name="input_internal"></a> [internal](#input\_internal) | Bool flag to indicate whether the ALB is internal or external | `bool` | `true` | no |
| <a name="input_ip_address_type"></a> [ip\_address\_type](#input\_ip\_address\_type) | Address type for the ALB. Can be ipv4 or dual | `string` | `"ipv4"` | no |
| <a name="input_name"></a> [name](#input\_name) | AWS ALB name | `string` | n/a | yes |
| <a name="input_security_group_ids"></a> [security\_group\_ids](#input\_security\_group\_ids) | List of security groups to be associated with the ALB | `list(string)` | n/a | yes |
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | List of subnets IDs where the ALB would be serving | `list(string)` | n/a | yes |
| <a name="input_timeouts"></a> [timeouts](#input\_timeouts) | ALB creation timeouts | <pre>object({<br> create = string,<br> delete = string,<br> update = string<br> })</pre> | <pre>{<br> "create": "10m",<br> "delete": "10m",<br> "update": "10m"<br>}</pre> | no |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | VPC ID where the ALB needs to be provisioned | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| arn | AWS ALB ARN |
| aws\_alb | AWS ALB attributes |
| aws\_alb\_listener\_http | AWS ALB HTTPS listener attributes |
| aws\_alb\_listener\_https | AWS ALB HTTPS listener attributes |
| default\_target\_group\_http | Default HTTP target group arn |
| default\_target\_group\_https | Default HTTPS target group arn |
| dns\_name | AWS ALB DNS name |
| http\_listner\_arn | AWS ALB HTTP listner arn |
| https\_listner\_arn | AWS ALB HTTP listner arn |
| id | AWS ALB id |
| zone\_id | AWS ALB zone id |
| <a name="output_arn"></a> [arn](#output\_arn) | AWS ALB ARN |
| <a name="output_aws_alb"></a> [aws\_alb](#output\_aws\_alb) | AWS ALB attributes |
| <a name="output_aws_alb_listener_http"></a> [aws\_alb\_listener\_http](#output\_aws\_alb\_listener\_http) | AWS ALB HTTPS listener attributes |
| <a name="output_aws_alb_listener_https"></a> [aws\_alb\_listener\_https](#output\_aws\_alb\_listener\_https) | AWS ALB HTTPS listener attributes |
| <a name="output_default_target_group_http"></a> [default\_target\_group\_http](#output\_default\_target\_group\_http) | Default HTTP target group arn |
| <a name="output_default_target_group_https"></a> [default\_target\_group\_https](#output\_default\_target\_group\_https) | Default HTTPS target group arn |
| <a name="output_dns_name"></a> [dns\_name](#output\_dns\_name) | AWS ALB DNS name |
| <a name="output_http_listner_arn"></a> [http\_listner\_arn](#output\_http\_listner\_arn) | AWS ALB HTTP listner arn |
| <a name="output_https_listner_arn"></a> [https\_listner\_arn](#output\_https\_listner\_arn) | AWS ALB HTTP listner arn |
| <a name="output_id"></a> [id](#output\_id) | AWS ALB id |
| <a name="output_zone_id"></a> [zone\_id](#output\_zone\_id) | AWS ALB zone id |
2 changes: 1 addition & 1 deletion alb/versions.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

terraform {
required_version = ">= 0.14"
required_version = "~> 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
Expand Down
43 changes: 28 additions & 15 deletions apig/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Terraform AWS module for API gateway with Swagger spec

## Introduction
## Introduction
This is a minimal Terraform module which accepts a AWS + Swagger spec and deploys an AWS API Gateway

## Usage
## Usage
Check [examples](./examples) on how to use this module

## Authors
Expand All @@ -19,31 +19,44 @@ MIT Licensed. See [LICENSE](LICENSE) for full details.

| Name | Version |
|------|---------|
| terraform | >= 0.13 |
| aws | ~> 3.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.0 |

## Providers

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

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_api_gateway_base_path_mapping.custom-domain](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_base_path_mapping) | resource |
| [aws_api_gateway_deployment.api-deployment](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_deployment) | resource |
| [aws_api_gateway_rest_api.api](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_rest_api) | resource |
| [aws_api_gateway_stage.stage](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/api_gateway_stage) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| definition | Definition of the API Gateway | `string` | n/a | yes |
| domain\_name | Custom domain name | `string` | `""` | no |
| name | Name of the API gateway deployment | `string` | n/a | yes |
| stage | Name of the stage to which deployed | `string` | n/a | yes |
| <a name="input_definition"></a> [definition](#input\_definition) | Definition of the API Gateway | `string` | n/a | yes |
| <a name="input_domain_name"></a> [domain\_name](#input\_domain\_name) | Custom domain name | `string` | `""` | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the API gateway deployment | `string` | n/a | yes |
| <a name="input_stage"></a> [stage](#input\_stage) | Name of the stage to which deployed | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| deployment\_execution\_arn | Deployment execution ARN |
| deployment\_id | Deployment id |
| deployment\_invoke\_url | Deployment invoke url |
| name | API Gateway name |
| rest\_api\_id | REST API id |
| url | Serverless invoke url |
| <a name="output_deployment_execution_arn"></a> [deployment\_execution\_arn](#output\_deployment\_execution\_arn) | Deployment execution ARN |
| <a name="output_deployment_id"></a> [deployment\_id](#output\_deployment\_id) | Deployment id |
| <a name="output_deployment_invoke_url"></a> [deployment\_invoke\_url](#output\_deployment\_invoke\_url) | Deployment invoke url |
| <a name="output_name"></a> [name](#output\_name) | API Gateway name |
| <a name="output_rest_api_id"></a> [rest\_api\_id](#output\_rest\_api\_id) | REST API id |
| <a name="output_url"></a> [url](#output\_url) | Serverless invoke url |
2 changes: 1 addition & 1 deletion apig/versions.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

terraform {
required_version = ">= 0.14"
required_version = "~> 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
Expand Down
56 changes: 36 additions & 20 deletions apigv2/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Terraform AWS module for [AWS API gateway V2](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html) with OpenAPI spec

## Introduction
## Introduction
This is a minimal Terraform module which accepts a AWS + OpenAPI spec and deploys an [AWS API Gateway V2](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api.html)

## Usage
## Usage
Check [examples](./examples) on how to use this module

## Authors
Expand All @@ -19,36 +19,52 @@ MIT Licensed. See [LICENSE](LICENSE) for full details.

| Name | Version |
|------|---------|
| terraform | >= 0.13 |
| aws | ~> 3.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 3.0 |

## Providers

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

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [aws_apigatewayv2_api.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_api) | resource |
| [aws_apigatewayv2_api_mapping.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_api_mapping) | resource |
| [aws_apigatewayv2_deployment.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_deployment) | resource |
| [aws_apigatewayv2_domain_name.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_domain_name) | resource |
| [aws_apigatewayv2_stage.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_stage) | resource |
| [aws_cloudwatch_log_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_log_group) | resource |
| [aws_route53_record.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| access\_log\_settings | https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#apigateway-cloudwatch-log-formats | <pre>object({<br> format = string<br> retention_in_days = number<br> })</pre> | <pre>{<br> "format": "{ \"requestId\":\"$context.requestId\", \"ip\": \"$context.identity.sourceIp\", \"requestTime\":\"$context.requestTime\", \"httpMethod\":\"$context.httpMethod\",\"routeKey\":\"$context.routeKey\", \"status\":\"$context.status\",\"protocol\":\"$context.protocol\", \"responseLength\":\"$context.responseLength\" }",<br> "retention_in_days": 90<br>}</pre> | no |
| body | Definition of the API Gateway | `string` | n/a | yes |
| cors\_configuration | https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_api#cors_configuration | <pre>list(object({<br> allow_credentials = bool<br> allow_headers = list(string)<br> allow_methods = list(string)<br> allow_origins = list(string)<br> expose_headers = list(string)<br> max_age = number<br> }))</pre> | `[]` | no |
| domain\_settings | https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_domain_name | <pre>object({<br> enable = bool<br> domain_name = string<br> zone_id = string<br> certificate_arn = string<br> endpoint_type = string<br> security_policy = string<br> })</pre> | <pre>{<br> "certificate_arn": "",<br> "domain_name": "",<br> "enable": false,<br> "endpoint_type": "",<br> "security_policy": "",<br> "zone_id": ""<br>}</pre> | no |
| name | Name of the API gateway deployment | `string` | n/a | yes |
| protocol\_type | https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_api#protocol_type | `string` | n/a | yes |
| stage | Name of the stage to which deployed | `string` | n/a | yes |
| tags | Tags for resources | `map` | `{}` | no |
| <a name="input_access_log_settings"></a> [access\_log\_settings](#input\_access\_log\_settings) | https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#apigateway-cloudwatch-log-formats | <pre>object({<br> format = string<br> retention_in_days = number<br> })</pre> | <pre>{<br> "format": "{ \"requestId\":\"$context.requestId\", \"ip\": \"$context.identity.sourceIp\", \"requestTime\":\"$context.requestTime\", \"httpMethod\":\"$context.httpMethod\",\"routeKey\":\"$context.routeKey\", \"status\":\"$context.status\",\"protocol\":\"$context.protocol\", \"responseLength\":\"$context.responseLength\" }",<br> "retention_in_days": 90<br>}</pre> | no |
| <a name="input_body"></a> [body](#input\_body) | Definition of the API Gateway | `string` | n/a | yes |
| <a name="input_cors_configuration"></a> [cors\_configuration](#input\_cors\_configuration) | https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_api#cors_configuration | <pre>list(object({<br> allow_credentials = bool<br> allow_headers = list(string)<br> allow_methods = list(string)<br> allow_origins = list(string)<br> expose_headers = list(string)<br> max_age = number<br> }))</pre> | `[]` | no |
| <a name="input_domain_settings"></a> [domain\_settings](#input\_domain\_settings) | https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_domain_name | <pre>object({<br> enable = bool<br> domain_name = string<br> zone_id = string<br> certificate_arn = string<br> endpoint_type = string<br> security_policy = string<br> })</pre> | <pre>{<br> "certificate_arn": "",<br> "domain_name": "",<br> "enable": false,<br> "endpoint_type": "",<br> "security_policy": "",<br> "zone_id": ""<br>}</pre> | no |
| <a name="input_name"></a> [name](#input\_name) | Name of the API gateway deployment | `string` | n/a | yes |
| <a name="input_protocol_type"></a> [protocol\_type](#input\_protocol\_type) | https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/apigatewayv2_api#protocol_type | `string` | n/a | yes |
| <a name="input_stage"></a> [stage](#input\_stage) | Name of the stage to which deployed | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | Tags for resources | `map(string)` | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| aws\_apigatewayv2\_api | aws\_apigatewayv2\_api outputs |
| aws\_apigatewayv2\_api\_mapping | aws\_apigatewayv2\_api\_mapping outputs |
| aws\_apigatewayv2\_deployment | aws\_apigatewayv2\_deployment outputs |
| aws\_apigatewayv2\_domain\_name | aws\_apigatewayv2\_domain\_name outputs |
| aws\_apigatewayv2\_stage | aws\_apigatewayv2\_stage outputs |
| aws\_cloudwatch\_log\_group | aws\_cloudwatch\_log\_group outputs |
| aws\_route53\_record | aws\_route53\_record outputs |
| <a name="output_aws_apigatewayv2_api"></a> [aws\_apigatewayv2\_api](#output\_aws\_apigatewayv2\_api) | aws\_apigatewayv2\_api outputs |
| <a name="output_aws_apigatewayv2_api_mapping"></a> [aws\_apigatewayv2\_api\_mapping](#output\_aws\_apigatewayv2\_api\_mapping) | aws\_apigatewayv2\_api\_mapping outputs |
| <a name="output_aws_apigatewayv2_deployment"></a> [aws\_apigatewayv2\_deployment](#output\_aws\_apigatewayv2\_deployment) | aws\_apigatewayv2\_deployment outputs |
| <a name="output_aws_apigatewayv2_domain_name"></a> [aws\_apigatewayv2\_domain\_name](#output\_aws\_apigatewayv2\_domain\_name) | aws\_apigatewayv2\_domain\_name outputs |
| <a name="output_aws_apigatewayv2_stage"></a> [aws\_apigatewayv2\_stage](#output\_aws\_apigatewayv2\_stage) | aws\_apigatewayv2\_stage outputs |
| <a name="output_aws_cloudwatch_log_group"></a> [aws\_cloudwatch\_log\_group](#output\_aws\_cloudwatch\_log\_group) | aws\_cloudwatch\_log\_group outputs |
| <a name="output_aws_route53_record"></a> [aws\_route53\_record](#output\_aws\_route53\_record) | aws\_route53\_record outputs |
2 changes: 1 addition & 1 deletion apigv2/versions.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

terraform {
required_version = ">= 0.14"
required_version = "~> 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
Expand Down

0 comments on commit f2351d3

Please sign in to comment.