Open jfrazee216 opened 3 years ago
I am wanting to add user attributes and have a certain chicken and the egg dilemma.
I added the attributes schema like so
"attributes": &schema.Schema{ Type: schema.TypeList, Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, Optional: true, }, "value": &schema.Schema{ Type: schema.TypeString, Optional: true, },
and am able to create the user with attributes as so:
resource "jumpcloud_user" "test_user1" { username = "tuser" firstname = "test" lastname = "user" email = "testuser@test.com" attributes { name = "github" value = "test124" } }
However, this produces the following error:
Error: Invalid address to set: []string{"attributes", "0", "_id"}
on main.tf line 5, in resource "jumpcloud_user" "test_user1": 5: resource "jumpcloud_user" "test_user1" {
to workaround this I have implemented this:
"attributes": &schema.Schema{ Type: schema.TypeList, Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, Optional: true, }, "value": &schema.Schema{ Type: schema.TypeString, Optional: true, }, "_id": &schema.Schema{ Type: schema.TypeString, Optional: true, },
However, this is not scalable. I am looking for advice to pass the user ID as _id in the user creation api call. I am fearing a chicken and the egg dilemma
I am wanting to add user attributes and have a certain chicken and the egg dilemma.
I added the attributes schema like so
"attributes": &schema.Schema{ Type: schema.TypeList, Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, Optional: true, }, "value": &schema.Schema{ Type: schema.TypeString, Optional: true, },
and am able to create the user with attributes as so:
resource "jumpcloud_user" "test_user1" { username = "tuser" firstname = "test" lastname = "user" email = "testuser@test.com" attributes { name = "github" value = "test124" } }
However, this produces the following error:
Error: Invalid address to set: []string{"attributes", "0", "_id"}
on main.tf line 5, in resource "jumpcloud_user" "test_user1": 5: resource "jumpcloud_user" "test_user1" {
to workaround this I have implemented this:
"attributes": &schema.Schema{ Type: schema.TypeList, Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, Optional: true, }, "value": &schema.Schema{ Type: schema.TypeString, Optional: true, }, "_id": &schema.Schema{ Type: schema.TypeString, Optional: true, },
However, this is not scalable. I am looking for advice to pass the user ID as _id in the user creation api call. I am fearing a chicken and the egg dilemma