Skip to content

Commit

Permalink
Merge pull request #125 from mxmorin/master
Browse files Browse the repository at this point in the history
Management of missing resources
  • Loading branch information
wrighbr authored May 27, 2021
2 parents aeb3502 + 68898b7 commit 34bf1cf
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 7 deletions.
3 changes: 2 additions & 1 deletion provider/resource_config_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ func resourceConfigAuthRead(d *schema.ResourceData, m interface{}) error {

resp, _, err := apiClient.SendRequest("GET", models.PathConfig, nil, 200)
if err != nil {
return err
d.SetId("")
return nil
}

err = client.SetAuthValues(d, resp)
Expand Down
3 changes: 2 additions & 1 deletion provider/resource_config_email.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func resourceConfigEmailRead(d *schema.ResourceData, m interface{}) error {

resp, _, err := apiClient.SendRequest("GET", models.PathConfig, nil, 200)
if err != nil {
return err
d.SetId("")
return nil
}

var jsonData models.ConfigBodyResponse
Expand Down
3 changes: 2 additions & 1 deletion provider/resource_garbage_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ func resourceGCRead(d *schema.ResourceData, m interface{}) error {

resp, _, err := apiClient.SendRequest("GET", models.PathGC, nil, 200)
if err != nil {
return err
d.SetId("")
return nil
}

var jsonData models.SystemBody
Expand Down
3 changes: 2 additions & 1 deletion provider/resource_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ func resourceLabelRead(d *schema.ResourceData, m interface{}) error {

resp, _, err := apiClient.SendRequest("GET", d.Id(), nil, 200)
if err != nil {
return err
d.SetId("")
return nil
}

var jsonData models.Labels
Expand Down
3 changes: 2 additions & 1 deletion provider/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ func resourceProjectRead(d *schema.ResourceData, m interface{}) error {

resp, _, err := apiClient.SendRequest("GET", d.Id(), nil, 200)
if err != nil {
return err
d.SetId("")
return nil
}

var jsonData models.ProjectsBodyResponses
Expand Down
3 changes: 2 additions & 1 deletion provider/resource_project_member_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ func resourceMembersGroupRead(d *schema.ResourceData, m interface{}) error {

resp, _, err := apiClient.SendRequest("GET", d.Id(), nil, 200)
if err != nil {
fmt.Println(err)
d.SetId("")
return nil
}

var jsonData models.ProjectMembersBody
Expand Down
3 changes: 2 additions & 1 deletion provider/resource_project_member_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func resourceMembersUserRead(d *schema.ResourceData, m interface{}) error {

resp, _, err := apiClient.SendRequest("GET", d.Id(), nil, 200)
if err != nil {
fmt.Println(err)
d.SetId("")
return nil
}

var jsonData models.ProjectMembersBody
Expand Down
1 change: 1 addition & 0 deletions provider/resource_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func resourceRegistryRead(d *schema.ResourceData, m interface{}) error {
var jsonData models.RegistryBody
err = json.Unmarshal([]byte(resp), &jsonData)
if err != nil {
d.SetId("")
return fmt.Errorf("Resource not found %s", d.Id())
}

Expand Down
1 change: 1 addition & 0 deletions provider/resource_retention_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func resourceRentention() *schema.Resource {
"scope": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"rule": {
Type: schema.TypeList,
Expand Down

0 comments on commit 34bf1cf

Please sign in to comment.