-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS FMS: SecurityServicePolicyData rendering entirely as JSON #1834
Comments
Not sure how to tie |
The attached pull request results in the format covered in the AWS Documentation: BaseProtectionsIntPolicy:
Properties:
DeleteAllPolicyResources: true
ExcludeResourceTags: false
IncludeMap:
ACCOUNT:
- '123456789012'
ORGUNIT: []
PolicyName: Base-Protections-Int-Policy
RemediationEnabled: false
ResourceType: ResourceTypeList
ResourceTypeList:
- AWS::ElasticLoadBalancingV2::LoadBalancer
- AWS::ApiGateway::Stage
SecurityServicePolicyData:
ManagedServiceData: !Sub '{"type": "WAFV2", "preProcessRuleGroups": [{"ruleGroupArn":
null, "overrideAction": {"type": "COUNT"}, "managedRuleGroupIdentifier":
{"version": null, "vendorName": "AWS", "managedRuleGroupName": "AWSManagedRulesCommonRuleSet"},
"ruleGroupType": "ManagedRuleGroup"}, {"ruleGroupArn": null, "overrideAction":
{"type": "COUNT"}, "managedRuleGroupIdentifier": {"version": null, "vendorName":
"AWS", "managedRuleGroupName": "AWSManagedRulesAmazonIpReputationList"},
"ruleGroupType": "ManagedRuleGroup"}, {"ruleGroupArn": "${BaseIntRuleGroup.Arn}",
"overrideAction": {"type": "NONE"}, "ruleGroupType": "RuleGroup"}], "postProcessRuleGroups":
[], "defaultAction": {"type": "ALLOW"}}'
Type: WAFV2
Type: AWS::FMS::Policy When used as follows: from troposphere import fms, Sub
# ... redacted ...
policy_obj = fms.Policy(
title="BaseProtectionsIntPolicy",
PolicyName="Base-Protections-Int-Policy",
DeleteAllPolicyResources=True,
ExcludeResourceTags=False,
RemediationEnabled=False,
ResourceType="ResourceTypeList",
ResourceTypeList=["AWS::ElasticLoadBalancingV2::LoadBalancer", "AWS::ApiGateway::Stage"],
IncludeMap=fms.IEMap(
ACCOUNT=[ "123456789012" ],
ORGUNIT=[]
),
SecurityServicePolicyData=fms.SecurityServicePolicyData(
Type="WAFV2",
ManagedServiceData=Sub(generated_managed_service_data)
)
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By AWS CloudFormation documentation, the YAML representation of the SecurityServicePolicyData has two child nodes... Type and ManagedServiceData. They are represented in YAML as follows:
The ManagedServiceData property is the only item of the node that is supposed to be JSON based, but in the FMS::Policy troposphere object, the entire thing is coded/output as JSON, which results in outputs like this:
Furthermore, attempting to add a troposphere Sub() object around the ManagedServiceData string results in an error that the Sub() object is not JSON Serializable.
I propose that an additional helper object be defined in FMS.py that allows further breakout of these items and moves the json_checker validation to the ManagedServiceData definition under the new object.
I'm curious to know if anyone has this working as is.
Thanks!
The text was updated successfully, but these errors were encountered: