From adc98c684d2dd8f5c6eeff5b8b999105eb5aee59 Mon Sep 17 00:00:00 2001 From: briri Date: Tue, 19 Dec 2023 14:14:31 -0800 Subject: [PATCH] updates to fix issues with prod deploy (most name conflicts since stg/prd are in same env) --- config/prd/config.yaml | 1 + config/prd/global/config.yaml | 1 + config/prd/regional/config.yaml | 2 +- config/prd/regional/dynamo.yaml | 2 +- initial_setup.rb | 2 ++ src/sam/template.yaml | 10 +++++----- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/config/prd/config.yaml b/config/prd/config.yaml index 6d98ec86..5371c788 100644 --- a/config/prd/config.yaml +++ b/config/prd/config.yaml @@ -2,6 +2,7 @@ # provide the name of an existing bucket. # template_bucket_name: 'uc3-dmp-hub-cf-bucket-cdluc3prd' + # Stack tags are attached to every AWS resource created by these CloudFormation templates # with the exception of the Lambda functions and layers which are managed by AWS SAM. # diff --git a/config/prd/global/config.yaml b/config/prd/global/config.yaml index c2f34e37..c4a5cae7 100644 --- a/config/prd/global/config.yaml +++ b/config/prd/global/config.yaml @@ -6,4 +6,5 @@ region: 'us-east-1' sceptre_user_data: env: 'prd' domain: 'dmphub.uc3prd.cdlib.net' + hosted_zone: !ssm_parameter /uc3/dmp/hub/prd/HostedZoneId ssm_path: '/uc3/dmp/hub/prd/' diff --git a/config/prd/regional/config.yaml b/config/prd/regional/config.yaml index 1e79b5e2..86da18e4 100644 --- a/config/prd/regional/config.yaml +++ b/config/prd/regional/config.yaml @@ -9,7 +9,7 @@ sceptre_user_data: - !stack_output_external cdl-uc3-prd-defaultsubnet-stack::defaultsubnet2b - !stack_output_external cdl-uc3-prd-defaultsubnet-stack::defaultsubnet2c - # hosted_zone: !stack_output_external uc3-ops-aws-prd-route53::HostedZoneIdUc3PrdCdlibNet + hosted_zone: !ssm_parameter /uc3/dmp/hub/prd/HostedZoneId env: 'prd' domain: 'dmphub.uc3prd.cdlib.net' diff --git a/config/prd/regional/dynamo.yaml b/config/prd/regional/dynamo.yaml index d6b383d3..521a45ad 100644 --- a/config/prd/regional/dynamo.yaml +++ b/config/prd/regional/dynamo.yaml @@ -31,4 +31,4 @@ hooks: # Build and deploy the React based DMP ID Landing Page to the CloudFront S3 bucket # Args are: environment - - !cmd 'cd ./src/landing_page && ruby build_deply.sh prd' + - !cmd 'cd ./src/landing_page && ruby build_deply.rb prd' diff --git a/initial_setup.rb b/initial_setup.rb index a1d194ce..9f31db75 100644 --- a/initial_setup.rb +++ b/initial_setup.rb @@ -8,6 +8,7 @@ parser.on("-r", "--region AWS_REGION", "The AWS region (Default: us-west-2)") { |r| @opts[:region] = r } parser.on("-o", "--override", TrueClass, "Replace existing values") { |o| @opts[:override] = o } + parser.on("-h", "--hosted-zone ZONE", "The HostedZoneId") { |h| @opts[:hosted_zone] = h } parser.on("-a", "--admin-email EMAIL", "The Administrator email address") { |a| @opts[:email] = a } parser.on("-x", "--pause-ezid", TrueClass, "Pause EZID submissions") { |o| @opts[:pause_ezid] = o } @@ -41,6 +42,7 @@ def put_param(key:, val:, secure: false, override: false) ezid_doi_base = 'https://doi.org/' ezid_url = @opts[:env].downcase == 'prd' ? 'https://ezid.cdlib.org/' : 'https://ezid-stg.cdlib.org/' + put_param(key: 'HostedZoneId', val: @opts[:hosted_zone]) unless @opts[:hosted_zone].nil? put_param(key: 'AdminEmail', val: @opts[:email]) unless @opts[:email].nil? put_param(key: 'EzidApiUrl', val: ezid_url) diff --git a/src/sam/template.yaml b/src/sam/template.yaml index 9dfc7951..85ea8522 100644 --- a/src/sam/template.yaml +++ b/src/sam/template.yaml @@ -103,7 +103,7 @@ Resources: Type: 'AWS::IAM::ManagedPolicy' Properties: Description: 'DMPHub - Read access to the DynamoDB Table' - ManagedPolicyName: 'DmpHubDynamoReadPolicy' + ManagedPolicyName: !Sub 'DmpHub${Env}DynamoReadPolicy' PolicyDocument: Version: '2012-10-17' Statement: @@ -124,7 +124,7 @@ Resources: Type: 'AWS::IAM::ManagedPolicy' Properties: Description: 'DMPHub - Write access (and GetItem) to the DynamoDB Table' - ManagedPolicyName: 'DmpHubDynamoWritePolicy' + ManagedPolicyName: !Sub 'DmpHub${Env}DynamoWritePolicy' PolicyDocument: Version: '2012-10-17' Statement: @@ -205,7 +205,7 @@ Resources: Type: 'AWS::IAM::ManagedPolicy' Properties: Description: 'DMPHub - Access to the EventBus' - ManagedPolicyName: 'DmpHubEventBusPolicy' + ManagedPolicyName: !Sub 'DmpHub${Env}EventBusPolicy' PolicyDocument: Version: '2012-10-17' Statement: @@ -218,7 +218,7 @@ Resources: Type: 'AWS::IAM::ManagedPolicy' Properties: Description: 'DMPHub - Access to the Cognito User Pool Client' - ManagedPolicyName: 'DmpHubCognitoPolicy' + ManagedPolicyName: !Sub 'DmpHub${Env}CognitoPolicy' PolicyDocument: Version: '2012-10-17' Statement: @@ -231,7 +231,7 @@ Resources: Type: 'AWS::IAM::ManagedPolicy' Properties: Description: 'DMPHub - Access to the S3 Bucket' - ManagedPolicyName: 'DmpHubS3Policy' + ManagedPolicyName: !Sub 'DmpHub${Env}S3Policy' PolicyDocument: Version: '2012-10-17' Statement: