Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita Dugar committed Sep 23, 2019
0 parents commit bfb61af
Show file tree
Hide file tree
Showing 16 changed files with 1,584 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ignored files
*.tfstate
*.tfstate.backup
.terraform
.idea
*.iml
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.12.0
hooks:
- id: terraform_fmt

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
- id: check-merge-conflict
- id: trailing-whitespace
- id: check-yaml
- id: check-added-large-files
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Cloud Drove

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export GENIE_PATH ?= $(shell 'pwd')/../../../genie

include $(GENIE_PATH)/Makefile
354 changes: 354 additions & 0 deletions README.md

Large diffs are not rendered by default.

179 changes: 179 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#

# Name of this project
name : Terraform AWS Api Gateway

# License of this project
license: "MIT"

# Canonical GitHub repo
github_repo: clouddrove/terraform-aws-api-gateway

# Badges to display
badges:
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v0.12-green"
url: "https://www.terraform.io"
- name: "Licence"
image: "https://img.shields.io/badge/License-MIT-blue.svg"
url: "LICENSE.md"

# description of this project
description: |-
Terraform module to create Route53 resource on AWS for create api gateway with it's basic elements.
# extra content
# please not remove these two If you need add more
include:
- "terraform.md"

# How to use this project
usage : |-
Here are examples of how you can use this module in your inventory structure:
### Basic Example
```hcl
module "api-gateway" {
source = "git::https://github.com/clouddrove/terraform-aws-api-gateway.git?ref=tags/0.12.0"
name = "api-gateway"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]
enabled = true
# Api Gateway Resource
path_parts = ["mytestresource", "mytestresource1"]
# Api Gateway Method
method_enabled = true
http_methods = ["GET", "GET"]
# Api Gateway Integration
integration_types = ["MOCK", "AWS_PROXY"]
integration_http_methods = ["POST", "POST"]
uri = ["", "arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:xxxxxxxxxx:function:test/invocations"]
integration_request_parameters = [{
"integration.request.header.X-Authorization" = "'static'"
}, {}]
request_templates = [{
"application/xml" = <<EOF
{
"body" : $input.json('$')
}
EOF
}, {}]
# Api Gateway Method Response
status_codes = [200, 200]
response_models = [{ "application/json" = "Empty" }, {}]
response_parameters = [{ "method.response.header.X-Some-Header" = true }, {}]
# Api Gateway Integration Response
integration_response_parameters = [{ "method.response.header.X-Some-Header" = "integration.response.header.X-Some-Other-Header" }, {}]
response_templates = [{
"application/xml" = <<EOF
#set($inputRoot = $input.path('$'))
<?xml version="1.0" encoding="UTF-8"?>
<message>
$inputRoot.body
</message>
EOF
}, {}]
# Api Gateway Deployment
deployment_enabled = true
stage_name = "deploy"
# Api Gateway Stage
stage_enabled = true
stage_names = ["qa", "dev"]
}
```
### Complete Example
```hcl
module "api-gateway" {
source = "git::https://github.com/clouddrove/terraform-aws-api-gateway.git?ref=tags/0.12.0"
name = "api-gateway"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]
enabled = true
# Api Gateway Resource
path_parts = ["mytestresource", "mytestresource1"]
# Api Gateway Method
method_enabled = true
http_methods = ["GET", "GET"]
# Api Gateway Integration
integration_types = ["MOCK", "AWS_PROXY"]
integration_http_methods = ["POST", "POST"]
uri = ["", "arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:xxxxxxxxxx:function:test/invocations"]
integration_request_parameters = [{
"integration.request.header.X-Authorization" = "'static'"
}, {}]
request_templates = [{
"application/xml" = <<EOF
{
"body" : $input.json('$')
}
EOF
}, {}]
# Api Gateway Method Response
status_codes = [200, 200]
response_models = [{ "application/json" = "Empty" }, {}]
response_parameters = [{ "method.response.header.X-Some-Header" = true }, {}]
# Api Gateway Integration Response
integration_response_parameters = [{ "method.response.header.X-Some-Header" = "integration.response.header.X-Some-Other-Header" }, {}]
response_templates = [{
"application/xml" = <<EOF
#set($inputRoot = $input.path('$'))
<?xml version="1.0" encoding="UTF-8"?>
<message>
$inputRoot.body
</message>
EOF
}, {}]
# Api Gateway Deployment
deployment_enabled = true
stage_name = "deploy"
# Api Gateway Stage
stage_enabled = true
stage_names = ["qa", "dev"]
# Api Gateway Client Certificate
cert_enabled = true
cert_description = "clouddrove"
# Api Gateway Authorizer
authorizer_count = 2
authorizer_names = ["test", "test1"]
authorizer_uri = ["arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:xxxxxxxxxx:function:test/invocations", "arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:xxxxxxxxxx:function:test/invocations"]
authorizer_credentials = ["arn:aws:iam::xxxxxxxxxx:role/lambda-role", "arn:aws:iam::xxxxxxxxxx:role/lambda-role"]
identity_sources = ["method.request.header.Authorization", "method.request.header.Authorization"]
identity_validation_expressions = ["sfdgfhghrfdsdas", ""]
authorizer_types = ["TOKEN", "REQUEST"]
# Api Gateway Gateway Response
gateway_response_count = 2
response_types = ["UNAUTHORIZED", "RESOURCE_NOT_FOUND"]
gateway_status_codes = ["401", "404"]
# Api Gateway Model
model_count = 2
model_names = ["test", "test1"]
content_types = ["application/json", "application/json"]
# Api Gateway Api Key
key_count = 2
key_names = ["test", "test1"]
}
```
59 changes: 59 additions & 0 deletions _example/basic/example.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
provider "aws" {
region = "eu-west-1"
}

module "api-gateway" {
source = "git::https://github.com/clouddrove/terraform-aws-api-gateway.git?ref=tags/0.12.0"
name = "api-gateway"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]
enabled = true

# Api Gateway Resource
path_parts = ["mytestresource", "mytestresource1"]

# Api Gateway Method
method_enabled = true
http_methods = ["GET", "GET"]

# Api Gateway Integration
integration_types = ["MOCK", "AWS_PROXY"]
integration_http_methods = ["POST", "POST"]
uri = ["", "arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:xxxxxxxxxxxx:function:test/invocations"]
integration_request_parameters = [{
"integration.request.header.X-Authorization" = "'static'"
}, {}]
request_templates = [{
"application/xml" = <<EOF
{
"body" : $input.json('$')
}
EOF
}, {}]

# Api Gateway Method Response
status_codes = [200, 200]
response_models = [{ "application/json" = "Empty" }, {}]
response_parameters = [{ "method.response.header.X-Some-Header" = true }, {}]

# Api Gateway Integration Response
integration_response_parameters = [{ "method.response.header.X-Some-Header" = "integration.response.header.X-Some-Other-Header" }, {}]
response_templates = [{
"application/xml" = <<EOF
#set($inputRoot = $input.path('$'))
<?xml version="1.0" encoding="UTF-8"?>
<message>
$inputRoot.body
</message>
EOF
}, {}]

# Api Gateway Deployment
deployment_enabled = true
stage_name = "deploy"

# Api Gateway Stage
stage_enabled = true
stage_names = ["qa", "dev"]
}
6 changes: 6 additions & 0 deletions _example/basic/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Module : Route53
# Description : Terraform module to create Route53 resource on AWS for managing queue.
output "arn" {
value = module.api-gateway.*.execution_arn
description = "The Execution ARN of the REST API."
}
87 changes: 87 additions & 0 deletions _example/complete/example.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
provider "aws" {
region = "eu-west-1"
}

module "api-gateway" {
source = "git::https://github.com/clouddrove/terraform-aws-api-gateway.git?ref=tags/0.12.0"

name = "api-gateway"
application = "clouddrove"
environment = "test"
label_order = ["environment", "name", "application"]
enabled = true

# Api Gateway Resource
path_parts = ["mytestresource", "mytestresource1"]

# Api Gateway Method
method_enabled = true
http_methods = ["GET", "GET"]

# Api Gateway Integration
integration_types = ["MOCK", "AWS_PROXY"]
integration_http_methods = ["POST", "POST"]
uri = ["", "arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:xxxxxxxxxx:function:test/invocations"]
integration_request_parameters = [{
"integration.request.header.X-Authorization" = "'static'"
}, {}]
request_templates = [{
"application/xml" = <<EOF
{
"body" : $input.json('$')
}
EOF
}, {}]

# Api Gateway Method Response
status_codes = [200, 200]
response_models = [{ "application/json" = "Empty" }, {}]
response_parameters = [{ "method.response.header.X-Some-Header" = true }, {}]

# Api Gateway Integration Response
integration_response_parameters = [{ "method.response.header.X-Some-Header" = "integration.response.header.X-Some-Other-Header" }, {}]
response_templates = [{
"application/xml" = <<EOF
#set($inputRoot = $input.path('$'))
<?xml version="1.0" encoding="UTF-8"?>
<message>
$inputRoot.body
</message>
EOF
}, {}]

# Api Gateway Deployment
deployment_enabled = true
stage_name = "deploy"

# Api Gateway Stage
stage_enabled = true
stage_names = ["qa", "dev"]

# Api Gateway Client Certificate
cert_enabled = true
cert_description = "clouddrove"

# Api Gateway Authorizer
authorizer_count = 2
authorizer_names = ["test", "test1"]
authorizer_uri = ["arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:xxxxxxxxxx:function:test/invocations", "arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:xxxxxxxxxx:function:test/invocations"]
authorizer_credentials = ["arn:aws:iam::xxxxxxxxxx:role/lambda-role", "arn:aws:iam::xxxxxxxxxx:role/lambda-role"]
identity_sources = ["method.request.header.Authorization", "method.request.header.Authorization"]
identity_validation_expressions = ["sfdgfhghrfdsdas", ""]
authorizer_types = ["TOKEN", "REQUEST"]

# Api Gateway Gateway Response
gateway_response_count = 2
response_types = ["UNAUTHORIZED", "RESOURCE_NOT_FOUND"]
gateway_status_codes = ["401", "404"]

# Api Gateway Model
model_count = 2
model_names = ["test", "test1"]
content_types = ["application/json", "application/json"]

# Api Gateway Api Key
key_count = 2
key_names = ["test", "test1"]
}
6 changes: 6 additions & 0 deletions _example/complete/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Module : Route53
# Description : Terraform module to create Route53 resource on AWS for managing queue.
output "arn" {
value = module.api-gateway.*.execution_arn
description = "The Execution ARN of the REST API."
}
Loading

0 comments on commit bfb61af

Please sign in to comment.