Pass ip adress to user data that contains a bash script

Hey guys! I am trying to run a bash script in user_data that prompts the user for a domain

DOMAIN=$1
if [ -z $1 ]
then
echo ""
printf "Enter the domain you want to host BookStack and press [ENTER]\nExamples: my-site.com or docs.my-site.com\n"
read DOMAIN
fi

I would like to pass my EIP, aws_eip.one.public_ip as an input to the script.

Here is the actual commands that are run in the user_data section.

#!/bin/bash
      sudo apt install wget
       # Ensure you have read the above information about what this script does before executing these commands.
      sudo apt install -y wget
      
      # Download the script
      wget https://raw.githubusercontent.com/BookStackApp/devops/main/scripts/installation-ubuntu-18.04.sh

      # Make it executable
      chmod a+x installation-ubuntu-18.04.sh

      # Run the script with admin permissions
      sudo ./installation-ubuntu-18.04.sh $ (this is where I would like to pass my eip variable) 

Thanks for your help!

Depending on how user_data is embedded within the terraform code, there a different options. You could utilise templatefile() or in case of an inline definition, just add the variable as an argument:

user_data = <<USERDATA
        .... script ...
       sudo ....sh ${aws_eip.myeip.public_ip}
USERDATA