Search code examples
amazon-web-servicesterraformterraform-import

How to fetch the target_id for aws_cloudwatch_event_target for a resource created manually from AWS console?


As per the Terraform documentation, the parameters needed for import of aws_cloudwatch_event_target are rule-name/target-id. If the resource is created manually and now it is to be imported into state file, how can I get the target-id from the console?


Solution

  • I don't see target-id in the console, however you can retrieve it with the following CLI call:

    $ aws events list-targets-by-rule --rule rule_name