Open
Description
Terraform Version
Terraform v1.3.6
on darwin_arm64
Affected Resource(s)
fastly_service_vcl
Terraform Configuration Files
From
resource "fastly_service_vcl" "demo" {
name = "demofastly"
...
dynamicsnippet {
name = "Waf_Prefetch"
...
}
}
To
resource "fastly_service_vcl" "demo" {
name = "demofastly"
...
snippet {
name = "WAF_Prefetch"
...
}
}
Debug Output
╷
│ Error: 409 - Conflict:
│
│ Title: Duplicate record
│ Detail: Duplicate snippet: 'WAF_Snippet'
│
│ with module.service.fastly_service_vcl.this,
│ on .terraform/modules/service/terraform/modules/services/single-origin-service/main.tf line 150, in resource "fastly_service_vcl" "this":
│ 150: resource "fastly_service_vcl" "this" {
│
╵
ERRO[0011] Terraform invocation failed in /home/circleci/project/terraform/services/service
ERRO[0011] 1 error occurred:
* exit status 1
Exited with code exit status 1
Expected Behavior
In order to avoid a conflict when converting a dynamic snippet into a standard snippet with the same name:
- First delete the dynamic snippet
- Then create the standard snippet
Or vice versa if going in the other direction, the key being for any snippet deletions to occur before snippet creations to avoid conflicts if the name is identical.
Actual Behavior
The API request to create the standard snippet occurs before the request to delete the dynamic snippet.
Important Factoids
We're seeing this in relation to converting the WAF_Prefetch
Legacy WAF dynamic snippet into a standard snippet.