Pass resource value to user data script

Hello guys,

is it possible to pass resource values to my user data script? For example i want to pass the domain name of an aws instance (aws_instance.example.domain_name) to my user data script as a parameter a script.

Thanks in advance for your help.

Friendly regards,


This would not be possible as far as I can see, because the userdata is rendered prior to the resource being created.

But at lot of the information will also be accessible inside the instance through the instance metadata so the userdata script could use that as datasource.