mirror of
https://github.com/ysoftdevs/terraform-provider-bitbucketserver.git
synced 2026-03-22 09:29:09 +01:00
Fix an issue where manual user removing requires terraform state rm. (#35)
This commit is contained in:
@@ -3,6 +3,7 @@ package bitbucket
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
|
"log"
|
||||||
"net/url"
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -74,7 +75,9 @@ func resourceGroupRead(d *schema.ResourceData, m interface{}) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("unable to find a matching group %s", groupName)
|
d.SetId("")
|
||||||
|
log.Printf("[WARN] Group %s not found, removing from state", groupName)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceGroupUpdate(d *schema.ResourceData, m interface{}) error {
|
func resourceGroupUpdate(d *schema.ResourceData, m interface{}) error {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/hashicorp/terraform/helper/schema"
|
"github.com/hashicorp/terraform/helper/schema"
|
||||||
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -103,7 +104,9 @@ func resourceUserGroupRead(d *schema.ResourceData, m interface{}) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("unable to find a matching user %s in group %s", userGroup.User, userGroup.Group)
|
d.SetId("")
|
||||||
|
log.Printf("[WARN] User %s in group %s not found, removing from state", userGroup.User, userGroup.Group)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceUserGroupDelete(d *schema.ResourceData, m interface{}) error {
|
func resourceUserGroupDelete(d *schema.ResourceData, m interface{}) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user