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

Support for External mode of profile #7424

Open
zhangcly opened this issue Jul 4, 2024 · 0 comments
Open

Support for External mode of profile #7424

zhangcly opened this issue Jul 4, 2024 · 0 comments

Comments

@zhangcly
Copy link

zhangcly commented Jul 4, 2024

Hi there,

I am a developer that is trying to migrate our code from AWS to AliCloud. When I use the external mode profile in terraform-provider-alicloud, it gives me an error.

Terraform Version

v1.5.7

Affected Resource(s)

Terraform Configuration Files

terraform file:

provider "alicloud" {
  profile = "product"
}
data "alicloud_caller_identity" "current" {
}
output "current_user_arn" {
  value = "${data.alicloud_caller_identity.current.id}"
}

~/.aliyun/config.json:

{
    "name": "product",
    "mode": "External",
    "access_key_id": "",
    "access_key_secret": "",
    "sts_token": "",
    "sts_region": "",
    "ram_role_name": "",
    "ram_role_arn": "",
    "ram_session_name": "",
    "source_profile": "",
    "private_key": "",
    "key_pair_name": "",
    "expired_seconds": 0,
    "verified": "",
    "region_id": "cn-beijing",
    "output_format": "json",
    "language": "zh",
    "site": "",
    "retry_timeout": 0,
    "connect_timeout": 0,
    "retry_count": 0,
    "process_command": "a command",
    "credentials_uri": "",
    "oidc_provider_arn": "",
    "oidc_token_file": ""
}

Debug Output

Panic Output

joe@JoedeMacBook-Air test % terraform apply         
╷
│ Error: configuring Terraform Alibaba Cloud Provider: no valid credential sources for Terraform Alibaba Cloud Provider found.
│ 
│ Please see https://registry.terraform.io/providers/aliyun/alicloud/latest/docs#authentication
│ for more information about providing credentials.
│ 
│   with provider["registry.terraform.io/hashicorp/alicloud"],
│   on test.tf line 1, in provider "alicloud":
│    1: provider "alicloud" {
│ 
╵

Expected Behavior

When I use aliyun config runing with the config file ~/.aliyun/config.json, it works

joe@JoedeMacBook-Air test % aliyun sts GetCallerIdentity --profile product
{
	"AccountId": "xxxx",
	"Arn": "acs:ram::xxxx:assumed-role/daytona-developer/daytona",
	"IdentityType": "AssumedRoleUser",
	"PrincipalId": "xxxx:daytona",
	"RequestId": "xxxx",
	"RoleId": "xxxx"
}

and I expect that when running terraform scripts with this profile, it can aslo work.

Actual Behavior

When running terraform scripts with this profile, error occured with the message "Error: configuring Terraform Alibaba Cloud Provider: no valid credential sources for Terraform Alibaba Cloud Provider found.".

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform init
  2. terraform apply

Important Factoids

References

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

1 participant