hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.77k stars 9.12k forks source link

Customizing EC2 instance scheduled event notifications to include instance tags #14333

Open SpComb opened 4 years ago

SpComb commented 4 years ago

Community Note

Description

By default, the email notifications that AWS sends for EC2 instance scheduled events only include the instance ID. However, it is also possible to configure these to include instance tags, making it easier to keep track of these events: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html#customizing_scheduled_event_notifications

This seems to be a regional per-account configuration.

New or Affected Resource(s)

Potential Terraform Configuration

resource "aws_instance_event_notification_attributes" "main" {
  instance_tag_attributes {
    instance_tag_keys = ["Name", "Environment"]
  }
}

References

handlerbot commented 4 years ago

FYI, my testing shows this to be per-region, not global.

seanorama commented 3 years ago

The documentation confirms that this is per region: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html

The tags that you choose to include apply to all resources (instances and Dedicated Hosts) in the selected Region. To customize event notifications in other Regions, first select the required Region and then perform the following steps.

SpComb commented 3 years ago

Apologies for the poor choice of wording and resulting confusion, I should have written "regional".

Fixed/edited in the issue description.

aaron-hastings-travelport commented 2 years ago

This is something we would like to see also, so that we can ensure full automation of our AWS accounts without having to do this manual step.

datfinesoul commented 3 months ago

It would be great if this could be added to the provider at some point with both of these options configurable.

{
  "IncludeAllTagsOfInstance": true|false,
  "InstanceTagKeys": ["string", ...]
}