Here’s how to add userdata in Terraform.

user_data = filebase64("${path.module}/example.sh")