data "template_file" "asg_user_data" {
template = "asg_user_data.tpl"
vars {
hub_url = "${var.hub_url}"
password = "${var.admin_password}"
}
}
resource "aws_instance" "winrm" {
# The connection block tells our provisioner how to
# communicate with the resource (instance)
connection {
type = "winrm"
user = "Administrator"
password = "${var.admin_password}"
# set from default of 5m to 10m to avoid winrm timeout
timeout = "10m"
}
instance_type = "t2.micro"
ami = "${data.aws_ami.amazon_windows_2016.image_id}"
# The name of our SSH keypair you've created and downloaded
# from the AWS console.
#
# https://console.aws.amazon.com/ec2/v2/home?region=us-west-2#KeyPairs
#
key_name = "${var.key_name}"
# Our Security group to allow WinRM access
security_groups = ["selenium-grid-hub-sg"]
# Note that terraform uses Go WinRM which doesn't support https at this time. If server is not on a private network,
# recommend bootstraping Chef via user_data. See asg_user_data.tpl for an example on how to do that.
user_data = "${data.template_file.asg_user_data.rendered}"
}
Steps to generate:
Created a selenium hub. node with centos machines on aws with terraform
Trying to create the windows instance with terraform mentioned in an example in choco-selenium-grid
Modified the terraform script, just creating plan node with script mentioned in asg_user_data.tpl
can you please check and let us know is that example works ?