Skip to content

Commit

Permalink
CCM-5100: Rename repo to nhs-notify-iam-webauth
Browse files Browse the repository at this point in the history
  • Loading branch information
m-houston committed Jul 10, 2024
1 parent a0e979b commit c914d78
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 31 deletions.
3 changes: 1 addition & 2 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ USER_POOL_ID=eu-west-2_fhHtnXS3G
USER_POOL_CLIENT_ID=<client ID>
HOSTED_LOGIN_DOMAIN=nhsnotify-iam-dev-auth-userpool.auth.eu-west-2.amazoncognito.com

NOTIFY_STAGE=nonprod
NOTIFY_GROUP=nonprod
NOTIFY_ENVIRONMENT=dev
AWS_APP=d1axbs26ewhyx4
AWS_BRANCH=main
Expand All @@ -14,4 +14,3 @@ AWS_BRANCH=main

# Use a GitHub Personal Access Token to deploy a new Amplify integration (connect to a GitHub repo)
TF_VAR_github_pat=<github_pat_xxxx>

6 changes: 3 additions & 3 deletions amplify/auth/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const userPoolClientId = process.env.USER_POOL_CLIENT_ID!;
const hostedLoginDomain = process.env.HOSTED_LOGIN_DOMAIN!;

const appId = process.env.AWS_APP_ID!;
const stage = process.env.NOTIFY_STAGE!;
const group = process.env.NOTIFY_GROUP!;
const subdomain = process.env.NOTIFY_SUBDOMAIN!;
const domainName = process.env.NOTIFY_DOMAIN_NAME!;

Expand All @@ -28,12 +28,12 @@ export const authConfig: DeepPartialAmplifyGeneratedConfigs<ClientConfig> = {
'redirect_sign_in_uri': [
`https://${subdomain}.${appId}.amplifyapp.com/auth/`,
`https://${subdomain}.${domainName}/auth/`,
...(stage === 'nonprod' ? ['http://localhost:3000/auth/']: [])
...(group === 'nonprod' ? ['http://localhost:3000/auth/']: [])
],
'redirect_sign_out_uri': [
`https://${subdomain}.${appId}.amplifyapp.com/`,
`https://${subdomain}.${domainName}/`,
...(stage === 'nonprod' ? ['http://localhost:3000/']: [])
...(group === 'nonprod' ? ['http://localhost:3000/']: [])
],
'response_type': 'code'
},
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/environments/dev/module-amplify-app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module "amplify_app" {
domain = var.domain
environment = var.environment
component = var.component
stage = var.stage
group = var.group

cognito_user_pool_id = module.userpool.user_pool_id
cognito_hosted_login_domain = module.userpool.hosted_login_domain
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/environments/dev/module-amplify-branch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module "amplify_branch" {
domain = var.domain
environment = var.environment
component = var.component
stage = var.stage
group = var.group

cognito_user_pool_id = module.userpool.user_pool_id
cognito_user_pool_identity_provider_names = module.userpool.identity_provider_names
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/environments/dev/module-route53-zone.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ module "route53-zone" {
domain = var.domain
environment = var.environment
component = var.component
stage = var.stage
group = var.group
}
2 changes: 1 addition & 1 deletion infrastructure/environments/dev/module-userpool.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module "userpool" {
domain = var.domain
environment = var.environment
component = var.component
stage = var.stage
group = var.group

app_url = "https://${local.app_domain_name}"
}
4 changes: 2 additions & 2 deletions infrastructure/environments/dev/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "domain" {
default = "iam"
}

variable "stage" {
variable "group" {
type = string
default = "nonprod"
}
Expand All @@ -25,7 +25,7 @@ variable "github_pat" {

variable "repository" {
type = string
default = "https://github.com/NHSDigital/nhs-notify-iam"
default = "https://github.com/NHSDigital/nhs-notify-iam-webauth"
}

variable "branch" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module "amplify_branch" {
domain = var.domain
environment = var.environment
component = var.component
stage = var.stage
group = var.group

cognito_user_pool_id = local.user_pool_id
cognito_user_pool_identity_provider_names = local.identity_provider_names
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/environments/dynamic/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "domain" {
default = "iam"
}

variable "stage" {
variable "group" {
type = string
default = "nonprod"
}
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/modules/amplify-app/amplify-app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "aws_amplify_app" "app" {
environment_variables = {
USER_POOL_ID = var.cognito_user_pool_id
HOSTED_LOGIN_DOMAIN = var.cognito_hosted_login_domain
NOTIFY_STAGE = var.stage
NOTIFY_GROUP = var.group
NOTIFY_ENVIRONMENT = var.environment
NOTIFY_DOMAIN_NAME = var.domain_name
}
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/modules/amplify-app/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ variable "module" {
default = "app"
}

variable "stage" {
variable "group" {
type = string
description = "The domain PTL stage (prod|nonprod)"
description = "The domain PTL group (prod|nonprod)"
}

variable "cognito_user_pool_id" {
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/modules/amplify-branch/amplify-branch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ resource "aws_amplify_domain_association" "domain" {
domain_name = "${var.subdomain}.${var.domain_name}"
enable_auto_sub_domain = false

# Wait for domain verification in prod stage environments
wait_for_verification = var.stage == "prod"
# Wait for domain verification in prod group environments
wait_for_verification = var.group == "prod"

sub_domain {
branch_name = aws_amplify_branch.branch.branch_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ resource "aws_cognito_user_pool_client" "client" {

callback_urls = flatten([
["https://${var.subdomain}.${var.domain_name}/auth/", "https://${var.subdomain}.${var.amplify_app_id}.amplifyapp.com/auth/"],
var.stage == "nonprod" ? ["http://localhost:3000/auth/"] :
var.group == "nonprod" ? ["http://localhost:3000/auth/"] :
var.environment == "prod" ? ["https://notify.nhs.net/auth/"] : []
])
supported_identity_providers = flatten([
var.stage == "nonprod" ? ["COGNITO"] : [],
var.group == "nonprod" ? ["COGNITO"] : [],
var.cognito_user_pool_identity_provider_names
])
allowed_oauth_flows = ["code"]
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/modules/amplify-branch/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ variable "module" {
default = "branch"
}

variable "stage" {
variable "group" {
type = string
description = "The domain PTL stage (prod|nonprod)"
description = "The domain PTL group (prod|nonprod)"
}

variable "cognito_user_pool_id" {
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/modules/route53-zone/route53-zone.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Should reference existing zone if created via standard account boostrap
# data "aws_route53_zone" "zone" {
# name = "iam.${var.stage}.nhsnotify.national.nhs.uk"
# name = "iam.${var.group}.nhsnotify.national.nhs.uk"
# }

resource "aws_route53_zone" "zone" {
name = "iam.${var.stage}.nhsnotify.national.nhs.uk"
name = "iam.${var.group}.nhsnotify.national.nhs.uk"
}
4 changes: 2 additions & 2 deletions infrastructure/modules/route53-zone/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ variable "module" {
default = "r53"
}

variable "stage" {
variable "group" {
type = string
description = "The domain PTL stage (prod|nonprod)"
description = "The domain PTL group (prod|nonprod)"
}
4 changes: 2 additions & 2 deletions infrastructure/modules/userpool/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ variable "module" {
default = "userpool"
}

variable "stage" {
variable "group" {
type = string
description = "The domain PTL stage (prod|nonprod)"
description = "The domain PTL group (prod|nonprod)"
}

variable "app_url" {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "nhs-notify-iam",
"name": "nhs-notify-iam-webauth",
"version": "1.0.0",
"description": "[![CI/CD Pull Request](https://github.com/nhs-england-tools/repository-template/actions/workflows/cicd-1-pull-request.yaml/badge.svg)](https://github.com/nhs-england-tools/repository-template/actions/workflows/cicd-1-pull-request.yaml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=repository-template&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=repository-template)",
"main": "index.js",
Expand Down
4 changes: 2 additions & 2 deletions scripts/config/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ repos:
exclude: .+\.cs
- id: forbid-new-submodules
- id: mixed-line-ending
- id: pretty-format-json
args: ['--autofix']
# - id: pretty-format-json # This re-orders object keys which is annoying for structured JSON config like package.json
# args: ['--autofix']
# - id: ...
- repo: local
hooks:
Expand Down

0 comments on commit c914d78

Please sign in to comment.