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

Use region as tenant_name if not set #330

Merged
merged 1 commit into from
May 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion huaweicloud/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,14 @@ func init() {
}

func configureProvider(d *schema.ResourceData, terraformVersion string) (interface{}, error) {
var tenant_name string
// Use region as tenant_name if it's not set
if v, ok := d.GetOk("tenant_name"); ok && v.(string) != "" {
tenant_name = v.(string)
} else {
tenant_name = d.Get("region").(string)
}

config := Config{
AccessKey: d.Get("access_key").(string),
SecretKey: d.Get("secret_key").(string),
Expand All @@ -394,7 +402,7 @@ func configureProvider(d *schema.ResourceData, terraformVersion string) (interfa
Region: d.Get("region").(string),
Token: d.Get("token").(string),
TenantID: d.Get("tenant_id").(string),
TenantName: d.Get("tenant_name").(string),
TenantName: tenant_name,
Username: d.Get("user_name").(string),
UserID: d.Get("user_id").(string),
AgencyName: d.Get("agency_name").(string),
Expand Down