diff --git a/CHANGELOG.md b/CHANGELOG.md index 00fd27e0..e4d81b3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log All notable changes to this project will be documented in this file. +## 0.16.2 - [2022-02-16] +### Fixes +- `resolve` was converting to string booleans, this is incompatible since 0.14.0 because bool were converted to StrictBooleans. + +### Updates +- Update `CLOUDFORMATION_ACTIONS`. + ## 0.16.1 - [2022-02-16] ### Fixes - AWS KMS Key policies can contain an `Id` field in a `PolicyDocument`. The model for `PolicyDocument` has been updated accordingly to support this. diff --git a/pycfmodel/cloudformation_actions.py b/pycfmodel/cloudformation_actions.py index 5237e0cf..d8367a6f 100644 --- a/pycfmodel/cloudformation_actions.py +++ b/pycfmodel/cloudformation_actions.py @@ -2560,10 +2560,12 @@ "connect:SearchVocabularies", "connect:StartChatContact", "connect:StartContactRecording", + "connect:StartContactStreaming", "connect:StartOutboundVoiceContact", "connect:StartTaskContact", "connect:StopContact", "connect:StopContactRecording", + "connect:StopContactStreaming", "connect:SuspendContactRecording", "connect:TagResource", "connect:UntagResource", @@ -4546,10 +4548,13 @@ "evidently:ListFeatures", "evidently:ListLaunches", "evidently:ListProjects", + "evidently:ListTagsForResource", "evidently:StartExperiment", "evidently:StartLaunch", "evidently:StopExperiment", "evidently:StopLaunch", + "evidently:TagResource", + "evidently:UntagResource", "evidently:UpdateExperiment", "evidently:UpdateFeature", "evidently:UpdateLaunch", @@ -5112,6 +5117,7 @@ "glue:GetMLTransforms", "glue:GetMapping", "glue:GetPartition", + "glue:GetPartitionIndexes", "glue:GetPartitions", "glue:GetPlan", "glue:GetRegistry", @@ -5449,6 +5455,7 @@ "honeycode:BatchUpsertTableRows", "honeycode:CreateTeam", "honeycode:CreateTenant", + "honeycode:DeleteDomains", "honeycode:DeregisterGroups", "honeycode:DescribeTableDataImportJob", "honeycode:DescribeTeam", @@ -5459,6 +5466,7 @@ "honeycode:ListTableColumns", "honeycode:ListTableRows", "honeycode:ListTables", + "honeycode:ListTagsForResource", "honeycode:ListTeamAssociations", "honeycode:ListTenants", "honeycode:QueryTableRows", @@ -5467,6 +5475,8 @@ "honeycode:RejectTeamAssociation", "honeycode:RestartDomainVerification", "honeycode:StartTableDataImportJob", + "honeycode:TagResource", + "honeycode:UntagResource", "honeycode:UpdateTeam", "iam:AddClientIDToOpenIDConnectProvider", "iam:AddRoleToInstanceProfile", @@ -7609,13 +7619,16 @@ "mediastore:StopAccessLogging", "mediastore:TagResource", "mediastore:UntagResource", + "mediatailor:ConfigureLogsForPlaybackConfiguration", "mediatailor:CreateChannel", + "mediatailor:CreatePrefetchSchedule", "mediatailor:CreateProgram", "mediatailor:CreateSourceLocation", "mediatailor:CreateVodSource", "mediatailor:DeleteChannel", "mediatailor:DeleteChannelPolicy", "mediatailor:DeletePlaybackConfiguration", + "mediatailor:DeletePrefetchSchedule", "mediatailor:DeleteProgram", "mediatailor:DeleteSourceLocation", "mediatailor:DeleteVodSource", @@ -7626,9 +7639,11 @@ "mediatailor:GetChannelPolicy", "mediatailor:GetChannelSchedule", "mediatailor:GetPlaybackConfiguration", + "mediatailor:GetPrefetchSchedule", "mediatailor:ListAlerts", "mediatailor:ListChannels", "mediatailor:ListPlaybackConfigurations", + "mediatailor:ListPrefetchSchedules", "mediatailor:ListSourceLocations", "mediatailor:ListTagsForResource", "mediatailor:ListVodSources", @@ -8530,6 +8545,7 @@ "proton:ListServiceTemplates", "proton:ListServices", "proton:ListTagsForResource", + "proton:NotifyResourceDeploymentStatusChange", "proton:RejectEnvironmentAccountConnection", "proton:TagResource", "proton:UntagResource", @@ -8923,9 +8939,11 @@ "redshift-data:ListStatements", "redshift-data:ListTables", "redshift:AcceptReservedNodeExchange", + "redshift:AddPartner", "redshift:AssociateDataShareConsumer", "redshift:AuthorizeClusterSecurityGroupIngress", "redshift:AuthorizeDataShare", + "redshift:AuthorizeEndpointAccess", "redshift:AuthorizeSnapshotAccess", "redshift:BatchDeleteClusterSnapshots", "redshift:BatchModifyClusterSnapshots", @@ -8940,6 +8958,7 @@ "redshift:CreateClusterSnapshot", "redshift:CreateClusterSubnetGroup", "redshift:CreateClusterUser", + "redshift:CreateEndpointAccess", "redshift:CreateEventSubscription", "redshift:CreateHsmClientCertificate", "redshift:CreateHsmConfiguration", @@ -8956,9 +8975,11 @@ "redshift:DeleteClusterSecurityGroup", "redshift:DeleteClusterSnapshot", "redshift:DeleteClusterSubnetGroup", + "redshift:DeleteEndpointAccess", "redshift:DeleteEventSubscription", "redshift:DeleteHsmClientCertificate", "redshift:DeleteHsmConfiguration", + "redshift:DeletePartner", "redshift:DeleteSavedQueries", "redshift:DeleteScheduledAction", "redshift:DeleteSnapshotCopyGrant", @@ -8980,6 +9001,8 @@ "redshift:DescribeDataSharesForConsumer", "redshift:DescribeDataSharesForProducer", "redshift:DescribeDefaultClusterParameters", + "redshift:DescribeEndpointAccess", + "redshift:DescribeEndpointAuthorization", "redshift:DescribeEventCategories", "redshift:DescribeEventSubscriptions", "redshift:DescribeEvents", @@ -8988,6 +9011,7 @@ "redshift:DescribeLoggingStatus", "redshift:DescribeNodeConfigurationOptions", "redshift:DescribeOrderableClusterOptions", + "redshift:DescribePartners", "redshift:DescribeQuery", "redshift:DescribeReservedNodeOfferings", "redshift:DescribeReservedNodes", @@ -9025,6 +9049,7 @@ "redshift:ModifyClusterSnapshot", "redshift:ModifyClusterSnapshotSchedule", "redshift:ModifyClusterSubnetGroup", + "redshift:ModifyEndpointAccess", "redshift:ModifyEventSubscription", "redshift:ModifySavedQuery", "redshift:ModifyScheduledAction", @@ -9041,8 +9066,10 @@ "redshift:RestoreTableFromClusterSnapshot", "redshift:ResumeCluster", "redshift:RevokeClusterSecurityGroupIngress", + "redshift:RevokeEndpointAccess", "redshift:RevokeSnapshotAccess", "redshift:RotateEncryptionKey", + "redshift:UpdatePartnerStatus", "redshift:ViewQueriesFromConsole", "redshift:ViewQueriesInConsole", "refactor-spaces:CreateApplication", @@ -11855,12 +11882,14 @@ "workspaces:AssociateIpGroups", "workspaces:AuthorizeIpRules", "workspaces:CopyWorkspaceImage", + "workspaces:CreateConnectClientAddIn", "workspaces:CreateConnectionAlias", "workspaces:CreateIpGroup", "workspaces:CreateTags", "workspaces:CreateUpdatedWorkspaceImage", "workspaces:CreateWorkspaceBundle", "workspaces:CreateWorkspaces", + "workspaces:DeleteConnectClientAddIn", "workspaces:DeleteConnectionAlias", "workspaces:DeleteIpGroup", "workspaces:DeleteTags", @@ -11870,6 +11899,7 @@ "workspaces:DescribeAccount", "workspaces:DescribeAccountModifications", "workspaces:DescribeClientProperties", + "workspaces:DescribeConnectClientAddIns", "workspaces:DescribeConnectionAliasPermissions", "workspaces:DescribeConnectionAliases", "workspaces:DescribeIpGroups", @@ -11901,6 +11931,7 @@ "workspaces:StartWorkspaces", "workspaces:StopWorkspaces", "workspaces:TerminateWorkspaces", + "workspaces:UpdateConnectClientAddIn", "workspaces:UpdateConnectionAliasPermission", "workspaces:UpdateRulesOfIpGroup", "workspaces:UpdateWorkspaceBundle", diff --git a/pycfmodel/resolver.py b/pycfmodel/resolver.py index 14e5c66e..41a76a21 100644 --- a/pycfmodel/resolver.py +++ b/pycfmodel/resolver.py @@ -32,7 +32,10 @@ def resolve(function: ValidResolvers, params: Dict, mappings: Dict[str, Dict], c return resolve_ssm(ssm_parameter_key, params) return function - if isinstance(function, (int, float, date, bool, IPv4Network, IPv6Network)): + if isinstance(function, bool): + return function + + if isinstance(function, (int, float, date, IPv4Network, IPv6Network)): return str(function) if isinstance(function, list): diff --git a/setup.py b/setup.py index aeac63a5..4dec9845 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ setup( name="pycfmodel", - version="0.16.1", + version="0.16.2", description="A python model for CloudFormation scripts", author="Skyscanner Product Security", author_email="security@skyscanner.net", diff --git a/tests/test_resolver.py b/tests/test_resolver.py index e990a7d3..b2d6fdb9 100644 --- a/tests/test_resolver.py +++ b/tests/test_resolver.py @@ -4,6 +4,7 @@ import pytest from pycfmodel import parse +from pycfmodel.model.resources.kms_key import KMSKey from pycfmodel.resolver import resolve @@ -188,6 +189,10 @@ def test_not(function, expected_output): ({"Fn::Equals": ["1123456789", 1123456789]}, True), ({"Fn::Equals": ["2019-12-10", date(2019, 12, 10)]}, True), ({"Fn::Equals": ["0.3", 0.3]}, True), + ({"Fn::Equals": [True, True]}, True), + ({"Fn::Equals": [False, False]}, True), + ({"Fn::Equals": [False, True]}, False), + ({"Fn::Equals": [True, False]}, False), ], ) def test_equals(function, expected_output): @@ -566,3 +571,24 @@ def test_resolve_ssm(): "Cluster": "UNDEFINED_PARAM_main-k8s-cluster-arn:3", "ServiceArn": "vpc-123-abc", } + + +def test_resolve_booleans(): + template = { + "AWSTemplateFormatVersion": "2010-09-09", + "Resources": { + "KMSKey": { + "Type": "AWS::KMS::Key", + "Properties": { + "Enabled": True, + "EnableKeyRotation": True, + "KeyPolicy": { + "Version": "2012-10-17", + "Statement": [], + }, + }, + } + }, + } + model = parse(template).resolve(extra_params={"some-service-arn:1": "vpc-123-abc"}) + assert isinstance(model.Resources["KMSKey"], KMSKey)