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

make sure use correct endpoint for China cluster #17182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 6 additions & 1 deletion util/pkg/vfs/s3fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,14 @@ func (p *S3Path) GetHTTPsUrl(dualstack bool) (string, error) {
var url string
if dualstack {
url = fmt.Sprintf("https://s3.dualstack.%s.amazonaws.com/%s/%s", bucketDetails.region, bucketDetails.name, p.Key())
if strings.Contains(bucketDetails.region, "cn-") {
url = fmt.Sprintf("https://s3.dualstack.%s.amazonaws.com.cn/%s/%s", bucketDetails.region, bucketDetails.name, p.Key())
}
} else {
url = fmt.Sprintf("https://%s.s3.%s.amazonaws.com/%s", bucketDetails.name, bucketDetails.region, p.Key())
if strings.Contains(bucketDetails.region, "cn-") {
url = fmt.Sprintf("https://%s.s3.%s.amazonaws.com.cn/%s", bucketDetails.name, bucketDetails.region, p.Key())
}
}
return strings.TrimSuffix(url, "/"), nil
}
Expand Down Expand Up @@ -773,7 +779,6 @@ func (p *S3Path) RenderTerraform(w *terraformWriter.TerraformWriter, name string
}
return w.RenderResource("aws_s3_object", name, tf)
}

}

// AWSErrorCode returns the aws error code, if it is an smity.APIError, otherwise ""
Expand Down
Loading