Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to output public_dns/public_ip value when requesting spot instances #1

Closed
vithursant opened this issue Apr 29, 2018 · 3 comments

Comments

@vithursant
Copy link
Owner

vithursant commented Apr 29, 2018

Adding the snippet below to the outputs.tf file:

output "public-dns" {
  value = ["${aws_spot_instance_request.aws_dl_custom_spot.*.public_dns}"]
}


output "ssh-cmd" {
  value = ["${format("ssh -i %s%s.pem ubuntu@%s", var.ssh-key-dir,
    aws_spot_instance_request.aws_dl_custom_spot.*.key_name,
    aws_spot_instance_request.aws_dl_custom_spot.*.public_dns)}"]
}

Results in the following error when executing the command terraform apply:

* output.public-ip: Resource 'aws_spot_instance_request.aws_dl_custom_spot' does not have attribute 'public_dns' for variable 'aws_spot_instance_request.aws_dl_custom_spot.*.public_dns'
* output.ssh-cmd: Resource 'aws_spot_instance_request.aws_dl_custom_spot' does not have attribute 'public_dns' for variable

This issue is linked to hashicorp/terraform-provider-aws#4313.

@dennisobrien
Copy link

I had the same issue. I added wait_for_fulfillment = true to the resource "aws_spot_instance_request" "aws_dl_custom_spot" section and it seems to have fixed it. Can you try adding that and let us know if it fixed it for you?

@dennisobrien
Copy link

By the way -- thanks for this working example project! It saved me a lot of time.

@vithursant
Copy link
Owner Author

No problem @dennisobrien I will close this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants