Merge branch 'main' into all-contributors

main
Elie 2021-02-03 15:01:29 +01:00 committed by GitHub
commit 01c677f825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 71 additions and 5 deletions

View File

@ -1,6 +1,7 @@
version: 2.1
orbs:
aws-cli: circleci/aws-cli@1.3.0
go: circleci/go@1.5.0
jobs:
build:
docker:
@ -12,6 +13,44 @@ jobs:
root: ~/project
paths:
- bin/
test_acc:
machine:
image: ubuntu-2004:202010-01
environment:
AWS_DEFAULT_REGION: us-east-1
steps:
- checkout
- go/install:
version: 1.15.7
- run:
name: install dependencies
command: |
sudo apt-get -qq update && sudo apt-get -qq -y install unzip
curl "https://releases.hashicorp.com/terraform/0.14.5/terraform_0.14.5_linux_amd64.zip" --output terraform.zip
unzip terraform.zip
sudo mv terraform /usr/local/bin && sudo chmod +x /usr/local/bin
terraform version
- run: make install-tools
- run:
name: Run acceptance tests
command: make acc
- run:
name: Discord notification
command: |
curl -X POST \
-H "Content-Type: application/json" \
-d "{\"content\": \"✅ Acceptance tests succeeded 🎉\n<${CIRCLE_BUILD_URL}>\" }"\
${DISCORD_WEBHOOK}
- run:
name: Discord notification
when: on_fail
command: |
curl -X POST \
-H "Content-Type: application/json" \
-d "{\"content\": \"❌ Acceptance tests failed\n<${CIRCLE_BUILD_URL}>\" }"\
${DISCORD_WEBHOOK}
- store_test_results:
path: ./
test:
docker:
- image: golang:1.15
@ -70,6 +109,17 @@ jobs:
brew install-bundler-gems -d -v
brew bump-formula-pr driftctl --url https://github.com/cloudskiff/driftctl/archive/$CIRCLE_TAG.tar.gz -d -v
workflows:
nightly:
jobs:
- test_acc:
context: driftctl-acc
triggers:
- schedule:
cron: "0 3 * * *"
filters:
branches:
only:
- main
pullrequest:
jobs:
- test:

6
doc/LIMITATIONS.md Normal file
View File

@ -0,0 +1,6 @@
# Known Issues and Limitations
## AWS Regions & Credentials Limits
- The user needs to use the same AWS region and credentials for both the scanned infrastructure and the S3 bucket where the Terraform state is stored (for example, a Terraform state stored on S3 on us-east-1 for an infrastructure to be scanned on us-west-1 won't work). Think `AWS_PROFILE` for the underlying reason. See the related [GitHub Discussion](https://github.com/cloudskiff/driftctl/discussions/130).
- Driftctl currently doesn't support multiple aliased providers in a single Terraform state (like a single account but multiple regions). This will be implemented soon.

View File

@ -22,3 +22,6 @@ Details of reported data can be found [here](./cmd/flags/error-reporting.md)
- [Iac sources](cmd/scan/iac_source.md)
- [Completion](cmd/completion/script.md)
## Issues
- [Known Issues & Limitations](LIMITATIONS.md)

View File

@ -5,6 +5,7 @@ provider "registry.terraform.io/hashicorp/aws" {
version = "3.19.0"
constraints = "3.19.0"
hashes = [
"h1:+7Vi7p13+cnrxjXbfJiTimGSFR97xCaQwkkvWcreLns=",
"h1:xur9tF49NgsovNnmwmBR8RdpN8Fcg1TD4CKQPJD6n1A=",
"zh:185a5259153eb9ee4699d4be43b3d509386b473683392034319beee97d470c3b",
"zh:2d9a0a01f93e8d16539d835c02b8b6e1927b7685f4076e96cb07f7dd6944bc6c",

View File

@ -77,3 +77,9 @@ gox \
-ldflags "${LD_FLAGS}" \
-output "bin/driftctl_{{.OS}}_{{.Arch}}" \
./
if [ $ENV = "release" ]; then
echo "+ Computing checksums"
cd bin
sha256sum * > driftctl_SHA256SUMS
fi

View File

@ -271,16 +271,16 @@ func Run(t *testing.T, c AccTestCase) {
if check.Check == nil {
t.Fatal("Check attribute must be defined")
}
if check.PreExec != nil {
c.useTerraformEnv()
check.PreExec()
c.restoreEnv()
}
if len(check.Env) > 0 {
for key, value := range check.Env {
os.Setenv(key, value)
}
}
if check.PreExec != nil {
c.useTerraformEnv()
check.PreExec()
c.restoreEnv()
}
_, out, cmdErr := runDriftCtlCmd(driftctlCmd)
if len(check.Env) > 0 {
for key := range check.Env {