async function putPipelineParametersInSsm()

in resources/start_oidc_provider_pipeline_lambda/handler.js [75:99]


async function putPipelineParametersInSsm(pipelineExecutionId, body, token, tenantuuid) {
  /*
  The below parameters are written to ssm parameter store for the codepipeline execution
  created above.code build step will read these values to infer the tenant for which it
  is building and synthesizing. pipelineExecutionId is the only unique identifier that
  codebuild has available at runtime in the container. that is the reason why we are
  using it to record the tenant details.
  */
  console.log('Pipeline execution ID is', pipelineExecutionId);
  console.log('Input body is', body);
  const promises = [];
  promises.push(putParameterValue('dynamodbtablename', 'dynamodbTableName' in body ? body.dynamodbTableName : 'oidc-provider', pipelineExecutionId));
  promises.push(putParameterValue('loglevel', 'logLevel' in body ? body.logLevel : 'ERROR', pipelineExecutionId));
  promises.push(putParameterValue('token', token, pipelineExecutionId));
  promises.push(putParameterValue('tenantuuid', tenantuuid, pipelineExecutionId));

  if (body.vpcConfig) {
    promises.push(putParameterValue('subnet1', body.vpcConfig.subnetIds[0], pipelineExecutionId));
    promises.push(putParameterValue('subnet2', body.vpcConfig.subnetIds[1], pipelineExecutionId));
    promises.push(putParameterValue('securityGroup1', body.vpcConfig.securityGroupIds[0], pipelineExecutionId));
    promises.push(putParameterValue('securityGroup2', body.vpcConfig.securityGroupIds[1], pipelineExecutionId));
    promises.push(putParameterValue('vpcid', body.vpcConfig.vpcId, pipelineExecutionId));
  }
  return Promise.all(promises);
}