I want to get `.terraform` directory as a cache in the next step so that I can run driftctl command. Here is my bitbucket-pipeline.yml
definitions:
caches:
terraform: .terraform
pipelines:
branches:
Dev:
- step:
name: Dev - Validate
caches:
- terraform
script:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID_DEV
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY_DEV
- export AWS_REGION=$AWS_REGION_DEV
- cp env/dev/backend.tf backend.tf
- terraform init
- terraform validate
- step:
name: Dev - Driftctl Scan
image: cloudskiff/driftctl
script:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID_DEV
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY_DEV
- export AWS_REGION=$AWS_REGION_DEV
- cd .terraform
- driftctl scan --from tfstate+s3://dev-tfstate/Terraform/terraform.tfstate
```
Since the previous step use different image, seems the it is not getting the cache. Here is the error I'm getting in second step:
```
<span>/opt/atlassian/pipelines/agent/tmp/shellScript449014055886284312.sh: cd: line 13: can't cd to .terraform: No such file or directory</span>
```