Skip to content

Commit

Permalink
fix function get azs cloudformation template (#10595)
Browse files Browse the repository at this point in the history
  • Loading branch information
sannya-singal committed Apr 3, 2024
1 parent 3261414 commit 84ce11b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/aws/services/cloudformation/test_template_engine.py
Expand Up @@ -8,6 +8,7 @@
import yaml

from localstack.aws.api.lambda_ import Runtime
from localstack.constants import AWS_REGION_US_EAST_1
from localstack.services.cloudformation.engine.yaml_parser import parse_yaml
from localstack.testing.aws.cloudformation_utils import load_template_file, load_template_raw
from localstack.testing.pytest import markers
Expand Down Expand Up @@ -250,6 +251,7 @@ def test_get_azs_function(self, deploy_cfn_template, snapshot):
template_path=template_path,
)

snapshot.add_transformer(snapshot.transform.regex(AWS_REGION_US_EAST_1, "<region>"))
snapshot.match("azs", deployed.outputs["Zones"].split(";"))

@markers.aws.validated
Expand Down
Expand Up @@ -601,7 +601,7 @@
}
},
"tests/aws/services/cloudformation/test_template_engine.py::TestIntrinsicFunctions::test_get_azs_function": {
"recorded-date": "27-11-2023, 13:14:35",
"recorded-date": "03-04-2024, 07:12:29",
"recorded-content": {
"azs": [
"<region>a",
Expand Down
@@ -1,6 +1,6 @@
{
"tests/aws/services/cloudformation/test_template_engine.py::TestIntrinsicFunctions::test_get_azs_function": {
"last_validated_date": "2023-11-27T12:14:35+00:00"
"last_validated_date": "2024-04-03T07:12:29+00:00"
},
"tests/aws/services/cloudformation/test_template_engine.py::TestMacros::test_capabilities_requirements": {
"last_validated_date": "2023-01-30T19:15:46+00:00"
Expand Down
14 changes: 13 additions & 1 deletion tests/aws/templates/functions_get_azs.yml
@@ -1,12 +1,24 @@
Parameters:
DeployRegion:
Type: String
Default: us-east-1

Conditions:
DeployInUSEast1:
Fn::Equals:
- !Ref DeployRegion
- us-east-1

Resources:
SsmParameter:
Type: AWS::SSM::Parameter
Condition: DeployInUSEast1
Properties:
Type: String
Value:
Fn::Join:
- ";"
- Fn::GetAZs: !Ref "AWS::Region"
- Fn::GetAZs: !Ref DeployRegion
Outputs:
Zones:
Value:
Expand Down

0 comments on commit 84ce11b

Please sign in to comment.