grem11n / terraform-aws-vpc-peering

Terraform module to setup VPC peering connection
https://registry.terraform.io/modules/grem11n/vpc-peering/aws/latest
Apache License 2.0
126 stars 91 forks source link

[bug] Autoaccept for peering doesn't work properly #21

Closed ghost closed 5 years ago

ghost commented 5 years ago

Terraform 0.11

While peering two VPCs in the same account I've got an error:

Error: Error applying plan:

2 error(s) occurred:

* aws_vpc_peering_connection_options.this: 1 error(s) occurred:

* aws_vpc_peering_connection_options.this: Error modifying VPC Peering Connection Options: OperationNotPermitted: Peering pcx-12345 is not active. Peering options can be added only to active peerings.
        status code: 400, request id: 15835518-b196-497a-8f4f-1c9926decb8d
* aws_vpc_peering_connection_options.accepter: 1 error(s) occurred:

* aws_vpc_peering_connection_options.accepter: Error modifying VPC Peering Connection Options: OperationNotPermitted: Peering pcx-12345 is not active. Peering options can be added only to active peerings.
        status code: 400, request id: 56cba658-4fe0-4e17-bb97-009a2524366b

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

I should go to AWS console, accept the new peering connection and repeat terraform apply, after that it works fine. I'm not sure that the common problem or just in my case but it might be helpful for someone.

grem11n commented 5 years ago

@AmetPreply, which version of the module do you use?

ghost commented 5 years ago

The latest one from 0.11 branch. It's hard to reproduce this error, so, unfortunately, I can't provide more details.

grem11n commented 5 years ago

So, is it an occasional issue or a permanent one? Please, make sure that you have auto_accept_peering = true option enabled. Also, it worth to run Terraform with TF_LOG=DEBUG for verbosity. If it's an occasional error it might be due to some API calls to AWS fails for whatever reason. Some documentation about the DEBUG mode

ghost commented 5 years ago

Cool, thanks. I'll close this issue, will reopen if get it again.