terraform-provider-gsuite icon indicating copy to clipboard operation
terraform-provider-gsuite copied to clipboard

Attribute gets ignored

Open astratto opened this issue 4 years ago • 4 comments

I've been playing around and it's a pretty great provider, thanks!

I've hit a weird situation with a newly created user:

  1. create a user with a random password and change_password_next_login = true
  2. turn the attribute to false and re-apply

The apply succeeds, but it keeps showing the diff and the attribute stays set to true.

A similar problem happens when setting a recovery phone, it gets set but I can't remove it.

Any ideas on how to troubleshoot this?

astratto avatar Nov 21 '19 17:11 astratto

Possibly API's changed underneath us, will need to look into this.

DeviaVir avatar Nov 22 '19 09:11 DeviaVir

Found the "issue" for the recovery_phone part.

Setting it to null is correctly detected as a change of the attribute, but the PUT doesn't send it.

  ~ resource "gsuite_user" "my_user" {
...
        name                       = {
            "family_name" = "My"
            "given_name"  = "User"
        }
      - recovery_phone             = "+34000000000" -> null
---[ REQUEST ]---------------------------------------
PUT /admin/directory/v1/users/...?alt=json&prettyPrint=false HTTP/1.1
Host: www.googleapis.com
User-Agent: google-api-go-client/0.5 (darwin amd64) Terraform/0.12.12
Content-Length: 55
Content-Type: application/json
X-Goog-Api-Client: gl-go/1.11.0 gdcl/20190802
Accept-Encoding: gzip

{
 "name": {
  "familyName": "My",
  "givenName": "User"
 }
}

astratto avatar Nov 22 '19 09:11 astratto

What happens if you set it to ""?

DeviaVir avatar Nov 22 '19 09:11 DeviaVir

Yeah, tried that and it still sees it as null and won't send it as parameter. 🤔

astratto avatar Nov 22 '19 10:11 astratto