async function createIngress()

in resources/add_tenant_infra_lambda/handler.js [468:505]


async function createIngress(event) {
  const {
    body: {
      tenantSubDomain,
      tenantEmailDomain,
    },
    addTenantConfigResult: { baseParams },
    addTenantCertResult: { cert: { CertificateArn: certificateArn } },
    tenantuuid,
  } = event;
  const hostedZoneId = getParameterValue('hostedzoneid', baseParams);
  console.log(`hostedzoneid is ${hostedZoneId}`);
  const oidcClientRestApiId = getParameterValue('oidcClientRestApiId', baseParams);
  console.log(`oidcClientRestApiId is ${oidcClientRestApiId}`);
  const cognitoUserPoolId = getParameterValue('cognitoUserPoolId', baseParams);
  console.log(`userPoolId is ${cognitoUserPoolId}`);
  console.log('Going to create a API Gateway Custom domain next');
  const apigwDomain = await getApigwDomainName(
    tenantSubDomain,
    certificateArn,
    tenantuuid,
    tenantEmailDomain,
  );
  console.log(`Done creating API Gateway Custom domain next ${JSON.stringify(apigwDomain)}`);

  console.log('Going to create API Gateway basepath mapping for custom domain and oidc client rest api');
  const basePath = await createBasePathMapping(oidcClientRestApiId, apigwDomain.domainName);
  console.log(`Done creating API Gateway basepath mapping for custom domain and oidc client rest api, ${JSON.stringify(basePath)}`);

  console.log(`Going to create Route53 A record for ${tenantSubDomain}`);
  const route53ARecordCreationResponse = await createARecord(hostedZoneId,
    tenantSubDomain,
    tenantEmailDomain,
    apigwDomain.distributionDomainName,
    apigwDomain.distributionHostedZoneId);
  console.log(`Done creating Route53 A record for ${tenantSubDomain}`);
  return { route53ARecordCreationResponse };
}