From 2db60b5507e5f91e835277697a9f94b19e3db239 Mon Sep 17 00:00:00 2001 From: philippschulte Date: Tue, 1 Oct 2019 13:06:44 -0700 Subject: [PATCH 1/2] feat(service_v1): add cloned_version field Cloned Version represents the latest cloned version by the provider. --- fastly/resource_fastly_service_v1.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fastly/resource_fastly_service_v1.go b/fastly/resource_fastly_service_v1.go index 5fe9c005c..9da0b7bd6 100644 --- a/fastly/resource_fastly_service_v1.go +++ b/fastly/resource_fastly_service_v1.go @@ -52,6 +52,17 @@ func resourceServiceV1() *schema.Resource { Computed: true, }, + // Cloned Version represents the latest cloned version by the provider. It + // gets set whenever Terraform detects changes and clones the currently + // activated version in order to modify it. Active Version and Cloned + // Version can be different if the Activate field is set to false in order + // to prevent the service from being activated. It is not used internally, + // but it is exported for users to see after running `terraform apply`. + "cloned_version": { + Type: schema.TypeInt, + Computed: true, + }, + "activate": { Type: schema.TypeBool, Description: "Conditionally prevents the Service from being activated", @@ -1576,6 +1587,7 @@ func resourceServiceV1Update(d *schema.ResourceData, meta interface{}) error { // The new version number is named "Number", but it's actually a string latestVersion = newVersion.Number + d.Set("cloned_version", latestVersion) // New versions are not immediately found in the API, or are not // immediately mutable, so we need to sleep a few and let Fastly ready From 6aa73cd9105d392cf66ad7edf17595c081e8766f Mon Sep 17 00:00:00 2001 From: philippschulte Date: Tue, 1 Oct 2019 13:07:39 -0700 Subject: [PATCH 2/2] docs(service_v1): add description for cloned_version --- website/docs/r/service_v1.html.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/r/service_v1.html.markdown b/website/docs/r/service_v1.html.markdown index 436e81b46..b7bf465f6 100644 --- a/website/docs/r/service_v1.html.markdown +++ b/website/docs/r/service_v1.html.markdown @@ -536,6 +536,7 @@ In addition to the arguments listed above, the following attributes are exported * `id` – The ID of the Service. * `active_version` – The currently active version of your Fastly Service. +* `cloned_version` - The latest cloned version by the provider. The value gets only set after running `terraform apply`. The `dynamicsnippet` block exports: