onelogin / terraform-provider-onelogin

GNU General Public License v3.0
27 stars 19 forks source link

docs, some examples missing TF resource internal '=' #39

Closed rjhornsby closed 3 years ago

rjhornsby commented 3 years ago

Might be something changed in newer versions of TF syntax, running v0.14.6 presently.

The OL provider docs and some example code are missing the required '=' when setting values inside a resource block. For example in onelogin_app.md:

resource onelogin_apps my_app {
...
  provisioning {
    enabled = false
  }

throws an error on terraform plan:

Error: Unsupported block type

  on onelogin-auth.tf line 19, in resource "onelogin_apps" "my_app":
  19:   provisioning {

Blocks of type "provisioning" are not expected here. Did you mean to define
argument "provisioning"? If so, use the equals sign to assign it a value.

The syntax should be

  provisioning = {
    enabled = false
  }

This issue+fix does not affect the provider's operation or functionality in any way.

dcaponi commented 3 years ago

@rjhornsby Im on Terraform 0.14.7 and the latest version of our TF provider I tried running an app that looks like this

resource onelogin_oidc_apps onelogin_oidc_apps_aws-1369824 {
    connector_id = 108419
    notes = ""

    provisioning = {
        enabled = false
    }
    allow_assumed_signin = false
    description = ""
    name = "AWS"
    visible = true

    parameters = {
        default_values = ""
        include_in_saml_assertion = false
        label = "Groups"
        param_key_name = "groups"
        provisioned_entitlements = false
        safe_entitlements_enabled = false
        attributes_transformations = "group_list"
        skip_if_blank = false
        user_attribute_macros = ""
        user_attribute_mappings = "member_of"
        values = ""
    }
}

where I had a = for the parameters block and it gave me an error. are you sure this isn't due to some difference between your setup and mine? Do you have the latest version of the OneLogin provider installed?

rjhornsby commented 3 years ago

That's really weird. Just checked, and I'm on TF 0.14.7* as well. I'm also running the latest OL provider:

$ terraform providers
...
provider[registry.terraform.io/onelogin/onelogin] ~> 0.1.7

I was about to say I couldn't think of a reason why we would have the same setup and opposite syntax errors - are we possibly looking at the difference between hcl and json? Strictly speaking, that doesn't make sense because json wouldn't match either of our formats. as json syntax requires a : for hashes/maps ie "provisioning": { "enabled": false }

i don't fully understand it yet, but maybe this doc Attributes as Blocks is related?

* In the OP I noted 0.14.6, but in the meantime homebrew updated the TF binary to .7

dcaponi commented 3 years ago

oh weird. I happened to notice, after blowing away my .terraform directory that your case now comes up and an = is required. I must have had something cached from development. I'll just merge this @rjhornsby sorry for the hangup

rjhornsby commented 3 years ago

No worries. It's hard to keep up with TF syntax changes sometimes. We run into the same "weird. works for me?" thing among our team as well. :)