Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding attributes #23

Open
jfrazee216 opened this issue Sep 15, 2020 · 0 comments
Open

Adding attributes #23

jfrazee216 opened this issue Sep 15, 2020 · 0 comments

Comments

@jfrazee216
Copy link

jfrazee216 commented Sep 15, 2020

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 = "[email protected]"
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant