-
Notifications
You must be signed in to change notification settings - Fork 142
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 support for 'staging' of draft service-versions. #933
base: main
Are you sure you want to change the base?
Conversation
d89f721
to
196ac2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This took me a while to wrap my head around. The changes look good and make sense now.
I think it's worth to mention somewhere in the provider docs that the following doesn't make sense:
resource "fastly_service_vcl" "test" {
...
activate = true
stage = true
...
}
Specially because activate = true
is the default. Why would you activate staging and production at the same time. Since we don't check this during the plan
I think it would be good to to have a notice in the docs which points out that when you use stage
to set activate
to false
. Maybe the Guides
section would be the right place or even under the stage
field description itself.
A new 'Activation and Staging' section has been added to the docs for both Delivery and Compute services. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding detailed docs!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I've left some comments regarding some minor formatting issues.
5cbe2be
This adds a 'stage' attribute to both fastly_service_vcl and fastly_service_compute resources, with a default of 'false' (no change to existing behavior). If 'stage' is set to 'true', then 'plan' operations which make changes to service versions will also 'stage' those service versions, whether they are also activated or not. The expected usage is to have 'stage = true' and 'activate = false', so that the provider will clone when necessary to make draft versions, apply changes to those draft versions and stage them, but otherwise leave them alone. When 'stage = true' an existing draft version will *not* be cloned in order to apply additional changes to it, they will be applied to that draft version. Additional implementation notes: * Added a new function in fastly_test.go to render templates (from the text/template module), which can be used by acceptance tests for generating HCL. The acceptance tests for the staging feature use templates. * Moved a function from resource_fastly_service_vcl_test.go to fastly_test.go, refactored it, and fixed bugs in it. This function is used in acceptance tests to compare the list of expected backends for a service to the list of actual backends for the service. * Added golang-set as a new dependency, which is used in the function mentioned in the last bullet.
Co-authored-by: Matt Cone <[email protected]>
OK, this needs final check-offs from @philippschulte and @anthony-gomez-fastly and it's ready to be merged. Thanks to everyone for the feedback! |
This adds a 'stage' attribute to both
fastly_service_vcl
andfastly_service_compute
resources, with a default of 'false' (no changeto existing behavior).
If 'stage' is set to 'true', then 'plan' operations which make changes
to service versions will also 'stage' those service versions, whether
they are also activated or not. The expected usage is to have 'stage =
true' and 'activate = false', so that the provider will clone when
necessary to make draft versions, apply changes to those draft
versions and stage them, but otherwise leave them alone. When 'stage =
true' an existing draft version will not be cloned in order to apply
additional changes to it, they will be applied to that draft version.
Additional implementation notes:
Added a new function in
fastly_test.go
to render templates (from thetext/template module), which can be used by acceptance tests for
generating HCL. The acceptance tests for the staging feature use
templates.
Moved a function from
resource_fastly_service_vcl_test.go
tofastly_test.go
, refactored it, and fixed bugs in it. This functionis used in acceptance tests to compare the list of expected backends
for a service to the list of actual backends for the service.
Added
golang-set
as a new dependency, which is used in the functionmentioned in the last bullet.
All Submissions:
New Feature Submissions:
Changes to Core Features:
User Impact