Terraform Provider Version: 1.1.4
Connect Server Version: 1.10.0
OS: Terraform Cloud so probably Ubuntu
Terraform Version: Latest (1.4.2)
What happened?
Hostname for database category items is not set
What did you expect to happen?
Hostname for database items should be set
Steps to reproduce
Create a database item in 1password
Use the data resource for item to access the item
The hostname field will be null instead of the value
Notes & Logs
The problem stems from onepassword\data_source_onepassword_item.go line 211 to 222 specifically line 220
for _, f := range item.Fields {
switch f.Purpose {
case "USERNAME":
data.Set("username", f.Value)
case "PASSWORD":
data.Set("password", f.Value)
case "NOTES":
data.Set("note_value", f.Value)
default:
if f.Section == nil {
data.Set(strings.ToLower(f.Label), f.Value)
}
}
}
In the case of database items 1connect sends and id for hostname but the label is set to server they probably should both be server as that makes more sense for a database.
The best work around I could come up with that didn't require a major refactor was to set that section like this.
for _, f := range item.Fields {
switch f.Purpose {
case "USERNAME":
data.Set("username", f.Value)
case "PASSWORD":
data.Set("password", f.Value)
case "NOTES":
data.Set("note_value", f.Value)
default:
if f.Section == nil {
if f.Label == "server" {
data.Set(strings.ToLower(f.ID), f.Value)
} else {
data.Set(strings.ToLower(f.Label), f.Value)
}
}
}
}
Basically use ID inste4ad of label for server this gets around the schema validation. Another option would be to solve the naming issue in 1password connect and use hostname or server for both ID and label.
Your environment
Terraform Provider Version: 1.1.4 Connect Server Version: 1.10.0 OS: Terraform Cloud so probably Ubuntu Terraform Version: Latest (1.4.2)
What happened?
Hostname for database category items is not set
What did you expect to happen?
Hostname for database items should be set
Steps to reproduce
Notes & Logs
The problem stems from onepassword\data_source_onepassword_item.go line 211 to 222 specifically line 220
In the case of database items 1connect sends and id for hostname but the label is set to server they probably should both be server as that makes more sense for a database.
The best work around I could come up with that didn't require a major refactor was to set that section like this.
Basically use ID inste4ad of label for server this gets around the schema validation. Another option would be to solve the naming issue in 1password connect and use hostname or server for both ID and label.