Closed3
err: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetad
terraformerのimport処理にて以下のメッセージ
2024/02/23 01:17:08 aws importing... accessanalyzer
2024/02/23 01:17:08 aws error initializing resources in service accessanalyzer, err: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, failed to get API token, cannot get API token, operation error ec2imds: getToken, http response error StatusCode: 400, request to EC2 IMDS failed
actions実行時のenv
env:
TERRAFORM_CLI_PATH: /home/runner/work/_temp/0a5edf47-a849-419f-892d-9e8114a359aa
AWS_DEFAULT_REGION: ap-northeast-1
AWS_REGION: ap-northeast-1
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
AWS_SESSION_TOKEN: ***
REGION: ap-northeast-1
terraformのバージョン
Initializing provider plugins...
- Finding latest version of hashicorp/aws...
- Installing hashicorp/aws v5.38.0...
- Installed hashicorp/aws v5.38.0 (signed by HashiCorp)
以下を参考に --profile=""
を追加したところ解決
echo 'provider "aws" {}' > init.tf
terraform init
export resources=`terraformer import aws list`
set +e
for resource in ${resources} ; do terraformer import aws --resources=${resource} --regions=${REGION} --profile=""; done
ls -lR
このスクラップは2024/02/23にクローズされました