In reference to hashicorp/terraform#13271
Please support the option to use ssm run command. With the current level of ssm support I've not found a way use "run command". I.e. triggering a command on demand without using a association.
The target is to run a ssm document only once and not on a regular basis.
Hi @allcloud-jonathan! Thanks for this feature request.
Terraform's usual model is to maintain long-lived resources by making updates to them over time, and so one-off actions are not a natural fit for Terraform's model.
However, we could potentially support this by following a similar principle to null_resource
, which uses changes to an arbitrary user-provided map to signal when the resource must be replaced and thus the associated action re-taken. This might look like this:
# (not yet implemented, and may change before implementation)
resource "aws_ssm_send_command" "example" {
# Not sent to SSM API, but any change here will cause the resource to be replaced
# and thus the command to be re-run.
triggers = {
# ...
}
document_name = "${aws_ssm_document.example.name}"
instance_ids = "${aws_instance.example.*.id}"
}
The above is based on the SendCommand
API action, which I believe is the API function analogous to "Run Command" in the AWS Console.
The Terraform team at HashiCorp won't be able to work on this in the near future due to our focus being elsewhere, but we'd be happy to review a pull request if you or someone else has the time and motivation to implement it. Alternatively, if others would also like to see this implemented I'd encourage adding a :+1: upvote reaction to the original issue comment (not to _this_ comment), which we use as one of the inputs to prioritize work for the Terraform team.
馃憤
any update on this?
+1
馃憤
+1
+1
Most helpful comment
+1