Open Venkat2512 opened 1 year ago
I am having the same issue, is there any workaround for this @Venkat2512
Unfortunately, no. Any luck on your side?
hi @ewbankkit any suggestions for this one please.
Similar issue here on AWS account under control tower, works fine on non control tower AWS account
│ Error: AWS SDK Go Service Operation Incomplete │ │ with module.cloud_watch_alarms.awscc_chatbot_slack_channel_configuration.slack_integration[0], │ on ../../../cloudwatchalarm/main.tf line 31, in resource "awscc_chatbot_slack_channel_configuration" "slack_integration": │ 31: resource "awscc_chatbot_slack_channel_configuration" "slack_integration" { │ │ Waiting for Cloud Control API service CreateResource operation completion returned: waiter state transitioned to │ FAILED. StatusMessage: Cross-account pass role is not allowed. (Service: AWSChatbot; Status Code: 403; Error │ Code: AccessDeniedException; Request ID: c84dc7eb-7e1f-41ef-8216-d43e57ebdd53; Proxy: null). ErrorCode: │ GeneralServiceException provider = terraform-provider-aws_v5.14.0_x5: on darwin_arm64
Turns out to be an AWS IAM cross account configuration issue rather than TF resolved by adding a provider stanza for awscc with profile and region settings
Thanks @corrigac
For clarity, this is the stanza I added successfully:
provider "awscc" {
# As we use some resources not yet in the aws terraform provider
# see https://registry.terraform.io/providers/hashicorp/awscc/latest/docs
region = "us-east-1"
assume_role = {
role_arn = local.aws_provider_iam_role_arn
}
}
where the role arn is based on which control tower account we are deploying into
@Venkat2512 are you able to incorporate the suggested fix above?
this is working for me.
`provider "aws" { region = var.region }
provider "awscc" { region = var.region }
provider "awscc" { region = var.region alias = "modeling" assume_role = { role_arn = "Destination assumed role ARN" } }
terraform { required_version = ">= 0.15"
required_providers { aws = { source = "hashicorp/aws" version = ">= 4.9.0" } awscc = { source = "hashicorp/awscc" version = ">= 0.55.0" } }
backend "s3" {
} }
resource "awscc_databrew_job" "databrew" { name = "brewjob" role_arn = aws_iam_role.databrew_role[0].arn type = "PROFILE" provider = awscc.modeling }
data "aws_iam_policy_document" "databrew_assume_role_document" { version = "2012-10-17" statement { effect = "Allow" principals { type = "Service" identifiers = ["databrew.amazonaws.com"] } actions = [ "sts:AssumeRole" ] } }
resource "aws_iam_role" "databrew_role" { name = "testrole" assume_role_policy = data.aws_iam_policy_document.databrew_assume_role_document.json }
resource "aws_iam_role_policy" "databrew_role_policy" { name = "testpolicy" role = aws_iam_role.databrew_role.id policy = data.aws_iam_policy_document.databrew_policy.json }
data "aws_iam_policy_document" "databrew_policy" { version = "2012-10-17" statement { sid = "ToUseCloudWatchLogs" effect = "Allow" actions = [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ] resources = ["*"] ] } }`
Community Note
Description:
We have a multi account setup where in the source account assumes a role in the destination account to create resources. Both the user in the source and assumed role in the destination account has full permissions on all the resources.
aws provider is able to create cross account resources without any issues but awscc fails to do so.
Terraform CLI and Terraform AWS Cloud Control Provider Version
Terraform v1.0.9 on darwin_arm64
Affected Resource(s)
awscc_databrew_job
Terraform Configuration Files
Root module:
provider.tf
versions.tf
Main.tf
Debug Output
Panic Output
Expected Behavior
Actual Behavior
Steps to Reproduce
terraform apply with the above configuration.
Important Factoids
References
0000