diff --git a/huaweicloud/resource_huaweicloud_vpc_subnet_v1.go b/huaweicloud/resource_huaweicloud_vpc_subnet_v1.go index 9db21d62cb..37f772820b 100644 --- a/huaweicloud/resource_huaweicloud_vpc_subnet_v1.go +++ b/huaweicloud/resource_huaweicloud_vpc_subnet_v1.go @@ -208,12 +208,16 @@ func resourceVpcSubnetV1Read(d *schema.ResourceData, meta interface{}) error { } resourceTags, err := tags.Get(vpcSubnetV2Client, "subnets", d.Id()).Extract() if err != nil { - return fmt.Errorf("Error fetching HuaweiCloud VpcSubnet tags: %s", err) - } - - tagmap := tagsToMap(resourceTags.Tags) - if err := d.Set("tags", tagmap); err != nil { - return fmt.Errorf("Error saving tags for HuaweiCloud VpcSubnet (%s): %s", d.Id(), err) + if err404, ok := err.(golangsdk.ErrDefault404); ok { + log.Printf("[INFO] fetching Subnet tags failed: %s", err404) + } else { + return fmt.Errorf("Error fetching HuaweiCloud Subnet %s tags: %s", d.Id(), err) + } + } else { + tagmap := tagsToMap(resourceTags.Tags) + if err := d.Set("tags", tagmap); err != nil { + return fmt.Errorf("Error saving HuaweiCloud Subnet %s tags: %s", d.Id(), err) + } } return nil diff --git a/huaweicloud/resource_huaweicloud_vpc_v1.go b/huaweicloud/resource_huaweicloud_vpc_v1.go index 445241452e..04c5a1eb84 100644 --- a/huaweicloud/resource_huaweicloud_vpc_v1.go +++ b/huaweicloud/resource_huaweicloud_vpc_v1.go @@ -144,12 +144,16 @@ func resourceVirtualPrivateCloudV1Read(d *schema.ResourceData, meta interface{}) } resourceTags, err := tags.Get(vpcV2Client, "vpcs", d.Id()).Extract() if err != nil { - return fmt.Errorf("Error fetching HuaweiCloud VirtualPrivateCloud tags: %s", err) - } - - tagmap := tagsToMap(resourceTags.Tags) - if err := d.Set("tags", tagmap); err != nil { - return fmt.Errorf("Error saving tags for HuaweiCloud VirtualPrivateCloud (%s): %s", d.Id(), err) + if err404, ok := err.(golangsdk.ErrDefault404); ok { + log.Printf("[INFO] fetching VPC tags failed: %s", err404) + } else { + return fmt.Errorf("Error fetching HuaweiCloud VPC %s tags: %s", d.Id(), err) + } + } else { + tagmap := tagsToMap(resourceTags.Tags) + if err := d.Set("tags", tagmap); err != nil { + return fmt.Errorf("Error saving HuaweiCloud VPC %s tags: %s", d.Id(), err) + } } return nil