-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix errors in ApplicationAutoScaling models (#259)
* add support for AWS::EC2::VPCEndpoint * remove errant comma * add dynamodb SSESpecification * Adds support for PointInTimeRecoverySpecification * Adds support for Tags * Fix errors in ApplicationAutoScaling models * - Added Description field to SecurityGroupIngress and SecurityGroupEgress. - Changed StringBackedInt to Token[Int] for autoscaling group so that you can use parameters. - AmazonTag.Key is now a token, so that you can use functions. - Tested it with a real script: https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#eks-create-cluster - Step 3: point 5 (https://amazon-eks.s3-us-west-2.amazonaws.com/cloudformation/2018-08-30/amazon-eks-nodegroup.yaml) * Fix unit tests: - No longer use stringbackedint - copied contents from generated extension file to non-generated extension file * - Make Roles field in InstanceProfile to have tokens, so you can reference roles (instead of requiring you to always configure your own roles in the template). * - Add EKS support and unit test. * - Add GroupName support for security group. - Make GroupDescription a Token type. * - Add AssociateIpAddress field. * Add additional parameters to AWS::EC2::VPCEndpoint * cleanup AWS::ApplicationAutoScaling::ScalableTarget
- Loading branch information
1 parent
247e708
commit c1ee37a
Showing
2 changed files
with
132 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...est/scala/com/monsanto/arch/cloudformation/model/resource/ApplicationAutoScaling_UT.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.monsanto.arch.cloudformation.model.resource | ||
|
||
import com.monsanto.arch.cloudformation.model.{JsonWritingMatcher, ResourceRef} | ||
import org.scalatest.{FunSpec, Matchers} | ||
|
||
class ApplicationAutoScaling_UT extends FunSpec with Matchers with JsonWritingMatcher { | ||
|
||
val scalableTarget = `AWS::ApplicationAutoScaling::ScalableTarget`( | ||
name = "myScalableTarget", | ||
MaxCapacity = 100, | ||
MinCapacity = 1, | ||
ResourceId = "myResourceId", | ||
RoleARN = "myRoleArn", | ||
ScalableDimension = ApplicationAutoScaling.ScalableDimension.`custom-resource:ResourceType:Property`, | ||
ServiceNamespace = ApplicationAutoScaling.ServiceNamespace.`custom-resource`) | ||
|
||
|
||
it("should generate scalable target policy document") { | ||
|
||
val resource: Resource[`AWS::ApplicationAutoScaling::ScalableTarget`] = scalableTarget | ||
|
||
resource shouldMatch | ||
""" | ||
|{ | ||
| "Type": "AWS::ApplicationAutoScaling::ScalableTarget", | ||
| "Properties": { | ||
| "MaxCapacity": 100, | ||
| "MinCapacity": 1, | ||
| "ResourceId": "myResourceId", | ||
| "RoleARN": "myRoleArn", | ||
| "ScalableDimension": "custom-resource:ResourceType:Property", | ||
| "ServiceNamespace": "custom-resource" | ||
| } | ||
|} | ||
""".stripMargin | ||
} | ||
|
||
it("should error if ScalableDimension doesn't match the ServiceNamespace") { | ||
an [java.lang.AssertionError] should be thrownBy | ||
`AWS::ApplicationAutoScaling::ScalableTarget`( | ||
name = "myScalableTarget", | ||
MaxCapacity = 100, | ||
MinCapacity = 1, | ||
ResourceId = "myResourceId", | ||
RoleARN = "myRoleArn", | ||
ScalableDimension = ApplicationAutoScaling.ScalableDimension.`custom-resource:ResourceType:Property`, | ||
ServiceNamespace = ApplicationAutoScaling.ServiceNamespace.dynamodb | ||
) | ||
} | ||
|
||
it("should generate scaling policy document") { | ||
val scalingPolicy = `AWS::ApplicationAutoScaling::ScalingPolicy`( | ||
name = "myScalingPolicy", | ||
PolicyName = "myPolicyName", | ||
PolicyType = ApplicationAutoScaling.PolicyType.StepScaling, | ||
ScalingTargetId = Some(ResourceRef(scalableTarget)) | ||
) | ||
|
||
val resource: Resource[`AWS::ApplicationAutoScaling::ScalingPolicy`] = scalingPolicy | ||
|
||
resource shouldMatch | ||
""" | ||
|{ | ||
| "Type": "AWS::ApplicationAutoScaling::ScalingPolicy", | ||
| "Properties": { | ||
| "PolicyName": "myPolicyName", | ||
| "PolicyType": "StepScaling", | ||
| "ScalingTargetId": { "Ref":"myScalableTarget" } | ||
| } | ||
|} | ||
""".stripMargin | ||
} | ||
} |