Skip to content

Extract Marketing Sites Deployer Roles from Monolith's IAM Stack #66824

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

Merged
merged 8 commits into from
Jul 10, 2025

Conversation

sureshc
Copy link
Contributor

@sureshc sureshc commented Jul 1, 2025

To facilitate provisioning Marketing Site Stacks in multiple AWS Accounts, start provisioning the deployer Roles in a template that's part of the marketing sites sub-project and deployed separately. Also, enable provisioning of development Stacks, but don't permit GitHub Actions to create/update development systems.

Testing story

Successfully provisioned a marketing site in the AWS Dev Account, us-east-1 with the following steps:

1-setup $ ./deploy.rb


cicd $ ./deploy.rb --environment_type development \
            --region us-east-1 \
            --hosted_zone_id ZABC123 \
            --base_domain_name marketing-sites.dev-code.org \
            --subdomain_name code \
            --container_image_hash sha256:517b0277eaf9d81127ad1b35865ec929b48cfe76d65335750758579d11ce2471 \
            --role_arn  arn:aws:iam::1234567890:role/admin/CloudFormationMarketingSitesDevelopmentRole \
            --web_application_server_secrets_arn arn:aws:secretsmanager:us-east-1:1234567890:secret:marketing-sites/development/marketing-sites.dev-code.org/code-abc1234 \
            --cloudformation_role_boundary arn:aws:iam::1234567890:policy/marketing-sites-role-permissions-boundary-development

Deployment strategy

  1. Delete the Marketing Sites Deployer Roles/Policies provisioned in the monolith's IAM Stack:
  • export AWS_PROFILE=codeorg-admin
  • bundle exec rake stack:iam:start RAILS_ENV=production ADMIN=true
  1. Provision Marketing Sites Deployer Resources in production AWS Account using the deploy script in this feature branch.

Follow-up work

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@sureshc sureshc requested review from stephenliang and a team July 8, 2025 05:16
@sureshc sureshc marked this pull request as ready for review July 8, 2025 05:16
@sureshc sureshc force-pushed the infrastructure/extract-marketing-sites-iam branch from 8affed8 to 2a97e9a Compare July 8, 2025 05:54
}

opt_parser = OptionParser.new do |opts|
opts.banner = "Usage: ./deploy.rb [options]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we may want to rename this to deploy-global-resources.rb?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been considering something similar. There will soon be another CloudFormation template in this directory that provisions networking infrastructure that needs to be setup once per account-region. Likely the Ruby shell script in this directory will provision / update both, so I've been thinking of calling it setup-account-and-region, or just setup, or maybe keeping deploy and using the context that it's in the 1-setup directory, and moving the existing deploy.rb in the root of the cicd directory down into 3-app so that each directory has a deploy script. Let me know if any of these choices seem like they would work better for our future selves trying to use and maintain this infrastructure code.

@sureshc sureshc force-pushed the infrastructure/extract-marketing-sites-iam branch from 5a0efd5 to b7e5c11 Compare July 10, 2025 15:21
@sureshc
Copy link
Contributor Author

sureshc commented Jul 10, 2025

Deployed changed to monolith's IAM Stack

export AWS_PROFILE=codeorg-admin

bundle exec rake stack:iam:start RAILS_ENV=production ADMIN=true

Pending update for stack `IAM`:
Remove CloudFormationServiceMarketingSitesProductionRole [AWS::IAM::Role]
Remove CloudFormationServiceMarketingSitesTestRole [AWS::IAM::Role]
Remove GitHubActionsProductionRole [AWS::IAM::Role]
Remove GitHubActionsTestRole [AWS::IAM::Role]
Remove GitHubOpenIDConnectProvider [AWS::IAM::OIDCProvider]
Remove MarketingSitesRoleCreationBoundaryProductionPolicy [AWS::IAM::ManagedPolicy]
Remove MarketingSitesRoleCreationBoundaryTestPolicy [AWS::IAM::ManagedPolicy]
Proceed? [y/n]
y
Stack update requested, waiting for provisioning to complete...
.2025-07-10 15:22:36 UTC- IAM [UPDATE_COMPLETE_CLEANUP_IN_PROGRESS]
2025-07-10 15:22:36 UTC- IAM [UPDATE_COMPLETE_CLEANUP_IN_PROGRESS]

Stack update complete.

@sureshc sureshc merged commit 4dbccd2 into staging Jul 10, 2025
9 of 11 checks passed
@sureshc sureshc deleted the infrastructure/extract-marketing-sites-iam branch July 10, 2025 18:33
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

Successfully merging this pull request may close these issues.

2 participants