cisagov / cool-assessment-terraform

Terraform to deploy an assessment environment to the COOL
Creative Commons Zero v1.0 Universal
13 stars 4 forks source link

Deploy assessment artifact export script and credentials to Terraformer instance #227

Closed dav3r closed 1 year ago

dav3r commented 1 year ago

πŸ—£ Description

This PR deploys the assessment archive script (and corresponding credentials file) to Terraformer instances, but only when there are no Kali instances in the assessment environment (var.assessment_artifact_export_enabled also must be set to true).

πŸ’­ Motivation and context

There are certain assessment types that only receive a Terraformer and don't get any Kali instances, but they still would like to be able to run the assessment artifact export script. The current workaround has been to spin up a Kali instance at the end of the assessment in order to run the artifact export script, but that is cumbersome. This approach will simplify things.

If there are any Kali instances in the environment, they continue to be where assessment artifacts should be exported from. This change is only meant to handle the situation where there is a Terraformer instance, but no Kali instances.

Resolves #224.

πŸ§ͺ Testing

I applied this code several times in a test environment, modifying the TF variables each time and verifying that the outcome was as expected:

I also confirmed that if there was a Terraformer instance and no Kali instances deployed, followed by the deployment of a Kali instance, the Terraformer instance was destroyed and recreated without the artifact export script and credentials. This is the expected behavior since the Kali got the artifact export script and credentials.

βœ… Pre-approval checklist