Skip to content

Commit 3dfcd3e

Browse files
authored
Export users and groups with the force flag (#1661)
this will help avoiding errors when applying to another workspace with existing users
1 parent 9cd7417 commit 3dfcd3e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

exporter/importables.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,13 +549,16 @@ var resourcesMap map[string]importable = map[string]importable{
549549
Import: func(ic *importContext, r *resource) error {
550550
if r.Name == "admins" || r.Name == "users" {
551551
// admins & users are to be imported through "data block"
552+
// TODO: it doesn't work, fix it...
552553
r.Mode = "data"
553554
r.Data.State().Set(&terraform.InstanceState{
554555
ID: r.ID,
555556
Attributes: map[string]string{
556557
"display_name": r.Name,
557558
},
558559
})
560+
} else if r.Data != nil {
561+
r.Data.Set("force", true)
559562
}
560563
if err := ic.cacheGroups(); err != nil {
561564
return err
@@ -658,6 +661,7 @@ var resourcesMap map[string]importable = map[string]importable{
658661
},
659662
Import: func(ic *importContext, r *resource) error {
660663
username := r.Data.Get("user_name").(string)
664+
r.Data.Set("force", true)
661665
u, err := ic.findUserByName(username)
662666
if err != nil {
663667
return err

0 commit comments

Comments
 (0)