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 message_type support to syslog logging configuration #30

Merged
merged 4 commits into from
Aug 8, 2017
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
2 changes: 1 addition & 1 deletion fastly/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package fastly
import (
"fmt"

gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

type Config struct {
Expand Down
11 changes: 10 additions & 1 deletion fastly/resource_fastly_service_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"

"github.com/hashicorp/terraform/helper/schema"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

var fastlyNoServiceFoundErr = errors.New("No matching Fastly Service found")
Expand Down Expand Up @@ -793,6 +793,13 @@ func resourceServiceV1() *schema.Resource {
Default: "",
Description: "Name of a condition to apply this logging.",
},
"message_type": {
Type: schema.TypeString,
Optional: true,
Default: "classic",
Description: "How the message should be formatted.",
ValidateFunc: validateLoggingMessageType,
},
},
},
},
Expand Down Expand Up @@ -1704,6 +1711,7 @@ func resourceServiceV1Update(d *schema.ResourceData, meta interface{}) error {
UseTLS: gofastly.CBool(slf["use_tls"].(bool)),
TLSCACert: slf["tls_ca_cert"].(string),
ResponseCondition: slf["response_condition"].(string),
MessageType: slf["message_type"].(string),
}

log.Printf("[DEBUG] Create Syslog Opts: %#v", opts)
Expand Down Expand Up @@ -2692,6 +2700,7 @@ func flattenSyslogs(syslogList []*gofastly.Syslog) []map[string]interface{} {
"use_tls": p.UseTLS,
"tls_ca_cert": p.TLSCACert,
"response_condition": p.ResponseCondition,
"message_type": p.MessageType,
}

// prune any empty values that come from the default string value in structs
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_cache_setting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestAccFastlyServiceV1CacheSetting_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_conditionals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestAccFastlyServiceV1_conditional_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_gcslogging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestResourceFastlyFlattenGCS(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_gzip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestFastlyServiceV1_FlattenGzips(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_headers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestFastlyServiceV1_BuildHeaders(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_healthcheck_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestAccFastlyServiceV1_healthcheck_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_papertrail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestAccFastlyServiceV1_papertrail_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_request_setting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestAccFastlyServiceV1RequestSetting_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_response_object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestAccFastlyServiceV1_response_object_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_s3logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestAccFastlyServiceV1_s3logging_basic(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_sumologic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestResourceFastlyFlattenSumologic(t *testing.T) {
Expand Down
23 changes: 21 additions & 2 deletions fastly/resource_fastly_service_v1_syslog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestAccFastlyServiceV1_syslog_basic(t *testing.T) {
Expand All @@ -21,19 +21,35 @@ func TestAccFastlyServiceV1_syslog_basic(t *testing.T) {
Version: 1,
Name: "somesyslogname",
Address: "127.0.0.1",
IPV4: "127.0.0.1",
Port: uint(514),
Format: "%h %l %u %t \"%r\" %>s %b",
FormatVersion: 1,
ResponseCondition: "response_condition_test",
MessageType: "classic",
}

log1_after_update := gofastly.Syslog{
Version: 1,
Name: "somesyslogname",
Address: "127.0.0.1",
IPV4: "127.0.0.1",
Port: uint(514),
Format: "%h %l %u %t \"%r\" %>s %b",
FormatVersion: 1,
ResponseCondition: "response_condition_test",
MessageType: "blank",
}

log2 := gofastly.Syslog{
Version: 1,
Name: "somesyslogname2",
Address: "127.0.0.2",
IPV4: "127.0.0.2",
Port: uint(10514),
Format: "%h %l %u %t \"%r\" %>s %b",
FormatVersion: 1,
MessageType: "classic",
}

resource.Test(t, resource.TestCase{
Expand All @@ -57,7 +73,7 @@ func TestAccFastlyServiceV1_syslog_basic(t *testing.T) {
Config: testAccServiceV1SyslogConfig_update(name, domainName1),
Check: resource.ComposeTestCheckFunc(
testAccCheckServiceV1Exists("fastly_service_v1.foo", &service),
testAccCheckFastlyServiceV1SyslogAttributes(&service, []*gofastly.Syslog{&log1, &log2}),
testAccCheckFastlyServiceV1SyslogAttributes(&service, []*gofastly.Syslog{&log1_after_update, &log2}),
resource.TestCheckResourceAttr(
"fastly_service_v1.foo", "name", name),
resource.TestCheckResourceAttr(
Expand All @@ -77,9 +93,11 @@ func TestAccFastlyServiceV1_syslog_formatVersion(t *testing.T) {
Version: 1,
Name: "somesyslogname",
Address: "127.0.0.1",
IPV4: "127.0.0.1",
Port: uint(514),
Format: "%a %l %u %t %m %U%q %H %>s %b %T",
FormatVersion: 2,
MessageType: "classic",
}

resource.Test(t, resource.TestCase{
Expand Down Expand Up @@ -198,6 +216,7 @@ resource "fastly_service_v1" "foo" {
address = "127.0.0.1"
port = 514
response_condition = "response_condition_test"
message_type = "blank"
}
syslog {
name = "somesyslogname2"
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestResourceFastlyFlattenDomains(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion fastly/resource_fastly_service_v1_vcl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/terraform"
gofastly "github.com/sethvargo/go-fastly"
gofastly "github.com/sethvargo/go-fastly/fastly"
)

func TestAccFastlyServiceV1_VCL_basic(t *testing.T) {
Expand Down
62 changes: 0 additions & 62 deletions vendor/github.com/sethvargo/go-fastly/Makefile

This file was deleted.

Loading