diff --git a/outscale/resource_outscale_nat_service.go b/outscale/resource_outscale_nat_service.go index 8e0dc592c..bc105ff63 100644 --- a/outscale/resource_outscale_nat_service.go +++ b/outscale/resource_outscale_nat_service.go @@ -178,8 +178,14 @@ func resourceOAPINatServiceRead(d *schema.ResourceData, meta interface{}) error return err } - if err := set("public_ip_id", public_ips[0].GetPublicIpId()); err != nil { - return err + if len(public_ips) > 0 { + if err := set("public_ip_id", public_ips[0].GetPublicIpId()); err != nil { + return err + } + } else { + if err := set("public_ip_id", ""); err != nil { + return err + } } if err := d.Set("tags", tagsOSCAPIToMap(natService.GetTags())); err != nil {