Skip to content

Commit

Permalink
ci: Updated pre-commit hooks, added terraform_validate (claranet#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
antonbabenko authored Nov 2, 2020
1 parent 962e524 commit c272944
Showing 3 changed files with 83 additions and 94 deletions.
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:
@@ -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
@@ -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"
@@ -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
@@ -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

0 comments on commit c272944

Please sign in to comment.