hashicorp / terraform-provider-googleworkspace

Terraform Provider for Google Workspace
https://registry.terraform.io/providers/hashicorp/googleworkspace
Mozilla Public License 2.0
130 stars 59 forks source link

Provider produced inconsistent final plan after resource googleworkspace_group_settings creation #463

Open ankitg4 opened 1 year ago

ankitg4 commented 1 year ago

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed. 1.5.5

Affected Resource(s)

Please list the resources as a list, for example: googleworkspace_group_settings

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

Terraform Configuration Files

terraform.tfvars

map_for_groups = {
  Crisis_Team = {
    description = "crisis"
    owners = [
      "xxxxx@yy.com",
    ]
    members = [
      "xxxx@yy.com",
    ]
  },
}

Module

module "group" {
  source = "./group-module"

  for_each                       = var.map_for_groups
  id                             = "${each.key}@${each.value.domain}"
  display_name                   = each.key
  description                    = each.value.description
  domain                         = each.value.domain
  owners                         = each.value.owners != null ? each.value.owners : []
  managers                       = each.value.managers != null ? each.value.managers : []
  members                        = each.value.members != null ? each.value.members : []
....
}

variables.tf

variable "map_for_groups" {
  type = map(object({
    domain                         = optional(string, "yy.com")
    owners                         = optional(list(string))
    managers                       = optional(list(string))
    description                    = optional(string, "group created with terraform")
    members                        = optional(list(string))
...
  }))
}

group-module/group-setting.tf

resource "googleworkspace_group" "create_group" {
  email       = var.id
  name        = var.display_name
  description = var.description
  aliases     = var.aliases
}

resource "googleworkspace_group_settings" "group_settings" {
  email                          = googleworkspace_group.create_group.email
  ......
}

Debug Output

Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

no error

Actual Behavior

module.group["Crisis_Team"].googleworkspace_group.create_group: Creating... module.group["Crisis_Team"].googleworkspace_group.create_group: Still creating... [10s elapsed] module.group["Crisis_Team"].googleworkspace_group.create_group: Creation complete after 18s [id=02u6wntf0n043jl] module.group["Crisis_Team"].googleworkspace_group_members.group_members_add[0]: Creating... module.group["Crisis_Team"].googleworkspace_group_members.group_members_add[0]: Creation complete after 4s [id=groups/02u6wntf0n043jl] ╷ │ Error: Provider produced inconsistent final plan │ │ When expanding the plan for │ module.group["Crisis_Team"].googleworkspace_group_settings.group_settings │ to include new values learned so far during apply, provider │ "registry.terraform.io/hashicorp/googleworkspace" produced an invalid new │ value for .email: was │ cty.StringVal("Crisis_Team@yy.com"), but now │ cty.StringVal("crisis_team@yy.com"). │ │ This is a bug in the provider, which should be reported in the provider's │ own issue tracker. ╵ time=2023-08-23T08:50:15Z level=error msg=Terraform invocation failed in /workspace/infrastructure/base/application/.terragrunt-cache/yaM8PfjkdTwTAPISn07Jj8aUYTY/_r_3GVArpItcTrZkN8HTLMN-K6Q prefix=[/workspace/infrastructure/base/application] time=2023-08-23T08:50:15Z level=error msg=1 error occurred:

Steps to Reproduce

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

  1. terraform apply
ankitg4 commented 1 year ago

module.group["Crisis_Team"].googleworkspace_group_settings.group_settings.email case is getting changed to lower unexpectedly.