Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Updated pre-commit hooks, added terraform_validate #68

Merged
merged 1 commit into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.41.0
rev: v1.44.0
hooks:
- id: terraform_fmt
- id: terraform_validate
- id: terraform_docs
- id: terraform_tflint
args:
Expand All @@ -20,6 +21,6 @@ repos:
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v3.3.0
hooks:
- id: check-merge-conflict
164 changes: 76 additions & 88 deletions examples/alias/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,95 +12,62 @@ provider "aws" {
resource "random_pet" "this" {
length = 2
}
#
#module "lambda_function" {
# source = "../../"
#
# function_name = "${random_pet.this.id}-lambda"
# handler = "index.lambda_handler"
# runtime = "python3.8"
# publish = true
#
# source_path = "${path.module}/../fixtures/python3.8-app1"
# hash_extra = "yo"
#
# create_async_event_config = true
# maximum_event_age_in_seconds = 100
#
# provisioned_concurrent_executions = 1
#
# allowed_triggers = {
# APIGatewayAny = {
# service = "apigateway"
# arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0"
# }
# }
#
# # current version
# # create_current_version_async_event_config = false
# # create_current_version_triggers = false
#
# # unqualified alias
# # create_unqualified_alias_async_event_config = false
# # create_unqualified_alias_triggers = false
#}
#
#module "alias_no_refresh" {
# source = "../../modules/alias"
#
# create = true
# refresh_alias = false
#
# name = "current-no-refresh"
#
# function_name = module.lambda_function.this_lambda_function_name
# function_version = module.lambda_function.this_lambda_function_version
#
# # create_version_async_event_config = false
# # create_async_event_config = true
# # maximum_event_age_in_seconds = 130
#
# allowed_triggers = {
# AnotherAPIGatewayAny = { # keys should be unique
# service = "apigateway"
# arn = "arn:aws:execute-api:eu-west-1:135367859851:abcdedfgse"
# }
# }
#
#}
#
#module "alias_refresh" {
# source = "../../modules/alias"
#
# create = true
# refresh_alias = true
#
# name = "current-with-refresh"
#
# function_name = module.lambda_function.this_lambda_function_name
#}
#
#module "alias_existing" {
# source = "../../modules/alias"
#
# create = true
# use_existing_alias = true
#
# name = module.alias_refresh.this_lambda_alias_name
# function_name = module.lambda_function.this_lambda_function_name
#
# create_async_event_config = true
# maximum_event_age_in_seconds = 100
#
# allowed_triggers = {
# ThirdAPIGatewayAny = {
# service = "apigateway"
# arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0"
# }
# }
#
#}

module "lambda_function" {
source = "../../"

function_name = "${random_pet.this.id}-lambda"
handler = "index.lambda_handler"
runtime = "python3.8"
publish = true

source_path = "${path.module}/../fixtures/python3.8-app1"
hash_extra = "yo"

create_async_event_config = true
maximum_event_age_in_seconds = 100

provisioned_concurrent_executions = 1

allowed_triggers = {
APIGatewayAny = {
service = "apigateway"
arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0"
}
}

# current version
# create_current_version_async_event_config = false
# create_current_version_triggers = false

# unqualified alias
# create_unqualified_alias_async_event_config = false
# create_unqualified_alias_triggers = false
}

module "alias_no_refresh" {
source = "../../modules/alias"

create = true
refresh_alias = false

name = "current-no-refresh"

function_name = module.lambda_function.this_lambda_function_name
function_version = module.lambda_function.this_lambda_function_version

# create_version_async_event_config = false
# create_async_event_config = true
# maximum_event_age_in_seconds = 130

allowed_triggers = {
AnotherAPIGatewayAny = { # keys should be unique
service = "apigateway"
arn = "arn:aws:execute-api:eu-west-1:135367859851:abcdedfgse"
}
}

}

module "alias_refresh" {
source = "../../modules/alias"
Expand All @@ -112,3 +79,24 @@ module "alias_refresh" {

function_name = module.lambda_function.this_lambda_function_name
}

module "alias_existing" {
source = "../../modules/alias"

create = true
use_existing_alias = true

name = module.alias_refresh.this_lambda_alias_name
function_name = module.lambda_function.this_lambda_function_name

create_async_event_config = true
maximum_event_age_in_seconds = 100

allowed_triggers = {
ThirdAPIGatewayAny = {
service = "apigateway"
arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0"
}
}

}
8 changes: 4 additions & 4 deletions package.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ data "external" "archive_prepare" {
with_ssh_agent = var.docker_with_ssh_agent
}) : null

artifacts_dir = var.artifacts_dir
runtime = var.runtime
source_path = jsonencode(var.source_path)
hash_extra = var.hash_extra
artifacts_dir = var.artifacts_dir
runtime = var.runtime
source_path = jsonencode(var.source_path)
hash_extra = var.hash_extra
hash_extra_paths = jsonencode(
[
# Temporary fix when building from multiple locations
Expand Down