Skip to content

Instantly share code, notes, and snippets.

@partcyborg
Last active June 5, 2024 01:39
Show Gist options
  • Save partcyborg/370d66dfea927052e27fa00f2e378019 to your computer and use it in GitHub Desktop.
Save partcyborg/370d66dfea927052e27fa00f2e378019 to your computer and use it in GitHub Desktop.
Integration Test config and output for TestTerragruntAssumeRoleWebIdentityEnv and TestTerragruntAssumeRoleWebIdentityFile
web_identity_integration_test:
image:
name: golang:1.21.7
id_tokens:
GITLAB_OIDC_TOKEN:
aud: https://gitlab.com
variables:
# integration test variables
AWS_TEST_S3_ASSUME_ROLE: arn:aws:iam::503396375767:role/OrganizationAccountAccessRole
AWS_TEST_S3_IDENTITY_TOKEN_FILE_PATH: /tmp/web-identity-token
AWS_TEST_S3_IDENTITY_TOKEN_VAR: GITLAB_OIDC_TOKEN
# additional variables to setup the test
TERRAFORM_VERSION: 1.5.5
# before_script installs the terraform binary so the tests can function
before_script:
- apt-get update
- env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends unzip
- mkdir -p ${HOME}/bin
- curl -Lo /tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
- unzip /tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d ${HOME}/bin
- chmod 755 ${HOME}/bin/terraform
- export "PATH=${PATH}:${HOME}/bin"
script:
# write the WebIdentity token to a file so that TestTerragruntAssumeRoleWebIdentityFile works
- echo "${GITLAB_OIDC_TOKEN}" > "${AWS_TEST_S3_IDENTITY_TOKEN_FILE_PATH}"
- go test -v -run '^TestTerragruntAssumeRoleWebIdentity' ./test/...
Running with gitlab-runner 16.1.0~beta.1.ge3b19e73 (e3b19e73)
on shared-gitlab-runner-blue Ay7g_-T4s, system ID: r_WT5X1g1E6GC3
Resolving secrets
00:00
Preparing the "kubernetes" executor
00:00
"CPURequest" overwritten with "4"
"CPULimit" overwritten with "4"
Using Kubernetes namespace: shared-gitlab-runner
Using Kubernetes executor with image golang:1.21.7 ...
Using attach strategy to execute scripts...
Preparing environment
00:04
Waiting for pod shared-gitlab-runner/runner-ay7g-t4s-project-58328432-concurrent-0km2nm to be running, status is Pending
Running on runner-ay7g-t4s-project-58328432-concurrent-0km2nm via shared-gitlab-runner-blue-575f4fddcb-tqhrj...
Getting source from Git repository
00:02
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/singlestore/engineering/terragrunt-mwilder/.git/
Created fresh repository.
Checking out a038cf88 as detached HEAD (ref is assume-role-web-identity-pipeline)...
Skipping Git submodules setup
Executing "step_script" stage of the job script
01:50
$ apt-get update
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8786 kB]
Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [13.8 kB]
Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [157 kB]
Fetched 9211 kB in 1s (9204 kB/s)
Reading package lists...
$ env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends unzip
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
zip
The following NEW packages will be installed:
unzip
0 upgraded, 1 newly installed, 0 to remove and 13 not upgraded.
Need to get 166 kB of archives.
After this operation, 388 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bookworm/main amd64 unzip amd64 6.0-28 [166 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 166 kB in 0s (2811 kB/s)
Selecting previously unselected package unzip.
(Reading database ... 15610 files and directories currently installed.)
Preparing to unpack .../unzip_6.0-28_amd64.deb ...
Unpacking unzip (6.0-28) ...
Setting up unzip (6.0-28) ...
$ mkdir -p ${HOME}/bin
$ curl -Lo /tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 20.0M 100 20.0M 0 0 212M 0 --:--:-- --:--:-- --:--:-- 213M
$ unzip /tmp/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -d ${HOME}/bin
Archive: /tmp/terraform_1.5.5_linux_amd64.zip
inflating: /root/bin/terraform
$ chmod 755 ${HOME}/bin/terraform
$ export "PATH=${PATH}:${HOME}/bin"
$ echo "${GITLAB_OIDC_TOKEN}" > "${AWS_TEST_S3_IDENTITY_TOKEN_FILE_PATH}"
$ go test -v -run '^TestTerragruntAssumeRoleWebIdentity' ./test/...
go: downloading github.com/gruntwork-io/go-commons v0.17.1
go: downloading github.com/aws/aws-sdk-go v1.50.0
go: downloading cloud.google.com/go/storage v1.33.0
go: downloading github.com/stretchr/testify v1.9.0
go: downloading github.com/gruntwork-io/terratest v0.41.0
go: downloading google.golang.org/api v0.149.0
go: downloading github.com/hashicorp/go-multierror v1.1.1
go: downloading github.com/hashicorp/hcl/v2 v2.19.1
go: downloading github.com/gitsight/go-vcsurl v1.0.1
go: downloading github.com/zclconf/go-cty v1.14.1
go: downloading gopkg.in/ini.v1 v1.67.0
go: downloading github.com/hashicorp/go-getter v1.7.4
go: downloading github.com/hashicorp/go-version v1.6.0
go: downloading github.com/sirupsen/logrus v1.9.3
go: downloading github.com/hashicorp/go-cleanhttp v0.5.2
go: downloading github.com/hashicorp/go-safetemp v1.0.0
go: downloading github.com/hashicorp/terraform-config-inspect v0.0.0-20210318070130-9a80970d6b34
go: downloading github.com/gruntwork-io/gruntwork-cli v0.7.0
go: downloading github.com/mattn/go-zglob v0.0.3
go: downloading github.com/google/uuid v1.5.0
go: downloading golang.org/x/exp v0.0.0-20231006140011-7918f672742d
go: downloading golang.org/x/sync v0.5.0
go: downloading golang.org/x/text v0.14.0
go: downloading github.com/gofrs/flock v0.8.1
go: downloading github.com/hashicorp/go-getter/v2 v2.2.1
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/mitchellh/mapstructure v1.5.0
go: downloading golang.org/x/oauth2 v0.15.0
go: downloading cloud.google.com/go v0.111.0
go: downloading golang.org/x/term v0.18.0
go: downloading github.com/creack/pty v1.1.17
go: downloading github.com/getsops/sops/v3 v3.8.1
go: downloading github.com/hashicorp/hcl v1.0.1-vault
go: downloading github.com/hashicorp/terraform v0.15.3
go: downloading github.com/imdario/mergo v0.3.12
go: downloading github.com/posener/complete v1.2.3
go: downloading github.com/urfave/cli/v2 v2.26.0
go: downloading github.com/gruntwork-io/boilerplate v0.5.11
go: downloading github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
go: downloading github.com/pkg/errors v0.9.1
go: downloading go.opentelemetry.io/otel v1.23.1
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.23.1
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.23.1
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.23.0
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.23.0
go: downloading go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.23.1
go: downloading go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.22.0
go: downloading go.opentelemetry.io/otel/metric v1.23.1
go: downloading go.opentelemetry.io/otel/sdk/metric v1.23.1
go: downloading go.opentelemetry.io/otel/sdk v1.23.1
go: downloading go.opentelemetry.io/otel/trace v1.23.1
go: downloading github.com/hashicorp/errwrap v1.1.0
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading gopkg.in/yaml.v3 v3.0.1
go: downloading github.com/go-errors/errors v1.4.2
go: downloading github.com/urfave/cli v1.22.14
go: downloading github.com/terraform-linters/tflint v0.47.0
go: downloading github.com/labstack/echo/v4 v4.11.4
go: downloading golang.org/x/sys v0.18.0
go: downloading github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c
go: downloading github.com/rogpeppe/go-internal v1.11.0
go: downloading github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d
go: downloading github.com/klauspost/compress v1.17.7
go: downloading github.com/mitchellh/go-testing-interface v1.14.1
go: downloading github.com/ulikunitz/xz v0.5.11
go: downloading cloud.google.com/go/compute/metadata v0.2.3
go: downloading cloud.google.com/go/iam v1.1.5
go: downloading github.com/googleapis/gax-go/v2 v2.12.0
go: downloading cloud.google.com/go/compute v1.23.3
go: downloading google.golang.org/genproto v0.0.0-20231212172506-995d672761c0
go: downloading google.golang.org/grpc v1.61.0
go: downloading google.golang.org/protobuf v1.33.0
go: downloading github.com/apparentlymart/go-textseg/v15 v15.0.0
go: downloading github.com/mitchellh/go-wordwrap v1.0.1
go: downloading github.com/agext/levenshtein v1.2.3
go: downloading github.com/google/go-cmp v0.6.0
go: downloading go.opentelemetry.io/proto/otlp v1.1.0
go: downloading github.com/go-logr/logr v1.4.1
go: downloading google.golang.org/genproto/googleapis/rpc v0.0.0-20240102182953-50ed04b92917
go: downloading github.com/go-ozzo/ozzo-validation v3.6.0+incompatible
go: downloading gopkg.in/yaml.v2 v2.4.0
go: downloading github.com/charmbracelet/bubbles v0.16.1
go: downloading github.com/charmbracelet/bubbletea v0.24.2
go: downloading github.com/charmbracelet/glamour v0.6.0
go: downloading github.com/charmbracelet/lipgloss v0.9.1
go: downloading github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.2
go: downloading github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
go: downloading github.com/labstack/gommon v0.4.2
go: downloading golang.org/x/crypto v0.21.0
go: downloading golang.org/x/net v0.23.0
go: downloading github.com/go-sql-driver/mysql v1.5.0
go: downloading github.com/pquerna/otp v1.2.1-0.20191009055518-468c2dd2b58d
go: downloading google.golang.org/genproto/googleapis/api v0.0.0-20240102182953-50ed04b92917
go: downloading go.opencensus.io v0.24.0
go: downloading github.com/fatih/color v1.15.0
go: downloading github.com/hashicorp/logutils v1.0.0
go: downloading github.com/jessevdk/go-flags v1.5.0
go: downloading github.com/sourcegraph/jsonrpc2 v0.2.0
go: downloading github.com/spf13/afero v1.9.5
go: downloading github.com/terraform-linters/tflint-plugin-sdk v0.17.0
go: downloading github.com/terraform-linters/tflint-ruleset-terraform v0.4.0
go: downloading github.com/zclconf/go-cty-yaml v1.0.3
go: downloading github.com/hashicorp/terraform-svchost v0.0.1
go: downloading github.com/go-logr/stdr v1.2.2
go: downloading github.com/cenkalti/backoff/v4 v4.2.1
go: downloading github.com/golang/protobuf v1.5.3
go: downloading github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0
go: downloading github.com/AlecAivazis/survey/v2 v2.3.4
go: downloading github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3
go: downloading github.com/pterm/pterm v0.12.41
go: downloading github.com/google/go-jsonnet v0.18.0
go: downloading github.com/Masterminds/sprig/v3 v3.2.3
go: downloading github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
go: downloading github.com/muesli/reflow v0.3.0
go: downloading github.com/sahilm/fuzzy v0.1.0
go: downloading github.com/golang-jwt/jwt v3.2.2+incompatible
go: downloading github.com/valyala/fasttemplate v1.2.2
go: downloading golang.org/x/time v0.5.0
go: downloading github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81
go: downloading github.com/mattn/go-isatty v0.0.20
go: downloading github.com/mattn/go-localereader v0.0.1
go: downloading github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b
go: downloading github.com/muesli/cancelreader v0.2.2
go: downloading github.com/muesli/termenv v0.15.2
go: downloading github.com/mattn/go-runewidth v0.0.15
go: downloading github.com/russross/blackfriday/v2 v2.1.0
go: downloading github.com/yuin/goldmark v1.5.2
go: downloading github.com/yuin/goldmark-emoji v1.0.1
go: downloading github.com/mattn/go-colorable v0.1.13
go: downloading github.com/cloudflare/circl v1.3.7
go: downloading github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
go: downloading github.com/jstemmer/go-junit-report v1.0.0
go: downloading github.com/owenrumney/go-sarif v1.1.1
go: downloading github.com/sourcegraph/go-lsp v0.0.0-20200429204803-219e11d77f5d
go: downloading github.com/google/go-github/v35 v35.3.0
go: downloading github.com/hashicorp/go-plugin v1.4.10
go: downloading github.com/apparentlymart/go-cidr v1.1.0
go: downloading github.com/bmatcuk/doublestar v1.3.4
go: downloading github.com/hashicorp/go-uuid v1.0.3
go: downloading github.com/apparentlymart/go-versions v1.0.1
go: downloading github.com/hashicorp/go-retryablehttp v0.7.1
go: downloading github.com/aws/aws-sdk-go-v2 v1.21.1
go: downloading golang.org/x/mod v0.13.0
go: downloading github.com/blang/semver v3.5.1+incompatible
go: downloading github.com/aws/aws-sdk-go-v2/config v1.18.44
go: downloading github.com/goware/prefixer v0.0.0-20160118172347-395022866408
go: downloading github.com/aws/aws-sdk-go-v2/credentials v1.13.42
go: downloading github.com/aws/aws-sdk-go-v2/service/kms v1.24.6
go: downloading github.com/aws/aws-sdk-go-v2/service/sts v1.23.1
go: downloading github.com/atotto/clipboard v0.1.4
go: downloading github.com/valyala/bytebufferpool v1.0.0
go: downloading github.com/alecthomas/chroma v0.10.0
go: downloading github.com/microcosm-cc/bluemonday v1.0.21
go: downloading github.com/olekukonko/tablewriter v0.0.5
go: downloading github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
go: downloading github.com/Masterminds/goutils v1.1.1
go: downloading github.com/Masterminds/semver/v3 v3.2.1
go: downloading github.com/mitchellh/copystructure v1.2.0
go: downloading github.com/huandu/xstrings v1.3.3
go: downloading github.com/shopspring/decimal v1.2.0
go: downloading github.com/spf13/cast v1.3.1
go: downloading github.com/google/s2a-go v0.1.7
go: downloading github.com/googleapis/enterprise-certificate-proxy v0.3.2
go: downloading github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc
go: downloading github.com/jmespath/go-jmespath v0.4.0
go: downloading github.com/atomicgo/cursor v0.0.1
go: downloading github.com/gookit/color v1.5.0
go: downloading github.com/hashicorp/terraform-registry-address v0.2.0
go: downloading github.com/rivo/uniseg v0.2.0
go: downloading github.com/hashicorp/go-hclog v1.5.0
go: downloading github.com/mitchellh/panicwrap v1.0.0
go: downloading github.com/lib/pq v1.10.9
go: downloading filippo.io/age v1.1.1
go: downloading github.com/aymanbagabas/go-osc52/v2 v2.0.1
go: downloading github.com/lucasb-eyer/go-colorful v1.2.0
go: downloading github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0
go: downloading github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0
go: downloading github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.0.1
go: downloading cloud.google.com/go/kms v1.15.5
go: downloading github.com/hashicorp/vault/api v1.10.0
go: downloading github.com/getsops/gopgagent v0.0.0-20170926210634-4d7ea76ff71a
go: downloading github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
go: downloading github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87
go: downloading github.com/oklog/run v1.1.0
go: downloading github.com/mitchellh/reflectwalk v1.0.2
go: downloading github.com/aymerick/douceur v0.2.0
go: downloading github.com/aws/smithy-go v1.15.0
go: downloading github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.42
go: downloading github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.12
go: downloading github.com/aws/aws-sdk-go-v2/internal/ini v1.3.44
go: downloading github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.36
go: downloading github.com/aws/aws-sdk-go-v2/service/sso v1.15.1
go: downloading github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.2
go: downloading github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778
go: downloading github.com/google/go-querystring v1.1.0
go: downloading github.com/vmihailenco/msgpack/v5 v5.3.5
go: downloading github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0
go: downloading github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1
go: downloading github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.0.0
go: downloading github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.36
go: downloading github.com/cenkalti/backoff/v3 v3.2.2
go: downloading github.com/go-jose/go-jose/v3 v3.0.3
go: downloading github.com/hashicorp/go-rootcerts v1.0.2
go: downloading github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6
go: downloading github.com/hashicorp/go-secure-stdlib/strutil v0.1.2
go: downloading github.com/gorilla/css v1.0.0
go: downloading sigs.k8s.io/yaml v1.2.0
go: downloading github.com/dlclark/regexp2 v1.4.0
go: downloading github.com/vmihailenco/tagparser/v2 v2.0.0
go: downloading github.com/hashicorp/go-sockaddr v1.0.2
go: downloading github.com/ryanuber/go-glob v1.0.0
go: downloading github.com/kylelemons/godebug v1.1.0
go: downloading github.com/golang-jwt/jwt/v5 v5.0.0
? github.com/gruntwork-io/terragrunt/test/helpers [no test files]
=== RUN TestTerragruntAssumeRoleWebIdentityEnv
=== PAUSE TestTerragruntAssumeRoleWebIdentityEnv
=== RUN TestTerragruntAssumeRoleWebIdentityFile
=== PAUSE TestTerragruntAssumeRoleWebIdentityFile
=== CONT TestTerragruntAssumeRoleWebIdentityEnv
=== CONT TestTerragruntAssumeRoleWebIdentityFile
=== NAME TestTerragruntAssumeRoleWebIdentityEnv
integration_test.go:4227: Copying fixture-assume-role-web-identity/env-var to /tmp/terragrunt-test3218253589
=== NAME TestTerragruntAssumeRoleWebIdentityFile
integration_test.go:4227: Copying fixture-assume-role-web-identity/file-path to /tmp/terragrunt-test2082538588
=== NAME TestTerragruntAssumeRoleWebIdentityEnv
integration_test.go:4181: [terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir /tmp/terragrunt-test3218253589/fixture-assume-role-web-identity/env-var]
=== NAME TestTerragruntAssumeRoleWebIdentityFile
integration_test.go:4181: [terragrunt apply -auto-approve --terragrunt-non-interactive --terragrunt-working-dir /tmp/terragrunt-test2082538588/fixture-assume-role-web-identity/file-path]
integration_test.go:4498: Deleting test s3 bucket terragrunt-test-bucket-leufmk
=== NAME TestTerragruntAssumeRoleWebIdentityEnv
integration_test.go:4498: Deleting test s3 bucket terragrunt-test-bucket-cjo8ev
--- PASS: TestTerragruntAssumeRoleWebIdentityFile (7.56s)
--- PASS: TestTerragruntAssumeRoleWebIdentityEnv (7.67s)
PASS
ok github.com/gruntwork-io/terragrunt/test 7.701s
Cleaning up project directory and file based variables
00:00
Job succeeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment