Skip to content

Commit f6b24dd

Browse files
authored
Merge pull request #16 from NHSDigital/feature/CCM-13764_init
CCM-13764: Init
2 parents d996f47 + 30023e8 commit f6b24dd

51 files changed

Lines changed: 1023 additions & 185 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# NHS Notify Code Owners
22

33
# Notify default owners
4-
* @NHSDigital/nhs-notify-repository-template
4+
* @NHSDigital/nhs-notify-client-callbacks
55

6-
/.github/ @NHSDigital/nhs-notify-repository-template-admins
7-
*.code-workspace @NHSDigital/nhs-notify-repository-template-admins
6+
/.github/ @NHSDigital/nhs-notify-admins
7+
*.code-workspace @NHSDigital/nhs-notify-admins
88
/infrastructure/terraform/ @NHSDigital/nhs-notify-platform
99

1010
# Root level AGENTS.md owned by platform.

.github/workflows/cicd-1-pull-request.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ on:
1111
branches:
1212
- main
1313

14+
permissions:
15+
id-token: write
16+
contents: write
17+
packages: read
18+
19+
1420
jobs:
1521
metadata:
1622
name: "Set CI/CD metadata"
@@ -142,6 +148,30 @@ jobs:
142148
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
143149
version: "${{ needs.metadata.outputs.version }}"
144150
secrets: inherit
151+
pr-create-dynamic-environment:
152+
name: Create Dynamic Environment
153+
needs: [metadata, build-stage]
154+
runs-on: ubuntu-latest
155+
if: needs.metadata.outputs.does_pull_request_exist == 'true' && github.ref != 'refs/heads/main'
156+
env:
157+
APP_CLIENT_ID: ${{ secrets.APP_CLIENT_ID }}
158+
APP_PEM_FILE: ${{ secrets.APP_PEM_FILE }}
159+
steps:
160+
- uses: actions/checkout@v5.0.0
161+
- name: Trigger dynamic environment creation
162+
shell: bash
163+
run: |
164+
.github/scripts/dispatch_internal_repo_workflow.sh \
165+
--infraRepoName "$(echo ${{ github.repository }} | cut -d'/' -f2)" \
166+
--releaseVersion "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" \
167+
--targetWorkflow "dispatch-deploy-dynamic-env.yaml" \
168+
--targetEnvironment "pr${{ needs.metadata.outputs.pr_number }}" \
169+
--targetComponent "callbacks" \
170+
--targetAccountGroup "nhs-notify-client-callbacks-dev" \
171+
--terraformAction "apply" \
172+
--overrideProjectName "nhs" \
173+
--overrideRoleName "nhs-main-acct-client-callbacks-github-deploy" \
174+
--overrides "branch_name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
145175
acceptance-stage: # Recommended maximum execution time is 10 minutes
146176
name: "Acceptance stage"
147177
needs: [metadata, build-stage]
@@ -155,4 +185,5 @@ jobs:
155185
python_version: "${{ needs.metadata.outputs.python_version }}"
156186
terraform_version: "${{ needs.metadata.outputs.terraform_version }}"
157187
version: "${{ needs.metadata.outputs.version }}"
188+
target_environment: "pr${{ needs.metadata.outputs.pr_number }}"
158189
secrets: inherit
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
strategy:
4747
max-parallel: 1
4848
matrix:
49-
component: [acct, app]
49+
component: [callbacks]
5050

5151
steps:
5252
- name: Checkout repository
@@ -59,8 +59,8 @@ jobs:
5959
run: |
6060
bash .github/scripts/dispatch_internal_repo_workflow.sh \
6161
--releaseVersion "main" \
62-
--targetWorkflow "dispatch-deploy-static-notify-bounded-context-env.yaml" ## Replace with correct targetWorkflow \
62+
--targetWorkflow "dispatch-deploy-static-notify-client-callbacks-env.yaml" \
6363
--targetEnvironment "main" \
64-
--targetAccountGroup "nhs-notify-bounded-context-dev" ## Replace with correct targetAccountGroup \
64+
--targetAccountGroup "nhs-notify-client-callbacks-dev" \
6565
--targetComponent "${{ matrix.component }}" \
6666
--terraformAction "apply"

.github/workflows/pr_create_dynamic_env.disabled

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/pr_destroy_dynamic_env.disabled renamed to .github/workflows/pr_destroy_dynamic_env.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
--arg infraRepoName "${this_repo_name}" \
2929
--arg releaseVersion "main" \
3030
--arg targetEnvironment "pr${{ github.event.number }}" \
31-
--arg targetAccountGroup "nhs-notify-bounded-context-dev" \ ## Replace with correct targetAccountGroup
32-
--arg targetComponent "component" \ ## Replace with correct targetComponent
31+
--arg targetAccountGroup "nhs-notify-client-callbacks-dev" \
32+
--arg targetComponent "callbacks" \
3333
--arg terraformAction "destroy" \
3434
'{ "ref": "main",
3535
"inputs": {

.github/workflows/release_created.disabled renamed to .github/workflows/release_created.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
max-parallel: 1
2424
matrix:
25-
component: [component1, component2] ## Replace with correct components
25+
component: [callbacks]
2626

2727
steps:
2828
- name: Checkout repository
@@ -35,8 +35,8 @@ jobs:
3535
run: |
3636
bash .github/scripts/dispatch_internal_repo_workflow.sh \
3737
--releaseVersion "${{ github.event.release.tag_name }}" \
38-
--targetWorkflow "dispatch-deploy-static-notify-bounded-context-env.yaml" ## Replace with correct targetWorkflow \
38+
--targetWorkflow "dispatch-deploy-static-notify-client-callbacks-env.yaml" \
3939
--targetEnvironment "main" \
40-
--targetAccountGroup "nhs-notify-bounded-context-nonprod" ## Replace with correct targetAccountGroup \
40+
--targetAccountGroup "nhs-notify-client-callbacks-nonprod" \
4141
--targetComponent "${{ matrix.component }}" \
4242
--terraformAction "apply"

.github/workflows/stage-4-acceptance.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ on:
3131
description: "Version of the software, set by the CI/CD pipeline workflow"
3232
required: true
3333
type: string
34+
target_environment:
35+
description: "Environment to run acceptance tests with"
36+
required: true
37+
type: string
3438

3539
jobs:
3640
environment-set-up:

infrastructure/terraform/bin/terraform.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ readonly backend_config="terraform {
599599
region = \"${region}\"
600600
bucket = \"${bucket}\"
601601
key = \"${backend_key}\"
602-
dynamodb_table = \"${bucket}\"
603602
use_lockfile = true
604603
}
605604
}";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform 1.10.1
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
<!-- markdownlint-disable -->
3+
<!-- vale off -->
4+
5+
## Requirements
6+
7+
| Name | Version |
8+
|------|---------|
9+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.10.1 |
10+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | 6.13 |
11+
## Inputs
12+
13+
| Name | Description | Type | Default | Required |
14+
|------|-------------|------|---------|:--------:|
15+
| <a name="input_aws_account_id"></a> [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes |
16+
| <a name="input_clients"></a> [clients](#input\_clients) | n/a | <pre>list(object({<br/> connection_name = string<br/> destination_name = string<br/> invocation_endpoint = string<br/> invocation_rate_limit_per_second = optional(number, 10)<br/> http_method = optional(string, "POST")<br/> header_name = optional(string, "x-api-key")<br/> header_value = string<br/> client_detail = list(string)<br/> }))</pre> | `[]` | no |
17+
| <a name="input_component"></a> [component](#input\_component) | The variable encapsulating the name of this component | `string` | `"callbacks"` | no |
18+
| <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | A map of default tags to apply to all taggable resources within the component | `map(string)` | `{}` | no |
19+
| <a name="input_environment"></a> [environment](#input\_environment) | The name of the tfscaffold environment | `string` | n/a | yes |
20+
| <a name="input_force_lambda_code_deploy"></a> [force\_lambda\_code\_deploy](#input\_force\_lambda\_code\_deploy) | If the lambda package in s3 has the same commit id tag as the terraform build branch, the lambda will not update automatically. Set to True if making changes to Lambda code from on the same commit for example during development | `bool` | `false` | no |
21+
| <a name="input_group"></a> [group](#input\_group) | The group variables are being inherited from (often synonmous with account short-name) | `string` | n/a | yes |
22+
| <a name="input_kms_deletion_window"></a> [kms\_deletion\_window](#input\_kms\_deletion\_window) | When a kms key is deleted, how long should it wait in the pending deletion state? | `string` | `"30"` | no |
23+
| <a name="input_log_level"></a> [log\_level](#input\_log\_level) | The log level to be used in lambda functions within the component. Any log with a lower severity than the configured value will not be logged: https://docs.python.org/3/library/logging.html#levels | `string` | `"INFO"` | no |
24+
| <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | The retention period in days for the Cloudwatch Logs events to be retained, default of 0 is indefinite | `number` | `0` | no |
25+
| <a name="input_parent_acct_environment"></a> [parent\_acct\_environment](#input\_parent\_acct\_environment) | Name of the environment responsible for the acct resources used, affects things like DNS zone. Useful for named dev environments | `string` | `"main"` | no |
26+
| <a name="input_pipe_event_patterns"></a> [pipe\_event\_patterns](#input\_pipe\_event\_patterns) | value | `list(string)` | `[]` | no |
27+
| <a name="input_pipe_sqs_input_batch_size"></a> [pipe\_sqs\_input\_batch\_size](#input\_pipe\_sqs\_input\_batch\_size) | n/a | `number` | `1` | no |
28+
| <a name="input_pipe_sqs_max_batch_window"></a> [pipe\_sqs\_max\_batch\_window](#input\_pipe\_sqs\_max\_batch\_window) | n/a | `number` | `2` | no |
29+
| <a name="input_project"></a> [project](#input\_project) | The name of the tfscaffold project | `string` | n/a | yes |
30+
| <a name="input_region"></a> [region](#input\_region) | The AWS Region | `string` | n/a | yes |
31+
## Modules
32+
33+
| Name | Source | Version |
34+
|------|--------|---------|
35+
| <a name="module_client_destination"></a> [client\_destination](#module\_client\_destination) | ../../modules/client-destination | n/a |
36+
| <a name="module_client_transform_filter_lambda"></a> [client\_transform\_filter\_lambda](#module\_client\_transform\_filter\_lambda) | git::https://github.com/NHSDigital/nhs-notify-shared-modules.git//infrastructure/modules/lambda | v2.0.29 |
37+
| <a name="module_kms"></a> [kms](#module\_kms) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-kms.zip | n/a |
38+
| <a name="module_sqs_inbound_event"></a> [sqs\_inbound\_event](#module\_sqs\_inbound\_event) | https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-sqs.zip | n/a |
39+
## Outputs
40+
41+
No outputs.
42+
<!-- vale on -->
43+
<!-- markdownlint-enable -->
44+
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)