Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Remove reliance on remote backend #30

Merged
merged 1 commit into from
Nov 24, 2022
Merged

Conversation

dms1981
Copy link
Contributor

@dms1981 dms1981 commented Nov 23, 2022

Relevant Issue: ministryofjustice/modernisation-platform#2647

Because the infrastructure created by terratest code is transient and to minimise the overhead of managing additional terraform state, the terratest code is being shifted to use local backend that doesn't persist the state between runs. The change makes the use of terraform workspaces irrelevant.

  • Update go-terratest workflow to remove the code explicitly selecting a workspace
  • Update README.md in the test folder to remove references to terraform workspaces
  • Update go code to remove set workspace command and merge Init + Apply back into one statement
  • Remove backend.tf from unit-test code
  • Update providers.tf to remove references to terraform.workspace
    Additionally some minor changes for consistency and neatness.

@dms1981 dms1981 requested a review from a team as a code owner November 23, 2022 16:43
@github-actions
Copy link
Contributor

TFSEC Scan Success

Show Output
*****************************

TFSEC will check the following folders:
.

*****************************

Running TFSEC in .
Excluding the following checks: AWS089, AWS099, AWS009, AWS097, AWS018
  timings
  ──────────────────────────────────────────
  disk i/o             111.903µs
  parsing              4.838213ms
  adaptation           638.615µs
  checks               21.599312ms
  total                27.188043ms

  counts
  ──────────────────────────────────────────
  modules downloaded   0
  modules processed    1
  blocks processed     61
  files read           4

  results
  ──────────────────────────────────────────
  passed               8
  ignored              34
  critical             0
  high                 0
  medium               0
  low                  0


No problems detected!

tfsec_exitcode=0

Checkov Scan Success

Show Output
*****************************

Checkov will check the following folders:
.

*****************************

Running Checkov in .
Excluding the following checks: CKV_GIT_1
2022-11-23 16:46:04,146 [MainThread  ] [WARNI]  Failed to download module github.com/ministryofjustice/modernisation-platform-terraform-ecs?ref=e57c01f26ddc488fe6c83bfdc2817510f44f3b19:None (for external modules, the --download-external-modules flag is required)
Process ForkProcess-11:
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.7/dist-packages/checkov/common/parallelizer/parallel_runner.py", line 37, in func_wrapper
    result = original_func(item)
  File "/usr/local/lib/python3.7/dist-packages/checkov/common/runners/runner_registry.py", line 89, in _parallel_run
    collect_skip_comments=collect_skip_comments,
  File "/usr/local/lib/python3.7/dist-packages/checkov/github/runner.py", line 34, in run
    self.prepare_data()
  File "/usr/local/lib/python3.7/dist-packages/checkov/github/runner.py", line 43, in prepare_data
    self.github.persist_all_confs()
  File "/usr/local/lib/python3.7/dist-packages/checkov/github/dal.py", line 137, in persist_all_confs
    self.persist_branch_protection_rules()
  File "/usr/local/lib/python3.7/dist-packages/checkov/github/dal.py", line 69, in persist_branch_protection_rules
    BaseVCSDAL.persist(path=self.github_branch_protection_rules_file_path, conf=data)
  File "/usr/local/lib/python3.7/dist-packages/checkov/common/vcs/base_vcs_dal.py", line 113, in persist
    BaseVCSDAL.ensure_dir(path)
  File "/usr/local/lib/python3.7/dist-packages/checkov/common/vcs/base_vcs_dal.py", line 123, in ensure_dir
    os.makedirs(directory_path)
  File "/usr/lib/python3.7/os.py", line 221, in makedirs
    mkdir(name, mode)
FileNotFoundError: [Errno 2] No such file or directory: ''
terraform scan results:

Passed checks: 38, Failed checks: 0, Skipped checks: 10

github_actions scan results:

Passed checks: 123, Failed checks: 0, Skipped checks: 0


checkov_exitcode=0

CTFLint Scan Success

Show Output
*****************************

Setting default tflint config...
Running tflint --init...
Installing `terraform` plugin...
Installed `terraform` (source: github.com/terraform-linters/tflint-ruleset-terraform, version: 0.2.1)
tflint will check the following folders:
.

*****************************

Running tflint in .
tflint_exitcode=0

Copy link
Contributor

@julialawrence julialawrence left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dms1981 dms1981 merged commit 9e9e245 into main Nov 24, 2022
@dms1981 dms1981 deleted the feature/remove-test-backends-2647 branch November 24, 2022 10:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants