# RIO CDK Constructs

This package contains CDK constructs and [projen](https://github.com/projen/projen) projects for RIO teams.

> NPM: `@rioclaid/cdk-constructs`

## Projen

Run `npx projen new --from @rioclaid/cdk-constructs rio-fargate-web-app`

## Constructs

See [./API.md](API.md) for a list of constructs

## Open issues

- DataDog: Use DataDog.jar inside Docker image for profiling (using AWS Artifacts?)
- Add vulnerability and license-check actions
- Get self-signed certificate for LB<->Service communication

- DataDog: Provide aspect to use lambda extensions to send logs to DataDog
- Introduce immutable tags to RioEcrRepo (waits for https://github.com/aws/aws-cdk/pull/10557))
- projen template should provide useful tags in pipeline template
- Replace custom synth action with standard one, once [CDK #12061](https://github.com/aws/aws-cdk/issues/12061) is fixed

- Have custom resource to create BitBucket repo and webhook automatically
- Send container image scan results to OpsGenie
- Check for security requirements (s3 buckets, ...) - maybe automated as aspect?
- RDS: Provide RIO-style Aurora
- Backup: Provide aspect to add automatically backup tags
- Send build status back to BitBucket (see cdk-codepipeline-bitbucket-build-result-reporter)
- Support PR builds (using StepFunctions?)
- Move this library to AWS CodeArtifact

## Developing CDK libraries

Provide commit messages according to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). This library uses [standard-version](https://github.com/conventional-changelog/standard-version) to generate the changelog and publish a new version.
Example commit message: 
```shell
fix(watchful): :bug: removing toggle rioclaid-1857-datadog-threshold; removed threshold
rioclaid-1857
```

## Releasing a new version

Make sure that the parameter store `/config/npm/token` having the npm token to publish is added before releasing.

1. Create locally a new release by running `npm run release`. (e.g. `npm run release -- --release-as minor`)
2. Check the generated `CHANGELOG.md` file and adjust thing when necessary


## Test projen projects locally

- Ensure to have the changes compiled (run `npm run compile` or `npm run build`)
- Create a new directory (next to this one)
- Run `npx projen new --from ../cdk-constructs/ rio-fargate-web-app --synth false`
- Open `.projenrc.js` and change the first line to reference the local one and `devDeps` to use the published one.

```ts
const { RioFargateWebApp } = require('../cdk-constructs/');

const project = new RioFargateWebApp({
  cdkVersion: '1.95.2',
  defaultReleaseBranch: 'main',
  devDeps: ['@rioclaid/cdk-constructs'],
  jsiiFqn: '@rioclaid/cdk-constructs.RioFargateWebApp',
  name: 'rio-projen',
});
project.synth();
```

- Run `npx projen`

## FAQ

- Getting error **Could not resolve dependency: jest** while running `projen new`command

	The issue is resolved in projen version `0.34.8`. Use versions >= `0.34.8`
