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

[Bug]: Issue installing adf in new account #747

Open
1 of 2 tasks
KarBroden opened this issue Jul 12, 2024 · 2 comments
Open
1 of 2 tasks

[Bug]: Issue installing adf in new account #747

KarBroden opened this issue Jul 12, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@KarBroden
Copy link

KarBroden commented Jul 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I just setup a new management account with Control Tower configured.

When installing ADF v.4.0.0 in this account with the following flags using a Cloud9 environment

{"CrossAccountAccessRoleName": "AWSControlTowerExecution", "MainNotificationEndpoint": "", "DeploymentAccountName": "", "DeploymentAccountEmailAddress": "", "DeploymentAccountAlias": "", "DeploymentAccountId": "ID-OF-DEPLOY-ACC", "DeploymentAccountMainRegion": "eu-west-1", "DeploymentAccountTargetRegions": "us-east-1", "ProtectedOUs": "", "LogLevel": "INFO", "AllowBootstrappingOfManagementAccount": "No", "GrantOrgWidePrivilegedBootstrapAccessUntil": "1900-12-31T23:59:59Z"}

the installation successfully completes but the aws-deployment-framework-bootstrap-pipeline fails with

[Container] 2024/07/12 14:28:55.222874 Running command python adf-build/store_config.py
--
494 | 2024-07-12 14:28:55,479 \| INFO \| __main__ \| ADF Version v4.0.0 \| (store_config.py:25)
495 | 2024-07-12 14:28:55,479 \| INFO \| __main__ \| ADF Log Level is INFO \| (store_config.py:26)
496 | 2024-07-12 14:28:55,479 \| INFO \| __main__ \| Storing configuration values in AWS Systems Manager Parameter Store. \| (store_config.py:28)
497 | 2024-07-12 14:28:55,562 \| INFO \| config \| Using default ADF config: ./adfconfig.yml \| (config.py:115)
498 | 2024-07-12 14:28:57,198 \| INFO \| __main__ \| Configuration values stored successfully. \| (store_config.py:33)
499 |  
500 | [Container] 2024/07/12 14:28:57.267522 Running command aws s3 sync ./adf-build/shared s3://$SHARED_MODULES_BUCKET/adf-build --only-show-errors
501 |  
502 | [Container] 2024/07/12 14:29:13.464580 Running command aws s3 sync . s3://$S3_BUCKET --only-show-errors --delete
503 |  
504 | [Container] 2024/07/12 14:31:16.067325 Running command python adf-build/shared/helpers/sync_to_s3.py --extension .yml --extension .yaml --metadata adf_version=${ADF_VERSION} --upload-with-metadata execution_id=${CODEPIPELINE_EXECUTION_ID} --recursive adf-accounts s3://$ACCOUNT_BUCKET
505 | INFO:__main__:All done.
506 |  
507 | [Container] 2024/07/12 14:31:16.636245 Running command sleep 10
508 |  
509 | [Container] 2024/07/12 14:31:26.642540 Running command python adf-build/main.py
510 | 2024-07-12 14:31:26,956 \| INFO \| __main__ \| ADF Version v4.0.0 \| (main.py:464)
511 | 2024-07-12 14:31:26,957 \| INFO \| __main__ \| ADF Log Level is INFO \| (main.py:465)
512 | 2024-07-12 14:31:27,423 \| INFO \| config \| Using default ADF config: ./adfconfig.yml \| (config.py:115)
513 | 2024-07-12 14:31:27,501 \| WARNING \| organizations \| Deprecation warning: Using a role in the organizations client is being deprecated. Please provide the relevant clients to remove this warning \| (organizations.py:44)
514 | 2024-07-12 14:31:27,711 \| INFO \| organization_policy \| Determining if Organization Policy changes are required. (Tagging or Service Controls) \| (organization_policy.py:123)
515 | 2024-07-12 14:31:41,227 \| INFO \| organizations \| SERVICE_CONTROL_POLICY are currently enabled within the Organization \| (organizations.py:111)
516 | 2024-07-12 14:31:42,821 \| INFO \| organizations \| TAG_POLICY are currently enabled within the Organization \| (organizations.py:111)
517 | 2024-07-12 14:31:42,921 \| INFO \| sts \| Using ADF Account-Bootstrapping Jump Role to assume into account REDACTED \| (sts.py:83)
518 | 2024-07-12 14:31:42,999 \| INFO \| sts \| Assumed into arn:aws:iam::REDACTED:role/adf/account-bootstrapping/jump/adf-bootstrapping-cross-account-jump-role with session name: management \| (sts.py:42)
519 | 2024-07-12 14:31:43,137 \| INFO \| sts \| Assumed into arn:aws:iam::REDACTED:role/AWSControlTowerExecution with session name: management \| (sts.py:42)
520 | 2024-07-12 14:31:43,147 \| WARNING \| sts \| Using the privileged cross-account access role: AWSControlTowerExecution, as access to this role was granted for account REDACTED \| (sts.py:107)
521 | Traceback (most recent call last):
522 | File "/codebuild/output/src3016576730/src/adf-build/main.py", line 577, in <module>
523 | main()
524 | File "/codebuild/output/src3016576730/src/adf-build/main.py", line 483, in main
525 | deployment_account_role = prepare_deployment_account(
526 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
527 | File "/codebuild/output/src3016576730/src/adf-build/main.py", line 205, in prepare_deployment_account
528 | if '@' not in config.notification_endpoint:
529 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
530 | TypeError: argument of type 'NoneType' is not iterable
531 |  
532 | [Container] 2024/07/12 14:31:45.939501 Command did not exit successfully python adf-build/main.py exit status 1
533 | [Container] 2024/07/12 14:31:45.943328 Phase complete: BUILD State: FAILED
534 | [Container] 2024/07/12 14:31:45.943350 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: python adf-build/main.py. Reason: exit status 1
535 | [Container] 2024/07/12 14:31:46.019122 Entering phase POST_BUILD
536 | [Container] 2024/07/12 14:31:46.022013 Phase complete: POST_BUILD State: SUCCEEDED
537 | [Container] 2024/07/12 14:31:46.022026 Phase context status code:  Message:

I assume it's attempting to send a notification but is unable to do so as I set "MainNotificationEndpoint": ""
I would like some help in figuring out if the notification error is the "real" error or if this error is just hiding some other underlying issue.

Expected Behavior

If I set "MainNotificationEndpoint": "" it won't try to run the notification part of the code

Current Behavior

Setting "MainNotificationEndpoint": "" results in an error

Steps To Reproduce

  1. Install ADF v4 with these flags

{"CrossAccountAccessRoleName": "AWSControlTowerExecution", "MainNotificationEndpoint": "", "DeploymentAccountName": "", "DeploymentAccountEmailAddress": "", "DeploymentAccountAlias": "", "DeploymentAccountId": "ID-OF-DEPLOY-ACC", "DeploymentAccountMainRegion": "eu-west-1", "DeploymentAccountTargetRegions": "us-east-1", "ProtectedOUs": "", "LogLevel": "INFO", "AllowBootstrappingOfManagementAccount": "No", "GrantOrgWidePrivilegedBootstrapAccessUntil": "1900-12-31T23:59:59Z"}

  1. The aws-deployment-framework-bootstrap-pipeline pipeline step UploadAndUpdateBaseStacks will fail

Possible Solution

Workaround is to modify the adfconfig.yml in codecommit and add a notification endpoint. Once added the pipeline will succeed.

Additional Information/Context

No response

ADF Version

v4.0.0

Contributing a fix?

  • Yes, I am working on a fix to resolve this issue
@KarBroden KarBroden added the bug Something isn't working label Jul 12, 2024
@sbkok
Copy link
Collaborator

sbkok commented Aug 9, 2024

Hi @KarBroden,

This seems to be a bug in the validation logic. It should not allow you to install ADF without it.
When you install ADF, you are required to specify the MainNotificationEndpoint as written in the parameters description.
Not setting the notification endpoint is unsupported, so this may cause issues elsewhere.

Therefore I would recommend that you update the adfconfig.yml and include this configuration:

# ...
config:
  main-notification-endpoint:
    - type: email
      target: [email protected]

Best regards, Simon

sbkok added a commit to sbkok/aws-deployment-framework that referenced this issue Aug 9, 2024
Issue: awslabs#747

## Why?

When no notification endpoint is configured, it did not warm about this.
Instead, the execution of the main bootstrap pipeline failed.

## What?

* Add validation logic to confirm that a notification endpoint is configured.
* When an email address is configured, it should contain the '@' character too.
sbkok added a commit to sbkok/aws-deployment-framework that referenced this issue Aug 9, 2024
Issue: awslabs#747

## Why?

When no notification endpoint is configured, it did not warm about this.
Instead, the execution of the main bootstrap pipeline failed.

## What?

* Add validation logic to confirm that a notification endpoint is configured.
* When an email address is configured, it should contain the '@' character too.
@KarBroden
Copy link
Author

Thanks for looking into this. The installation guide mentions this configuration parameter as optional. If it's not we should change the documentation as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants