Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State discovery for Terraform cloud #1563

Merged
merged 2 commits into from
Jul 25, 2022
Merged

Conversation

sundowndev-snyk
Copy link
Contributor

@sundowndev-snyk sundowndev-snyk commented Jul 13, 2022

Q A
πŸ› Bug fix? no
πŸš€ New feature? yes
⚠ Deprecations? no
❌ BC Break no
πŸ”— Related issues CTX-331
❓ Documentation snyk/driftctl-docs#247

Description

This PR adds state discovery for terraform cloud backend. This was tested with a TFC workspace, using both named and tag-targeted configurations.

What changed

  • Moved TestHCL_getCurrentWorkspaceName test suite to hcl_test.go with no changes
  • Added support for Cloud block in schema
  • The backend block in HCL is not required anymore since Cloud and Backend are mutually exclusive

Notes for the reviewers

  • Should we rename the terraform/hcl package to a more relevant name ? I think hcl is a bit too generic for such a specific logic

@sundowndev-snyk sundowndev-snyk marked this pull request as draft July 13, 2022 07:54
@codecov-commenter
Copy link

Codecov Report

Merging #1563 (58ae9eb) into main (7e5c31f) will decrease coverage by 0.66%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1563      +/-   ##
==========================================
- Coverage   83.78%   83.12%   -0.67%     
==========================================
  Files         178      173       -5     
  Lines        6113     5998     -115     
==========================================
- Hits         5122     4986     -136     
- Misses        847      871      +24     
+ Partials      144      141       -3     
Impacted Files Coverage Ξ”
pkg/terraform/hcl/hcl.go 87.50% <ΓΈ> (ΓΈ)
pkg/cmd/scan.go 65.39% <72.72%> (-25.90%) ⬇️
pkg/terraform/hcl/cloud.go 100.00% <100.00%> (ΓΈ)
pkg/resource/google/google_compute_network.go 14.28% <0.00%> (-85.72%) ⬇️
pkg/resource/google/google_project_iam_member.go 20.00% <0.00%> (-80.00%) ⬇️
pkg/resource/google/google_storage_bucket.go 25.00% <0.00%> (-75.00%) ⬇️
pkg/resource/init_metadatas.go 0.00% <0.00%> (-53.85%) ⬇️
pkg/output/printer.go 55.55% <0.00%> (-44.45%) ⬇️
pkg/iac/supplier/IacChainSupplier.go 76.08% <0.00%> (-13.05%) ⬇️
... and 11 more

@sundowndev-snyk sundowndev-snyk added the kind/enhancement New feature or improvement label Jul 13, 2022
@sundowndev-snyk sundowndev-snyk marked this pull request as ready for review July 13, 2022 08:28
@sundowndev-snyk sundowndev-snyk requested review from eliecharra and moadibfr and removed request for eliecharra July 18, 2022 06:56
Copy link
Contributor

@moadibfr moadibfr left a comment

Choose a reason for hiding this comment

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

LGTM πŸ‘

@sundowndev-snyk sundowndev-snyk merged commit 351e216 into main Jul 25, 2022
@sundowndev-snyk sundowndev-snyk deleted the feat/tfstate-discovery-tfc branch July 25, 2022 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants