We already went through REX-Ray manual setup so it should be relatively easy to add it to Packer and Terraform configurations. We'll add to Packer the static parts that do not depend on runtime resources and the rest to Terraform. What that means is that Packer will create AMIs with REX-Ray installed and Terraform will create its configuration and start the service.
Let's take a look at the terraform/aws-full/packer-ubuntu-docker-rexray.json (https://github.com/vfarcic/cloud-provisioning/blob/master/terraform/aws-full/packer-ubuntu-docker-rexray.json) file:
cat packer-ubuntu-docker-rexray.json
The only difference when compared with the terraform/aws-full/packer-ubuntu-docker.json (https://github.com/vfarcic/cloud-provisioning/blob/master/terraform/aws-full/packer-ubuntu-docker.json) config we used before is an additional command in the shell provisioner...