Open mikkelramlov opened 1 year ago
Problem The main function: findAndReplace(obj, path) takes a string as path and relies on period as delimiter. That works well in most cases except when a key consist of a name with periods in it. My example is this:
findAndReplace(obj, path)
GithubActionRole: Type: AWS::IAM::Role Properties: RoleName: GithubActionRole AssumeRolePolicyDocument: Version: '2012-10-17' Statement: - Effect: Allow Principal: Federated: !Ref OIDCProvider Action: sts:AssumeRoleWithWebIdentity Condition: StringEquals: token.actions.githubusercontent.com:aud: sts.amazonaws.com StringLike: token.actions.githubusercontent.com:sub: - $forEach: iterator: ${self:custom.sourceRepos} template: - 'repo:$forEach.value:*'
Notice
token.actions.githubusercontent.com:sub
in the Condition statement.
Condition
Solution
Utilize the lodash.get capability to use Array as path to a given property.
lodash.get
Problem The main function:
findAndReplace(obj, path)
takes a string as path and relies on period as delimiter. That works well in most cases except when a key consist of a name with periods in it. My example is this:Notice
in the
Condition
statement.Solution
Utilize the
lodash.get
capability to use Array as path to a given property.