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

Fresh install fails on terraform plan #26

Closed
alefr opened this issue Sep 30, 2021 · 5 comments
Closed

Fresh install fails on terraform plan #26

alefr opened this issue Sep 30, 2021 · 5 comments

Comments

@alefr
Copy link

alefr commented Sep 30, 2021

I tried following the getting started guide according to the README with fresh repos and as far as I can tell I have all prerequisites setup but it failed in a few ways a long the way.

I found issue #22 which helped me get passed the initial terraform init error by removing the ref as suggested and running with terraform init -upgrade.

But while @mrmarcsmith managed to run terraform plan I get the following error:

image

I take it it fails to fetch the needed iam user/role for the eks worker? Is this something that the terraform scripts are creating or am I failing in providing something?

As you probably can tell I'm new to Terraform and have tried looking for information to get around this but failed.

I've tried with different versions of the jx-eks module with the latest being 1.16.1.

As others have managed to bypass the plan step I take it I'm missing something, but I've gone through the readme several times and fail to see what, and being new to Terraform is kind of crippling in this case.

Happy to provide any other information needed.
Hoping anyone is able to see what I'm missing
Thanks

@alefr
Copy link
Author

alefr commented Sep 30, 2021

Borrowing from @mrmarchsmith good example of how to illustrate the changes made to the repo:
image

Exported the following env vars

export TF_VAR_jx_bot_token=<REDACTED>
export AWS_PROFILE=jx3

~/.aws/credentials file:

[default]
aws_access_key_id = <REDACTED>
aws_secret_access_key = <REDACTED>

[jx3]
aws_access_key_id = <REDACTED>
aws_secret_access_key = <REDACTED>

~/.aws/config:

[default]
region = eu-north-1
output = json

[profile jx3]
region = eu-north-1
output = json

@ankitm123
Copy link
Collaborator

I've tried with different versions of the jx-eks module with the latest being 1.16.1.

You need to delete the cached/lock files/folders in terraform folder from older versions

rm -rf .terraform* terraform.lock.hcl

@alefr
Copy link
Author

alefr commented Oct 6, 2021

rm -rf .terraform* terraform.lock.hcl

Yes, that did it in regards of the terraform init command.
Was now able to run it without adding -upgrade.

But did not change anything for terraform plan.
Still get the same error.

To start in the correct end.
The missing eks_worker (as I interpret it), is that an ami that the script is creating or do I need to prepopulate something in AWS?

The active AWS profile I'm running the scripts with should have full privilages in this case.

@ankitm123
Copy link
Collaborator

So the issue comes from this line:
https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/data.tf#L25
which calls this line: https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/locals.tf#L28
which in ur case is searching for amazon-eks-node-1.21.2-v*, but aws eks amis dont have the last digit in their AMI, so the query returns blank, and hence the error.
The name of the AMI is of the form amazon-eks-node-1.21-v*
image
Change ur cluster version to 1.21 and try, it should get past that error.

@alefr
Copy link
Author

alefr commented Oct 6, 2021

Yes, you're right, that solved it.

I was in there touching on the the lines, but my knowledge about how it all connected together was too low.
Thank you for the help @ankitm123 !

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