public void CreatesStackWithOversizedTemplates() { string stackName = "ProvisioningTest-CreatesStackWithOversizedTemplates"; SetUp(stackName); try { var deployer = new Deployer(_awsConfiguration); deployer.CreateStack(new StackTemplate { StackName = stackName, TemplatePath = CloudFormationTemplates.Path("example-oversize.template") }); var status = StackStatus.CREATE_IN_PROGRESS; while (status == StackStatus.CREATE_IN_PROGRESS) { var stack = _cloudFormationClient.DescribeStacks(new DescribeStacksRequest { StackName = stackName }) .Stacks.First(); status = stack.StackStatus; if (status == StackStatus.CREATE_IN_PROGRESS) Thread.Sleep(TimeSpan.FromSeconds(10)); } Assert.AreEqual(status, StackStatus.CREATE_COMPLETE); } finally { DeleteTestStack(stackName); } }
public void EnsureStackExists() { if (_hasCreatedStack) return; _awsConfiguration = new AwsConfiguration { AssumeRoleTrustDocument = Roles.Path("code-deploy-trust.json"), IamRolePolicyDocument = Roles.Path("code-deploy-policy.json"), Bucket = "aws-deployment-tools-tests", RoleName = "CodeDeployRole", AwsEndpoint = TestConfiguration.AwsEndpoint, Credentials = new TestSuiteCredentials() }; _iamClient = new AmazonIdentityManagementServiceClient( new AmazonIdentityManagementServiceConfig { RegionEndpoint = _awsConfiguration.AwsEndpoint, ProxyHost = _awsConfiguration.ProxyHost, ProxyPort = _awsConfiguration.ProxyPort }); DeletePreviousTestStack(); _deployer = new Deployer(_awsConfiguration); _stack = _deployer.CreateStack(new StackTemplate { StackName = StackName, TemplatePath = CloudFormationTemplates.Path("example-windows-vpc-autoscaling-group.template") }); _hasCreatedStack = true; }
public void ThrowsWhenStackFailsToDetele() { var stackName = "AwsToolsRemovalThrowsWhenStackFailsToDeteleTest"; var securityGroupName = "AwsToolsRemovalThrowsWhenStackFailsToDeteleTest"; SetUp(stackName); var deployer = new Deployer(_awsConfiguration); try { deployer.CreateStack(new StackTemplate { StackName = stackName, TemplatePath = CloudFormationTemplates.Path("example-basic-vpc.template") }); CreateSecurityGroup(securityGroupName, stackName); TestDelegate act = () => deployer.DeleteStack(stackName); Assert.Throws<FailedToDeleteStackException>(act); } finally { DeleteSecurityGroup(securityGroupName, stackName); DeletePreviousTestStack(stackName); } }
public void CreatingStackCapturesOutputs() { var deployer = new Deployer(new AwsConfiguration { AwsEndpoint = TestConfiguration.AwsEndpoint, Credentials = new TestSuiteCredentials(), Bucket = "aws-deployment-tools-tests" }); var stack = deployer.CreateStack(new StackTemplate { StackName = _stackName, TemplatePath = CloudFormationTemplates.Path("stack-outputs.template") }); Assert.That(stack.Outputs["outputA"], Is.EqualTo("123")); Assert.That(stack.Outputs["outputB"], Is.EqualTo("456")); }
public void DeletesExistingStack() { var stackName = "AwsToolsRemovalDeletesExistingStackTest"; SetUp(stackName); var deployer = new Deployer(_awsConfiguration); deployer.CreateStack(new StackTemplate { StackName = stackName, TemplatePath = CloudFormationTemplates.Path("example-basic-vpc.template") }); deployer.DeleteStack(stackName); var status = StackStatus.DELETE_IN_PROGRESS; status = WaitForStackDeleted(status, stackName); Assert.AreEqual(StackStatus.DELETE_COMPLETE, status); }
public void CreatesStackWithParameters() { var stackName = "ProvisioningTest-CreatesStackWithParameters"; SetUp(stackName); try { var deployer = new Deployer(_awsConfiguration); deployer.CreateStack(new StackTemplate { StackName = stackName, TemplatePath = CloudFormationTemplates.Path("example-parameters.template"), ParameterPath = CloudFormationTemplates.Path("example-parameters.parameters") }); var status = StackStatus.CREATE_IN_PROGRESS; while (status == StackStatus.CREATE_IN_PROGRESS) { var stack = _cloudFormationClient.DescribeStacks(new DescribeStacksRequest {StackName = stackName}) .Stacks.First(); status = stack.StackStatus; if (status == StackStatus.CREATE_IN_PROGRESS) Thread.Sleep(TimeSpan.FromSeconds(10)); } var vpcId = _cloudFormationClient.DescribeStackResource(new DescribeStackResourceRequest { LogicalResourceId = "vpc1", StackName = stackName }).StackResourceDetail.PhysicalResourceId; var vpc = _ec2Client.DescribeVpcs(new DescribeVpcsRequest {VpcIds = new List<string> {vpcId}}).Vpcs.First(); var vpcName = vpc.Tags.First(tag => tag.Key == "Name").Value; Assert.AreEqual(status, StackStatus.CREATE_COMPLETE); Assert.AreEqual("TestVpcName", vpcName); } finally { DeleteTestStack(stackName); } }
public void EnsureStackExists() { if (_hasCreatedStack) return; _awsConfiguration = new AwsConfiguration { AssumeRoleTrustDocument = Roles.Path("code-deploy-trust.json"), IamRolePolicyDocument = Roles.Path("code-deploy-policy.json"), Bucket = "aws-deployment-tools-tests", RoleName = "CodeDeployRole", AwsEndpoint = TestConfiguration.AwsEndpoint, Credentials = new TestSuiteCredentials() }; _deployer = new Deployer(_awsConfiguration); DeletePreviousTestStack(); _stack = _deployer.CreateStack(new StackTemplate { StackName = StackName, TemplatePath = CloudFormationTemplates.Path("example-windows-vpc.template") }); _hasCreatedStack = true; }
static void Main(string[] args) { var options = new Options(); if (!Parser.Default.ParseArguments(args, options)) Environment.Exit(1); var deployer = new Deployer(new AwsConfiguration { AwsEndpoint = RegionEndpoint.GetBySystemName(options.Region), RoleName = options.RoleName, Proxy = new AwsProxy { Host = options.ProxyHost, Port = options.ProxyPort }, Bucket = options.BucketName }); deployer.CreateStack(new StackTemplate { StackName = options.StackName, TemplatePath = options.TemplatePath, ParameterPath = options.ParameterPath }); }