ministryofjustice / modernisation-platform

A place for the core work of the Modernisation Platform • This repository is defined and managed in Terraform
https://user-guide.modernisation-platform.service.justice.gov.uk
MIT License
680 stars 289 forks source link

Automate creation of application.json file for Account Creation #6318

Open richgreen-moj opened 9 months ago

richgreen-moj commented 9 months ago

User Story

As a MP Engineer I want to automate the creation of the application.json file for account creation So that I can further reduce the manual steps required to onboard members

Value / Purpose

https://user-guide.modernisation-platform.service.justice.gov.uk/runbooks/creating-accounts-for-end-users.html#creating-aws-accounts-for-teams defines the runbook for onboarding new accounts.

This story would aim to automate creation of the first PR required which includes steps:

1. Create a new environment file
2. Update the expected.rego

NB - We could make this a manually triggered job so that PRs are not created for requests which turn out to be rejected as they are not suitable to be hosted in MP etc.

The purpose of the story would be to parse the information from the issue template that members raise to request an environment and automatically compile the application.json file using details supplied in the form. Currently engineers create a new file using this template and raise a PR.

It would need to account for the possibility of existing applications adding new environments (hence no new application.json file required just and update to the existing). It may also require a change to the issue form we use to gather the data (to make it easier to parse).

Overall this would reduce the time/steps required to onboard member accounts.

Useful Contacts

@richgreen-moj

Additional Information

There are some non-verified actions that parse github issues and transform to json here that could provide some inspiration. Perhaps there other ways this could be achieved though? Unfortunately I don't think GitHub has native ability to export the various fields in a template issue form into a queryable json format.

Proposal / Unknowns

For the demand of new accounts the effort here might outweigh the benefit but it could be a fun project!

Definition of Done

SimonPPledger commented 6 months ago

Do we want to do this?

dms1981 commented 3 months ago

Having a think about this, I don't think it's impossible but we would want have to think about our new account issue template. At the moment it's free text, which is great for humans but bad for automation. The challenge would be to keep something that's user-friendly but includes json which is great for machines to read.

Once we've got json we can have a GitHub action that triggers when a new account issue is raised, that takes that json and turns it into a file for a PR. In theory. It's probably a fair bit more complicated than I'm making out.

  1. Refactor new-environment.yml so that it has a field with structure text (eg. json).
  2. Create a GH action that triggers when an onboarding issue is created.
  3. Have that GH action parse the json from the issue and create a new environments/*.json file and raise a PR from it.
  4. Have that GH action also update the expected.rego and include that in the PR.
github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 90 days with no activity.