diff --git a/go.mod b/go.mod index 02cb23d..be163fe 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/ebu/terraform-provider-mcma go 1.18 require ( - github.com/ebu/mcma-libraries-go v0.0.4 + github.com/ebu/mcma-libraries-go v0.0.10 github.com/hashicorp/terraform-plugin-docs v0.7.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.13.0 ) diff --git a/go.sum b/go.sum index dd50c54..d43cac3 100644 --- a/go.sum +++ b/go.sum @@ -49,8 +49,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/ebu/mcma-libraries-go v0.0.4 h1:3Toie/9EWbJkSvFLSLyN/Ijge/vUJGeajCB6iLhbikk= -github.com/ebu/mcma-libraries-go v0.0.4/go.mod h1:RnT/sTbg7ICp6NHDxyj/xX9xI+bqbcm9SUkPTIJnqs4= +github.com/ebu/mcma-libraries-go v0.0.10 h1:/1NuRPq+5saXLOScvv2Gydfg9HjKqE8gXsC1eFTGlYY= +github.com/ebu/mcma-libraries-go v0.0.10/go.mod h1:RnT/sTbg7ICp6NHDxyj/xX9xI+bqbcm9SUkPTIJnqs4= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= diff --git a/mcma/provider.go b/mcma/provider.go index 7687bfb..fa6379e 100644 --- a/mcma/provider.go +++ b/mcma/provider.go @@ -119,7 +119,6 @@ func configure(d *schema.ResourceData) (interface{}, diag.Diagnostics) { } func getResourceManager(m interface{}) (*mcmaclient.ResourceManager, diag.Diagnostics) { - println("getResourceManager") if m == nil { return nil, diag.Diagnostics{ diag.Diagnostic{ diff --git a/mcma/resource_job_profile.go b/mcma/resource_job_profile.go index d4214bf..95eaff9 100644 --- a/mcma/resource_job_profile.go +++ b/mcma/resource_job_profile.go @@ -29,6 +29,7 @@ func resourceJobProfile() *schema.Resource { Type: schema.TypeString, Description: "The ID of the job profile. MCMA IDs are always absolute urls.", Computed: true, + ForceNew: true, }, "date_created": { Type: schema.TypeString, @@ -137,7 +138,6 @@ func getJobProfileFromResourceData(d *schema.ResourceData) mcmamodel.JobProfile } func resourceJobProfileRead(_ context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - println("resourceJobProfileRead") resourceManager, di := getResourceManager(m) if di != nil { return di @@ -149,6 +149,7 @@ func resourceJobProfileRead(_ context.Context, d *schema.ResourceData, m interfa return diag.Errorf("error getting job profile with id %s: %s", jobProfileId, err) } if resource == nil { + _ = d.Set("id", "") return diag.Diagnostics{} } @@ -195,7 +196,6 @@ func resourceJobProfileRead(_ context.Context, d *schema.ResourceData, m interfa } func resourceJobProfileCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - println("resourceJobProfileCreate") resourceManager, di := getResourceManager(m) if di != nil { return di @@ -213,7 +213,6 @@ func resourceJobProfileCreate(ctx context.Context, d *schema.ResourceData, m int } func resourceJobProfileUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - println("resourceJobProfileUpdate") resourceManager, di := getResourceManager(m) if di != nil { return di @@ -231,7 +230,6 @@ func resourceJobProfileUpdate(ctx context.Context, d *schema.ResourceData, m int } func resourceJobProfileDelete(_ context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - println("resourceJobProfileDelete") resourceManager, di := getResourceManager(m) if di != nil { return di diff --git a/mcma/resource_mcma_resource.go b/mcma/resource_mcma_resource.go index 2917c62..15b90b8 100644 --- a/mcma/resource_mcma_resource.go +++ b/mcma/resource_mcma_resource.go @@ -27,6 +27,7 @@ func resourceMcmaResource() *schema.Resource { Type: schema.TypeString, Description: "The ID of the service. MCMA IDs are always absolute urls.", Computed: true, + ForceNew: true, }, "resource_json": { Type: schema.TypeString, @@ -65,6 +66,7 @@ func resourceMcmaResourceRead(_ context.Context, d *schema.ResourceData, m inter return diag.Errorf("error getting resource of type %s with id %s: %s", resourceType, resourceId, err) } if resource == nil { + _ = d.Set("id", "") return diag.Diagnostics{} } diff --git a/mcma/resource_service.go b/mcma/resource_service.go index 4adb12c..ea3bbea 100644 --- a/mcma/resource_service.go +++ b/mcma/resource_service.go @@ -29,6 +29,7 @@ func resourceService() *schema.Resource { Type: schema.TypeString, Description: "The ID of the service. MCMA IDs are always absolute urls.", Computed: true, + ForceNew: true, }, "date_created": { Type: schema.TypeString, @@ -152,13 +153,14 @@ func resourceServiceRead(_ context.Context, d *schema.ResourceData, m interface{ return diag.Errorf("error getting service with id %s: %s", serviceId, err) } if resource == nil { + _ = d.Set("id", "") return diag.Diagnostics{} } service := resource.(mcmamodel.Service) - _ = d.Set("type", service.Type) _ = d.Set("id", service.Id) + _ = d.Set("type", service.Type) _ = d.Set("date_created", service.DateCreated.Format(time.RFC3339)) _ = d.Set("date_modified", service.DateModified.Format(time.RFC3339)) _ = d.Set("name", service.Name)