mumoshu / terraform-provider-eksctl

Manage AWS EKS clusters using Terraform and eksctl
Apache License 2.0
234 stars 44 forks source link

parse iamidentitymapping error when creating or refreshing cluster in using new eksctl #62

Closed charlie-fox closed 1 year ago

charlie-fox commented 2 years ago

What happened?

using eksctl new version, like 0.89.0

eksclt terraform provider would return such error when refreshing or creating EKS cluster

Error: creating cluster: can not get iamidentitymapping from eks cluster: parse iamidentitymapping : invalid character '-' after top-level value

dig some more details, I found it would be cause new output of ecksctl new version.

When we execute eksctl get iamidentitymapping --cluster my-cluster-name -o json --region my-region

it would response

2022-03-31 14:59:54 [ℹ]  eksctl version 0.89.0
2022-03-31 14:59:54 [ℹ]  using region us-west-2
[
   xxxx real json output 
]

if tools is using the json output to parse aws_auth information, it would make them failed.

samroy92 commented 2 years ago

I have been having this same issue, I downgraded my eksctl version arbitrarily to 0.77.0 and it fixed this error for me. Versions 0.90,0.89, and 0.88 are all affected in my testing.

Here are my Terraform debug errors: [ERROR] vertex "eksctl_cluster.cluster" error: reading cluster: reading aws-auth via eksctl get iamidentitymaping: can not get iamidentitymapping from eks cluster: parse iamidentitymapping : invalid character '-' after top-level value Error: reading cluster: reading aws-auth via eksctl get iamidentitymaping: can not get iamidentitymapping from eks cluster: parse iamidentitymapping : invalid character '-' after top-level value

I am using MacOS with homebrew, to downgrade the version I found a previous commit of the brew formula and used this command: curl https://raw.githubusercontent.com/Homebrew/homebrew-core/19e81b3c456c0afb8abede830e38bad28be44b09/Formula/eksctl.rb > $(find $(brew --repository) -name eksctl.rb) && brew reinstall eksctl

This works as a workaround!

mumoshu commented 2 years ago

Hey! Have you already reported this to eksctl? If eksctl0.88+ has a regression that wraps any json output with some prefixes for the logger of their choice, I consider it's a bug in eksctl, because that effectively breaks the meaning of -o json.

samroy92 commented 2 years ago

Hey! Have you already reported this to eksctl? If eksctl0.88+ has a regression that wraps any json output with some prefixes the logger of their choice, I consider it's a bug in eksctl, because that effectively breaks the meaning of -o json.

It looks like they are working on it here: https://github.com/weaveworks/eksctl/issues/5038. I will comment to provide additional context in that thread!

charlie-fox commented 2 years ago

Hi @mumoshu , I have reported this issue to eksctl on first time, but also file case here to let terraform-provider-eksctl users be aware it.

charlie-fox commented 2 years ago

Hi @mumoshu , eksctl team would not change the output format, and they think the output from stdout is still structured and can be parsed, FYI https://github.com/weaveworks/eksctl/issues/5038

mumoshu commented 2 years ago

@charlie-fox Thanks for sharing! I didn't realize this provider captured both stdout and stderr. Yes, I eksctl's behavior seems correct and we should fix this provider to only capture stdout!

benjiro commented 1 year ago

This is now resolved in release 0.17.0