Skip to content

Commit c0a8be8

Browse files
jamengualcloudpossebotnitrocode
authored
Attach VPC and XRay Roles when needed (#16)
* Fixing lambda function iam role logic Co-authored-by: cloudpossebot <[email protected]> Co-authored-by: nitrocode <[email protected]>
1 parent 71c329c commit c0a8be8

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,12 +402,14 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
402402
### Contributors
403403

404404
<!-- markdownlint-disable -->
405-
| [![Matt Calhoun][mcalhoun_avatar]][mcalhoun_homepage]<br/>[Matt Calhoun][mcalhoun_homepage] |
406-
|---|
405+
| [![Matt Calhoun][mcalhoun_avatar]][mcalhoun_homepage]<br/>[Matt Calhoun][mcalhoun_homepage] | [![PePe Amengual][jamengual_avatar]][jamengual_homepage]<br/>[PePe Amengual][jamengual_homepage] |
406+
|---|---|
407407
<!-- markdownlint-restore -->
408408

409409
[mcalhoun_homepage]: https://github.com/mcalhoun
410410
[mcalhoun_avatar]: https://img.cloudposse.com/150x150/https://github.com/mcalhoun.png
411+
[jamengual_homepage]: https://github.com/jamengual
412+
[jamengual_avatar]: https://img.cloudposse.com/150x150/https://github.com/jamengual.png
411413

412414
[![README Footer][readme_footer_img]][readme_footer_link]
413415
[![Beacon][beacon]][website]

README.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,5 @@ include:
8787
contributors:
8888
- name: "Matt Calhoun"
8989
github: "mcalhoun"
90+
- name: "PePe Amengual"
91+
github: "jamengual"

iam-role.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ resource "aws_iam_role_policy_attachment" "cloudwatch_insights" {
3232
}
3333

3434
resource "aws_iam_role_policy_attachment" "vpc_access" {
35-
count = local.enabled && var.vpc_config == null ? 1 : 0
35+
count = local.enabled && try(length(var.vpc_config), 0) > 0 ? 1 : 0
3636

3737
policy_arn = "arn:${local.partition}:iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"
3838
role = aws_iam_role.this[0].name
3939
}
4040

4141
resource "aws_iam_role_policy_attachment" "xray" {
42-
count = local.enabled && var.tracing_config_mode == null ? 1 : 0
42+
count = local.enabled && try(length(var.tracing_config_mode), 0) > 0 ? 1 : 0
4343

4444
policy_arn = "arn:${local.partition}:iam::aws:policy/AWSXRayDaemonWriteAccess"
4545
role = aws_iam_role.this[0].name

0 commit comments

Comments
 (0)