Skip to content

Commit

Permalink
CCM-5836 Drop the cognito bits that dont work and minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenvaines-bjss committed Aug 1, 2024
1 parent 23eecae commit 70915fc
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ resource "null_resource" "remove_amplify_branch" {
# Dispite destroying the resouce, apparently Amplify thinks we want to keep the branch resrouce around
triggers = {
csi = local.csi
amplify_app_id = local.iam.amplify["id"]
amplify_branch_name = module.amplify_branch.name
}

provisioner "local-exec" {
when = destroy
command = "aws amplify delete-branch --app-id ${local.iam.amplify["id"]} --branch-name ${module.amplify_branch.name}"
command = "aws amplify delete-branch --app-id ${self.triggers.amplify_app_id} --branch-name ${self.triggers.amplify_branch_name}"
}
}


14 changes: 0 additions & 14 deletions infrastructure/terraform/components/iam/acm_certificate.tf

This file was deleted.

2 changes: 1 addition & 1 deletion infrastructure/terraform/components/iam/amplify_app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource "aws_amplify_app" "main" {

environment_variables = {
USER_POOL_ID = aws_cognito_user_pool.main.id
# HOSTED_LOGIN_DOMAIN = "auth.${var.environment}.${local.acct.dns_zone["name"]}"
# HOSTED_LOGIN_DOMAIN = "auth.${local.acct.dns_zone["name"]}"
NOTIFY_GROUP = var.group
NOTIFY_ENVIRONMENT = var.environment
NOTIFY_DOMAIN_NAME = local.acct.dns_zone["name"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ data "terraform_remote_state" "acct" {
var.project,
var.aws_account_id,
"eu-west-2",
"main"
var.environment
)

region = "eu-west-2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module "amplify_branch" {
source = "../../modules/amp_branch"

name = var.environment
name = "main"
aws_account_id = var.aws_account_id
component = var.component
environment = var.environment
Expand All @@ -12,7 +12,8 @@ module "amplify_branch" {
cognito_user_pool_client_id = aws_cognito_user_pool_client.main.user_pool_id
cognito_user_pool_identity_provider_names = aws_cognito_user_pool_client.main.supported_identity_providers
amplify_app_id = aws_amplify_app.main.id
branch = var.environment
branch = "main"
domain_name = local.acct.dns_zone["name"]
subdomain = var.environment
enable_auto_deploy = true
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ resource "aws_amplify_branch" "main" {
app_id = var.amplify_app_id
branch_name = var.branch
display_name = var.name
enable_pull_request_preview = false # PR previews are not supported for public repos
enable_pull_request_preview = false
enable_auto_build = var.enable_auto_deploy

environment_variables = {
USER_POOL_CLIENT_ID = var.cognito_user_pool_client_id
Expand Down
12 changes: 9 additions & 3 deletions infrastructure/terraform/modules/amp_branch/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ variable "name" {
}

variable "cognito_user_pool_client_id" {
description = "Cognito User Pool client ID"
type = string
description = "Cognito User Pool client ID"
}

variable "cognito_user_pool_identity_provider_names" {
description = "A list of Cognito IDP names"
type = list(string)
description = "A list of Cognito IDP names"
}

variable "amplify_app_id" {
description = "Amplify application ID"
type = string
description = "Amplify application ID"
}

variable "branch" {
Expand All @@ -90,3 +90,9 @@ variable "subdomain" {
default = "main"
description = "Subdomain used as the branch alias"
}

variable "enable_auto_deploy" {
type = bool
description = "Enable the auto deployment of the branch code as well as just the resources for it"
default = false
}
46 changes: 0 additions & 46 deletions scripts/terraform/examples/terraform-state-aws-s3/main.tf

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/terraform/examples/terraform-state-aws-s3/provider.tf

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/terraform/examples/terraform-state-aws-s3/versions.tf

This file was deleted.

8 changes: 4 additions & 4 deletions scripts/terraform/terraform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# Custom implementation - implementation of a make target should not exceed 5 lines of effective code.
# In most cases there should be no need to modify the existing make targets.

TF_ENV ?= dev
STACK ?= ${stack}
TERRAFORM_STACK ?= $(or ${STACK}, infrastructure/terraform)
dir ?= ${TERRAFORM_STACK}
# TF_ENV ?= dev
# STACK ?= ${stack}
# TERRAFORM_STACK ?= $(or ${STACK}, infrastructure/terraform)
# dir ?= ${TERRAFORM_STACK}

terraform-init: # Initialise Terraform - optional: terraform_dir|dir=[path to a directory where the command will be executed, relative to the project's top-level directory, default is one of the module variables or the example directory, if not set], terraform_opts|opts=[options to pass to the Terraform init command, default is none/empty] @Development
make _terraform cmd="init" \
Expand Down

0 comments on commit 70915fc

Please sign in to comment.