Open onixsib opened 7 months ago
Hi, is it still reproducible with 0.105.0? If yes - could you share a sample so we can use to reproduce it locally?
╷
│ Error: Plugin did not respond
│
│ The plugin encountered an error, and failed to respond to the
│ plugin6.(*GRPCProvider).ApplyResourceChange call. The plugin logs may
│ contain more details.
╵
Stack trace from the terraform-provider-yandex_v0.105.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x1aaef09]
goroutine 28 [running]:
github.com/yandex-cloud/terraform-provider-yandex/yandex.getSamlUserAccount({0x2663c28, 0xc001406b40}, 0xc001350160, {0xc0005eabe8, 0x14}, {0xc0005eac00, 0x15})
github.com/yandex-cloud/terraform-provider-yandex/yandex/resource_yandex_organizationmanager_saml_federation_user_account.go:194 +0x389
github.com/yandex-cloud/terraform-provider-yandex/yandex.resourceYandexOrganizationManagerSamlFederationUserAccountRead({0x2663c28, 0xc001406b40}, 0xc001406b40?, {0x204bd20?, 0xc001350160})
github.com/yandex-cloud/terraform-provider-yandex/yandex/resource_yandex_organizationmanager_saml_federation_user_account.go:114 +0x106
github.com/yandex-cloud/terraform-provider-yandex/yandex.resourceYandexOrganizationManagerSamlFederationUserAccountCreate({0x2663c28, 0xc001406b40}, 0x0?, {0x204bd20?, 0xc001350160?})
github.com/yandex-cloud/terraform-provider-yandex/yandex/resource_yandex_organizationmanager_saml_federation_user_account.go:107 +0x5fe
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc000d67dc0, {0x2663c60, 0xc001406000}, 0xd?, {0x204bd20, 0xc001350160})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/resource.go:778 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000d67dc0, {0x2663c60, 0xc001406000}, 0xc001324b60, 0xc001378300, {0x204bd20, 0xc001350160})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/resource.go:909 +0xa7e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000729680, {0x2663c60?, 0xc001363e00?}, 0xc001319f90)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/grpc_provider.go:1027 +0xe8d
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x266e148?, 0xc000729680?}}, {0x2663c60, 0xc001363e00}, 0x0?)
github.com/hashicorp/terraform-plugin-mux@v0.11.2/tf5to6server/tf5to6server.go:37 +0x5a
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.muxServer.ApplyResourceChange({0xc000d84a80, 0xc000fcfb60, 0xc000d84ab0, 0xc000d84ae0, {0xc0008c6ce0, 0x2, 0x2}}, {0x2663c60?, 0xc001363ad0?}, 0xc001319f40)
github.com/hashicorp/terraform-plugin-mux@v0.11.2/tf6muxserver/mux_server_ApplyResourceChange.go:30 +0x139
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc000598960, {0x2663c60?, 0xc0013630e0?}, 0xc0001ed810)
github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov6/tf6server/server.go:819 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x22431c0?, 0xc000598960}, {0x2663c60, 0xc0013630e0}, 0xc001307b00, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:422 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0008bed20, {0x2663c60, 0xc001363050}, {0x266c920, 0xc000e44ea0}, 0xc0013707e0, 0xc000e3c960, 0x3ec3c60, 0x0)
google.golang.org/grpc@v1.59.0/server.go:1343 +0xe49
google.golang.org/grpc.(*Server).handleStream(0xc0008bed20, {0x266c920, 0xc000e44ea0}, 0xc0013707e0)
google.golang.org/grpc@v1.59.0/server.go:1737 +0xca6
google.golang.org/grpc.(*Server).serveStreams.func1.1()
google.golang.org/grpc@v1.59.0/server.go:986 +0x8c
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/grpc@v1.59.0/server.go:997 +0x15c
Error: The terraform-provider-yandex_v0.105.0 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
Yes it still crashes.
Below i has put code and data which going to provider.
variable "federations" {
type = map(any)
}
variable "folder_ids" {
type = map(any)
}
variable "cloud_ids" {
type = map(any)
}
variable "staff_users" {
type = list(object({
username = string
enabled = optional(bool)
email = string
email_verified = optional(bool)
first_name = string
last_name = string
groups = list(string)
initial_password = optional(string)
vpn_access = optional(object({
prod = optional(list(string))
staging = optional(list(string))
}))
cloud_access = optional(object({
prod = optional(object({
prod = optional(list(string))
}))
staging = optional(object({
stress = optional(list(string))
tech = optional(list(string))
}))
}))
description = optional(string)
}))
default = []
description = "List of users"
}
locals {
users = {
for user in var.staff_users : user.username => user
}
yandex_users = flatten([
for key, user in local.users : [
for cloud, access in user.cloud_access : {
username = "${user.username}"
email = "${user.email}"
cloud = "${cloud}"
access = access
} if access != null && access != ""
] if user.cloud_access != null && user.cloud_access != {}
])
yandex_users_folder = flatten([
for key, user in local.users : [
for cloud, access in user.cloud_access : [
for folder, rights in access : [
for role in rights :
{
username = "${user.username}"
email = "${user.email}"
username_cloud = "${user.username}-${cloud}"
cloud = "${cloud}"
folder = "${folder}"
role = "${role}"
}
] if rights != null
] if access != null
] if user.cloud_access != null && user.cloud_access != {}
])
}
resource "yandex_organizationmanager_saml_federation_user_account" "federation_account" {
for_each = { for user in local.yandex_users : "${user.username}-${user.cloud}" => user }
federation_id = yandex_organizationmanager_saml_federation.federation["${each.value.cloud}"].id
name_id = each.value.email
}
resource "yandex_resourcemanager_cloud_iam_member" "iam_member" {
for_each = { for user in local.yandex_users : "${user.username}-${user.cloud}" => user }
cloud_id = var.cloud_ids[each.value.cloud]
role = "resource-manager.clouds.member"
member = "federatedUser:${yandex_organizationmanager_saml_federation_user_account.federation_account["${each.value.username}-${each.value.cloud}"].id}"
}
resource "yandex_resourcemanager_folder_iam_member" "iam_member" {
for_each = { for user in local.yandex_users_folder : "${user.username}-${user.cloud}-${user.folder}-${user.role}" => user }
folder_id = var.folder_ids[each.value.folder]
role = each.value.role
member = "federatedUser:${yandex_organizationmanager_saml_federation_user_account.federation_account["${each.value.username_cloud}"].id}"
}
Data
staff_users = [
{
username = "user"
email = "user@company.com"
first_name = "User"
last_name = "Resu"
groups = [""]
vpn_access = {
prod = [""]
staging = [""]
},
cloud_access = {
prod = {
prod = ["admin"]
},
staging = {
strees = ["admin"],
tech = ["admin"]
}
}
description = "DevOps"
},
]
folder_ids = {
stress = "idiididididididididi"
tech = "idiidididididididid2"
prod = "idiidididididididid3"
}
cloud_ids = {
staging = "idc11111111111111111"
prod = "idc22222222222222222"
}
federations = {
staging = "idf11111111111111111"
prod = "idf22222222222222222"
}
v0.107.0
Stack trace from the terraform-provider-yandex_v0.107.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x1ad68a9]
goroutine 40 [running]:
github.com/yandex-cloud/terraform-provider-yandex/yandex.getSamlUserAccount({0x26ab308, 0xc000febda0}, 0xc00097d1e0, {0xc000f8a528, 0x14}, {0xc000f8a540, 0x15})
github.com/yandex-cloud/terraform-provider-yandex/yandex/resource_yandex_organizationmanager_saml_federation_user_account.go:194 +0x389
github.com/yandex-cloud/terraform-provider-yandex/yandex.resourceYandexOrganizationManagerSamlFederationUserAccountRead({0x26ab308, 0xc000febda0}, 0xc000febda0?, {0x2085d60?, 0xc00097d1e0})
github.com/yandex-cloud/terraform-provider-yandex/yandex/resource_yandex_organizationmanager_saml_federation_user_account.go:114 +0x106
github.com/yandex-cloud/terraform-provider-yandex/yandex.resourceYandexOrganizationManagerSamlFederationUserAccountCreate({0x26ab308, 0xc000febda0}, 0x0?, {0x2085d60?, 0xc00097d1e0?})
github.com/yandex-cloud/terraform-provider-yandex/yandex/resource_yandex_organizationmanager_saml_federation_user_account.go:107 +0x5fe
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc000d92380, {0x26ab340, 0xc000feb260}, 0xd?, {0x2085d60, 0xc00097d1e0})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/resource.go:778 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000d92380, {0x26ab340, 0xc000feb260}, 0xc000fccd00, 0xc000f96c80, {0x2085d60, 0xc00097d1e0})
github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/resource.go:909 +0xa7e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000783668, {0x26ab340?, 0xc000feb080?}, 0xc000fb0a50)
github.com/hashicorp/terraform-plugin-sdk/v2@v2.28.0/helper/schema/grpc_provider.go:1027 +0xe8d
github.com/hashicorp/terraform-plugin-mux/tf5to6server.v5tov6Server.ApplyResourceChange({{0x26b5848?, 0xc000783668?}}, {0x26ab340, 0xc000feb080}, 0x0?)
github.com/hashicorp/terraform-plugin-mux@v0.11.2/tf5to6server/tf5to6server.go:37 +0x5a
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.muxServer.ApplyResourceChange({0xc000db63c0, 0xc001162880, 0xc000db63f0, 0xc000db6420, {0xc000c72b00, 0x2, 0x2}}, {0x26ab340?, 0xc000fead50?}, 0xc000fb0a00)
github.com/hashicorp/terraform-plugin-mux@v0.11.2/tf6muxserver/mux_server_ApplyResourceChange.go:30 +0x139
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).ApplyResourceChange(0xc000992b40, {0x26ab340?, 0xc000fea360?}, 0xc000238b60)
github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov6/tf6server/server.go:819 +0x574
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_ApplyResourceChange_Handler({0x2284b00?, 0xc000992b40}, {0x26ab340, 0xc000fea360}, 0xc000f96480, 0x0)
github.com/hashicorp/terraform-plugin-go@v0.18.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:422 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0009dd000, {0x26ab340, 0xc000fea2d0}, {0x26b4000, 0xc000db96c0}, 0xc000fe2360, 0xc000e582a0, 0x3f54b40, 0x0)
google.golang.org/grpc@v1.60.1/server.go:1372 +0xe49
google.golang.org/grpc.(*Server).handleStream(0xc0009dd000, {0x26b4000, 0xc000db96c0}, 0xc000fe2360)
google.golang.org/grpc@v1.60.1/server.go:1783 +0x1031
google.golang.org/grpc.(*Server).serveStreams.func2.1()
google.golang.org/grpc@v1.60.1/server.go:1016 +0x68
created by google.golang.org/grpc.(*Server).serveStreams.func2
google.golang.org/grpc@v1.60.1/server.go:1027 +0x12e
Error: The terraform-provider-yandex_v0.107.0 plugin crashed!
Any news?
The issue was transmitted to the responsible team. Now waiting for a fix.
Similar behavior is observed when trying to create or import the resource yandex_organizationmanager_saml_federation_user_account
XXX-NAME - string XXX-ID id from YC