Skip to content

Commit

Permalink
Fix Cognito params
Browse files Browse the repository at this point in the history
  • Loading branch information
wellyfrs committed Aug 8, 2024
1 parent 30a36c7 commit 3c1b7f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ jobs:
run: exit 1

- name: Terraform Apply
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event_name == 'workflow_dispatch'
#if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event_name == 'workflow_dispatch'
run: terraform apply -auto-approve -input=false
4 changes: 0 additions & 4 deletions terraform/outputs.tf

This file was deleted.

20 changes: 8 additions & 12 deletions terraform/secrets.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
module "secrets_manager" {
source = "terraform-aws-modules/secrets-manager/aws"
version = "1.1.2"
module "cognito_ssm_param" {
source = "terraform-aws-modules/ssm-parameter/aws"
name = "live/cognito"
type = "String"

name = "live/cognito"

ignore_secret_changes = true
recovery_window_in_days = 0

secret_string = jsonencode({
value = jsonencode({
"issuer-uri" = "https://cognito-idp.${var.region}.amazonaws.com/${aws_cognito_user_pool.user_pool.id}"
"jwk-set-uri" = "https://cognito-idp.${var.region}.amazonaws.com/${aws_cognito_user_pool.user_pool.id}/.well-known/jwks.json"
})
Expand All @@ -24,10 +20,10 @@ resource "aws_iam_policy" "cognito_secrets_read_only_policy" {
{
Effect = "Allow"
Action = [
"secretsmanager:DescribeSecret",
"secretsmanager:GetSecretValue"
"ssm:GetParameter",
"ssm:GetParameters"
],
Resource = module.secrets_manager.secret_arn
Resource = module.cognito_ssm_param.ssm_parameter_arn
}
]
})
Expand Down

0 comments on commit 3c1b7f4

Please sign in to comment.