in aws_codeseeder/commands/_seedkit_commands.py [0:0]
def deploy_seedkit(seedkit_name: str, managed_policy_arns: Optional[List[str]]) -> None:
"""Deploys the seedkit resources into the environment.
Resources deployed include: S3 Bucket, CodeArtifact Domain, CodeArtifact Repository, CodeBuild Project,
IAM Role, IAM Managed Policy, and KMS Key. All resource names will include the seedkit_name and IAM Role and Policy
grant least privilege access to only the resources associated with this Seedkit. Seedkits are deployed to an
AWS Region, names on global resources (S3, IAM) include a region identifier to avoid conflicts and ensure the same
Seedkit name can be deployed to multiple regions.
Parameters
----------
seedkit_name : str
Name of the seedkit to deploy. All resources will include this in their naming conventions
managed_policy_arns : Optional[List[str]]
List of Managed Policy to ARNs to attach to the default IAM Role created and used
by the CodeBuild Project
"""
stack_name: str = cfn.get_stack_name(seedkit_name=seedkit_name)
LOGGER.info("Deploying Seedkit %s with Stack Name %s", seedkit_name, stack_name)
LOGGER.debug("Managed Policy Arns: %s", managed_policy_arns)
deploy_id: Optional[str] = None
stack_exists, stack_outputs = cfn.does_stack_exist(stack_name=stack_name)
if stack_exists:
deploy_id = stack_outputs.get("DeployId")
LOGGER.info("Seedkit found with DeployId: %s", deploy_id)
template_filename: str = _cfn_seedkit.synth(
seedkit_name=seedkit_name, deploy_id=deploy_id, managed_policy_arns=managed_policy_arns
)
cfn.deploy_template(stack_name=stack_name, filename=template_filename, seedkit_tag=f"codeseeder-{seedkit_name}")
LOGGER.info("Seedkit Deployed")