File tree Expand file tree Collapse file tree 7 files changed +146
-2
lines changed
Expand file tree Collapse file tree 7 files changed +146
-2
lines changed Original file line number Diff line number Diff line change 1+ name : Test driftctl-action
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+
9+ jobs :
10+ test :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout
14+ uses : actions/checkout@v2
15+
16+ - name : Run driftctl
17+ uses : ./
18+ env :
19+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
20+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
21+ AWS_REGION : us-east-1
22+ DCTL_NO_VERSION_CHECK : true
23+ DCTL_FROM : " tfstate://tests/terraform.tfstate"
24+ DCTL_FILTER : " Type=='unknown_type'" # Makes driftctl to exit 0 each time
25+
26+ - name : Run driftctl v0.5.0
27+ uses : ./
28+ env :
29+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
30+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
31+ AWS_REGION : us-east-1
32+ DCTL_NO_VERSION_CHECK : true
33+ DCTL_FROM : " tfstate://tests/terraform.tfstate"
34+ DCTL_FILTER : " Type=='unknown_type'" # Makes driftctl to exit 0 each time
35+ with :
36+ version : 0.5.0
Original file line number Diff line number Diff line change 1+ FROM alpine:3.12.4
2+
3+ RUN apk add --update --no-cache curl git bash gnupg
4+
5+ COPY . .
6+
7+ RUN chmod +x /entrypoint.sh
8+
9+ ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change 1- # driftctl-action
2- GitHub Action for driftctl
1+ # GitHub Action for driftctl
2+
3+ ` driftctl-action ` runs a full driftctl scan in your GitHub Actions workflow.
4+
5+ ## Inputs
6+
7+ ### ` version `
8+
9+ The version of driftctl to install. Default to ` latest ` .
10+
11+ ## Example usage
12+
13+ ``` yml
14+ name : Test Workflow
15+
16+ on : [push, pull_request]
17+
18+ jobs :
19+ test :
20+ runs-on : ubuntu-latest
21+ steps :
22+ - name : Checkout
23+ uses : actions/checkout@v2
24+ - name : Run driftctl
25+ uses : cloudskiff/driftctl-action@v1
26+ with :
27+ version : 0.6.0
28+ ` ` `
Original file line number Diff line number Diff line change 1+ name : " driftctl-action"
2+ author : " CloudSkiff"
3+ description : " Run driftctl in your GitHub Actions workflow."
4+
5+ runs :
6+ using : " docker"
7+ image : " Dockerfile"
8+
9+ inputs :
10+ version :
11+ description : " The version of driftctl to install."
12+ required : false
13+ default : " latest"
14+
15+ branding :
16+ icon : " cloud"
17+ color : " blue"
Original file line number Diff line number Diff line change 1+ -----BEGIN PGP PUBLIC KEY BLOCK-----
2+
3+ mDMEYBv2ABYJKwYBBAHaRw8BAQdAstkQggX4bNXmfdiy+Cn6XrQLk0GNx+s4hbvu
4+ Oi6DBS60JENsb3Vkc2tpZmYgPHNlY3VyaXR5QGNsb3Vkc2tpZmYuY29tPoiQBBMW
5+ CAA4FiEEJ3ZmAFp/AdSE9jdtrMd2p5yCTr0FAmAb9gACGwMFCwkIBwIGFQoJCAsC
6+ BBYCAwECHgECF4AACgkQrMd2p5yCTr3CCgEA5kYdx5TMTHUJXwVs64QpQB5neN41
7+ y7EEnD7zWoZUMxcBAOeZxVsR6VZQENhpBpFcSJDSHAK6KDdrBYc2FpRDXQ4G
8+ =L0r6
9+ -----END PGP PUBLIC KEY BLOCK-----
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ log_error () {
4+ echo $1
5+ exit 1
6+ }
7+
8+ install_driftctl () {
9+ echo " Installing dctlenv"
10+ git clone --depth 1 --branch v0.1.3 https://github.com/wbeuil/dctlenv ~ /.dctlenv
11+ export PATH=" $HOME /.dctlenv/bin:$PATH "
12+ gpg --import cloudskiff_pubkey.pem
13+
14+ echo " Downloading driftctl:$version "
15+ DCTLENV_PGP=1 dctlenv use $version
16+ }
17+
18+ parse_inputs () {
19+ # Required inputs
20+ if [ " $INPUT_VERSION " != " " ]; then
21+ version=$INPUT_VERSION
22+ else
23+ log_error " Input version cannot be empty"
24+ fi
25+ }
26+
27+ # First we need to parse inputs
28+ parse_inputs
29+
30+ # Then we install the requested driftctl binary
31+ install_driftctl
32+
33+ # Finally we run the scan command
34+ driftctl scan
Original file line number Diff line number Diff line change 1+ {
2+ "version" : 4 ,
3+ "terraform_version" : " 0.14.4" ,
4+ "serial" : 2 ,
5+ "lineage" : " de636df3-c5dc-c1cf-ed3b-8908a1e971b8" ,
6+ "outputs" : {
7+ "public_ip" : {
8+ "value" : " 3.91.106.58" ,
9+ "type" : " string"
10+ }
11+ },
12+ "resources" : []
13+ }
You can’t perform that action at this time.
0 commit comments