GithubHelp home page GithubHelp logo

Comments (1)

ShahradR avatar ShahradR commented on July 25, 2024

Hi @nileshbhadana!

The good news is that this action runs taskcat and the AWS CloudFormation Linter in the background, so we can leverage functionality from those tools to configure how our linter behaves!

Ideally you'd be able to leverage the new functionality introduced in cfn-lint release v0.43.0, which allows you to provide your own schema specification and have the CloudFormation Linter actually recognize your custom CloudFormation resource. I'm still trying to figure that option out though—I'll play with it a bit more, and let you know if I can get a solution working!

Answering your question more directly though, here are a few options to disable specific rules, or linting altogether—let me know what you think!

Option 1: disable cfn-lint rules on specific resources

You can configure cfn-lint to skip certain checks directly in your CloudFormation template by leveraging the resource's Metadata attribute.

For example, using the example template provided in the project you linked, you can add the following lines to ignore the E3001 rule for the myCluster resource only:

  Resources:
    # EKS Cluster
    myCluster:
      Type: "AWSQS::EKS::Cluster"
      Properties:
        RoleArn: !GetAtt serviceRole.Arn
        KubernetesNetworkConfig:
          ServiceIpv4Cidr: "192.168.0.0/16"
        ResourcesVpcConfig:
          SubnetIds: !Ref SubnetIds
          SecurityGroupIds: !Ref SecurityGroupIds
          EndpointPrivateAccess: true
          EndpointPublicAccess: false
        EnabledClusterLoggingTypes: ["audit"]
        KubernetesApiAccess:
          Users:
            - Arn: !Sub "arn:${AWS::Partition}:iam::${AWS::AccountId}:user/my-user"
              Username: "CliUser"
              Groups: ["system:masters"]
          Roles:
            - Arn: !Sub "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/my-role"
              Username: "AdminRole"
              Groups: ["system:masters"]
        Tags:
          - Key: ClusterName
            Value: myCluster
+     Metadata:
+       cfn-lint:
+         config:
+           ignore_checks:
+           - E3001

Option 2: globally disable certain linting rules using a config file

If modifying your CloudFormation template ends up being trickier than expected, you can use a configuration file to globally disable certain cfn-lint rules.

In my case, I created a file called .cfnlintrc.yaml in my project's root directory, and configured it to globally ignore the E3001 rule, as follows:

---
ignore_checks:
  - E3001

Option 3: disable linting altogether by passing the --lint-disable parameter

If the cfn-lint configuration options don't work out for you, taskcat allows you to pass the --lint-disable parameter when running your tests, which skips the CloudFormation linting step altogether.

You can pass that parameter to this action by modifying your workflow file under .github/workflows/ as shown below:

  - name: Run taskcat test run
    uses: ShahradR/action-taskcat@v1
    with:
-     commands: test run
+     commands: test run --lint-disable

from action-taskcat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.