How to run a specific terminal command after successful terraform apply
?
More specifically, I would like to save output variables to some S3 bucket (the state is already in S3, but it contains sensitive output, so the bucket has a restricted access), and while this feature request is still open, I'm using this workaround:
terraform apply && terraform output -json | aws s3 cp - s3://bucket/output.json
But would it be possible to force terraform to call this command automatically?
Makefile
with the commandterraform apply && terraform output ...
for deployment target. It is ok, but not elegant. Also it adds build time, as terraform output takes considerable time when the state is in the S3 bucket. – Vladimir