Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### BUG FIXES:

- fix(header): preserve optional bool field `ignore_if_set` during updates and add acceptance test coverage ([#1142](https://github.com/fastly/terraform-provider-fastly/pull/1142))
- fix(block_fastly_service_logging_logentries_test): fix tests for logentries to account for API behavior ([#1143](https://github.com/fastly/terraform-provider-fastly/pull/1143))
- fix(image_optimizer_default_settings): preserve optional bool fields (`allow_video`, `webp`, `upscale`) during updates and add acceptance test coverage ([#1145](https://github.com/fastly/terraform-provider-fastly/pull/1145))
- fix(logging_kafka): preserve optional bool fields (`use_tls`, `parse_log_keyvals`) during updates and add acceptance test coverage ([#1147](https://github.com/fastly/terraform-provider-fastly/pull/1147))
- fix(product_enablement): ensure `ddos_protection` mode updates are applied ([#1149](https://github.com/fastly/terraform-provider-fastly/pull/1149))
Expand Down
32 changes: 27 additions & 5 deletions fastly/block_fastly_service_logging_logentries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestAccFastlyServiceVCL_logentries_basic(t *testing.T) {
Port: gofastly.ToPointer(10000),
UseTLS: gofastly.ToPointer(false),
Token: gofastly.ToPointer("newtoken"),
Format: gofastly.ToPointer(LoggingFormatUpdate),
Format: gofastly.ToPointer(`%h %u %t %r %>s`),
FormatVersion: gofastly.ToPointer(2),
ResponseCondition: gofastly.ToPointer("response_condition_test"),
ProcessingRegion: gofastly.ToPointer("none"),
Expand Down Expand Up @@ -153,8 +153,26 @@ func testAccCheckFastlyServiceVCLLogentriesAttributes(service *gofastly.ServiceD
ls.Placement = s.Placement
}

if !reflect.DeepEqual(s, ls) {
return fmt.Errorf("bad match Logentries logging match,\nexpected:\n(%#v),\ngot:\n(%#v)", s, ls)
if *s.Format != *ls.Format {
return fmt.Errorf("bad Logentries Format match for service %s,\nexpected:\n(%s),\ngot:\n(%s)", *s.Name, *s.Format, *ls.Format)
}
if *s.FormatVersion != *ls.FormatVersion {
return fmt.Errorf("bad Logentries FormatVersion match for service %s,\nexpected:\n(%d),\ngot:\n(%d)", *s.Name, *s.FormatVersion, *ls.FormatVersion)
}
if *s.Port != *ls.Port {
return fmt.Errorf("bad Logentries Port match for service %s,\nexpected:\n(%d),\ngot:\n(%d)", *s.Name, *s.Port, *ls.Port)
}
if *s.UseTLS != *ls.UseTLS {
return fmt.Errorf("bad Logentries UseTLS match for service %s,\nexpected:\n(%t),\ngot:\n(%t)", *s.Name, *s.UseTLS, *ls.UseTLS)
}
if *s.Token != *ls.Token {
return fmt.Errorf("bad Logentries Token match for service %s,\nexpected:\n(%s),\ngot:\n(%s)", *s.Name, *s.Token, *ls.Token)
}
if *s.ResponseCondition != *ls.ResponseCondition {
return fmt.Errorf("bad Logentries ResponseCondition match for service %s,\nexpected:\n(%s),\ngot:\n(%s)", *s.Name, *s.ResponseCondition, *ls.ResponseCondition)
}
if *s.ProcessingRegion != *ls.ProcessingRegion {
return fmt.Errorf("bad Logentries ProcessingRegion match for service %s,\nexpected:\n(%s),\ngot:\n(%s)", *s.Name, *s.ProcessingRegion, *ls.ProcessingRegion)
}
found++
}
Expand Down Expand Up @@ -183,6 +201,7 @@ func TestAccFastlyServiceVCL_logentries_formatVersion(t *testing.T) {
Format: gofastly.ToPointer(`%h %l %u %t "%r" %>s %b`),
FormatVersion: gofastly.ToPointer(2),
ResponseCondition: gofastly.ToPointer("response_condition_test"),
ProcessingRegion: gofastly.ToPointer("us"),
}

resource.ParallelTest(t, resource.TestCase{
Expand Down Expand Up @@ -227,7 +246,7 @@ resource "fastly_service_compute" "foo" {
logging_logentries {
name = "somelogentriesname"
token = "token"
processing_region = "us"
processing_region = "us"
}
package {
Expand Down Expand Up @@ -261,7 +280,7 @@ resource "fastly_service_vcl" "foo" {
name = "somelogentriesname"
token = "token"
response_condition = "response_condition_test"
processing_region = "us"
processing_region = "us"
}
force_destroy = true
}`, name, domain)
Expand Down Expand Up @@ -289,6 +308,7 @@ resource "fastly_service_vcl" "foo" {
name = "somelogentriesname"
token = "token"
response_condition = "response_condition_test"
processing_region = "us"
}
logging_logentries {
name = "somelogentriesanothername"
Expand All @@ -297,6 +317,7 @@ resource "fastly_service_vcl" "foo" {
token = "newtoken"
format = "%%h %%u %%t %%r %%>s"
response_condition = "response_condition_test"
processing_region = "none"
}
force_destroy = true
}`, name, domain)
Expand Down Expand Up @@ -325,6 +346,7 @@ resource "fastly_service_vcl" "foo" {
token = "token"
response_condition = "response_condition_test"
format_version = 2
processing_region = "us"
}
force_destroy = true
}`, name, domain)
Expand Down
Loading