I was trying to trigger Terraform destroy for specific target via API . I was used below payload .
{ "type": "runs", "data":{"attributes": { "is-destroy":true, "target-addrs": "module.mvdev-eks-xx", "message": "Triggered Destroy" }, "relationships": { "workspace": { "data": { "type": "workspaces", "id": "ws-XXXXXXXXAJiw" } } } } }
run this below curl call
curl --request POST --url https://$TFE_HOST/api/v2/runs \
--header 'Authorization: Bearer $TFE_TOKEN' \
--header 'Content-Type: application/vnd.api+json' \
--data @data.json
I see still see it trying to destroy all the resource instead of target mentioned . Is anything wrong here ?
Reference : Runs - API Docs - Terraform Cloud | Terraform | HashiCorp Developer
data.attributes.target-addrs