You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create an ECS resource in AWS china without changing any values in the module, but the ARN for principal is wrong in aws china. Even in china it has to be amazonaws.com not amazonaws.com.cn
If your request is for a new feature, please use the Feature request template.
✋ I have searched the open/closed issues and my issue is not listed.
⚠️ Note
Before you submit an issue, please perform the following first:
Yes, I performed all these steps.
Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
Re-initialize the project root to pull down modules: terraform init
Re-attempt your terraform plan or apply and check if the issue still persists
Versions
Module version [Required]:
Downloading registry.terraform.io/terraform-aws-modules/alb/aws 8.7.0 for example.alb...
Downloading registry.terraform.io/terraform-aws-modules/security-group/aws 4.17.2 for example.alb_sg...
Downloading registry.terraform.io/terraform-aws-modules/ecs/aws 5.2.0 for example.ecs...
Downloading registry.terraform.io/terraform-aws-modules/ecs/aws 5.2.2 for example.ecs_cluster...
Installing hashicorp/aws v5.22.0...
Installed hashicorp/aws v5.22.0 (signed by HashiCorp)
module "example" {
source = "../../module"
cluster_name = "harish"
environment = "test"
owner = "harish-test"
mic_project = "example"
# region = "cn-north-1" # the region where the S3 bucket is located
vpc_id = "vpc-0990f986c095751a4" # This will come from the vpc module
container_name = "ecsdemo-frontend"
namespace = "example1"
services = {}
additonal_tags = {
"test" = "test"
}
}
It created ecs tasks in AWS Commerical without any error.
Actual behavior
In AWS China it's throwing the error because the code is using dns_suffix from data "aws_partition" "current" {} This add amazonaws.com.cn instead of amazonaws.com
Error: creating IAM Role (harish-test-20231024220051883700000004): MalformedPolicyDocument: Invalid principal in policy: "SERVICE":"ecs-tasks.amazonaws.com.cn"
│ status code: 400, request id: 5dfe4253-bfdc-4017-b79b-71e69648eede
│
│ with module.example.module.ecs.module.cluster.aws_iam_role.task_exec[0],
│ on .terraform/modules/example.ecs/modules/cluster/main.tf line 202, in resource "aws_iam_role" "task_exec":
│ 202: resource "aws_iam_role" "task_exec" {
│
╵
╷
│ Error: creating IAM Role (harish-test-20231024220051882500000001): MalformedPolicyDocument: Invalid principal in policy: "SERVICE":"ecs-tasks.amazonaws.com.cn"
│ status code: 400, request id: 86bb015b-c085-48b0-9175-cb47bdaa3e89
│
│ with module.example.module.ecs_cluster.aws_iam_role.task_exec[0],
│ on .terraform/modules/example.ecs_cluster/modules/cluster/main.tf line 202, in resource "aws_iam_role" "task_exec":
│ 202: resource "aws_iam_role" "task_exec" {
│
Terminal Output Screenshot(s)
## Additional context
The text was updated successfully, but these errors were encountered:
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
I am trying to create an ECS resource in AWS china without changing any values in the module, but the ARN for principal is wrong in aws china. Even in china it has to be
amazonaws.com
notamazonaws.com.cn
If your request is for a new feature, please use the
Feature request
template.Before you submit an issue, please perform the following first:
Yes, I performed all these steps.
.terraform
directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/
terraform init
Versions
Downloading registry.terraform.io/terraform-aws-modules/alb/aws 8.7.0 for example.alb...
Downloading registry.terraform.io/terraform-aws-modules/security-group/aws 4.17.2 for example.alb_sg...
Downloading registry.terraform.io/terraform-aws-modules/ecs/aws 5.2.0 for example.ecs...
Downloading registry.terraform.io/terraform-aws-modules/ecs/aws 5.2.2 for example.ecs_cluster...
Terraform v1.5.7
on darwin_amd64
Reproduction Code [Required]
provider.tf
example.tf
../../module/main.tf
Steps to reproduce the behavior:
No
Expected behavior
It created ecs tasks in AWS Commerical without any error.
Actual behavior
In AWS China it's throwing the error because the code is using
dns_suffix
fromdata "aws_partition" "current" {}
This addamazonaws.com.cn
instead ofamazonaws.com
Terminal Output Screenshot(s)
The text was updated successfully, but these errors were encountered: