Is it possible to fail an aws_instance creation if script passed into user_data fails to run? e.g., with exit 1?
I have a null_resource that uses depends_on [aws_instance.myVM] to post a JSON to the instance, and I need that depends_on to fail when the user_data script fails.
I don’t think that’s possible; as far as AWS (and therefore Terraform) is concerned, the instance is alive once it is in the ‘running’ state, which I know from experience can be before your user_data configuration has even finished.