PaloAltoNetworks / terraform-provider-prismacloud

Terraform PrismaCloud provider
https://www.terraform.io/docs/providers/prismacloud/
Mozilla Public License 2.0
54 stars 65 forks source link

prismacloud_enterprise_settings does not match API Spec for required values #118

Closed mitchellharvey97 closed 2 years ago

mitchellharvey97 commented 2 years ago

Describe the bug

Terraform object prismacloud_enterprise_settings does not match the expected API Request object https://prisma.pan.dev/api/cloud/cspm/settings#operation/update-enterprise-settings.

It appears that as part of the new feature release here that the field accessKeyMaxValidity is required for this endpoint, but the terraform provider doesn't support this field.

Expected behavior

For the Terraform provider to match the API Spec

Current behavior

Terraform Crashes with either Error: 400/https://api.anz.prismacloud.io/settings/enterprise Error(msg:missing_required_parameter severity:error subject:accessKeyMaxValidity) or

│ Error: Unsupported argument
│ 
│   on main.tf line 12, in resource "prismacloud_enterprise_settings" "my_org":
│   12:   accessKeyMaxValidity         = 30
│ 
│ An argument named "accessKeyMaxValidity" is not expected here.

Possible solution

Update the Terraform provider & docs to support these new mandatory fields

Steps to reproduce

Run a Terraform Plan with the following

resource "prismacloud_enterprise_settings" "my_org" {
  accessKeyMaxValidity         = 30
  require_alert_dismissal_note = true

  session_timeout = 120
  default_policies_enabled = {
    "high" : "true",
    "medium" : "false",
    "low" : "false",
  }
}

and you will get:

│ Error: Unsupported argument
│ 
│   on main.tf line 12, in resource "prismacloud_enterprise_settings" "skedulo":
│   12:   accessKeyMaxValidity         = 30
│ 
│ An argument named "accessKeyMaxValidity" is not expected here.

OR run a Terraform apply with the following

resource "prismacloud_enterprise_settings" "my_org" {
  require_alert_dismissal_note = true

  session_timeout = 120
  default_policies_enabled = {
    "high" : "true",
    "medium" : "false",
    "low" : "false",
  }
}

and you will get Error: 400/https://api.anz.prismacloud.io/settings/enterprise Error(msg:missing_required_parameter severity:error subject:accessKeyMaxValidity)

Screenshots

Context

Can not manage Enterprise settings Via Terraform

Your Environment

Terraform v1.1.4 on Terraform Cloud Provider: registry.terraform.io/paloaltonetworks/prismacloud v1.2.2

welcome-to-palo-alto-networks[bot] commented 2 years ago

:tada: Thanks for opening your first issue here! Welcome to the community!