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

Error: ResourceNotFoundException: Requested resource not found #4

Open
olegburca opened this issue Mar 3, 2022 · 3 comments
Open

Comments

@olegburca
Copy link

olegburca commented Mar 3, 2022

Hello,

I used the HashiCorp tutorial: https://learn.hashicorp.com/tutorials/terraform/aws-control-tower-aft
Successfully passed the following actions:
Configure the landing zone,
Deploy AFT module,
Enabled CodeStar connection,
Grant AFT access to Service Catalog portfolio,
Rerun account provisioning pipeline.
Everything worked well so far.

But there is an issue deploying new accounts with ATF. terraform plan passes successfully, while terraform apply fails with the following error:
│ Error: ResourceNotFoundException: Requested resource not found │ │ with module.sandbox.aws_dynamodb_table_item.account-request, │ on modules/aft-account-request/ddb.tf line 1, in resource "aws_dynamodb_table_item" "account-request": │ 1: resource "aws_dynamodb_table_item" "account-request" {

The same error is present in CloudWatch /aws/codebuild/ct-aft-account-request.

Running terraform in debug mode doesn't provide more details.

This is the code for account definition:
`module "sandbox" {
source = "./modules/aft-account-request"

control_tower_parameters = {
AccountEmail = "[email protected]"
AccountName = "dev.aws"
ManagedOrganizationalUnit = "aft.aws"
SSOUserEmail = "[email protected]"
SSOUserFirstName = "DEV"
SSOUserLastName = "AWS"
}

account_tags = {
"Name" = "DEV AWS"
}

change_management_parameters = {
change_requested_by = "My Company"
change_reason = "Add dev.aws account"
}

custom_fields = {
group = "dev.aws"
}

account_customizations_name = "sandbox"
}`

Any help will be greatly appreciated!

@olegburca
Copy link
Author

It happens both with aws provider version 4.3 and 3.74.3, here is the entire stacktrace:
`2022-03-06T13:54:56.059+0200 [INFO] provider.terraform-provider-aws_v3.74.3_x5: 2022/03/06 13:54:56 [DEBUG] [aws-sdk-go] DEBUG: Response dynamodb/PutItem Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 400 Bad Request
Connection: close
Content-Length: 112
Content-Type: application/x-amz-json-1.0
Date: Sun, 06 Mar 2022 11:54:55 GMT
Server: Server
X-Amz-Crc32: 3737639027
X-Amzn-Requestid: TJDPIMMABNDKPNBNPF41JRM613VV4KQNSO5AEMVJF66Q9ASUAAJG

-----------------------------------------------------: timestamp=2022-03-06T13:54:56.059+0200
2022-03-06T13:54:56.059+0200 [INFO] provider.terraform-provider-aws_v3.74.3_x5: 2022/03/06 13:54:56 [DEBUG] [aws-sdk-go] {"__type":"com.amazonaws.dynamodb.v20120810#ResourceNotFoundException","message":"Requested resource not found"}: timestamp=2022-03-06T13:54:56.059+0200
2022-03-06T13:54:56.059+0200 [INFO] provider.terraform-provider-aws_v3.74.3_x5: 2022/03/06 13:54:56 [DEBUG] [aws-sdk-go] DEBUG: Validate Response dynamodb/PutItem failed, attempt 0/25, error ResourceNotFoundException: Requested resource not found: timestamp=2022-03-06T13:54:56.059+0200
2022-03-06T13:54:56.059+0200 [TRACE] provider.terraform-provider-aws_v3.74.3_x5: Called downstream: @module=sdk.proto tf_proto_version=5 tf_req_id=da770396-ce40-7b43-a229-99c6e5b437a3 @caller=/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:608 tf_provider_addr=provider tf_resource_type=aws_dynamodb_table_item tf_rpc=ApplyResourceChange timestamp=2022-03-06T13:54:56.059+0200
2022-03-06T13:54:56.059+0200 [TRACE] provider.terraform-provider-aws_v3.74.3_x5: Served request: tf_req_id=da770396-ce40-7b43-a229-99c6e5b437a3 tf_resource_type=aws_dynamodb_table_item @caller=/opt/teamcity-agent/work/5d79fe75d4460a2f/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:614 @module=sdk.proto tf_proto_version=5 tf_provider_addr=provider tf_rpc=ApplyResourceChange timestamp=2022-03-06T13:54:56.059+0200
2022-03-06T13:54:56.060+0200 [TRACE] maybeTainted: module.sandbox.aws_dynamodb_table_item.account-request encountered an error during creation, so it is now marked as tainted
2022-03-06T13:54:56.060+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for module.sandbox.aws_dynamodb_table_item.account-request
2022-03-06T13:54:56.060+0200 [TRACE] states.SyncState: pruning module.sandbox because it is empty
2022-03-06T13:54:56.061+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for module.sandbox.aws_dynamodb_table_item.account-request
2022-03-06T13:54:56.061+0200 [TRACE] evalApplyProvisioners: module.sandbox.aws_dynamodb_table_item.account-request is tainted, so skipping provisioning
2022-03-06T13:54:56.061+0200 [TRACE] maybeTainted: module.sandbox.aws_dynamodb_table_item.account-request was already tainted, so nothing to do
2022-03-06T13:54:56.061+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for module.sandbox.aws_dynamodb_table_item.account-request
2022-03-06T13:54:56.061+0200 [TRACE] states.SyncState: pruning module.sandbox because it is empty
2022-03-06T13:54:56.061+0200 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: removing state object for module.sandbox.aws_dynamodb_table_item.account-request
2022-03-06T13:54:56.061+0200 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old
2022-03-06T13:54:56.063+0200 [TRACE] statemgr.Filesystem: no state changes since last snapshot
2022-03-06T13:54:56.063+0200 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2022-03-06T13:54:56.083+0200 [ERROR] vertex "module.sandbox.aws_dynamodb_table_item.account-request" error: ResourceNotFoundException: Requested resource not found
2022-03-06T13:54:56.083+0200 [TRACE] vertex "module.sandbox.aws_dynamodb_table_item.account-request": visit complete, with errors
2022-03-06T13:54:56.083+0200 [TRACE] dag/walk: upstream of "module.sandbox (close)" errored, so skipping
2022-03-06T13:54:56.083+0200 [TRACE] dag/walk: upstream of "module.sandbox.provider["registry.terraform.io/hashicorp/aws"] (close)" errored, so skipping
2022-03-06T13:54:56.083+0200 [TRACE] dag/walk: upstream of "root" errored, so skipping
2022-03-06T13:54:56.083+0200 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old
2022-03-06T13:54:56.083+0200 [TRACE] statemgr.Filesystem: no state changes since last snapshot
2022-03-06T13:54:56.083+0200 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate

│ Error: ResourceNotFoundException: Requested resource not found

│ with module.sandbox.aws_dynamodb_table_item.account-request,
│ on modules/aft-account-request/ddb.tf line 1, in resource "aws_dynamodb_table_item" "account-request":
│ 1: resource "aws_dynamodb_table_item" "account-request" {


2022-03-06T13:54:56.106+0200 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2022-03-06T13:54:56.106+0200 [TRACE] statemgr.Filesystem: unlocking terraform.tfstate using fcntl flock
2022-03-06T13:54:56.107+0200 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"
2022-03-06T13:54:56.111+0200 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/aws/3.74.3/darwin_arm64/terraform-provider-aws_v3.74.3_x5 pid=3956
2022-03-06T13:54:56.111+0200 [DEBUG] provider: plugin exited`

@im2nguyen, can you please recommend how to solve this issue?

Best regards,
Oleg.

@quincyorange-daf
Copy link

Hi Oleg

Did you ever find the cause/solution to this issue? I am getting the exact same error.

Thanks
Quincy

@olegburca
Copy link
Author

@quincyorange-daf, the additional repositories need to use "main" branches. They were master in my case. Changing the branch name fixed the issue.

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

2 participants