aws-solutions / aws-control-tower-customizations

The Customizations for AWS Control Tower solution combines AWS Control Tower and other highly-available, trusted AWS services to help customers more quickly set up a secure, multi-account AWS environment using AWS best practices.
https://docs.aws.amazon.com/controltower/latest/userguide/cfct-overview.html
Apache License 2.0
356 stars 205 forks source link

cfn_nag validation failed #55

Closed jihed closed 3 years ago

jihed commented 3 years ago

Hi, Once upgrade to CfCT v2, I see this issue on cfn_nag

| FAIL FATAL
|
| #<ArgumentError: invalid byte sequence in US-ASCII>

Failures count: 1

Note that I run cfn_nag (v0.7.2) and it is running perfectly.

groverlalit commented 3 years ago

Hello @jihed Thanks for reporting this issue. It seems this is limited to CodeBuild image. It seems the template file contains non-U.S. English characters which fails the cfn-nag check.

The fix is to add the following commands to the pre_build section of your buildspec file for the "Build" stage. These commands make the build environment use U.S. English UTF-8 for its localization settings, which is more compatible with CodeBuild and file names that contain non-U.S. English characters.

pre_build:
  commands:
    - export LC_ALL="en_US.UTF-8"
    - locale-gen en_US en_US.UTF-8
    - dpkg-reconfigure locales

Reference: CodeBuild User Guide - Troubleshoot UTF-8 Issue

groverlalit commented 3 years ago

This change was released in v2.1.0.