Skip to content

Instantly share code, notes, and snippets.

@MatthewJDavis
Created February 4, 2021 14:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save MatthewJDavis/985f5e6dec08b7f70d3b87327f5ac546 to your computer and use it in GitHub Desktop.
Save MatthewJDavis/985f5e6dec08b7f70d3b87327f5ac546 to your computer and use it in GitHub Desktop.
Get ID of AWS cloudwatch event target
# To use the terraform import aws_cloudwatch_event_target provider, we need the rule name and target ID. To find the target ID,
# run the following with the AWS cli.
aws events list-targets-by-rule --rule "ruleName"
# This will return the following and the ID can be used to import the resource.
#{
# "Targets": [
# {
# "Id": "Id123456789",
# "Arn": "arn:aws:lambda:eu-west-1:123456789:function:Name"
# }
# ]
#}
# Can then import the cloudwatch event target with:
terraform import aws_cloudwatch_event_target.daily_lambda ruleName/Id123456789
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment