Skip to content

Commit

Permalink
add propoagte_tags option to cloudwatch event target configuration (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Nesbit <[email protected]>
  • Loading branch information
rnesbit and robertnesbit authored Jan 31, 2022
1 parent d7f64e3 commit 2e96de1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ In order to run all checks at any point run the following command:

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.50.0 |

## Modules

Expand Down Expand Up @@ -88,6 +88,7 @@ No modules.
| <a name="input_event_target_ecs_target_assign_public_ip"></a> [event\_target\_ecs\_target\_assign\_public\_ip](#input\_event\_target\_ecs\_target\_assign\_public\_ip) | (Optional) Assign a public IP address to the ENI. Default false. | `bool` | `false` | no |
| <a name="input_event_target_ecs_target_group"></a> [event\_target\_ecs\_target\_group](#input\_event\_target\_ecs\_target\_group) | (Optional) Specifies an ECS task group for the task. The maximum length is 255 characters. | `any` | `null` | no |
| <a name="input_event_target_ecs_target_platform_version"></a> [event\_target\_ecs\_target\_platform\_version](#input\_event\_target\_ecs\_target\_platform\_version) | (Optional) Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as 1.1.0. For more information about valid platform versions, see AWS Fargate Platform Versions. Default to LATEST | `string` | `"LATEST"` | no |
| <a name="input_event_target_ecs_target_propagate_tags"></a> [event\_target\_ecs\_target\_propagate\_tags](#input\_event\_target\_ecs\_target\_propagate\_tags) | (Optional) Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. | `bool` | `false` | no |
| <a name="input_event_target_ecs_target_security_groups"></a> [event\_target\_ecs\_target\_security\_groups](#input\_event\_target\_ecs\_target\_security\_groups) | (Optional) The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. | `list(any)` | `null` | no |
| <a name="input_event_target_ecs_target_subnets"></a> [event\_target\_ecs\_target\_subnets](#input\_event\_target\_ecs\_target\_subnets) | The subnets associated with the task or service. | `list(any)` | n/a | yes |
| <a name="input_event_target_ecs_target_task_count"></a> [event\_target\_ecs\_target\_task\_count](#input\_event\_target\_ecs\_target\_task\_count) | (Optional) The number of tasks to create based on the TaskDefinition. The default is 1. | `number` | `1` | no |
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ resource "aws_cloudwatch_event_target" "ecs_scheduled_task" {
platform_version = var.event_target_ecs_target_platform_version
task_count = var.event_target_ecs_target_task_count
task_definition_arn = var.event_target_ecs_target_task_definition_arn
propagate_tags = var.event_target_ecs_target_propagate_tags

network_configuration {
subnets = var.event_target_ecs_target_subnets
Expand Down
8 changes: 7 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,10 @@ variable "event_target_ecs_target_assign_public_ip" {
description = "(Optional) Assign a public IP address to the ENI. Default false."
type = bool
default = false
}
}

variable "event_target_ecs_target_propagate_tags" {
description = "(Optional) Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated."
type = bool

This comment has been minimized.

Copy link
@evilr00t

evilr00t Feb 1, 2022

should be string

default = false

This comment has been minimized.

Copy link
@evilr00t

evilr00t Feb 1, 2022

should be null if we want to omit that - otherwise TASK_DEFINITION to use tags from the task.

}

4 comments on commit 2e96de1

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’° Infracost estimate: monthly cost will increase by $146 πŸ“ˆ

Project Previous New Diff
cn-terraform/terraform-aws-ecs-...e-scheduled-task/examples/test $0 $146 +$146
Infracost output
Project: cn-terraform/terraform-aws-ecs-fargate-scheduled-task/examples/test

+ module.base-network.aws_eip.nat_eip[0]
  +$3.65

    + IP address (if unused)
      +$3.65

+ module.base-network.aws_eip.nat_eip[1]
  +$3.65

    + IP address (if unused)
      +$3.65

+ module.base-network.aws_eip.nat_eip[2]
  +$3.65

    + IP address (if unused)
      +$3.65

+ module.base-network.aws_eip.nat_eip[3]
  +$3.65

    + IP address (if unused)
      +$3.65

+ module.base-network.aws_nat_gateway.nat_gw[0]
  +$32.85

    + NAT gateway
      +$32.85

    + Data processed
      Monthly cost depends on usage
        +$0.045 per GB

+ module.base-network.aws_nat_gateway.nat_gw[1]
  +$32.85

    + NAT gateway
      +$32.85

    + Data processed
      Monthly cost depends on usage
        +$0.045 per GB

+ module.base-network.aws_nat_gateway.nat_gw[2]
  +$32.85

    + NAT gateway
      +$32.85

    + Data processed
      Monthly cost depends on usage
        +$0.045 per GB

+ module.base-network.aws_nat_gateway.nat_gw[3]
  +$32.85

    + NAT gateway
      +$32.85

    + Data processed
      Monthly cost depends on usage
        +$0.045 per GB

Monthly cost change for cn-terraform/terraform-aws-ecs-fargate-scheduled-task/examples/test
Amount:  +$146 ($0.00 β†’ $146)

──────────────────────────────────
Key: ~ changed, + added, - removed

50 cloud resources were detected, rerun with --show-skipped to see details:
βˆ™ 8 were estimated, 4 include usage-based costs, see https://infracost.io/usage-file
βˆ™ 42 were free

Add cost estimates to your pull requests: https://infracost.io/cicd
Is this comment useful? Yes, No

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’° Infracost estimate: monthly cost will increase by $146 πŸ“ˆ

Project Previous New Diff
cn-terraform/terraform-aws-ecs-...e-scheduled-task/examples/test $0 $146 +$146
Infracost output
Project: cn-terraform/terraform-aws-ecs-fargate-scheduled-task/examples/test

+ module.base-network.aws_eip.nat_eip[0]
  +$3.65

    + IP address (if unused)
      +$3.65

+ module.base-network.aws_eip.nat_eip[1]
  +$3.65

    + IP address (if unused)
      +$3.65

+ module.base-network.aws_eip.nat_eip[2]
  +$3.65

    + IP address (if unused)
      +$3.65

+ module.base-network.aws_eip.nat_eip[3]
  +$3.65

    + IP address (if unused)
      +$3.65

+ module.base-network.aws_nat_gateway.nat_gw[0]
  +$32.85

    + NAT gateway
      +$32.85

    + Data processed
      Monthly cost depends on usage
        +$0.045 per GB

+ module.base-network.aws_nat_gateway.nat_gw[1]
  +$32.85

    + NAT gateway
      +$32.85

    + Data processed
      Monthly cost depends on usage
        +$0.045 per GB

+ module.base-network.aws_nat_gateway.nat_gw[2]
  +$32.85

    + NAT gateway
      +$32.85

    + Data processed
      Monthly cost depends on usage
        +$0.045 per GB

+ module.base-network.aws_nat_gateway.nat_gw[3]
  +$32.85

    + NAT gateway
      +$32.85

    + Data processed
      Monthly cost depends on usage
        +$0.045 per GB

Monthly cost change for cn-terraform/terraform-aws-ecs-fargate-scheduled-task/examples/test
Amount:  +$146 ($0.00 β†’ $146)

──────────────────────────────────
Key: ~ changed, + added, - removed

50 cloud resources were detected, rerun with --show-skipped to see details:
βˆ™ 8 were estimated, 4 include usage-based costs, see https://infracost.io/usage-file
βˆ™ 42 were free

Add cost estimates to your pull requests: https://infracost.io/cicd
Is this comment useful? Yes, No

@evilr00t
Copy link

@evilr00t evilr00t commented on 2e96de1 Feb 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this introduces regression:

β•·
β”‚ Error: expected ecs_target.0.propagate_tags to be one of [TASK_DEFINITION], got false
β”‚
β”‚   with module.us-east-1.module.scheduled_task.aws_cloudwatch_event_target.ecs_scheduled_task,
β”‚   on .terraform/modules/us-east-1.scheduled_task/main.tf line 72, in resource "aws_cloudwatch_event_target" "ecs_scheduled_task":
β”‚   72:     propagate_tags      = var.event_target_ecs_target_propagate_tags
β”‚

quick fix:

event_target_ecs_target_propagate_tags      = null

@netaskd
Copy link

@netaskd netaskd commented on 2e96de1 Feb 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  event_target_ecs_target_propagate_tags = null
β”‚ Error: Invalid value for input variable
β”‚ 
β”‚ The environment variable TF_VAR_event_target_ecs_target_propagate_tags does
β”‚ not contain a valid value for variable
β”‚ "event_target_ecs_target_propagate_tags": a bool is required.

Please sign in to comment.