terrascan icon indicating copy to clipboard operation
terrascan copied to clipboard

Unsupported block type; Blocks of type "cloud" are not expected here.

Open yermulnik opened this issue 1 year ago • 13 comments

  • terrascan version: v1.15.2
  • Operating System: Ubuntu 20.04.5 LTS

Description

Scanning my Terraform config with Terrascan give me an error:

Unsupported block type; Blocks of type "cloud" are not expected here.

What I Did

> terrascan scan --config-path $HOME/.terrascan/config/terrascan.toml --log-level warn --iac-type terraform --policy-type all --use-terraform-cache
2022/09/08 20:27:57 [DEBUG] POST https://httpbin.org/post


Scan Errors -

        IaC Type            :   terraform
        Directory           :   /home/path/to/dir/with/tf/code
        Error Message       :   diagnostic errors while loading terraform config dir '/home/path/to/dir/with/tf/code'. error from terraform:
/home/path/to/dir/with/tf/code/backend.tf:2,3-8: Unsupported block type; Blocks of type "cloud" are not expected here.


        -----------------------------------------------------------------------

[skipping non-essential info on scan summary]

> cat backend.tf
terraform {
  cloud {
    organization = "[…]"

    workspaces {
      tags = [
        "mytag",
        "infra",
      ]
    }
  }
}

Terraform per se works as expected w/o issues.

yermulnik avatar Sep 08 '22 17:09 yermulnik

I have the exact same problem, same input, same output, etc. Happy to help providing whatever info may be needed to resolve this. :)

GoodGuyGroves avatar Sep 27 '22 15:09 GoodGuyGroves

Same problem here using Terraform Cloud as a backend!

occharliesmith avatar Nov 03 '22 08:11 occharliesmith

You have to update your terraform version >= 1.1.0. I had the same trouble and with the upgrade, was solved.

https://stackoverflow.com/questions/70763407/blocks-of-type-cloud-are-not-expected-here-for-integrating-with-terraform-clou

rodrigo-ramos avatar Dec 08 '22 19:12 rodrigo-ramos

You have to update your terraform version >= 1.1.0. I had the same trouble and with the upgrade, was solved.

https://stackoverflow.com/questions/70763407/blocks-of-type-cloud-are-not-expected-here-for-integrating-with-terraform-clou

This approach didn't work for me, I'm using terraform >= 1.3.0.

igorbrites avatar Jan 11 '23 15:01 igorbrites

All of a sudden all of my workflows that run terrascan are also running into this issue, I'm using required_version = ">= 1.3.0"

CalvinRossSmith avatar Jan 11 '23 20:01 CalvinRossSmith

TF 1.3.7 is similarly effected.

terrascan version: v1.15.1

terragrunt version v0.38.7

Darwin 21.6.0

  cloud {
    organization = "[[REDACTED]]"

    workspaces {
      name = "[[REDACTED]]"
    }
  }

  required_version = ">= 1.3.7"

  required_providers {
    archive = ...
  }
}```

davidjeddy avatar Jan 14 '23 15:01 davidjeddy

Any idea whom to tag here to at least have TerraScan devs look into this?

yermulnik avatar Feb 23 '23 19:02 yermulnik

Same problem for me, using different versions of terraform cloud (1.1.x, 1.2.x, 1.3.x) - all have the same problem with terrascan and the "cloud" type block

vdatsiuk avatar Feb 24 '23 22:02 vdatsiuk

Any idea whom to tag here to at least have TerraScan devs look into this?

@cesar-rodriguez Could you please assist?

yermulnik avatar Feb 28 '23 14:02 yermulnik

Hi @cesar-rodriguez, related to this issue terraform does support a cloud block is there any particular reason why this would be deemed unsupported by terrascan?

Reference: https://developer.hashicorp.com/terraform/cli/cloud/settings#the-cloud-block

jackton1 avatar Apr 14 '23 02:04 jackton1

Any idea whom to tag here to at least have TerraScan devs look into this?

@dev-gaur, maybe? https://github.com/tenable/terrascan/commit/87efa51baaad5644661c6d579cea1043bbd77004

ThomasGHenry avatar Jun 18 '23 07:06 ThomasGHenry

While static linked binaries are (in my opinion) a better option vs dynamic link; maybe terraform should be the exception for terrascan?

davidjeddy avatar Jul 25 '23 07:07 davidjeddy

did anyone come up with a solution for this? facing same issue using tf version >1.3

jonfoxchase avatar Mar 20 '24 16:03 jonfoxchase