Closed Bckarnati2018 closed 4 months ago
@Bckarnati2018 thank you for reaching out.
From the error logs it seems the failure occurs during create_configuration_version.
You could ensure that the api_token
being used is valid and has the right permissions.
I would recommend reaching out to AWS premium support for help in deep diving the issue in the environment.
Terraform Version & Prov: Using Terraform Cloud (TFC) version 1.5.7
AFT Version: (Can be found in the AFT Management Account in the SSM Parameter
/aft/config/aft/version
) 1.11.1Terraform Version & Provider Versions Please provide the outputs of
terraform version
andterraform providers
from within your AFT environmentterraform version 1.5.7
terraform providers Terraform Cloud
terraform distribution tfc
Bug Description A clear and concise description of what the bug is. Successfully deploying AFT module and completed the post deployment tasks, by enabling the CodeStar connection and granting AFT access to service catalog portfolio. Then proceed ahead to rerun the provisioned account and also rerun the account request pipelines. But, both the pipelines fail with he below error.
ERROR: [Container] 2024/02/04 21:25:46.375008 Command did not exit successfully if [ $TF_DISTRIBUTION = "oss" ]; then TF_BACKEND_REGION=$(aws ssm get-parameter --name "/aft/config/oss-backend/primary-region" --query "Parameter.Value" --output text)
ERROR LOGS: Successfully created workspace ct-aft-account-request with ID ws-LqBcpPpaSmsHdJ2m Successfully placed AWS credentials on workspace for arn:aws:iam::113634643425:role/AWSAFTAdmin Handling errors: [{'status': '404', 'title': 'not found'}] Traceback (most recent call last): File "/codebuild/output/src202587511/src/aws-aft-core-framework/sources/scripts/workspace_manager.py", line 275, in
setup_and_run_workspace(
File "/codebuild/output/src202587511/src/aws-aft-core-framework/sources/scripts/workspace_manager.py", line 22, in setup_and_run_workspace
run_id = stage_run(workspace_id, assume_role_arn, role_session_name, api_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/codebuild/output/src202587511/src/aws-aft-core-framework/sources/scripts/workspace_manager.py", line 48, in stage_run
cv_id, upload_url = terraform.create_configuration_version(workspace_id, api_token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/codebuild/output/src202587511/src/aws-aft-core-framework/sources/scripts/terraform_client.py", line 74, in create_configuration_version
response = __post(endpoint, headers, payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/codebuild/output/src202587511/src/aws-aft-core-framework/sources/scripts/terraform_client.py", line 215, in post
handle_errors(response)
File "/codebuild/output/src202587511/src/aws-aft-core-framework/sources/scripts/terraform_client.py", line 253, in __handle_errors
raise ClientError(status=error["status"], message=error["title"])
terraform_client.ClientError: not found
[Container] 2024/02/04 21:25:46.375008 Command did not exit successfully if [ $TF_DISTRIBUTION = "oss" ]; then TF_BACKEND_REGION=$(aws ssm get-parameter --name "/aft/config/oss-backend/primary-region" --query "Parameter.Value" --output text)
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen. Both the pipelines should be running to test and validate all the four scenarios listed below.
Related Logs Provide any related logs or error messages to help explain your problem.
1| [Container] 2024/02/04 21:24:59.831294 Waiting for agent ping 2 | [Container] 2024/02/04 21:25:00.032584 Waiting for DOWNLOAD_SOURCE 3 | [Container] 2024/02/04 21:25:01.485484 Phase is DOWNLOAD_SOURCE 4 | [Container] 2024/02/04 21:25:01.487826 CODEBUILD_SRC_DIR=/codebuild/output/src202587511/src 5 | [Container] 2024/02/04 21:25:01.488214 YAML location is /codebuild/readonly/buildspec.yml 6 | [Container] 2024/02/04 21:25:01.490696 Setting HTTP client timeout to higher timeout for S3 source 7 | [Container] 2024/02/04 21:25:01.490931 Processing environment variables 8 | [Container] 2024/02/04 21:25:01.767446 No runtime version selected in buildspec. 9 | [Container] 2024/02/04 21:25:01.796794 Moving to directory /codebuild/output/src202587511/src 10 | [Container] 2024/02/04 21:25:01.799896 Unable to initialize cache download: no paths specified to be cached 11 | [Container] 2024/02/04 21:25:01.876460 Configuring ssm agent with target id: codebuild:47a409b5-8403-4868-8371-cb36933e52aa 12 | [Container] 2024/02/04 21:25:01.886807 Successfully updated ssm agent configuration 13 | [Container] 2024/02/04 21:25:01.887154 Registering with agent 14 | [Container] 2024/02/04 21:25:01.887168 Phases found in YAML: 3 15 | [Container] 2024/02/04 21:25:01.887175 POST_BUILD: 1 commands 16 | [Container] 2024/02/04 21:25:01.887180 PRE_BUILD: 20 commands 17 | [Container] 2024/02/04 21:25:01.887190 BUILD: 1 commands 18 | [Container] 2024/02/04 21:25:01.887416 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED 19 | [Container] 2024/02/04 21:25:01.887430 Phase context status code: Message: 20 | [Container] 2024/02/04 21:25:02.074508 Entering phase INSTALL 21 | [Container] 2024/02/04 21:25:02.077543 Phase complete: INSTALL State: SUCCEEDED 22 | [Container] 2024/02/04 21:25:02.077558 Phase context status code: Message: 23 | [Container] 2024/02/04 21:25:02.165830 Entering phase PRE_BUILD 24 | [Container] 2024/02/04 21:25:02.166242 Running command DEFAULT_PATH=$(pwd) 25 | 26 | [Container] 2024/02/04 21:25:02.173178 Running command TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S') 27 | 28 | [Container] 2024/02/04 21:25:02.181509 Running command AWS_MODULE_SOURCE=$(aws ssm get-parameter --name "/aft/config/aft-pipeline-code-source/repo-url" --query "Parameter.Value" --output text) 29 | 30 | [Container] 2024/02/04 21:25:14.249401 Running command AWS_MODULE_GIT_REF=$(aws ssm get-parameter --name "/aft/config/aft-pipeline-code-source/repo-git-ref" --query "Parameter.Value" --output text) 31 | 32 | [Container] 2024/02/04 21:25:14.929991 Running command TF_VERSION=$(aws ssm get-parameter --name "/aft/config/terraform/version" --query "Parameter.Value" --output text) 33 | 34 | [Container] 2024/02/04 21:25:15.641795 Running command TF_DISTRIBUTION=$(aws ssm get-parameter --name "/aft/config/terraform/distribution" --query "Parameter.Value" --output text) 35 | 36 | [Container] 2024/02/04 21:25:16.358261 Running command CT_MGMT_REGION=$(aws ssm get-parameter --name "/aft/config/ct-management-region" --query "Parameter.Value" --output text) 37 | 38 | [Container] 2024/02/04 21:25:17.056081 Running command AFT_MGMT_ACCOUNT=$(aws sts get-caller-identity --query Account --output text) 39 | 40 | [Container] 2024/02/04 21:25:17.721088 Running command AFT_EXEC_ROLE_ARN=arn:$AWS_PARTITION:iam::$AFT_MGMT_ACCOUNT:role/AWSAFTExecution 41 | 42 | [Container] 2024/02/04 21:25:17.728997 Running command AFT_ADMIN_ROLE_NAME=$(aws ssm get-parameter --name /aft/resources/iam/aft-administrator-role-name \| jq --raw-output ".Parameter.Value") 43 | 44 | [Container] 2024/02/04 21:25:18.350353 Running command AFT_ADMIN_ROLE_ARN=arn:$AWS_PARTITION:iam::$AFT_MGMT_ACCOUNT:role/$AFT_ADMIN_ROLE_NAME 45 | 46 | [Container] 2024/02/04 21:25:18.356169 Running command ROLE_SESSION_NAME=$(aws ssm get-parameter --name /aft/resources/iam/aft-session-name \| jq --raw-output ".Parameter.Value") 47 | 48 | [Container] 2024/02/04 21:25:18.961563 Running command ssh_key_parameter=$(aws ssm get-parameter --name /aft/config/aft-ssh-key --with-decryption 2> /dev/null \|\| echo "None") 49 | if [[ $ssh_key_parameter != "None" ]]; then 50 | ssh_key=$(jq --raw-output ".Parameter.Value" <<< $ssh_key_parameter) 51 | mkdir -p ~/.ssh 52 | echo "Host *" >> ~/.ssh/config 53 | echo "StrictHostKeyChecking no" >> ~/.ssh/config 54 | echo "UserKnownHostsFile=/dev/null" >> ~/.ssh/config 55 | echo "$ssh_key" > ~/.ssh/ssh_key 56 | echo -e "\n\n" >> ~/.ssh/ssh_key 57 | chmod 600 ~/.ssh/ssh_key 58 | eval "$(ssh-agent -s)" 59 | ssh-add ~/.ssh/ssh_key 60 | fi 61 | 62 | 63 | [Container] 2024/02/04 21:25:19.583621 Running command git config --global credential.helper '!aws codecommit credential-helper $@' 64 | 65 | [Container] 2024/02/04 21:25:19.590588 Running command git config --global credential.UseHttpPath true 66 | 67 | [Container] 2024/02/04 21:25:19.598115 Running command git clone -b $AWS_MODULE_GIT_REF $AWS_MODULE_SOURCE aws-aft-core-framework 68 | Cloning into 'aws-aft-core-framework'... 69 | Note: switching to '26667e52d0e2f46e3213239933a1c8fcf1a83166'. 70 | 71 | You are in 'detached HEAD' state. You can look around, make experimental 72 | changes and commit them, and you can discard any commits you make in this 73 | state without impacting any branches by switching back to a branch. 74 | 75 | If you want to create a new branch to retain commits you create, you may 76 | do so (now or later) by using -c with the switch command. Example: 77 | 78 | git switch -c