-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Revert "Revert "Upgrade to Terraform 0.12"" This reverts commit 6e56c46. * Upgrade tests to use terraform 0.12 * Convert tests to use json output in Terraform 0.12
- Loading branch information
Showing
11 changed files
with
784 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,40 @@ | ||
terraform { | ||
required_version = ">= 0.12" | ||
} | ||
|
||
resource "aws_lambda_function" "lambda_function" { | ||
s3_bucket = "${var.s3_bucket}" | ||
s3_key = "${var.s3_key}" | ||
function_name = "${var.function_name}" | ||
role = "${aws_iam_role.iam_for_lambda.arn}" | ||
handler = "${var.handler}" | ||
runtime = "${var.runtime}" | ||
timeout = "${var.timeout}" | ||
memory_size = "${var.memory_size}" | ||
reserved_concurrent_executions = "${var.reserved_concurrent_executions}" | ||
tags = "${var.tags}" | ||
s3_bucket = var.s3_bucket | ||
s3_key = var.s3_key | ||
function_name = var.function_name | ||
role = aws_iam_role.iam_for_lambda.arn | ||
handler = var.handler | ||
runtime = var.runtime | ||
timeout = var.timeout | ||
memory_size = var.memory_size | ||
reserved_concurrent_executions = var.reserved_concurrent_executions | ||
tags = var.tags | ||
|
||
vpc_config { | ||
subnet_ids = ["${var.subnet_ids}"] | ||
security_group_ids = ["${var.security_group_ids}"] | ||
} | ||
subnet_ids = var.subnet_ids | ||
security_group_ids = var.security_group_ids | ||
} | ||
|
||
environment { | ||
variables = "${var.lambda_env}" | ||
variables = var.lambda_env | ||
} | ||
} | ||
|
||
resource "aws_cloudwatch_log_group" "lambda_loggroup" { | ||
name = "/aws/lambda/${var.function_name}" | ||
retention_in_days = 7 | ||
depends_on = ["aws_lambda_function.lambda_function"] | ||
depends_on = [aws_lambda_function.lambda_function] | ||
} | ||
|
||
resource "aws_cloudwatch_log_subscription_filter" "kinesis_log_stream" { | ||
count = "${var.datadog_log_subscription_arn != "" ? 1 : 0}" | ||
count = var.datadog_log_subscription_arn != "" ? 1 : 0 | ||
name = "kinesis-log-stream-${var.function_name}" | ||
destination_arn = "${var.datadog_log_subscription_arn}" | ||
log_group_name = "${aws_cloudwatch_log_group.lambda_loggroup.name}" | ||
filter_pattern = "${var.log_subscription_filter}" | ||
depends_on = ["aws_lambda_function.lambda_function"] | ||
destination_arn = var.datadog_log_subscription_arn | ||
log_group_name = aws_cloudwatch_log_group.lambda_loggroup.name | ||
filter_pattern = var.log_subscription_filter | ||
depends_on = [aws_lambda_function.lambda_function] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
output "lambda_arn" { | ||
value = "${aws_lambda_function.lambda_function.arn}" | ||
value = aws_lambda_function.lambda_function.arn | ||
} | ||
|
||
output "lambda_function_name" { | ||
value = "${aws_lambda_function.lambda_function.function_name}" | ||
value = aws_lambda_function.lambda_function.function_name | ||
} | ||
|
||
output "lambda_iam_role_name" { | ||
value = "${aws_iam_role.iam_for_lambda.name}" | ||
value = aws_iam_role.iam_for_lambda.name | ||
} | ||
|
||
output "lambda_invoke_arn" { | ||
value = "${aws_lambda_function.lambda_function.invoke_arn}" | ||
value = aws_lambda_function.lambda_function.invoke_arn | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
{ | ||
"resource_changes": [ | ||
{ | ||
"address": "module.lambda.aws_cloudwatch_log_group.lambda_loggroup", | ||
"module_address": "module.lambda", | ||
"mode": "managed", | ||
"type": "aws_cloudwatch_log_group", | ||
"name": "lambda_loggroup", | ||
"provider_name": "aws", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"before": null, | ||
"after": { | ||
"kms_key_id": null, | ||
"name": "/aws/lambda/check_lambda_function", | ||
"name_prefix": null, | ||
"retention_in_days": 7, | ||
"tags": null | ||
}, | ||
"after_unknown": { | ||
"arn": true, | ||
"id": true | ||
} | ||
} | ||
}, | ||
{ | ||
"address": "module.lambda.aws_iam_role.iam_for_lambda", | ||
"module_address": "module.lambda", | ||
"mode": "managed", | ||
"type": "aws_iam_role", | ||
"name": "iam_for_lambda", | ||
"provider_name": "aws", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"before": null, | ||
"after": { | ||
"assume_role_policy": "{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Action\": \"sts:AssumeRole\",\n \"Principal\": {\n \"Service\": \"lambda.amazonaws.com\"\n },\n \"Effect\": \"Allow\"\n }\n ]\n}\n", | ||
"description": null, | ||
"force_detach_policies": false, | ||
"max_session_duration": 3600, | ||
"name_prefix": "check_lambda_function", | ||
"path": "/", | ||
"permissions_boundary": null, | ||
"tags": null | ||
}, | ||
"after_unknown": { | ||
"arn": true, | ||
"create_date": true, | ||
"id": true, | ||
"name": true, | ||
"unique_id": true | ||
} | ||
} | ||
}, | ||
{ | ||
"address": "module.lambda.aws_iam_role_policy.lambda_policy", | ||
"module_address": "module.lambda", | ||
"mode": "managed", | ||
"type": "aws_iam_role_policy", | ||
"name": "lambda_policy", | ||
"provider_name": "aws", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"before": null, | ||
"after": { | ||
"name": "policy", | ||
"name_prefix": null, | ||
"policy": "{\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": [\n \"logs:CreateLogGroup\",\n \"logs:CreateLogStream\",\n \"logs:PutLogEvents\"\n ],\n \"Resource\": \"arn:aws:logs:*:*:*\"\n }\n ]\n}\n" | ||
}, | ||
"after_unknown": { | ||
"id": true, | ||
"role": true | ||
} | ||
} | ||
}, | ||
{ | ||
"address": "module.lambda.aws_lambda_function.lambda_function", | ||
"module_address": "module.lambda", | ||
"mode": "managed", | ||
"type": "aws_lambda_function", | ||
"name": "lambda_function", | ||
"provider_name": "aws", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"before": null, | ||
"after": { | ||
"dead_letter_config": [], | ||
"description": null, | ||
"environment": [ | ||
{ | ||
"variables": null | ||
} | ||
], | ||
"filename": null, | ||
"function_name": "check_lambda_function", | ||
"handler": "some_handler", | ||
"kms_key_arn": null, | ||
"layers": null, | ||
"memory_size": 128, | ||
"publish": false, | ||
"reserved_concurrent_executions": -1, | ||
"runtime": "python3.7", | ||
"s3_bucket": "cdflow-lambda-releases", | ||
"s3_key": "s3key.zip", | ||
"s3_object_version": null, | ||
"tags": null, | ||
"timeout": 3, | ||
"timeouts": null, | ||
"vpc_config": [ | ||
{ | ||
"security_group_ids": null, | ||
"subnet_ids": null | ||
} | ||
] | ||
}, | ||
"after_unknown": { | ||
"arn": true, | ||
"dead_letter_config": [], | ||
"environment": [ | ||
{} | ||
], | ||
"id": true, | ||
"invoke_arn": true, | ||
"last_modified": true, | ||
"qualified_arn": true, | ||
"role": true, | ||
"source_code_hash": true, | ||
"source_code_size": true, | ||
"tracing_config": true, | ||
"version": true, | ||
"vpc_config": [ | ||
{ | ||
"vpc_id": true | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.