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

Terraform apply fails first, then works 2nd time in some cases #1

Open
focusaurus opened this issue Jul 13, 2017 · 3 comments
Open

Comments

@focusaurus
Copy link
Owner

Sometimes a terraform apply run does some things successfully but fails before completing. Then I rerun it again immediately without any other changes/actions and it succeeds. My strong hunch about this is that most likely my resource dependencies are not modeled correctly in terraform. I have seen this in at least 2 specific cases.

  1. Fresh install into a blank slate AWS account.
aws_api_gateway_deployment.hexagonal-lambda-dev: Error creating API Gateway Deployment: BadRequestException: The REST API doesn't contain any methods
	status code: 400, request id: redacted
  1. Creating a new lambda function.
Error applying plan:

1 error(s) occurred:

* aws_iam_role_policy_attachment.post-up: 1 error(s) occurred:

* aws_iam_role_policy_attachment.post-up: [WARN] Error attaching policy arn:aws:iam::REDACTED:policy/terraform-redacted to IAM Role post-up: NoSuchEntity: Role not found for post-up
	status code: 404, request id: redacted
@focusaurus
Copy link
Owner Author

@cludden Might you be willing to review the terraform stuff in this repo? Mostly just for generally "am I doing this right" but also if you have experienced some of the dependency issues when using modules and have suggestions I'd love to hear them.

@cludden
Copy link

cludden commented Sep 28, 2017

@focusaurus I'm not exactly sure what's causing you're errors, but I pushed an example project that I through together based on past projects. Maybe you can spot the differences. Hope it helps

@focusaurus
Copy link
Owner Author

Thanks! Already picked up a nice tip with aws_caller_identity. Will study in more detail soon too.

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

No branches or pull requests

2 participants