GSA / notifications-api

The API powering Notify.gov
Other
10 stars 1 forks source link

Remove `prototyping` from broker names and SSB codebase #1085

Open jskinne3 opened 3 weeks ago

jskinne3 commented 3 weeks ago

This issue is a follow-on from #440

When the org name changed from gsa-tts-benefits-studio-prototyping to gsa-tts-benefits-studio a mismatch arose with the Supplementary Service Broker (SSB) codebase, which contained hard-coded instances of the old name. These were propagated into our Cloud.gov configuration and our Terraform state file. We had to update references in all these locations in order to make the SSB function again, which was needed to get the API sandbox working again.

What we did

  1. We removed hard-coded instances of the old name: https://github.com/GSA/usnotify-ssb/pull/19
  2. and disambiguated the name: https://github.com/GSA/usnotify-ssb/pull/22
  3. then moved existing resources to the new name: https://github.com/GSA/usnotify-ssb/pull/24
  4. ☠️ Because we ran some Terraform out of sequence during the above steps, we ended up with some resources existing simultaneously under the old and new names. In order to complete the move of old resources, we had to explicitly remove new-named resources:

    from Terraform state, using terraform state rm and
    
    
    $ docker-compose --env-file=.env.${ENV_NAME}.secrets run --rm terraform state rm 
    'module.broker_smtp.cloudfoundry_service_broker.space_scoped_broker["gsa-tts-benefits-studio/notify-demo"]' 
    Removed module.broker_smtp.cloudfoundry_service_broker.space_scoped_broker["gsa-tts-benefits-studio/notify-demo"]
    Successfully removed 1 resource instance(s).
    
    $ docker-compose --env-file=.env.${ENV_NAME}.secrets run --rm terraform state rm 
    'module.broker_smtp.cloudfoundry_service_broker.space_scoped_broker["gsa-tts-benefits-studio/notify-staging"]' 
    Removed module.broker_smtp.cloudfoundry_service_broker.space_scoped_broker["gsa-tts-benefits-studio/notify-staging"]
    Successfully removed 1 resource instance(s).
    
    $ docker-compose --env-file=.env.${ENV_NAME}.secrets run --rm terraform state rm 
    'module.broker_sms.cloudfoundry_service_broker.space_scoped_broker["gsa-tts-benefits-studio/notify-demo"]' 
    Removed module.broker_sms.cloudfoundry_service_broker.space_scoped_broker["gsa-tts-benefits-studio/notify-demo"]
    Successfully removed 1 resource instance(s).
    
    $ docker-compose --env-file=.env.${ENV_NAME}.secrets run --rm terraform state rm 
    'module.broker_sms.cloudfoundry_service_broker.space_scoped_broker["gsa-tts-benefits-studio/notify-staging"]' 
    Removed module.broker_sms.cloudfoundry_service_broker.space_scoped_broker["gsa-tts-benefits-studio/notify-staging"]
    Successfully removed 1 resource instance(s).
    
    
    
    from Cloud.gov, using cf rename-service-broker
    
    
    $ cf rename-service-broker ssb-sms-gsa-tts-benefits-studio-notify-demo remove-ssb-sms-gsa-tts-benefits-studio-notify-demo
    Renaming service broker ssb-sms-gsa-tts-benefits-studio-notify-demo to remove-ssb-sms-gsa-tts-benefits-studio-notify-demo as john.skinner@gsa.gov...
    OK
    
    $ cf rename-service-broker ssb-sms-gsa-tts-benefits-studio-notify-staging remove-ssb-sms-gsa-tts-benefits-studio-notify-staging
    Renaming service broker ssb-sms-gsa-tts-benefits-studio-notify-staging to remove-ssb-sms-gsa-tts-benefits-studio-notify-staging as john.skinner@gsa.gov...
    OK
    
    $ cf rename-service-broker ssb-smtp-gsa-tts-benefits-studio-notify-demo remove-ssb-smtp-gsa-tts-benefits-studio-notify-demo
    Renaming service broker ssb-smtp-gsa-tts-benefits-studio-notify-demo to remove-ssb-smtp-gsa-tts-benefits-studio-notify-demo as john.skinner@gsa.gov...
    OK
    
    $ cf rename-service-broker ssb-smtp-gsa-tts-benefits-studio-notify-staging remove-ssb-smtp-gsa-tts-benefits-studio-notify-staging
    Renaming service broker ssb-smtp-gsa-tts-benefits-studio-notify-staging to remove-ssb-smtp-gsa-tts-benefits-studio-notify-staging as john.skinner@gsa.gov...
    OK
    
    
    
  5. We then applied the renames by passing a trivial PR through all the CI/CD: https://github.com/GSA/usnotify-ssb/pull/26

As of 14 July 2024 I see no more broker names nor Terraform identifiers with -prototyping in them. So this issue is mainly done. But some cleanup remains:

Still to-dos

🏆 Bonus stuff we did

Thanks

This was a big project; these people helped me a lot:

jskinne3 commented 2 weeks ago

Update on one of the to-dos: A PR for the SSB Troubleshooting section