ns1-terraform / terraform-provider-ns1

Terraform NS1 provider
https://www.terraform.io/docs/providers/ns1/
Mozilla Public License 2.0
31 stars 63 forks source link

NS1 provider is not creating the user correctly #237

Closed ismferd closed 1 year ago

ismferd commented 2 years ago

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

"1.0.4"

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "ns1_user" "user" {
  name     = "user_test"
  username = "user_test"
  email    = "user_test@example.com"

  account_manage_account_settings = true
  account_manage_apikeys          = true
  account_manage_payment_methods  = true
  account_manage_teams            = true
  account_manage_users            = true
  account_view_activity_log       = true
  account_view_invoices           = true
  data_manage_datafeeds           = true
  data_manage_datasources         = true
  data_push_to_datafeeds          = true
  dns_manage_zones                = true
  dns_view_zones                  = true
  dns_zones_allow_by_default      = true
  monitoring_manage_jobs          = true
  monitoring_manage_lists         = true
  monitoring_view_jobs            = true
  security_manage_global_2fa      = true
  dhcp_manage_dhcp                = false
  dhcp_view_dhcp                  = false
  ipam_manage_ipam                = false
  ipam_view_ipam                  = false

  notify = {
    billing = true
  }
}

terraform {
  required_providers {

    ns1 = {
      source  = "ns1-terraform/ns1"
      version = "1.12.8"
    }

    time = {
      source  = "hashicorp/time"
      version = "~> 0.7.0"
    }
  }

  // this is pinned to a single version to prevent accidental upgrades of the statefile
  required_version = "1.0.4"
}

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://gist.github.com/ismferd/c31f8ae722a9dda0137a71b36ee989b6

Expected Behavior

What should have happened? Terraform should create the user with those 4 fields to false:

      "dhcp_manage_dhcp"                = false
      "dhcp_view_dhcp"                  = false
      "ipam_manage_ipam"                = false
      "ipam_view_ipam"                  = false

Actual Behavior

What actually happened? The user has more permissions I set it.

curl -X GET -H "X-NSONE-KEY: $API_KEY" https://api.nsone.net/v1/account/users/user_test
...
 "dhcp": {
      "manage_dhcp": true,
      "tags_allow": [],
      "tags_deny": [],
      "view_dhcp": true
    },
    "ipam": {
      "manage_ipam": true,
      "tags_allow": [],
      "tags_deny": [],
      "view_ipam": true
    },
...

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
eravin-ns1 commented 1 year ago

We released version 1.13.1 today, it should fix the above issue.

eravin-ns1 commented 1 year ago

Fixed in 1.13.1.

ismferd commented 1 year ago

Thanks, It helped us a lot.