diff --git a/provider/resource_edge_deployment.go b/provider/resource_edge_deployment.go index 891204d..cd69eba 100644 --- a/provider/resource_edge_deployment.go +++ b/provider/resource_edge_deployment.go @@ -24,9 +24,15 @@ func resourceEdgeDeployment() *schema.Resource { func createOrUpdateEdgeDeployment(d *schema.ResourceData, m interface{}) error { pm := m.(providerMetadata) + err := pm.Client.CreateOrUpdateEdgeDeployment(pm.Corp, d.Get("site_short_name").(string)) + + if err != nil { + return err + } + d.SetId(d.Get("site_short_name").(string)) - return pm.Client.CreateOrUpdateEdgeDeployment(pm.Corp, d.Get("site_short_name").(string)) + return nil } func readEdgeDeployment(d *schema.ResourceData, m interface{}) error { diff --git a/provider/resource_edge_deployment_service.go b/provider/resource_edge_deployment_service.go index 909afd6..5195051 100644 --- a/provider/resource_edge_deployment_service.go +++ b/provider/resource_edge_deployment_service.go @@ -45,13 +45,19 @@ func resourceEdgeDeploymentService() *schema.Resource { func createOrUpdateEdgeDeploymentService(d *schema.ResourceData, m interface{}) error { pm := m.(providerMetadata) - d.SetId(d.Get("fastly_sid").(string)) - activateVersion := d.Get("activate_version").(bool) - return pm.Client.CreateOrUpdateEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string), sigsci.CreateOrUpdateEdgeDeploymentServiceBody{ + err := pm.Client.CreateOrUpdateEdgeDeploymentService(pm.Corp, d.Get("site_short_name").(string), d.Get("fastly_sid").(string), sigsci.CreateOrUpdateEdgeDeploymentServiceBody{ ActivateVersion: &activateVersion, PercentEnabled: d.Get("percent_enabled").(int), }) + + if err != nil { + return err + } + + d.SetId(d.Get("fastly_sid").(string)) + + return nil } func readEdgeDeploymentService(d *schema.ResourceData, m interface{}) error {