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

The "name" field in integrations should be required #70

Closed
mati007thm opened this issue Apr 26, 2024 · 0 comments · Fixed by #80
Closed

The "name" field in integrations should be required #70

mati007thm opened this issue Apr 26, 2024 · 0 comments · Fixed by #80

Comments

@mati007thm
Copy link
Contributor

Describe the bug
Currently the "name" field in resources such as integration_gcp_resource is set to be optional but should be required to avoid the following error I encountered while writing and adding the slack integration:

Error: Provider produced inconsistent result after apply
 
When applying changes to mondoo_integration_slack.slack_abc, provider "provider[\"registry.terraform.io/mondoohq/mondoo\"]"
produced an unexpected new value: .name: was null, but now cty.StringVal("").
 
This is a bug in the provider, which should be reported in the provider's own issue tracker.

To Reproduce
Use any of the examples that have a "name" field as an optional parameter and try to run terraform apply while not providing the field e.g.:

terraform {
  required_providers {
    mondoo = {
      source = "mondoohq/mondoo"
    }
  }
}

provider "mondoo" {
  region = "us"
}

resource "mondoo_space" "my_space" {
  name = "My Space Name"
  # space_id = "your-space-id" # optional
  org_id = "your-org-1234567"
}

resource "mondoo_integration_oci_tenant" "tenant_abc" {
  space_id = mondoo_space.my_space.id
  # name     = "tenant ABC" remove this line !

  tenancy = "ocid1.tenancy.oc1..aaaaaaaavvvvvvvvwwwwwwwwxxxxxx..."
  region  = "us-ashburn-1"
  user    = "ocid1.user.oc1..aaaaaaaabbbbbbbbccccccccddddeeeeee..."

  credentials = {
    fingerprint = "12:34:56:78:9a:bc:de:f1:23:45:67:89:ab:cd:ef:12"
    private_key = <<EOT
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCf2kWtE6JkkP6E
cnQx/1oa4GqFs23nJFBQhgn9AThqAyUC1ilLQV9ZKjQj5/6+ljq/i4H/zU5lt2yB
....
qpbiCwjFYHmjWFygtYPhRH4T5TEzu4DXhjr4nn99sF0QFKcYkcTSIm7aZppYG4OS
1fnF+XoTcyFIGcSX/I1ND/4=
-----END PRIVATE KEY-----
EOT
  }
}

Expected behavior
The expected behaviour would be a CLI output stating that the field "name" is missing but required:

Error: Missing required argument
 
on resource.tf line 18, in resource "mondoo_integration_slack" "slack_abc":
18: resource "mondoo_integration_slack" "slack_abc" {

The argument "name" is required, but no definition was found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant