diff --git a/.github/workflows/cloudformation-validation.yml b/.github/workflows/cloudformation-validation.yml new file mode 100644 index 0000000..e78f54c --- /dev/null +++ b/.github/workflows/cloudformation-validation.yml @@ -0,0 +1,28 @@ +name: CloudFormation Validation + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: CloudFormation Template Validation + run: | + pip install awscli + aws cloudformation validate-template --template-body file://aws-config-cf-template.yml --region us-east-1 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + - name: CloudFormation Linter + run: | + pip install cfn-lint + cfn-lint -I aws-config-cf-template.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bab8f77..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: ruby - -git: - submodules: false - -env: - global: - - AWS_DEFAULT_REGION=us-east-2 - -before_install: - - echo "Installing AWS CLI" - - pip install --upgrade --user awscli - - echo "Installing test gems" - - gem install yaml-lint - -install: true - -script: - - aws cloudformation validate-template --template-body file://aws-config-cf-template.yml - - yaml-lint aws-config-cf-template.yml - -after_success: - - echo "Test Success - Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)" - - echo "Cloudformation template validated" - - echo "YAML linted" diff --git a/README.md b/README.md index 1c05f8f..c2808dc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # aws-config-cf-template -[![Build Status](https://travis-ci.org/getcft/aws-config-cf-template.svg?branch=master)](https://travis-ci.org/getcft/aws-config-cf-template) +[![CloudFormation Validation](https://github.com/getcft/aws-config-cf-template/actions/workflows/cloudformation-validation.yml/badge.svg)](https://github.com/getcft/aws-config-cf-template/actions/workflows/cloudformation-validation.yml) ## Description diff --git a/aws-config-cf-template.yml b/aws-config-cf-template.yml index abf3f38..38a32de 100644 --- a/aws-config-cf-template.yml +++ b/aws-config-cf-template.yml @@ -1,4 +1,4 @@ -# Copyright [2020] [Phil Chen] +# Copyright [2024] [Phil Chen] # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ Resources: AWSConfigS3Bucket: Type: AWS::S3::Bucket DeletionPolicy: Retain + UpdateReplacePolicy: Retain Properties: BucketEncryption: ServerSideEncryptionConfiguration: @@ -78,7 +79,7 @@ Resources: Action: - 'sts:AssumeRole' ManagedPolicyArns: - - 'arn:aws:iam::aws:policy/service-role/AWSConfigRole' + - 'arn:aws:iam::aws:policy/service-role/AWS_ConfigRole' Path: / Policies: - PolicyName: S3-access