Skip to content

Commit c272944

Browse files
authored
ci: Updated pre-commit hooks, added terraform_validate (claranet#68)
1 parent 962e524 commit c272944

File tree

3 files changed

+83
-94
lines changed

3 files changed

+83
-94
lines changed

.pre-commit-config.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.41.0
3+
rev: v1.44.0
44
hooks:
55
- id: terraform_fmt
6+
- id: terraform_validate
67
- id: terraform_docs
78
- id: terraform_tflint
89
args:
@@ -20,6 +21,6 @@ repos:
2021
- '--args=--only=terraform_standard_module_structure'
2122
- '--args=--only=terraform_workspace_remote'
2223
- repo: git://github.com/pre-commit/pre-commit-hooks
23-
rev: v3.2.0
24+
rev: v3.3.0
2425
hooks:
2526
- id: check-merge-conflict

examples/alias/main.tf

+76-88
Original file line numberDiff line numberDiff line change
@@ -12,95 +12,62 @@ provider "aws" {
1212
resource "random_pet" "this" {
1313
length = 2
1414
}
15-
#
16-
#module "lambda_function" {
17-
# source = "../../"
18-
#
19-
# function_name = "${random_pet.this.id}-lambda"
20-
# handler = "index.lambda_handler"
21-
# runtime = "python3.8"
22-
# publish = true
23-
#
24-
# source_path = "${path.module}/../fixtures/python3.8-app1"
25-
# hash_extra = "yo"
26-
#
27-
# create_async_event_config = true
28-
# maximum_event_age_in_seconds = 100
29-
#
30-
# provisioned_concurrent_executions = 1
31-
#
32-
# allowed_triggers = {
33-
# APIGatewayAny = {
34-
# service = "apigateway"
35-
# arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0"
36-
# }
37-
# }
38-
#
39-
# # current version
40-
# # create_current_version_async_event_config = false
41-
# # create_current_version_triggers = false
42-
#
43-
# # unqualified alias
44-
# # create_unqualified_alias_async_event_config = false
45-
# # create_unqualified_alias_triggers = false
46-
#}
47-
#
48-
#module "alias_no_refresh" {
49-
# source = "../../modules/alias"
50-
#
51-
# create = true
52-
# refresh_alias = false
53-
#
54-
# name = "current-no-refresh"
55-
#
56-
# function_name = module.lambda_function.this_lambda_function_name
57-
# function_version = module.lambda_function.this_lambda_function_version
58-
#
59-
# # create_version_async_event_config = false
60-
# # create_async_event_config = true
61-
# # maximum_event_age_in_seconds = 130
62-
#
63-
# allowed_triggers = {
64-
# AnotherAPIGatewayAny = { # keys should be unique
65-
# service = "apigateway"
66-
# arn = "arn:aws:execute-api:eu-west-1:135367859851:abcdedfgse"
67-
# }
68-
# }
69-
#
70-
#}
71-
#
72-
#module "alias_refresh" {
73-
# source = "../../modules/alias"
74-
#
75-
# create = true
76-
# refresh_alias = true
77-
#
78-
# name = "current-with-refresh"
79-
#
80-
# function_name = module.lambda_function.this_lambda_function_name
81-
#}
82-
#
83-
#module "alias_existing" {
84-
# source = "../../modules/alias"
85-
#
86-
# create = true
87-
# use_existing_alias = true
88-
#
89-
# name = module.alias_refresh.this_lambda_alias_name
90-
# function_name = module.lambda_function.this_lambda_function_name
91-
#
92-
# create_async_event_config = true
93-
# maximum_event_age_in_seconds = 100
94-
#
95-
# allowed_triggers = {
96-
# ThirdAPIGatewayAny = {
97-
# service = "apigateway"
98-
# arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0"
99-
# }
100-
# }
101-
#
102-
#}
10315

16+
module "lambda_function" {
17+
source = "../../"
18+
19+
function_name = "${random_pet.this.id}-lambda"
20+
handler = "index.lambda_handler"
21+
runtime = "python3.8"
22+
publish = true
23+
24+
source_path = "${path.module}/../fixtures/python3.8-app1"
25+
hash_extra = "yo"
26+
27+
create_async_event_config = true
28+
maximum_event_age_in_seconds = 100
29+
30+
provisioned_concurrent_executions = 1
31+
32+
allowed_triggers = {
33+
APIGatewayAny = {
34+
service = "apigateway"
35+
arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0"
36+
}
37+
}
38+
39+
# current version
40+
# create_current_version_async_event_config = false
41+
# create_current_version_triggers = false
42+
43+
# unqualified alias
44+
# create_unqualified_alias_async_event_config = false
45+
# create_unqualified_alias_triggers = false
46+
}
47+
48+
module "alias_no_refresh" {
49+
source = "../../modules/alias"
50+
51+
create = true
52+
refresh_alias = false
53+
54+
name = "current-no-refresh"
55+
56+
function_name = module.lambda_function.this_lambda_function_name
57+
function_version = module.lambda_function.this_lambda_function_version
58+
59+
# create_version_async_event_config = false
60+
# create_async_event_config = true
61+
# maximum_event_age_in_seconds = 130
62+
63+
allowed_triggers = {
64+
AnotherAPIGatewayAny = { # keys should be unique
65+
service = "apigateway"
66+
arn = "arn:aws:execute-api:eu-west-1:135367859851:abcdedfgse"
67+
}
68+
}
69+
70+
}
10471

10572
module "alias_refresh" {
10673
source = "../../modules/alias"
@@ -112,3 +79,24 @@ module "alias_refresh" {
11279

11380
function_name = module.lambda_function.this_lambda_function_name
11481
}
82+
83+
module "alias_existing" {
84+
source = "../../modules/alias"
85+
86+
create = true
87+
use_existing_alias = true
88+
89+
name = module.alias_refresh.this_lambda_alias_name
90+
function_name = module.lambda_function.this_lambda_function_name
91+
92+
create_async_event_config = true
93+
maximum_event_age_in_seconds = 100
94+
95+
allowed_triggers = {
96+
ThirdAPIGatewayAny = {
97+
service = "apigateway"
98+
arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0"
99+
}
100+
}
101+
102+
}

package.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ data "external" "archive_prepare" {
2525
with_ssh_agent = var.docker_with_ssh_agent
2626
}) : null
2727

28-
artifacts_dir = var.artifacts_dir
29-
runtime = var.runtime
30-
source_path = jsonencode(var.source_path)
31-
hash_extra = var.hash_extra
28+
artifacts_dir = var.artifacts_dir
29+
runtime = var.runtime
30+
source_path = jsonencode(var.source_path)
31+
hash_extra = var.hash_extra
3232
hash_extra_paths = jsonencode(
3333
[
3434
# Temporary fix when building from multiple locations

0 commit comments

Comments
 (0)