resource "null_resource" "cli-inspector2" { provisioner "local-exec" { when = create command = "/bin/bash -c 'aws inspector2 enable --resource-types \"ECR\"'" } provisioner "local-exec" { when = destroy command = "/bin/bash -c 'aws inspector2 disable --resource-types \"ECR\"; sleep 30; aws inspector2 disable'" } }