Skip to content

Commit 2998ecd

Browse files
authored
Merge branch 'main' into main
2 parents bd83103 + 302a4d5 commit 2998ecd

File tree

7 files changed

+40
-4
lines changed

7 files changed

+40
-4
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ Available targets:
206206
| Name | Description |
207207
|------|-------------|
208208
| <a name="output_arn"></a> [arn](#output\_arn) | ARN of the lambda function |
209+
| <a name="output_cloudwatch_log_group_name"></a> [cloudwatch\_log\_group\_name](#output\_cloudwatch\_log\_group\_name) | Name of Cloudwatch log group |
209210
| <a name="output_function_name"></a> [function\_name](#output\_function\_name) | Lambda function name |
210211
| <a name="output_invoke_arn"></a> [invoke\_arn](#output\_invoke\_arn) | Invoke ARN of the lambda function |
211212
| <a name="output_qualified_arn"></a> [qualified\_arn](#output\_qualified\_arn) | ARN identifying your Lambda Function Version (if versioning is enabled via publish = true) |

Diff for: examples/complete/main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ locals {
77

88
policy_arn_prefix = format(
99
"arn:%s:iam::%s:policy",
10-
join("", data.aws_partition.current.*.partition),
11-
join("", data.aws_caller_identity.current.*.account_id),
10+
join("", data.aws_partition.current[*].partition),
11+
join("", data.aws_caller_identity.current[*].account_id),
1212
)
1313

1414
policy_arn_inside = format("%s/%s", local.policy_arn_prefix, local.policy_name_inside)
@@ -77,7 +77,7 @@ resource "aws_iam_role_policy_attachment" "outside" {
7777
module "lambda" {
7878
source = "../.."
7979

80-
filename = join("", data.archive_file.lambda_zip.*.output_path)
80+
filename = join("", data.archive_file.lambda_zip[*].output_path)
8181
function_name = module.label.id
8282
handler = var.handler
8383
runtime = var.runtime

Diff for: examples/complete/outputs.tf

+15
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,18 @@ output "arn" {
22
description = "ARN of the lambda function"
33
value = module.lambda.arn
44
}
5+
6+
output "function_name" {
7+
description = "Lambda function name"
8+
value = module.lambda.function_name
9+
}
10+
11+
output "role_name" {
12+
description = "Lambda IAM role name"
13+
value = module.lambda.role_name
14+
}
15+
16+
output "cloudwatch_log_group_name" {
17+
description = "Name of Cloudwatch log group"
18+
value = module.lambda.cloudwatch_log_group_name
19+
}

Diff for: examples/complete/versions.tf

+4
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ terraform {
66
source = "hashicorp/aws"
77
version = ">= 3.0"
88
}
9+
archive = {
10+
source = "hashicorp/archive"
11+
version = ">= 2.0"
12+
}
913
}
1014
}

Diff for: main.tf

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ module "cloudwatch_log_group" {
99
source = "cloudposse/cloudwatch-logs/aws"
1010
version = "0.6.6"
1111

12+
enabled = module.this.enabled
13+
1214
iam_role_enabled = false
1315
kms_key_arn = var.cloudwatch_logs_kms_key_arn
1416
retention_in_days = var.cloudwatch_logs_retention_in_days
1517
name = "/aws/lambda/${var.function_name}"
16-
context = module.this.context
18+
19+
tags = module.this.tags
1720
}
1821

1922
resource "aws_lambda_function" "this" {

Diff for: outputs.tf

+5
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ output "role_arn" {
2727
description = "Lambda IAM role ARN"
2828
value = local.enabled ? aws_iam_role.this[0].arn : null
2929
}
30+
31+
output "cloudwatch_log_group_name" {
32+
description = "Name of Cloudwatch log group"
33+
value = local.enabled ? module.cloudwatch_log_group.log_group_name : null
34+
}

Diff for: test/src/examples_complete_test.go

+8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ func TestExamplesComplete(t *testing.T) {
3939

4040
// Run `terraform output` to get the value of an output variable
4141
arn := terraform.Output(t, terraformOptions, "arn")
42+
function_name := terraform.Output(t, terraformOptions, "function_name")
43+
role_name := terraform.Output(t, terraformOptions, "role_name")
44+
cloudwatch_log_group_name := terraform.Output(t, terraformOptions, "cloudwatch_log_group_name")
45+
46+
// Validate values returned by terraform
4247
assert.NotNil(t, arn)
48+
assert.Equal(t, "eg-ue2-test-" + randID + "-example-complete", function_name)
49+
assert.Equal(t, "eg-ue2-test-" + randID + "-example-complete-us-east-2", role_name)
50+
assert.Equal(t, "/aws/lambda/eg-ue2-test-" + randID + "-example-complete", cloudwatch_log_group_name)
4351

4452
sess := session.Must(session.NewSessionWithOptions(session.Options{
4553
SharedConfigState: session.SharedConfigEnable,

0 commit comments

Comments
 (0)