Terraform: Can't get AWS instance id to associate EIP with.

Created on 1 Jun 2017  ยท  5Comments  ยท  Source: hashicorp/terraform

Hi guys,

I parsed Google and what I found is to get AWS instance_id it is enough to use the construction as follow:
"${aws_instance.test_terraform.id}"

But whenever I try to use it this way I get an error as follow:

  • aws_instance.test_terraform: aws_instance.test_terraform: self reference not allowed: "aws_instance.test_terraform.id"

Doesn't matter if I try to save it into a variable or use from resource "aws_eip_association".
Always get this error.

But this way of doing that stuff even described here:
https://www.terraform.io/docs/providers/aws/r/eip_association.html

Can anyone help me please with this and whet I am doing wrong?

Regards,
Taras.

provideaws question waiting-response

Most helpful comment

Hi @stack72
I have just reviewed my config and found very simple but not very obvious error. :)
I tried to associate EIP inside of instance creation block.
Just moved it outside and everything works as expected.

Sorry to disturb you.

Regards,
Taras.

All 5 comments

Hi @fog1985

Please can you post your terraform config (minus any secrets) and we can try and help you with what you want to do

Thanks

Paul

Hi @stack72
I have just reviewed my config and found very simple but not very obvious error. :)
I tried to associate EIP inside of instance creation block.
Just moved it outside and everything works as expected.

Sorry to disturb you.

Regards,
Taras.

Nothing to apologise for @fog1985 :)

Glad you got it working

Paul

@fog1985 thanks for posting this!

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

c4milo picture c4milo  ยท  3Comments

ketzacoatl picture ketzacoatl  ยท  3Comments

thebenwaters picture thebenwaters  ยท  3Comments

shanmugakarna picture shanmugakarna  ยท  3Comments

rkulagowski picture rkulagowski  ยท  3Comments