You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dynamic snippet should not be part of the versioned VCL.
Actual Behavior
The existing already activated VCL version is altered and now contains the dynamic snippet. If the snippet is updated the VCL stays on the modified content. Is is not possible to know which snippet is actually running by then.
Besides this strongly contrasts the description of a dynamic snippet and promises of the VCL versioning.
Debug Output (optional)
Steps to Reproduce
Step 1 We initially add a dynamicsnippet block with a placeholder content. Same result is with empty content.
~ resource "fastly_service_vcl" "test" {
~ active_version = 141 -> (known after apply)
~ cloned_version = 141 -> (known after apply)
id = "test"
name = "Test"
# (9 unchanged attributes hidden)
+ dynamicsnippet {
+ name = "status-503-error"
+ priority = 100
+ snippet_id = (known after apply)
+ type = "error"
}
Results in new VCL version with this block:
# Snippet status-503-error : 100
This is expected.
Now we add a fastly_service_dictionary_items resource:
resource "fastly_service_dynamic_snippet_content" "status-page" {
for_each = {
for d in fastly_service_vcl.test.dynamicsnippet : d.name => d if startswith(d.name, "status-")
}
content = <<-CONTENT
if (obj.status == ${parseint(regex("status-(\\d{3}).*", each.key)[0], 10) + 400}) {
set obj.status = ${regex("status-(\\d{3}).*", each.key)[0]};
set obj.http.content-type = "text/html; charset=utf-8";
synthetic {"${file("${path.module}/response/${regex("status-(\\d{3}).*", each.key)[0]}.html")}"};
return(deliver);
}
CONTENT
service_id = fastly_service_vcl.test.id
snippet_id = each.value.snippet_id
manage_snippets = true
}
Terraform tells:
# fastly_service_dynamic_snippet_content.status-page["status-503-error"] will be created
+ resource "fastly_service_dynamic_snippet_content" "status-page" {
+ content = <<-EOT
# ...
Plan: 1 to add, 0 to change, 0 to destroy.
Sounds good, but it changes the active VCL version in place and adds the content in place.
# Snippet status-503-error : 100
if (obj.status == 903) {
set obj.status = 503;
set obj.http.content-type = "text/html; charset=utf-8";
synthetic {"<!doctype html>
# ...
The webinterface still claims this should be a dynamic snippet
Important Factoids (optional)
Initially I tried to only use the dynamicsnippet within fastly_service_vcl. But that kept detecting a change on every plan even without any change to the HCL. As it is simpler I would have preferred that.
The text was updated successfully, but these errors were encountered:
Terraform Version
Affected Fastly Terraform Resource(s)
fastly_service_vcl
fastly_service_dynamic_snippet_content
Terraform Configuration Files
Expected Behavior
The dynamic snippet should not be part of the versioned VCL.
Actual Behavior
The existing already activated VCL version is altered and now contains the dynamic snippet. If the snippet is updated the VCL stays on the modified content. Is is not possible to know which snippet is actually running by then.
Besides this strongly contrasts the description of a dynamic snippet and promises of the VCL versioning.
Debug Output (optional)
Steps to Reproduce
Step 1 We initially add a dynamicsnippet block with a placeholder content. Same result is with empty content.
Results in new VCL version with this block:
This is expected.
Now we add a
fastly_service_dictionary_items
resource:Terraform tells:
Sounds good, but it changes the active VCL version in place and adds the content in place.
The webinterface still claims this should be a dynamic snippet
Important Factoids (optional)
Initially I tried to only use the
dynamicsnippet
withinfastly_service_vcl
. But that kept detecting a change on every plan even without any change to the HCL. As it is simpler I would have preferred that.The text was updated successfully, but these errors were encountered: