NASA-IMPACT / veda-backend

Backend services for VEDA
Other
13 stars 5 forks source link

feat: deterministic outputs of service urls #411

Closed ciaransweet closed 3 months ago

ciaransweet commented 3 months ago

Towards #402

What this PR is

This PR ensures that outputs from CDK for the following services: stac-api, ingest-api, raster-api and stac-browser are available and deterministically named.

Prior to this change, if you piped the outputs to a file, you get a combination of export_name and a hash, which will cause issues when trying to retrieve values from the outputs for later jobs.

To get around this, I've specified the key parameter which explicitly tells CDK to save the outputs under a name without any logical ID logic from CDK.

I've also renamed the outputs file for this action to be veda-backend-cdk-outputs.json just so it's clear which stack it's for and prevents any clashes from further stacks we deploy.

How you can test it

You can run a cdk deploy/diff locally and notice that the outputs are generated with the deterministic names, you can see the difference when compared to outputs I've not changed yet:

{
  "veda-backend-ciaran-dev": {
    "rasterapiurl": "https://333omprhn9.execute-api.us-west-2.amazonaws.com/",
    "rasterapirasterapiarn1578467D": "arn:aws:lambda:us-west-2:853558080719:function:veda-backend-ciaran-dev-rasterapilambda27FDBBDF-x0eDtlf33IGK",
    "ingestapiurl": "https://og1qrf4cu6.execute-api.us-west-2.amazonaws.com/",
    "stacapiurl": "https://9cwrbb8l4i.execute-api.us-west-2.amazonaws.com/",
    "stacbrowserurl": "https://veda-ciaran-dev-stac-browser.s3-website-us-west-2.amazonaws.com",
    "databasepgstacsecretnameBAF265DE": "a-value",
    "networkvpcid3E9D121F": "a-value"
  }
}

You can see that the arns are still logical output id's and so is the secret name.

ciaransweet commented 3 months ago

Given there's no change for downstream services now, with the re-rename, is this good to merge @anayeaye @botanical ?

ciaransweet commented 3 months ago

Looks like this can go in @anayeaye @botanical - Ran OK in the job https://github.com/NASA-IMPACT/veda-deploy/actions/runs/10280359453