Repository: linz/geostore

Issue:
Make sure we can re-run pipelines
### Enabler

So that we can continue working when a pipeline fails for spurious reasons, we want to make sure we can re-run them.

#### Acceptance Criteria

- [ ] Re-running a pipeline does not cause it to fail unconditionally.

#### Additional context

From build:

> CREATE_FAILED        | AWS::Logs::LogGroup              | api/api-user-log (apiapiuserlog714734B6) Resource handler returned message: "Resource of type 'AWS::Logs::LogGroup' with identifier '{"/properties/LogGroupName":"ci1953438111-geostore-cloudtrail-api"}' already exists." (RequestToken: …, HandlerErrorCode: AlreadyExists)

#### Tasks

<!-- Tasks needed to complete this enabler -->

- [ ] ...
- [ ] ...

#### Definition of Ready

- [ ] This story is **ready** to work on
  - [ ] Negotiable (team can decide how to design and implement)
  - [ ] Valuable (from a user perspective)
  - [ ] Estimate value applied (agreed by team)
  - [ ] Small (so as to fit within an iteration)
  - [ ] Testable (in principle, even if there isn't a test for it yet)
  - [ ] Environments are ready to meet definition of done
  - [ ] Resources required to implement will be ready
  - [ ] Everyone understands and agrees with the tasks to complete the story
  - [ ] Release value (e.g. Iteration 3) applied
  - [ ] Sprint value (e.g. Aug 1 - Aug 15) applied

#### Definition of Done

- [ ] This story is **done**:
  - [ ] Acceptance criteria completed
  - [ ] Automated tests are passing
  - [ ] Code is peer reviewed and pushed to master
  - [ ] Deployed successfully to test environment
  - [ ] Checked against [CODING guidelines](https://github.com/linz/geostore/blob/master/CODING.md)
  - [ ] Relevant new tasks are added to backlog and communicated to the team
  - [ ] Important decisions recorded in the issue ticket
  - [ ] Readme/Changelog/Diagrams are updated
  - [ ] Product Owner has approved acceptance criteria as complete
  - [ ] Meets non-functional requirements:
    - [ ] Scalability (data): Can scale to 300TB of data and 100,000,000 files and ability to
          increase 10% every year
    - [ ] Scability (users): Can scale to 100 concurrent users
    - [ ] Cost: Data can be stored at < 0.5 NZD per GB per year
    - [ ] Performance: A large dataset (500 GB and 50,000 files - e.g. Akl aerial imagery) can be
          validated, imported and stored within 24 hours
    - [ ] Accessibility: Can be used from LINZ networks and the public internet
    - [ ] Availability: System available 24 hours a day and 7 days a week, this does not include
          maintenance windows < 4 hours and does not include operational support
    - [ ] Recoverability: RPO of fully imported datasets < 4 hours, RTO of a single 3 TB dataset <
          12 hours

<!-- Please add one or more of these labels: 'spike', 'refactor', 'architecture', 'infrastructure', 'compliance' -->



Discussion:

Resolving patch:
diff --git a/infrastructure/constructs/api.py b/infrastructure/constructs/api.py
--- a/infrastructure/constructs/api.py
+++ b/infrastructure/constructs/api.py
@@ -14,6 +14,7 @@
 
 from .common import grant_parameter_read_access
 from .lambda_endpoint import LambdaEndpoint
+from .removal_policy import REMOVAL_POLICY
 from .roles import MAX_SESSION_DURATION
 from .s3_policy import ALLOW_DESCRIBE_ANY_S3_JOB
 from .table import Table
@@ -126,6 +127,7 @@ def __init__(  # pylint: disable=too-many-arguments,too-many-locals
                 self,
                 "api-user-log",
                 log_group_name=Resource.CLOUDTRAIL_LOG_GROUP_NAME.resource_name,
+                removal_policy=REMOVAL_POLICY,
             ),  # type: ignore[arg-type]
         )
         trail.add_lambda_event_selector(


Test patch: