forked from clouddrove/terraform-aws-api-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.yaml
188 lines (161 loc) · 6.24 KB
/
README.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
---
#
# 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: "APACHE"
# Canonical GitHub repo
github_repo: clouddrove/terraform-aws-api-gateway
# Badges to display
badges:
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v1.1.7-green"
url: "https://www.terraform.io"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"
- name: "tfsec"
image: "https://github.com/clouddrove/terraform-aws-api-gateway/actions/workflows/tfsec.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-api-gateway/actions/workflows/tfsec.yml"
- name: "static-checks"
image: "https://github.com/clouddrove/terraform-aws-api-gateway/actions/workflows/terraform.yml/badge.svg"
url: "https://github.com/clouddrove/terraform-aws-api-gateway/actions/workflows/terraform.yml"
# description of this project
# yamllint disable rule:line-length
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
# yamllint disable rule:line-length
usage: |-
Here are examples of how you can use this module in your inventory structure:
### Basic Example
```hcl
module "api-gateway" {
source = "clouddrove/api-gateway/aws"
version = "1.0.1"
name = "api-gateway"
environment = "test"
label_order = ["name", "environment"]
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 = "clouddrove/api-gateway/aws"
version = "1.0.1"
name = "api-gateway"
environment = "test"
label_order = ["name", "environment"]
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"]
}
```