Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dependency of SSM to cognito url trigger #1395

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 26 additions & 15 deletions deploy/stacks/cloudfront.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,17 +180,19 @@ def __init__(
]
self.user_docs_bucket = None
if custom_auth is None:
userguide_docs_distribution, user_docs_bucket = self.build_static_site(
'userguide',
acl,
auth_at_edge,
envname,
resource_prefix,
userguide_domain_names,
certificate,
ssl_support_method,
security_policy,
logging_bucket,
userguide_docs_distribution, user_docs_bucket, ssm_distribution_domain_name_userguide = (
self.build_static_site(
'userguide',
acl,
auth_at_edge,
envname,
resource_prefix,
userguide_domain_names,
certificate,
ssl_support_method,
security_policy,
logging_bucket,
)
)

self.userguide_docs_distribution = userguide_docs_distribution
Expand Down Expand Up @@ -274,7 +276,13 @@ def __init__(
)

if not custom_auth:
self.cognito_urls_config(resource_prefix, envname, backend_region, custom_domain, [cloudfront_distribution])
self.cognito_urls_config(
resource_prefix,
envname,
backend_region,
custom_domain,
[cloudfront_distribution, ssm_distribution_domain_name, ssm_distribution_domain_name_userguide],
)

CfnOutput(
self,
Expand Down Expand Up @@ -441,8 +449,10 @@ def build_static_site(

param_path = f'/dataall/{envname}/cloudfront/docs/user'

self.store_distribution_params(cloudfront_bucket, construct_id, cloudfront_distribution, param_path)
return cloudfront_distribution, cloudfront_bucket
domain_name_ssm_param = self.store_distribution_params(
cloudfront_bucket, construct_id, cloudfront_distribution, param_path
)
return cloudfront_distribution, cloudfront_bucket, domain_name_ssm_param

def store_distribution_params(self, cloudfront_bucket, construct_id, distribution, param_path):
ssm.StringParameter(
Expand All @@ -451,7 +461,7 @@ def store_distribution_params(self, cloudfront_bucket, construct_id, distributio
parameter_name=f'{param_path}/CloudfrontDistributionId',
string_value=distribution.distribution_id,
)
ssm.StringParameter(
domain_name = ssm.StringParameter(
self,
f'{construct_id}DistributionDomain',
parameter_name=f'{param_path}/CloudfrontDistributionDomainName',
Expand All @@ -463,6 +473,7 @@ def store_distribution_params(self, cloudfront_bucket, construct_id, distributio
parameter_name=f'{param_path}/CloudfrontDistributionBucket',
string_value=cloudfront_bucket.bucket_name,
)
return domain_name

@staticmethod
def additional_documentation_behavior(func) -> cloudfront.BehaviorOptions:
Expand Down
Loading