Terraform EC2 userdata and variables

Hi Team,

I’m looking for some documentation and examples for multiple use cases on how to use variables in AWS EC2 userdata when deploying with terraform…

if variables (a) defined in terraform the declaration in userdata is as ${a}…

there are some case script inside userdata create some variables and how to reference it to avoid terraform to report that as un-referenced variables?

Please do the needful