Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add computed output field to get the latest cloned version by the provider #190

Merged
merged 2 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions fastly/resource_fastly_service_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/service_v1.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down