Terraform module to create an API Gateway, each gateway will have different resources hanging off it so its more of an example than a module. It's 100% Open Source and licensed under the APACHE2.
This is just a very basic example.
Include this repository as a module in your existing Terraform code:
module "apigateway" {
source = "git::https://github.com/JamesWoolfenden/terraform-aws-apigateway.git?ref=87a8ac3b548615d170c9f56cb30e92f11667c85c"
allowed_range = var.allowed_range
common_tags = var.common_tags
lambda_function = aws_lambda_function.examplea
name = var.name
kms_key_id = aws_kms_key.example.arn
}
No requirements.
Name | Version |
---|---|
aws | n/a |
No modules.
Name | Description | Type | Default | Required |
---|---|---|---|---|
allowed_range | List of allowed CIDR | list(any) |
n/a | yes |
authorization | What Auth to use for the method | string |
"AWS_IAM" |
no |
common_tags | This is to help you add tags to your cloud objects | map(any) |
n/a | yes |
kms_key_id | The arn of the KMS key | any |
n/a | yes |
lambda_function | n/a | any |
n/a | yes |
name | value | string |
n/a | yes |
retention | n/a | number |
365 |
no |
stage_name | n/a | string |
"test" |
no |
validator | n/a | object({ |
{ |
no |
Name | Description |
---|---|
api | n/a |
url | n/a |
The Terraform resource required is:
resource "aws_iam_policy" "terraform_pike" {
name_prefix = "terraform_pike"
path = "/"
description = "Pike Autogenerated policy from IAC"
policy = jsonencode({
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"apigateway:DELETE",
"apigateway:GET",
"apigateway:PATCH",
"apigateway:POST",
"apigateway:PUT",
"apigateway:UpdateRestApiPolicy"
],
"Resource": [
"*"
]
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"iam:PassRole"
],
"Resource": [
"*"
]
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": [
"lambda:AddPermission",
"lambda:GetPolicy",
"lambda:RemovePermission"
],
"Resource": [
"*"
]
},
{
"Sid": "VisualEditor3",
"Effect": "Allow",
"Action": [
"logs:AssociateKmsKey",
"logs:CreateLogGroup",
"logs:DeleteLogGroup",
"logs:DeleteRetentionPolicy",
"logs:DescribeLogGroups",
"logs:DisassociateKmsKey",
"logs:ListTagsLogGroup",
"logs:PutRetentionPolicy"
],
"Resource": [
"*"
]
}
]
})
}
Check out these related projects.
- terraform-aws-codecommit - Storing ones code
Got a question?
File a GitHub issue.
Please use the issue tracker to report any bugs or file feature requests.
Copyright © 2019-2023 James Woolfenden
See LICENSE for full details.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.