Skip to content
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

[GENERAL ISSUE] String concatenation with literal and variable #485

Closed
jkruse14 opened this issue Mar 26, 2024 · 2 comments
Closed

[GENERAL ISSUE] String concatenation with literal and variable #485

jkruse14 opened this issue Mar 26, 2024 · 2 comments
Labels

Comments

@jkruse14
Copy link

Describe the issue
A clear and concise description of what the issue is.

There does not seem to be a way to combine two strings, either inline or through variable definition, to allow for the combination of a string literal and a variable

Any examples

let bucket_name = "s3/%BucketName"
LoggingConfiguration.LogFilePrefix == %bucket_name
let bucket_name = "s3/"+%BucketName
LoggingConfiguration.LogFilePrefix == %bucket_name
LoggingConfiguration.LogFilePrefix == "s3/"+%BucketName

Version

> cfn-guard --version
cfn-guard 3.0.3

Operating System:
Windows

OS Version
Windows 10 Pro

Additional context
The outcome I would like to achieve in my specific context is to create a rule that enforces the LoggingConfiguration.LogFilePrefix of an S3 Bucket to match the pattern of s3/<bucket name>, so if I have this configuration:

Type: AWS::S3::Bucket
    Properties:
      BucketName: !Sub cfn-guard-test-${AWS::AccountId}-${AWS::Region}
      ...
      LoggingConfiguration:
        DestinationBucketName: !Sub dibh-${AWS::AccountId}-${AWS::Region}-common-logging
        LogFilePrefix: !Sub s3/cfn-guard-test-${AWS::AccountId}-${AWS::Region}

I could write something like

let log_file_prefix = "s3/"+BucketName
LoggingConfiguration.LogFilePrefix == %log_file_prefix

or with a function

let log_file_prefix = join_strings(["s3", BucketName], "/")
LoggingConfiguration.LogFilePrefix == %log_file_prefix
@joshfried-aws
Copy link
Contributor

Hi @jkruse14, you. are correct this is not currently possible using cfn-guard. While we do have a join function, this wouldnt work for the use case you have described. I think we could track this as part of #479

@joshfried-aws
Copy link
Contributor

closing this issue out, as mentioned above we are going to track this as part of #479

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants