Skip to content

Commit 0a04daa

Browse files
author
iru
committed
doc: tips on contribute
1 parent 7a18058 commit 0a04daa

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

CONTRIBUTE.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,31 @@ Implemented vía **Terraform Kitchen** | https://newcontext-oss.github.io/kitche
7373

7474
- Kitchen configuration can be found in `/.kitchen.yml`
7575
- Under `/test/fixtures` you can find the targets that will be tested. Please keep this as similar as possible to the Terraform Registry Modules examples.
76+
- In order to test this in your local environment use following recipee
77+
```bash
78+
terraform init -backend=false && \
79+
terraform validate && \
80+
terraform plan && \
81+
read && \ # will give you time to review plan or just push enter to apply
82+
terraform apply --auto-approve
83+
```
7684
- AWS_PROFILE configuration is required to access the [TF s3 state backend](#terraform-backend)
7785

78-
**Running Kitchen tests locally**
86+
### Terraform Backend
87+
88+
Because CI/CD sometimes fail, we setup the Terraform state to be handled in backend (s3+dynamo) within the Sysdig AWS backend (sysdig-test-account).
89+
90+
### Remote state cleanup from local
91+
92+
In case you need to handle terraform backend state from failing kitchen tests, some guidance for using the `backend.tf` remote state manifest, present on each test
93+
- Configure same parameters as the github action, that is `AWS_PROFILE`, and leave default `name` and `region` values
94+
- Kitchen works with `terraform workspaces` so, in case you want to fix a specific test, switch to that workspace after the `terraform init` with `terraform workspace select WORKSPACE`
95+
- Perform the desired terraform task
96+
97+
You can also use `kitchen destroy` instead of `terraform` but the requirements are the same, except that the workspace will be managed through kitchen
98+
99+
100+
### Running Kitchen tests locally
79101

80102
Ruby 2.7 is required to launch the tests.
81103
Run `bundle install` to get kitchen-terraform bundle.
@@ -92,16 +114,11 @@ $ bundle exec kitchen tests
92114

93115
# run one specific test
94116
$ bundle exec kitchen test "single-account-k8s-aws"
95-
96117
```
97118

98-
### Terraform Backend
99-
100-
Because CI/CD sometimes fail, we setup the Terraform state to be handled in backend (s3+dynamo) within the Sysdig AWS backend (sysdig-test-account).
101-
In order to be able to use this Terraform backend AWS credentials are configured as Github project secret
102-
103-
If terraform state ends up in bad shape and not cleaned, use the action called `Test Cleanup` that should destroy any messed situation.
104-
If this does not work, try it from your local, but please do it using `kitchen destroy`, not `terraform destroy` unless you really know what you're doing :]
119+
Note: As said before kitchen works with workspaces, so any local test, unless you change it, will fall into the `default` workspace and will not collide with
120+
Github Action tests. May collide however with other peers if they're doing similar tasks on local ;)
121+
You can always temporary delete the `backend.tf` file on the test you're running
105122

106123
### Deployed infrastructure resources
107124

0 commit comments

Comments
 (0)