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

Update director backends if changed #197

Closed
wants to merge 3 commits into from
Closed

Update director backends if changed #197

wants to merge 3 commits into from

Conversation

phamann
Copy link
Member

@phamann phamann commented Oct 30, 2019

TL;DR

This attempts to address #143 by ensuring we re-create the backend to director relationship when a backend changes. However the solution is non-ideal, see below for further information.

Why?

As the provider uses a schema.TypeSet set as the type for the backend field, we cannot cleanly determine whether a backend has been updated versus being added. Therefore, it simply deletes any backends in the change set and adds them again. See lines. (Note: this seems to be the convention for most collection based fields on the service resource.)

When the backend is deleted, this also propagates the delete through the models relationships and thus deletes the backend from the director.

Therefore, we have multiple options to solve this problem:\

  1. Refactor the provider to use schema.List as the backend field type, which will allow us to safely detect updates and use the appropriate gofastly.UpdateBackend API client call. This will ensure the backend isn't dereferenced from the director. However, this is a breaking change and should be considered as a wider refactor to update other fields to also use TypeList.
  2. Attempt to determine the updates in the change set using the backend.name property. However this is brittle as doesn't account for changes to the backend name itself.
  3. If there are backend changes, iterate over the directors on the service version and re-create the relationship if the backend name matches a backend in the change set.

This PR has implemented option 3 above, however I don't feel comfortable with the change and therefore would like to open discussion here for wider consensus.

Copy link
Member

@thommahoney thommahoney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code reads quite confusingly but I think that's just because I'm not a very experienced Gopher. This solution will work as a stopgap ahead of options (1) or (2). I'd be interested to see what the List implementation looks like.

@sbfaulkner
Copy link
Contributor

work-around: rename my backends any time that I update their configuration, so it correctly re-adds the "new" backends to the director(s), avoiding the problem

@sbfaulkner
Copy link
Contributor

since I have a work-around, I'd lean towards fixing "correctly" ... not 100% sure it requires a breaking change though... perhaps it can instead be managed with an approach that uses a smarter diff function instead of just using Set's Difference in the appropriate places?

related to the use of the List type instead, is this actually a breaking change? what makes it so... the way a Set is persisted in state vs a list?

@sbfaulkner
Copy link
Contributor

Attempt to determine the updates in the change set using the backend.name property. However this is brittle as doesn't account for changes to the backend name itself.

isn't the backend name the actual "id" for the director backend anyway? as such, I'm not 100% convinced it's "brittle" -- seems like a rename should be a delete and re-add perhaps? (and seems to work as per my work-around)

@sbfaulkner
Copy link
Contributor

@phamann did you (or anyone else) ha e further thoughts about this?

@phamann
Copy link
Member Author

phamann commented Feb 20, 2020

@sbfaulkner, @thom, @philippschulte et.al. Apologies for letting this one slip, I've now had some time to think about this a bit more and take in @sbfaulkner's good points regarding the backend name being the identifier.

I've now refactored my code to use Option 2 above, which is much cleaner and doesn't require the backend update logic to also update directors (which wasn't nice) and therefore much happier with the result.

The TL;DR is we now iterate over the set differences to determine which are genuine additions (new backend name) and which are updates (backend name existed previously). This in turn allows use to call gofastly.UpdateBackend()which won't remove the backend from the director and thus solves the original issue in #143.

Have pushed up for review from y'all and will run acceptance tests now.

@sbfaulkner
Copy link
Contributor

sbfaulkner commented Feb 25, 2020

approach looks reasonable, but I don't think acceptance tests are passing - have not debugged at all on my end

also wondering if we can better leverage schema.Set for the diffing

@sbfaulkner
Copy link
Contributor

eg.

			hashName := func(v interface{}) int {
				bf := v.(map[string]interface{})
				return hashcode.String(bf["name"].(string))
			}

			oldOnes := schema.NewSet(hashName, obs.List())
			newOnes := schema.NewSet(hashName, nbs.List())

			for ai, abRaw := range newOnes.Difference(oldOnes).List() {
				log.Printf("[DEBUG] add[%v] : %+v\n", ai, abRaw)
			}
			for ui, ubRaw := range newOnes.Intersection(oldOnes).List() {
				log.Printf("[DEBUG] update[%v] : %+v\n", ui, ubRaw)
			}
			for ri, rbRaw := range oldOnes.Difference(newOnes).List() {
				log.Printf("[DEBUG] remove[%v] : %+v\n", ri, rbRaw)
			}

Copy link
Member

@philippschulte philippschulte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with your approach when it is working. You should think about applying this to all Fastly resources of fastly_service_v1! As @sbfaulkner already mentioned some acceptance tests are failing. I didn't dig into it but I can say that they are failing because of the changes introduced in this PR. The problem is that for some tests there are dangling backends in the state! The failing tests for Syslog have been addressed in #212.

You can find the complete output of the acceptance tests below:

Acceptance Test Results

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v  -timeout 120m -ldflags="-X=github.com/terraform-providers/terraform-provider-fastly/version.ProviderVersion=acc"
?   	github.com/terraform-providers/terraform-provider-fastly	[no test files]
=== RUN   TestUserAgentContainsProviderVersion
--- PASS: TestUserAgentContainsProviderVersion (0.00s)
=== RUN   TestAccFastlyIPRanges
--- PASS: TestAccFastlyIPRanges (1.63s)
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestResourceFastlyFlattenAclEntries
--- PASS: TestResourceFastlyFlattenAclEntries (0.00s)
=== RUN   TestAccFastlyServiceAclEntriesV1_create
--- PASS: TestAccFastlyServiceAclEntriesV1_create (33.34s)
=== RUN   TestAccFastlyServiceAclEntriesV1_update
--- PASS: TestAccFastlyServiceAclEntriesV1_update (69.86s)
=== RUN   TestAccFastlyServiceAclEntriesV1_update_additional_fields
--- PASS: TestAccFastlyServiceAclEntriesV1_update_additional_fields (72.56s)
=== RUN   TestAccFastlyServiceAclEntriesV1_delete
--- FAIL: TestAccFastlyServiceAclEntriesV1_delete (69.89s)
    testing.go:569: Step 1 error: After applying this step and refreshing, the plan was not empty:

        DIFF:

        UPDATE: fastly_service_v1.foo
          acl.#:                           "1" => "1"
          acl.0.acl_id:                    "76OmXD8nI9fgH67dQiwhAq" => "76OmXD8nI9fgH67dQiwhAq"
          acl.0.name:                      "ACL z88ivvthdx" => "ACL z88ivvthdx"
          activate:                        "true" => "true"
          active_version:                  "2" => "2"
          backend.#:                       "2" => "1"
          backend.0.address:               "9gz.aws.amazon.com" => "9gz.aws.amazon.com"
          backend.0.auto_loadbalance:      "true" => "true"
          backend.0.between_bytes_timeout: "10000" => "10000"
          backend.0.connect_timeout:       "1000" => "1000"
          backend.0.error_threshold:       "0" => "0"
          backend.0.first_byte_timeout:    "15000" => "15000"
          backend.0.healthcheck:           "" => ""
          backend.0.max_conn:              "200" => "200"
          backend.0.max_tls_version:       "" => ""
          backend.0.min_tls_version:       "" => ""
          backend.0.name:                  "tf -test backend" => "tf -test backend"
          backend.0.override_host:         "" => ""
          backend.0.port:                  "80" => "80"
          backend.0.request_condition:     "" => ""
          backend.0.shield:                "" => ""
          backend.0.ssl_ca_cert:           "" => ""
          backend.0.ssl_cert_hostname:     "" => ""
          backend.0.ssl_check_cert:        "true" => "true"
          backend.0.ssl_ciphers:           "" => ""
          backend.0.ssl_client_cert:       "" => ""
          backend.0.ssl_client_key:        "" => ""
          backend.0.ssl_hostname:          "" => ""
          backend.0.ssl_sni_hostname:      "" => ""
          backend.0.use_ssl:               "false" => "false"
          backend.0.weight:                "100" => "100"
          backend.1.address:               "kkt.aws.amazon.com" => ""
          backend.1.auto_loadbalance:      "true" => ""
          backend.1.between_bytes_timeout: "10000" => ""
          backend.1.connect_timeout:       "1000" => ""
          backend.1.error_threshold:       "0" => ""
          backend.1.first_byte_timeout:    "15000" => ""
          backend.1.healthcheck:           "" => ""
          backend.1.max_conn:              "200" => ""
          backend.1.max_tls_version:       "" => ""
          backend.1.min_tls_version:       "" => ""
          backend.1.name:                  "tf-testing-backend" => ""
          backend.1.override_host:         "" => ""
          backend.1.port:                  "80" => ""
          backend.1.request_condition:     "" => ""
          backend.1.shield:                "" => ""
          backend.1.ssl_ca_cert:           "" => ""
          backend.1.ssl_cert_hostname:     "" => ""
          backend.1.ssl_check_cert:        "true" => ""
          backend.1.ssl_ciphers:           "" => ""
          backend.1.ssl_client_cert:       "" => ""
          backend.1.ssl_client_key:        "" => ""
          backend.1.ssl_hostname:          "" => ""
          backend.1.ssl_sni_hostname:      "" => ""
          backend.1.use_ssl:               "false" => ""
          backend.1.weight:                "100" => ""
          bigquerylogging.#:               "0" => "0"
          blobstoragelogging.#:            "0" => "0"
          cache_setting.#:                 "0" => "0"
          cloned_version:                  "2" => "2"
          comment:                         "Managed by Terraform" => "Managed by Terraform"
          condition.#:                     "0" => "0"
          default_host:                    "" => ""
          default_ttl:                     "3600" => "3600"
          dictionary.#:                    "0" => "0"
          director.#:                      "0" => "0"
          domain.#:                        "1" => "1"
          domain.0.comment:                "tf-testing-domain" => "tf-testing-domain"
          domain.0.name:                   "fastly-test.tf-724ebdcz30.com" => "fastly-test.tf-724ebdcz30.com"
          dynamicsnippet.#:                "0" => "0"
          force_destroy:                   "true" => "true"
          gcslogging.#:                    "0" => "0"
          gzip.#:                          "0" => "0"
          header.#:                        "0" => "0"
          healthcheck.#:                   "0" => "0"
          id:                              "7cWNUaNRK8Vl7V9WNIFBOz" => "7cWNUaNRK8Vl7V9WNIFBOz"
          logentries.#:                    "0" => "0"
          name:                            "tf-test-93ubr2z7z7" => "tf-test-93ubr2z7z7"
          papertrail.#:                    "0" => "0"
          request_setting.#:               "0" => "0"
          response_object.#:               "0" => "0"
          s3logging.#:                     "0" => "0"
          snippet.#:                       "0" => "0"
          splunk.#:                        "0" => "0"
          sumologic.#:                     "0" => "0"
          syslog.#:                        "0" => "0"
          vcl.#:                           "0" => "0"
          version_comment:                 "" => ""



        STATE:

        fastly_service_v1.foo:
          ID = 7cWNUaNRK8Vl7V9WNIFBOz
          provider = provider.fastly
          acl.# = 1
          acl.0.acl_id = 76OmXD8nI9fgH67dQiwhAq
          acl.0.name = ACL z88ivvthdx
          activate = true
          active_version = 2
          backend.# = 2
          backend.0.address = 9gz.aws.amazon.com
          backend.0.auto_loadbalance = true
          backend.0.between_bytes_timeout = 10000
          backend.0.connect_timeout = 1000
          backend.0.error_threshold = 0
          backend.0.first_byte_timeout = 15000
          backend.0.healthcheck =
          backend.0.max_conn = 200
          backend.0.max_tls_version =
          backend.0.min_tls_version =
          backend.0.name = tf -test backend
          backend.0.override_host =
          backend.0.port = 80
          backend.0.request_condition =
          backend.0.shield =
          backend.0.ssl_ca_cert =
          backend.0.ssl_cert_hostname =
          backend.0.ssl_check_cert = true
          backend.0.ssl_ciphers =
          backend.0.ssl_client_cert =
          backend.0.ssl_client_key =
          backend.0.ssl_hostname =
          backend.0.ssl_sni_hostname =
          backend.0.use_ssl = false
          backend.0.weight = 100
          backend.1.address = kkt.aws.amazon.com
          backend.1.auto_loadbalance = true
          backend.1.between_bytes_timeout = 10000
          backend.1.connect_timeout = 1000
          backend.1.error_threshold = 0
          backend.1.first_byte_timeout = 15000
          backend.1.healthcheck =
          backend.1.max_conn = 200
          backend.1.max_tls_version =
          backend.1.min_tls_version =
          backend.1.name = tf-testing-backend
          backend.1.override_host =
          backend.1.port = 80
          backend.1.request_condition =
          backend.1.shield =
          backend.1.ssl_ca_cert =
          backend.1.ssl_cert_hostname =
          backend.1.ssl_check_cert = true
          backend.1.ssl_ciphers =
          backend.1.ssl_client_cert =
          backend.1.ssl_client_key =
          backend.1.ssl_hostname =
          backend.1.ssl_sni_hostname =
          backend.1.use_ssl = false
          backend.1.weight = 100
          cloned_version = 2
          comment = Managed by Terraform
          default_host =
          default_ttl = 3600
          domain.# = 1
          domain.0.comment = tf-testing-domain
          domain.0.name = fastly-test.tf-724ebdcz30.com
          force_destroy = true
          name = tf-test-93ubr2z7z7
          version_comment =
=== RUN   TestAccFastlyServiceAclEntriesV1_import
--- PASS: TestAccFastlyServiceAclEntriesV1_import (32.96s)
=== RUN   TestAccFastlyServiceAclEntriesV1_process_1001_entries
--- PASS: TestAccFastlyServiceAclEntriesV1_process_1001_entries (82.25s)
=== RUN   TestResourceFastlyFlattenDictionaryItems
--- PASS: TestResourceFastlyFlattenDictionaryItems (0.00s)
=== RUN   TestAccFastlyServiceDictionaryItemV1_create
--- PASS: TestAccFastlyServiceDictionaryItemV1_create (35.14s)
=== RUN   TestAccFastlyServiceDictionaryItemV1_create_dynamic
--- PASS: TestAccFastlyServiceDictionaryItemV1_create_dynamic (32.57s)
=== RUN   TestAccFastlyServiceDictionaryItemV1_update
--- PASS: TestAccFastlyServiceDictionaryItemV1_update (71.62s)
=== RUN   TestAccFastlyServiceDictionaryItemV1_external_item_is_removed
--- PASS: TestAccFastlyServiceDictionaryItemV1_external_item_is_removed (54.25s)
=== RUN   TestAccFastlyServiceDictionaryItemV1_external_item_deleted
--- PASS: TestAccFastlyServiceDictionaryItemV1_external_item_deleted (71.87s)
=== RUN   TestAccFastlyServiceDictionaryItemV1_batch_1001_items
--- PASS: TestAccFastlyServiceDictionaryItemV1_batch_1001_items (54.93s)
=== RUN   TestAccFastlyServiceDictionaryItemV1_import
--- PASS: TestAccFastlyServiceDictionaryItemV1_import (33.23s)
=== RUN   TestAccFastlyServiceDynamicSnippetContentV1_create
--- PASS: TestAccFastlyServiceDynamicSnippetContentV1_create (33.40s)
=== RUN   TestAccFastlyServiceDynamicSnippetContentV1_update
--- PASS: TestAccFastlyServiceDynamicSnippetContentV1_update (67.97s)
=== RUN   TestAccFastlyServiceDynamicSnippetContentV1_external_snippet_is_removed
--- PASS: TestAccFastlyServiceDynamicSnippetContentV1_external_snippet_is_removed (70.59s)
=== RUN   TestAccFastlyServiceDynamicSnippetContentV1_normal_snippet_is_not_removed
--- PASS: TestAccFastlyServiceDynamicSnippetContentV1_normal_snippet_is_not_removed (69.59s)
=== RUN   TestAccFastlyServiceDynamicSnippetContentV1_import
--- PASS: TestAccFastlyServiceDynamicSnippetContentV1_import (32.11s)
=== RUN   TestResourceFastlyFlattenAcl
--- PASS: TestResourceFastlyFlattenAcl (0.00s)
=== RUN   TestAccFastlyServiceV1_acl
--- PASS: TestAccFastlyServiceV1_acl (28.29s)
=== RUN   TestResourceFastlyFlattenBigQuery
--- PASS: TestResourceFastlyFlattenBigQuery (0.56s)
=== RUN   TestAccFastlyServiceV1_bigquerylogging
--- PASS: TestAccFastlyServiceV1_bigquerylogging (29.57s)
=== RUN   TestAccFastlyServiceV1_bigquerylogging_env
--- PASS: TestAccFastlyServiceV1_bigquerylogging_env (29.95s)
=== RUN   TestResourceFastlyFlattenBlobStorage
--- PASS: TestResourceFastlyFlattenBlobStorage (0.00s)
=== RUN   TestAccFastlyServiceV1_blobstoragelogging_basic
--- PASS: TestAccFastlyServiceV1_blobstoragelogging_basic (66.74s)
=== RUN   TestAccFastlyServiceV1_blobstoragelogging_default
--- PASS: TestAccFastlyServiceV1_blobstoragelogging_default (30.02s)
=== RUN   TestAccFastlyServiceV1_blobstoragelogging_env
--- PASS: TestAccFastlyServiceV1_blobstoragelogging_env (29.37s)
=== RUN   TestResourceFastlyFlattenCacheSettings
--- PASS: TestResourceFastlyFlattenCacheSettings (0.00s)
=== RUN   TestAccFastlyServiceV1CacheSetting_basic
--- PASS: TestAccFastlyServiceV1CacheSetting_basic (63.58s)
=== RUN   TestResourceFastlyFlattenConditions
--- PASS: TestResourceFastlyFlattenConditions (0.00s)
=== RUN   TestAccFastlyServiceV1_conditional_basic
--- PASS: TestAccFastlyServiceV1_conditional_basic (31.09s)
=== RUN   TestResourceFastlyFlattenDictionary
--- PASS: TestResourceFastlyFlattenDictionary (0.00s)
=== RUN   TestAccFastlyServiceV1_dictionary
--- PASS: TestAccFastlyServiceV1_dictionary (28.47s)
=== RUN   TestAccFastlyServiceV1_dictionary_write_only
--- PASS: TestAccFastlyServiceV1_dictionary_write_only (29.03s)
=== RUN   TestAccFastlyServiceV1_dictionary_update_name
--- PASS: TestAccFastlyServiceV1_dictionary_update_name (64.40s)
=== RUN   TestAccFastlyServiceV1_dictionary_update_write_only
--- PASS: TestAccFastlyServiceV1_dictionary_update_write_only (64.49s)
=== RUN   TestResourceFastlyFlattenDirectors
--- PASS: TestResourceFastlyFlattenDirectors (0.00s)
=== RUN   TestAccFastlyServiceV1_directors_basic
--- FAIL: TestAccFastlyServiceV1_directors_basic (75.88s)
    testing.go:569: Step 1 error: After applying this step and refreshing, the plan was not empty:

        DIFF:

        UPDATE: fastly_service_v1.foo
          acl.#:                           "0" => "0"
          activate:                        "true" => "true"
          active_version:                  "2" => "2"
          backend.#:                       "4" => "3"
          backend.0.address:               "docs.fastly.com" => "docs.fastly.com"
          backend.0.auto_loadbalance:      "true" => "true"
          backend.0.between_bytes_timeout: "10000" => "10000"
          backend.0.connect_timeout:       "1000" => "1000"
          backend.0.error_threshold:       "0" => "0"
          backend.0.first_byte_timeout:    "15000" => "15000"
          backend.0.healthcheck:           "" => ""
          backend.0.max_conn:              "200" => "200"
          backend.0.max_tls_version:       "" => ""
          backend.0.min_tls_version:       "" => ""
          backend.0.name:                  "origin new" => "origin new"
          backend.0.override_host:         "" => ""
          backend.0.port:                  "80" => "80"
          backend.0.request_condition:     "" => ""
          backend.0.shield:                "" => ""
          backend.0.ssl_ca_cert:           "" => ""
          backend.0.ssl_cert_hostname:     "" => ""
          backend.0.ssl_check_cert:        "true" => "true"
          backend.0.ssl_ciphers:           "" => ""
          backend.0.ssl_client_cert:       "" => ""
          backend.0.ssl_client_key:        "" => ""
          backend.0.ssl_hostname:          "" => ""
          backend.0.ssl_sni_hostname:      "" => ""
          backend.0.use_ssl:               "false" => "false"
          backend.0.weight:                "100" => "100"
          backend.1.address:               "docs.fastly.com" => "www.fastly.com"
          backend.1.auto_loadbalance:      "true" => "true"
          backend.1.between_bytes_timeout: "10000" => "10000"
          backend.1.connect_timeout:       "1000" => "1000"
          backend.1.error_threshold:       "0" => "0"
          backend.1.first_byte_timeout:    "15000" => "15000"
          backend.1.healthcheck:           "" => ""
          backend.1.max_conn:              "200" => "200"
          backend.1.max_tls_version:       "" => ""
          backend.1.min_tls_version:       "" => ""
          backend.1.name:                  "origin old" => "origin x"
          backend.1.override_host:         "" => ""
          backend.1.port:                  "80" => "80"
          backend.1.request_condition:     "" => ""
          backend.1.shield:                "" => ""
          backend.1.ssl_ca_cert:           "" => ""
          backend.1.ssl_cert_hostname:     "" => ""
          backend.1.ssl_check_cert:        "true" => "true"
          backend.1.ssl_ciphers:           "" => ""
          backend.1.ssl_client_cert:       "" => ""
          backend.1.ssl_client_key:        "" => ""
          backend.1.ssl_hostname:          "" => ""
          backend.1.ssl_sni_hostname:      "" => ""
          backend.1.use_ssl:               "false" => "false"
          backend.1.weight:                "100" => "100"
          backend.2.address:               "www.fastly.com" => "www.fastlydemo.net"
          backend.2.auto_loadbalance:      "true" => "true"
          backend.2.between_bytes_timeout: "10000" => "10000"
          backend.2.connect_timeout:       "1000" => "1000"
          backend.2.error_threshold:       "0" => "0"
          backend.2.first_byte_timeout:    "15000" => "15000"
          backend.2.healthcheck:           "" => ""
          backend.2.max_conn:              "200" => "200"
          backend.2.max_tls_version:       "" => ""
          backend.2.min_tls_version:       "" => ""
          backend.2.name:                  "origin x" => "origin y"
          backend.2.override_host:         "" => ""
          backend.2.port:                  "80" => "80"
          backend.2.request_condition:     "" => ""
          backend.2.shield:                "" => ""
          backend.2.ssl_ca_cert:           "" => ""
          backend.2.ssl_cert_hostname:     "" => ""
          backend.2.ssl_check_cert:        "true" => "true"
          backend.2.ssl_ciphers:           "" => ""
          backend.2.ssl_client_cert:       "" => ""
          backend.2.ssl_client_key:        "" => ""
          backend.2.ssl_hostname:          "" => ""
          backend.2.ssl_sni_hostname:      "" => ""
          backend.2.use_ssl:               "false" => "false"
          backend.2.weight:                "100" => "100"
          backend.3.address:               "www.fastlydemo.net" => ""
          backend.3.auto_loadbalance:      "true" => ""
          backend.3.between_bytes_timeout: "10000" => ""
          backend.3.connect_timeout:       "1000" => ""
          backend.3.error_threshold:       "0" => ""
          backend.3.first_byte_timeout:    "15000" => ""
          backend.3.healthcheck:           "" => ""
          backend.3.max_conn:              "200" => ""
          backend.3.max_tls_version:       "" => ""
          backend.3.min_tls_version:       "" => ""
          backend.3.name:                  "origin y" => ""
          backend.3.override_host:         "" => ""
          backend.3.port:                  "80" => ""
          backend.3.request_condition:     "" => ""
          backend.3.shield:                "" => ""
          backend.3.ssl_ca_cert:           "" => ""
          backend.3.ssl_cert_hostname:     "" => ""
          backend.3.ssl_check_cert:        "true" => ""
          backend.3.ssl_ciphers:           "" => ""
          backend.3.ssl_client_cert:       "" => ""
          backend.3.ssl_client_key:        "" => ""
          backend.3.ssl_hostname:          "" => ""
          backend.3.ssl_sni_hostname:      "" => ""
          backend.3.use_ssl:               "false" => ""
          backend.3.weight:                "100" => ""
          bigquerylogging.#:               "0" => "0"
          blobstoragelogging.#:            "0" => "0"
          cache_setting.#:                 "0" => "0"
          cloned_version:                  "2" => "2"
          comment:                         "Managed by Terraform" => "Managed by Terraform"
          condition.#:                     "0" => "0"
          default_host:                    "" => ""
          default_ttl:                     "3600" => "3600"
          dictionary.#:                    "0" => "0"
          director.#:                      "2" => "2"
          director.0.backends.#:           "1" => "1"
          director.0.backends.0:           "origin new" => "origin new"
          director.0.capacity:             "25" => "25"
          director.0.comment:              "" => ""
          director.0.name:                 "mydirector" => "mydirector"
          director.0.quorum:               "30" => "30"
          director.0.retries:              "10" => "10"
          director.0.shield:               "" => ""
          director.0.type:                 "4" => "4"
          director.1.backends.#:           "2" => "2"
          director.1.backends.0:           "origin x" => "origin x"
          director.1.backends.1:           "origin y" => "origin y"
          director.1.capacity:             "100" => "100"
          director.1.comment:              "" => ""
          director.1.name:                 "myotherdirector" => "myotherdirector"
          director.1.quorum:               "75" => "75"
          director.1.retries:              "5" => "5"
          director.1.shield:               "" => ""
          director.1.type:                 "3" => "3"
          domain.#:                        "1" => "1"
          domain.0.comment:                "tf-testing-domain" => "tf-testing-domain"
          domain.0.name:                   "fastly-test.tf-ucquzdtov6.com" => "fastly-test.tf-ucquzdtov6.com"
          dynamicsnippet.#:                "0" => "0"
          force_destroy:                   "true" => "true"
          gcslogging.#:                    "0" => "0"
          gzip.#:                          "0" => "0"
          header.#:                        "0" => "0"
          healthcheck.#:                   "0" => "0"
          id:                              "2J9YCr77N99osxaQr59Zad" => "2J9YCr77N99osxaQr59Zad"
          logentries.#:                    "0" => "0"
          name:                            "tf-test-nxjwk2jx4n" => "tf-test-nxjwk2jx4n"
          papertrail.#:                    "0" => "0"
          request_setting.#:               "0" => "0"
          response_object.#:               "0" => "0"
          s3logging.#:                     "0" => "0"
          snippet.#:                       "0" => "0"
          splunk.#:                        "0" => "0"
          sumologic.#:                     "0" => "0"
          syslog.#:                        "0" => "0"
          vcl.#:                           "0" => "0"
          version_comment:                 "" => ""



        STATE:

        fastly_service_v1.foo:
          ID = 2J9YCr77N99osxaQr59Zad
          provider = provider.fastly
          activate = true
          active_version = 2
          backend.# = 4
          backend.0.address = docs.fastly.com
          backend.0.auto_loadbalance = true
          backend.0.between_bytes_timeout = 10000
          backend.0.connect_timeout = 1000
          backend.0.error_threshold = 0
          backend.0.first_byte_timeout = 15000
          backend.0.healthcheck =
          backend.0.max_conn = 200
          backend.0.max_tls_version =
          backend.0.min_tls_version =
          backend.0.name = origin new
          backend.0.override_host =
          backend.0.port = 80
          backend.0.request_condition =
          backend.0.shield =
          backend.0.ssl_ca_cert =
          backend.0.ssl_cert_hostname =
          backend.0.ssl_check_cert = true
          backend.0.ssl_ciphers =
          backend.0.ssl_client_cert =
          backend.0.ssl_client_key =
          backend.0.ssl_hostname =
          backend.0.ssl_sni_hostname =
          backend.0.use_ssl = false
          backend.0.weight = 100
          backend.1.address = docs.fastly.com
          backend.1.auto_loadbalance = true
          backend.1.between_bytes_timeout = 10000
          backend.1.connect_timeout = 1000
          backend.1.error_threshold = 0
          backend.1.first_byte_timeout = 15000
          backend.1.healthcheck =
          backend.1.max_conn = 200
          backend.1.max_tls_version =
          backend.1.min_tls_version =
          backend.1.name = origin old
          backend.1.override_host =
          backend.1.port = 80
          backend.1.request_condition =
          backend.1.shield =
          backend.1.ssl_ca_cert =
          backend.1.ssl_cert_hostname =
          backend.1.ssl_check_cert = true
          backend.1.ssl_ciphers =
          backend.1.ssl_client_cert =
          backend.1.ssl_client_key =
          backend.1.ssl_hostname =
          backend.1.ssl_sni_hostname =
          backend.1.use_ssl = false
          backend.1.weight = 100
          backend.2.address = www.fastly.com
          backend.2.auto_loadbalance = true
          backend.2.between_bytes_timeout = 10000
          backend.2.connect_timeout = 1000
          backend.2.error_threshold = 0
          backend.2.first_byte_timeout = 15000
          backend.2.healthcheck =
          backend.2.max_conn = 200
          backend.2.max_tls_version =
          backend.2.min_tls_version =
          backend.2.name = origin x
          backend.2.override_host =
          backend.2.port = 80
          backend.2.request_condition =
          backend.2.shield =
          backend.2.ssl_ca_cert =
          backend.2.ssl_cert_hostname =
          backend.2.ssl_check_cert = true
          backend.2.ssl_ciphers =
          backend.2.ssl_client_cert =
          backend.2.ssl_client_key =
          backend.2.ssl_hostname =
          backend.2.ssl_sni_hostname =
          backend.2.use_ssl = false
          backend.2.weight = 100
          backend.3.address = www.fastlydemo.net
          backend.3.auto_loadbalance = true
          backend.3.between_bytes_timeout = 10000
          backend.3.connect_timeout = 1000
          backend.3.error_threshold = 0
          backend.3.first_byte_timeout = 15000
          backend.3.healthcheck =
          backend.3.max_conn = 200
          backend.3.max_tls_version =
          backend.3.min_tls_version =
          backend.3.name = origin y
          backend.3.override_host =
          backend.3.port = 80
          backend.3.request_condition =
          backend.3.shield =
          backend.3.ssl_ca_cert =
          backend.3.ssl_cert_hostname =
          backend.3.ssl_check_cert = true
          backend.3.ssl_ciphers =
          backend.3.ssl_client_cert =
          backend.3.ssl_client_key =
          backend.3.ssl_hostname =
          backend.3.ssl_sni_hostname =
          backend.3.use_ssl = false
          backend.3.weight = 100
          cloned_version = 2
          comment = Managed by Terraform
          default_host =
          default_ttl = 3600
          director.# = 2
          director.0.backends.# = 1
          director.0.backends.0 = origin new
          director.0.capacity = 25
          director.0.comment =
          director.0.name = mydirector
          director.0.quorum = 30
          director.0.retries = 10
          director.0.shield =
          director.0.type = 4
          director.1.backends.# = 2
          director.1.backends.0 = origin x
          director.1.backends.1 = origin y
          director.1.capacity = 100
          director.1.comment =
          director.1.name = myotherdirector
          director.1.quorum = 75
          director.1.retries = 5
          director.1.shield =
          director.1.type = 3
          domain.# = 1
          domain.0.comment = tf-testing-domain
          domain.0.name = fastly-test.tf-ucquzdtov6.com
          force_destroy = true
          name = tf-test-nxjwk2jx4n
          version_comment =
=== RUN   TestResourceFastlyFlattenDynamicSnippets
--- PASS: TestResourceFastlyFlattenDynamicSnippets (0.00s)
=== RUN   TestAccFastlyServiceV1DynamicSnippet_basic
--- PASS: TestAccFastlyServiceV1DynamicSnippet_basic (66.24s)
=== RUN   TestResourceFastlyFlattenGCS
--- PASS: TestResourceFastlyFlattenGCS (0.12s)
=== RUN   TestAccFastlyServiceV1_gcslogging
--- PASS: TestAccFastlyServiceV1_gcslogging (30.39s)
=== RUN   TestAccFastlyServiceV1_gcslogging_env
--- PASS: TestAccFastlyServiceV1_gcslogging_env (29.61s)
=== RUN   TestResourceFastlyFlattenGzips
--- PASS: TestResourceFastlyFlattenGzips (0.00s)
=== RUN   TestAccFastlyServiceV1_gzips_basic
--- PASS: TestAccFastlyServiceV1_gzips_basic (65.04s)
=== RUN   TestResourceFastlyFlattenHeaders
--- PASS: TestResourceFastlyFlattenHeaders (0.00s)
=== RUN   TestFastlyServiceV1_BuildHeaders
--- PASS: TestFastlyServiceV1_BuildHeaders (0.00s)
=== RUN   TestAccFastlyServiceV1_headers_basic
--- PASS: TestAccFastlyServiceV1_headers_basic (64.46s)
=== RUN   TestResourceFastlyFlattenHealthChecks
--- PASS: TestResourceFastlyFlattenHealthChecks (0.00s)
=== RUN   TestAccFastlyServiceV1_healthcheck_basic
--- PASS: TestAccFastlyServiceV1_healthcheck_basic (63.56s)
=== RUN   TestResourceFastlyFlattenLogentries
--- PASS: TestResourceFastlyFlattenLogentries (0.00s)
=== RUN   TestAccFastlyServiceV1_logentries_basic
--- PASS: TestAccFastlyServiceV1_logentries_basic (64.18s)
=== RUN   TestAccFastlyServiceV1_logentries_formatVersion
--- PASS: TestAccFastlyServiceV1_logentries_formatVersion (32.70s)
=== RUN   TestResourceFastlyFlattenPapertrail
--- PASS: TestResourceFastlyFlattenPapertrail (0.00s)
=== RUN   TestAccFastlyServiceV1_papertrail_basic
--- PASS: TestAccFastlyServiceV1_papertrail_basic (62.96s)
=== RUN   TestResourceFastlyFlattenRequestSettings
--- PASS: TestResourceFastlyFlattenRequestSettings (0.00s)
=== RUN   TestAccFastlyServiceV1RequestSetting_basic
--- PASS: TestAccFastlyServiceV1RequestSetting_basic (29.88s)
=== RUN   TestResourceFastlyFlattenResponseObjects
--- PASS: TestResourceFastlyFlattenResponseObjects (0.00s)
=== RUN   TestAccFastlyServiceV1_response_object_basic
--- PASS: TestAccFastlyServiceV1_response_object_basic (65.19s)
=== RUN   TestAccFastlyServiceV1_s3logging_basic
--- PASS: TestAccFastlyServiceV1_s3logging_basic (64.70s)
=== RUN   TestAccFastlyServiceV1_s3logging_domain_default
--- PASS: TestAccFastlyServiceV1_s3logging_domain_default (30.59s)
=== RUN   TestAccFastlyServiceV1_s3logging_s3_env
--- PASS: TestAccFastlyServiceV1_s3logging_s3_env (30.17s)
=== RUN   TestAccFastlyServiceV1_s3logging_formatVersion
--- PASS: TestAccFastlyServiceV1_s3logging_formatVersion (28.48s)
=== RUN   TestResourceFastlyFlattenSnippets
--- PASS: TestResourceFastlyFlattenSnippets (0.00s)
=== RUN   TestAccFastlyServiceV1Snippet_basic
--- PASS: TestAccFastlyServiceV1Snippet_basic (63.15s)
=== RUN   TestResourceFastlyFlattenSplunk
--- PASS: TestResourceFastlyFlattenSplunk (0.00s)
=== RUN   TestAccFastlyServiceV1_splunk_basic
--- PASS: TestAccFastlyServiceV1_splunk_basic (65.29s)
=== RUN   TestAccFastlyServiceV1_splunk_default
--- PASS: TestAccFastlyServiceV1_splunk_default (29.05s)
=== RUN   TestAccFastlyServiceV1_splunk_env
--- PASS: TestAccFastlyServiceV1_splunk_env (30.36s)
=== RUN   TestResourceFastlyFlattenSumologic
--- PASS: TestResourceFastlyFlattenSumologic (0.00s)
=== RUN   TestAccFastlyServiceV1_sumologic
--- PASS: TestAccFastlyServiceV1_sumologic (68.12s)
=== RUN   TestResourceFastlyFlattenSyslog
--- PASS: TestResourceFastlyFlattenSyslog (0.00s)
=== RUN   TestAccFastlyServiceV1_syslog_basic
--- FAIL: TestAccFastlyServiceV1_syslog_basic (3.81s)
    testing.go:569: Step 0 error: errors during apply:

        Error: 400 - Bad Request:

            Title:  Bad request
            Detail: Domain 'notadomain1.com' is already taken by another customer

          on /var/folders/n4/ggm3f3vn1wbcql74h1xqt0nr0000gn/T/tf-test062314676/main.tf line 2:
          (source code not available)


=== RUN   TestAccFastlyServiceV1_syslog_formatVersion
--- FAIL: TestAccFastlyServiceV1_syslog_formatVersion (3.54s)
    testing.go:569: Step 0 error: errors during apply:

        Error: 400 - Bad Request:

            Title:  Bad request
            Detail: Domain 'notadomain1.com' is already taken by another customer

          on /var/folders/n4/ggm3f3vn1wbcql74h1xqt0nr0000gn/T/tf-test071690246/main.tf line 2:
          (source code not available)


=== RUN   TestResourceFastlyFlattenDomains
--- PASS: TestResourceFastlyFlattenDomains (0.00s)
=== RUN   TestResourceFastlyFlattenBackend
--- PASS: TestResourceFastlyFlattenBackend (0.00s)
=== RUN   TestAccFastlyServiceV1_updateDomain
--- PASS: TestAccFastlyServiceV1_updateDomain (62.80s)
=== RUN   TestAccFastlyServiceV1_updateBackend
--- FAIL: TestAccFastlyServiceV1_updateBackend (67.73s)
    testing.go:569: Step 1 error: After applying this step and refreshing, the plan was not empty:

        DIFF:

        UPDATE: fastly_service_v1.foo
          acl.#:                           "0" => "0"
          activate:                        "true" => "true"
          active_version:                  "2" => "2"
          backend.#:                       "3" => "2"
          backend.0.address:               "hdj.aws.amazon.com" => "hdj.aws.amazon.com"
          backend.0.auto_loadbalance:      "true" => "true"
          backend.0.between_bytes_timeout: "10000" => "10000"
          backend.0.connect_timeout:       "1000" => "1000"
          backend.0.error_threshold:       "0" => "0"
          backend.0.first_byte_timeout:    "15000" => "15000"
          backend.0.healthcheck:           "" => ""
          backend.0.max_conn:              "200" => "200"
          backend.0.max_tls_version:       "" => ""
          backend.0.min_tls_version:       "" => ""
          backend.0.name:                  "tf -test backend" => "tf-test-backend"
          backend.0.override_host:         "" => ""
          backend.0.port:                  "80" => "80"
          backend.0.request_condition:     "" => ""
          backend.0.shield:                "" => ""
          backend.0.ssl_ca_cert:           "" => ""
          backend.0.ssl_cert_hostname:     "" => ""
          backend.0.ssl_check_cert:        "true" => "true"
          backend.0.ssl_ciphers:           "" => ""
          backend.0.ssl_client_cert:       "" => ""
          backend.0.ssl_client_key:        "" => ""
          backend.0.ssl_hostname:          "" => ""
          backend.0.ssl_sni_hostname:      "" => ""
          backend.0.use_ssl:               "false" => "false"
          backend.0.weight:                "100" => "100"
          backend.1.address:               "hdj.aws.amazon.com" => "tsb.aws.amazon.com"
          backend.1.auto_loadbalance:      "true" => "true"
          backend.1.between_bytes_timeout: "10000" => "10000"
          backend.1.connect_timeout:       "1000" => "1000"
          backend.1.error_threshold:       "0" => "0"
          backend.1.first_byte_timeout:    "15000" => "15000"
          backend.1.healthcheck:           "" => ""
          backend.1.max_conn:              "200" => "200"
          backend.1.max_tls_version:       "" => ""
          backend.1.min_tls_version:       "" => ""
          backend.1.name:                  "tf-test-backend" => "tf-test-backend-other"
          backend.1.override_host:         "" => ""
          backend.1.port:                  "80" => "80"
          backend.1.request_condition:     "" => ""
          backend.1.shield:                "" => ""
          backend.1.ssl_ca_cert:           "" => ""
          backend.1.ssl_cert_hostname:     "" => ""
          backend.1.ssl_check_cert:        "true" => "true"
          backend.1.ssl_ciphers:           "" => ""
          backend.1.ssl_client_cert:       "" => ""
          backend.1.ssl_client_key:        "" => ""
          backend.1.ssl_hostname:          "" => ""
          backend.1.ssl_sni_hostname:      "" => ""
          backend.1.use_ssl:               "false" => "false"
          backend.1.weight:                "100" => "100"
          backend.2.address:               "tsb.aws.amazon.com" => ""
          backend.2.auto_loadbalance:      "true" => ""
          backend.2.between_bytes_timeout: "10000" => ""
          backend.2.connect_timeout:       "1000" => ""
          backend.2.error_threshold:       "0" => ""
          backend.2.first_byte_timeout:    "15000" => ""
          backend.2.healthcheck:           "" => ""
          backend.2.max_conn:              "200" => ""
          backend.2.max_tls_version:       "" => ""
          backend.2.min_tls_version:       "" => ""
          backend.2.name:                  "tf-test-backend-other" => ""
          backend.2.override_host:         "" => ""
          backend.2.port:                  "80" => ""
          backend.2.request_condition:     "" => ""
          backend.2.shield:                "" => ""
          backend.2.ssl_ca_cert:           "" => ""
          backend.2.ssl_cert_hostname:     "" => ""
          backend.2.ssl_check_cert:        "true" => ""
          backend.2.ssl_ciphers:           "" => ""
          backend.2.ssl_client_cert:       "" => ""
          backend.2.ssl_client_key:        "" => ""
          backend.2.ssl_hostname:          "" => ""
          backend.2.ssl_sni_hostname:      "" => ""
          backend.2.use_ssl:               "false" => ""
          backend.2.weight:                "100" => ""
          bigquerylogging.#:               "0" => "0"
          blobstoragelogging.#:            "0" => "0"
          cache_setting.#:                 "0" => "0"
          cloned_version:                  "2" => "2"
          comment:                         "Managed by Terraform" => "Managed by Terraform"
          condition.#:                     "0" => "0"
          default_host:                    "" => ""
          default_ttl:                     "3400" => "3400"
          dictionary.#:                    "0" => "0"
          director.#:                      "0" => "0"
          domain.#:                        "1" => "1"
          domain.0.comment:                "tf-testing-domain" => "tf-testing-domain"
          domain.0.name:                   "tf-acc-test-d8bca38rac.com" => "tf-acc-test-d8bca38rac.com"
          dynamicsnippet.#:                "0" => "0"
          force_destroy:                   "true" => "true"
          gcslogging.#:                    "0" => "0"
          gzip.#:                          "0" => "0"
          header.#:                        "0" => "0"
          healthcheck.#:                   "0" => "0"
          id:                              "5fTVFMJMeRs7bwkGx9DbrM" => "5fTVFMJMeRs7bwkGx9DbrM"
          logentries.#:                    "0" => "0"
          name:                            "tf-test-fea2h9hwnm" => "tf-test-fea2h9hwnm"
          papertrail.#:                    "0" => "0"
          request_setting.#:               "0" => "0"
          response_object.#:               "0" => "0"
          s3logging.#:                     "0" => "0"
          snippet.#:                       "0" => "0"
          splunk.#:                        "0" => "0"
          sumologic.#:                     "0" => "0"
          syslog.#:                        "0" => "0"
          vcl.#:                           "0" => "0"
          version_comment:                 "" => ""



        STATE:

        fastly_service_v1.foo:
          ID = 5fTVFMJMeRs7bwkGx9DbrM
          provider = provider.fastly
          activate = true
          active_version = 2
          backend.# = 3
          backend.0.address = hdj.aws.amazon.com
          backend.0.auto_loadbalance = true
          backend.0.between_bytes_timeout = 10000
          backend.0.connect_timeout = 1000
          backend.0.error_threshold = 0
          backend.0.first_byte_timeout = 15000
          backend.0.healthcheck =
          backend.0.max_conn = 200
          backend.0.max_tls_version =
          backend.0.min_tls_version =
          backend.0.name = tf -test backend
          backend.0.override_host =
          backend.0.port = 80
          backend.0.request_condition =
          backend.0.shield =
          backend.0.ssl_ca_cert =
          backend.0.ssl_cert_hostname =
          backend.0.ssl_check_cert = true
          backend.0.ssl_ciphers =
          backend.0.ssl_client_cert =
          backend.0.ssl_client_key =
          backend.0.ssl_hostname =
          backend.0.ssl_sni_hostname =
          backend.0.use_ssl = false
          backend.0.weight = 100
          backend.1.address = hdj.aws.amazon.com
          backend.1.auto_loadbalance = true
          backend.1.between_bytes_timeout = 10000
          backend.1.connect_timeout = 1000
          backend.1.error_threshold = 0
          backend.1.first_byte_timeout = 15000
          backend.1.healthcheck =
          backend.1.max_conn = 200
          backend.1.max_tls_version =
          backend.1.min_tls_version =
          backend.1.name = tf-test-backend
          backend.1.override_host =
          backend.1.port = 80
          backend.1.request_condition =
          backend.1.shield =
          backend.1.ssl_ca_cert =
          backend.1.ssl_cert_hostname =
          backend.1.ssl_check_cert = true
          backend.1.ssl_ciphers =
          backend.1.ssl_client_cert =
          backend.1.ssl_client_key =
          backend.1.ssl_hostname =
          backend.1.ssl_sni_hostname =
          backend.1.use_ssl = false
          backend.1.weight = 100
          backend.2.address = tsb.aws.amazon.com
          backend.2.auto_loadbalance = true
          backend.2.between_bytes_timeout = 10000
          backend.2.connect_timeout = 1000
          backend.2.error_threshold = 0
          backend.2.first_byte_timeout = 15000
          backend.2.healthcheck =
          backend.2.max_conn = 200
          backend.2.max_tls_version =
          backend.2.min_tls_version =
          backend.2.name = tf-test-backend-other
          backend.2.override_host =
          backend.2.port = 80
          backend.2.request_condition =
          backend.2.shield =
          backend.2.ssl_ca_cert =
          backend.2.ssl_cert_hostname =
          backend.2.ssl_check_cert = true
          backend.2.ssl_ciphers =
          backend.2.ssl_client_cert =
          backend.2.ssl_client_key =
          backend.2.ssl_hostname =
          backend.2.ssl_sni_hostname =
          backend.2.use_ssl = false
          backend.2.weight = 100
          cloned_version = 2
          comment = Managed by Terraform
          default_host =
          default_ttl = 3400
          domain.# = 1
          domain.0.comment = tf-testing-domain
          domain.0.name = tf-acc-test-d8bca38rac.com
          force_destroy = true
          name = tf-test-fea2h9hwnm
          version_comment =
=== RUN   TestAccFastlyServiceV1_updateInvalidBackend
--- PASS: TestAccFastlyServiceV1_updateInvalidBackend (31.88s)
=== RUN   TestAccFastlyServiceV1_basic
--- PASS: TestAccFastlyServiceV1_basic (62.32s)
=== RUN   TestAccFastlyServiceV1_disappears
--- PASS: TestAccFastlyServiceV1_disappears (13.40s)
=== RUN   TestAccFastlyServiceV1_defaultTTL
--- FAIL: TestAccFastlyServiceV1_defaultTTL (63.62s)
    testing.go:569: Step 1 error: After applying this step and refreshing, the plan was not empty:

        DIFF:

        UPDATE: fastly_service_v1.foo
          acl.#:                           "0" => "0"
          activate:                        "true" => "true"
          active_version:                  "2" => "2"
          backend.#:                       "3" => "2"
          backend.0.address:               "1hv.aws.amazon.com" => "1hv.aws.amazon.com"
          backend.0.auto_loadbalance:      "true" => "true"
          backend.0.between_bytes_timeout: "10000" => "10000"
          backend.0.connect_timeout:       "1000" => "1000"
          backend.0.error_threshold:       "0" => "0"
          backend.0.first_byte_timeout:    "15000" => "15000"
          backend.0.healthcheck:           "" => ""
          backend.0.max_conn:              "200" => "200"
          backend.0.max_tls_version:       "" => ""
          backend.0.min_tls_version:       "" => ""
          backend.0.name:                  "tf-test-backend-other" => "tf-test-backend-other"
          backend.0.override_host:         "" => ""
          backend.0.port:                  "80" => "80"
          backend.0.request_condition:     "" => ""
          backend.0.shield:                "" => ""
          backend.0.ssl_ca_cert:           "" => ""
          backend.0.ssl_cert_hostname:     "" => ""
          backend.0.ssl_check_cert:        "true" => "true"
          backend.0.ssl_ciphers:           "" => ""
          backend.0.ssl_client_cert:       "" => ""
          backend.0.ssl_client_key:        "" => ""
          backend.0.ssl_hostname:          "" => ""
          backend.0.ssl_sni_hostname:      "" => ""
          backend.0.use_ssl:               "false" => "false"
          backend.0.weight:                "100" => "100"
          backend.1.address:               "rcg.aws.amazon.com" => "rcg.aws.amazon.com"
          backend.1.auto_loadbalance:      "true" => "true"
          backend.1.between_bytes_timeout: "10000" => "10000"
          backend.1.connect_timeout:       "1000" => "1000"
          backend.1.error_threshold:       "0" => "0"
          backend.1.first_byte_timeout:    "15000" => "15000"
          backend.1.healthcheck:           "" => ""
          backend.1.max_conn:              "200" => "200"
          backend.1.max_tls_version:       "" => ""
          backend.1.min_tls_version:       "" => ""
          backend.1.name:                  "tf -test backend" => "tf-test-backend"
          backend.1.override_host:         "" => ""
          backend.1.port:                  "80" => "80"
          backend.1.request_condition:     "" => ""
          backend.1.shield:                "" => ""
          backend.1.ssl_ca_cert:           "" => ""
          backend.1.ssl_cert_hostname:     "" => ""
          backend.1.ssl_check_cert:        "true" => "true"
          backend.1.ssl_ciphers:           "" => ""
          backend.1.ssl_client_cert:       "" => ""
          backend.1.ssl_client_key:        "" => ""
          backend.1.ssl_hostname:          "" => ""
          backend.1.ssl_sni_hostname:      "" => ""
          backend.1.use_ssl:               "false" => "false"
          backend.1.weight:                "100" => "100"
          backend.2.address:               "rcg.aws.amazon.com" => ""
          backend.2.auto_loadbalance:      "true" => ""
          backend.2.between_bytes_timeout: "10000" => ""
          backend.2.connect_timeout:       "1000" => ""
          backend.2.error_threshold:       "0" => ""
          backend.2.first_byte_timeout:    "15000" => ""
          backend.2.healthcheck:           "" => ""
          backend.2.max_conn:              "200" => ""
          backend.2.max_tls_version:       "" => ""
          backend.2.min_tls_version:       "" => ""
          backend.2.name:                  "tf-test-backend" => ""
          backend.2.override_host:         "" => ""
          backend.2.port:                  "80" => ""
          backend.2.request_condition:     "" => ""
          backend.2.shield:                "" => ""
          backend.2.ssl_ca_cert:           "" => ""
          backend.2.ssl_cert_hostname:     "" => ""
          backend.2.ssl_check_cert:        "true" => ""
          backend.2.ssl_ciphers:           "" => ""
          backend.2.ssl_client_cert:       "" => ""
          backend.2.ssl_client_key:        "" => ""
          backend.2.ssl_hostname:          "" => ""
          backend.2.ssl_sni_hostname:      "" => ""
          backend.2.use_ssl:               "false" => ""
          backend.2.weight:                "100" => ""
          bigquerylogging.#:               "0" => "0"
          blobstoragelogging.#:            "0" => "0"
          cache_setting.#:                 "0" => "0"
          cloned_version:                  "2" => "2"
          comment:                         "Managed by Terraform" => "Managed by Terraform"
          condition.#:                     "0" => "0"
          default_host:                    "" => ""
          default_ttl:                     "3400" => "3400"
          dictionary.#:                    "0" => "0"
          director.#:                      "0" => "0"
          domain.#:                        "1" => "1"
          domain.0.comment:                "tf-testing-domain" => "tf-testing-domain"
          domain.0.name:                   "terraform-acc-test-jb9p7aeexj.com" => "terraform-acc-test-jb9p7aeexj.com"
          dynamicsnippet.#:                "0" => "0"
          force_destroy:                   "true" => "true"
          gcslogging.#:                    "0" => "0"
          gzip.#:                          "0" => "0"
          header.#:                        "0" => "0"
          healthcheck.#:                   "0" => "0"
          id:                              "7hcq0cpfcJfW3U0MtCGlRZ" => "7hcq0cpfcJfW3U0MtCGlRZ"
          logentries.#:                    "0" => "0"
          name:                            "tf-test-lch8yk6mtj" => "tf-test-lch8yk6mtj"
          papertrail.#:                    "0" => "0"
          request_setting.#:               "0" => "0"
          response_object.#:               "0" => "0"
          s3logging.#:                     "0" => "0"
          snippet.#:                       "0" => "0"
          splunk.#:                        "0" => "0"
          sumologic.#:                     "0" => "0"
          syslog.#:                        "0" => "0"
          vcl.#:                           "0" => "0"
          version_comment:                 "" => ""



        STATE:

        fastly_service_v1.foo:
          ID = 7hcq0cpfcJfW3U0MtCGlRZ
          provider = provider.fastly
          activate = true
          active_version = 2
          backend.# = 3
          backend.0.address = 1hv.aws.amazon.com
          backend.0.auto_loadbalance = true
          backend.0.between_bytes_timeout = 10000
          backend.0.connect_timeout = 1000
          backend.0.error_threshold = 0
          backend.0.first_byte_timeout = 15000
          backend.0.healthcheck =
          backend.0.max_conn = 200
          backend.0.max_tls_version =
          backend.0.min_tls_version =
          backend.0.name = tf-test-backend-other
          backend.0.override_host =
          backend.0.port = 80
          backend.0.request_condition =
          backend.0.shield =
          backend.0.ssl_ca_cert =
          backend.0.ssl_cert_hostname =
          backend.0.ssl_check_cert = true
          backend.0.ssl_ciphers =
          backend.0.ssl_client_cert =
          backend.0.ssl_client_key =
          backend.0.ssl_hostname =
          backend.0.ssl_sni_hostname =
          backend.0.use_ssl = false
          backend.0.weight = 100
          backend.1.address = rcg.aws.amazon.com
          backend.1.auto_loadbalance = true
          backend.1.between_bytes_timeout = 10000
          backend.1.connect_timeout = 1000
          backend.1.error_threshold = 0
          backend.1.first_byte_timeout = 15000
          backend.1.healthcheck =
          backend.1.max_conn = 200
          backend.1.max_tls_version =
          backend.1.min_tls_version =
          backend.1.name = tf -test backend
          backend.1.override_host =
          backend.1.port = 80
          backend.1.request_condition =
          backend.1.shield =
          backend.1.ssl_ca_cert =
          backend.1.ssl_cert_hostname =
          backend.1.ssl_check_cert = true
          backend.1.ssl_ciphers =
          backend.1.ssl_client_cert =
          backend.1.ssl_client_key =
          backend.1.ssl_hostname =
          backend.1.ssl_sni_hostname =
          backend.1.use_ssl = false
          backend.1.weight = 100
          backend.2.address = rcg.aws.amazon.com
          backend.2.auto_loadbalance = true
          backend.2.between_bytes_timeout = 10000
          backend.2.connect_timeout = 1000
          backend.2.error_threshold = 0
          backend.2.first_byte_timeout = 15000
          backend.2.healthcheck =
          backend.2.max_conn = 200
          backend.2.max_tls_version =
          backend.2.min_tls_version =
          backend.2.name = tf-test-backend
          backend.2.override_host =
          backend.2.port = 80
          backend.2.request_condition =
          backend.2.shield =
          backend.2.ssl_ca_cert =
          backend.2.ssl_cert_hostname =
          backend.2.ssl_check_cert = true
          backend.2.ssl_ciphers =
          backend.2.ssl_client_cert =
          backend.2.ssl_client_key =
          backend.2.ssl_hostname =
          backend.2.ssl_sni_hostname =
          backend.2.use_ssl = false
          backend.2.weight = 100
          cloned_version = 2
          comment = Managed by Terraform
          default_host =
          default_ttl = 3400
          domain.# = 1
          domain.0.comment = tf-testing-domain
          domain.0.name = terraform-acc-test-jb9p7aeexj.com
          force_destroy = true
          name = tf-test-lch8yk6mtj
          version_comment =
=== RUN   TestResourceFastlyFlattenVCLs
--- PASS: TestResourceFastlyFlattenVCLs (0.00s)
=== RUN   TestAccFastlyServiceV1_VCL_basic
--- PASS: TestAccFastlyServiceV1_VCL_basic (61.42s)
=== RUN   TestAccFastlyServiceV1_creation_with_versionless_resources
--- PASS: TestAccFastlyServiceV1_creation_with_versionless_resources (35.50s)
=== RUN   TestValidateLoggingFormatVersion
=== RUN   TestValidateLoggingFormatVersion/5
=== RUN   TestValidateLoggingFormatVersion/0
=== RUN   TestValidateLoggingFormatVersion/1
=== RUN   TestValidateLoggingFormatVersion/2
=== RUN   TestValidateLoggingFormatVersion/3
=== RUN   TestValidateLoggingFormatVersion/4
--- PASS: TestValidateLoggingFormatVersion (0.00s)
    --- PASS: TestValidateLoggingFormatVersion/5 (0.00s)
    --- PASS: TestValidateLoggingFormatVersion/0 (0.00s)
    --- PASS: TestValidateLoggingFormatVersion/1 (0.00s)
    --- PASS: TestValidateLoggingFormatVersion/2 (0.00s)
    --- PASS: TestValidateLoggingFormatVersion/3 (0.00s)
    --- PASS: TestValidateLoggingFormatVersion/4 (0.00s)
=== RUN   TestValidateLoggingMessageType
=== RUN   TestValidateLoggingMessageType/classic
=== RUN   TestValidateLoggingMessageType/loggly
=== RUN   TestValidateLoggingMessageType/logplex
=== RUN   TestValidateLoggingMessageType/blank
=== RUN   TestValidateLoggingMessageType/CLASSIC
=== RUN   TestValidateLoggingMessageType/LOGGLY
=== RUN   TestValidateLoggingMessageType/LOGPLEX
=== RUN   TestValidateLoggingMessageType/BLANK
--- PASS: TestValidateLoggingMessageType (0.00s)
    --- PASS: TestValidateLoggingMessageType/classic (0.00s)
    --- PASS: TestValidateLoggingMessageType/loggly (0.00s)
    --- PASS: TestValidateLoggingMessageType/logplex (0.00s)
    --- PASS: TestValidateLoggingMessageType/blank (0.00s)
    --- PASS: TestValidateLoggingMessageType/CLASSIC (0.00s)
    --- PASS: TestValidateLoggingMessageType/LOGGLY (0.00s)
    --- PASS: TestValidateLoggingMessageType/LOGPLEX (0.00s)
    --- PASS: TestValidateLoggingMessageType/BLANK (0.00s)
=== RUN   TestValidateLoggingPlacement
=== RUN   TestValidateLoggingPlacement/none
=== RUN   TestValidateLoggingPlacement/waf_debug
=== RUN   TestValidateLoggingPlacement/NONE
=== RUN   TestValidateLoggingPlacement/WAF_DEBUG
--- PASS: TestValidateLoggingPlacement (0.00s)
    --- PASS: TestValidateLoggingPlacement/none (0.00s)
    --- PASS: TestValidateLoggingPlacement/waf_debug (0.00s)
    --- PASS: TestValidateLoggingPlacement/NONE (0.00s)
    --- PASS: TestValidateLoggingPlacement/WAF_DEBUG (0.00s)
=== RUN   TestValidateDirectorQuorum
=== RUN   TestValidateDirectorQuorum/0
=== RUN   TestValidateDirectorQuorum/55
=== RUN   TestValidateDirectorQuorum/100
=== RUN   TestValidateDirectorQuorum/-1
=== RUN   TestValidateDirectorQuorum/101
=== RUN   TestValidateDirectorQuorum/150
--- PASS: TestValidateDirectorQuorum (0.00s)
    --- PASS: TestValidateDirectorQuorum/0 (0.00s)
    --- PASS: TestValidateDirectorQuorum/55 (0.00s)
    --- PASS: TestValidateDirectorQuorum/100 (0.00s)
    --- PASS: TestValidateDirectorQuorum/-1 (0.00s)
    --- PASS: TestValidateDirectorQuorum/101 (0.00s)
    --- PASS: TestValidateDirectorQuorum/150 (0.00s)
=== RUN   TestValidateDirectorType
=== RUN   TestValidateDirectorType/1
=== RUN   TestValidateDirectorType/2
=== RUN   TestValidateDirectorType/3
=== RUN   TestValidateDirectorType/4
=== RUN   TestValidateDirectorType/5
=== RUN   TestValidateDirectorType/0
--- PASS: TestValidateDirectorType (0.00s)
    --- PASS: TestValidateDirectorType/1 (0.00s)
    --- PASS: TestValidateDirectorType/2 (0.00s)
    --- PASS: TestValidateDirectorType/3 (0.00s)
    --- PASS: TestValidateDirectorType/4 (0.00s)
    --- PASS: TestValidateDirectorType/5 (0.00s)
    --- PASS: TestValidateDirectorType/0 (0.00s)
=== RUN   TestValidateConditionType
=== RUN   TestValidateConditionType/REQUEST
=== RUN   TestValidateConditionType/RESPONSE
=== RUN   TestValidateConditionType/CACHE
=== RUN   TestValidateConditionType/PREFETCH
=== RUN   TestValidateConditionType/request
=== RUN   TestValidateConditionType/response
=== RUN   TestValidateConditionType/cache
=== RUN   TestValidateConditionType/prefetch
--- PASS: TestValidateConditionType (0.00s)
    --- PASS: TestValidateConditionType/REQUEST (0.00s)
    --- PASS: TestValidateConditionType/RESPONSE (0.00s)
    --- PASS: TestValidateConditionType/CACHE (0.00s)
    --- PASS: TestValidateConditionType/PREFETCH (0.00s)
    --- PASS: TestValidateConditionType/request (0.00s)
    --- PASS: TestValidateConditionType/response (0.00s)
    --- PASS: TestValidateConditionType/cache (0.00s)
    --- PASS: TestValidateConditionType/prefetch (0.00s)
=== RUN   TestValidateHeaderAction
=== RUN   TestValidateHeaderAction/set
=== RUN   TestValidateHeaderAction/append
=== RUN   TestValidateHeaderAction/delete
=== RUN   TestValidateHeaderAction/regex
=== RUN   TestValidateHeaderAction/regex_repeat
=== RUN   TestValidateHeaderAction/SET
=== RUN   TestValidateHeaderAction/APPEND
=== RUN   TestValidateHeaderAction/DELETE
=== RUN   TestValidateHeaderAction/REGEX
=== RUN   TestValidateHeaderAction/REGEX_REPEAT
--- PASS: TestValidateHeaderAction (0.00s)
    --- PASS: TestValidateHeaderAction/set (0.00s)
    --- PASS: TestValidateHeaderAction/append (0.00s)
    --- PASS: TestValidateHeaderAction/delete (0.00s)
    --- PASS: TestValidateHeaderAction/regex (0.00s)
    --- PASS: TestValidateHeaderAction/regex_repeat (0.00s)
    --- PASS: TestValidateHeaderAction/SET (0.00s)
    --- PASS: TestValidateHeaderAction/APPEND (0.00s)
    --- PASS: TestValidateHeaderAction/DELETE (0.00s)
    --- PASS: TestValidateHeaderAction/REGEX (0.00s)
    --- PASS: TestValidateHeaderAction/REGEX_REPEAT (0.00s)
=== RUN   TestValidateHeaderType
=== RUN   TestValidateHeaderType/request
=== RUN   TestValidateHeaderType/fetch
=== RUN   TestValidateHeaderType/cache
=== RUN   TestValidateHeaderType/response
=== RUN   TestValidateHeaderType/REQUEST
=== RUN   TestValidateHeaderType/FETCH
=== RUN   TestValidateHeaderType/CACHE
=== RUN   TestValidateHeaderType/RESPONSE
--- PASS: TestValidateHeaderType (0.00s)
    --- PASS: TestValidateHeaderType/request (0.00s)
    --- PASS: TestValidateHeaderType/fetch (0.00s)
    --- PASS: TestValidateHeaderType/cache (0.00s)
    --- PASS: TestValidateHeaderType/response (0.00s)
    --- PASS: TestValidateHeaderType/REQUEST (0.00s)
    --- PASS: TestValidateHeaderType/FETCH (0.00s)
    --- PASS: TestValidateHeaderType/CACHE (0.00s)
    --- PASS: TestValidateHeaderType/RESPONSE (0.00s)
=== RUN   TestValidateSnippetType
=== RUN   TestValidateSnippetType/init
=== RUN   TestValidateSnippetType/recv
=== RUN   TestValidateSnippetType/hit
=== RUN   TestValidateSnippetType/miss
=== RUN   TestValidateSnippetType/pass
=== RUN   TestValidateSnippetType/fetch
=== RUN   TestValidateSnippetType/error
=== RUN   TestValidateSnippetType/deliver
=== RUN   TestValidateSnippetType/log
=== RUN   TestValidateSnippetType/none
=== RUN   TestValidateSnippetType/INIT
=== RUN   TestValidateSnippetType/RECV
=== RUN   TestValidateSnippetType/HIT
=== RUN   TestValidateSnippetType/MISS
=== RUN   TestValidateSnippetType/PASS
=== RUN   TestValidateSnippetType/FETCH
=== RUN   TestValidateSnippetType/ERROR
=== RUN   TestValidateSnippetType/DELIVER
=== RUN   TestValidateSnippetType/LOG
=== RUN   TestValidateSnippetType/NONE
--- PASS: TestValidateSnippetType (0.00s)
    --- PASS: TestValidateSnippetType/init (0.00s)
    --- PASS: TestValidateSnippetType/recv (0.00s)
    --- PASS: TestValidateSnippetType/hit (0.00s)
    --- PASS: TestValidateSnippetType/miss (0.00s)
    --- PASS: TestValidateSnippetType/pass (0.00s)
    --- PASS: TestValidateSnippetType/fetch (0.00s)
    --- PASS: TestValidateSnippetType/error (0.00s)
    --- PASS: TestValidateSnippetType/deliver (0.00s)
    --- PASS: TestValidateSnippetType/log (0.00s)
    --- PASS: TestValidateSnippetType/none (0.00s)
    --- PASS: TestValidateSnippetType/INIT (0.00s)
    --- PASS: TestValidateSnippetType/RECV (0.00s)
    --- PASS: TestValidateSnippetType/HIT (0.00s)
    --- PASS: TestValidateSnippetType/MISS (0.00s)
    --- PASS: TestValidateSnippetType/PASS (0.00s)
    --- PASS: TestValidateSnippetType/FETCH (0.00s)
    --- PASS: TestValidateSnippetType/ERROR (0.00s)
    --- PASS: TestValidateSnippetType/DELIVER (0.00s)
    --- PASS: TestValidateSnippetType/LOG (0.00s)
    --- PASS: TestValidateSnippetType/NONE (0.00s)
=== RUN   TestValidateDictionaryItemMaxSize
=== RUN   TestValidateDictionaryItemMaxSize/Ten_hundred_dictionary_items
=== RUN   TestValidateDictionaryItemMaxSize/Ten_thousand_dictionary_items
=== RUN   TestValidateDictionaryItemMaxSize/Ten_thousand_and_one_dictionary_items
--- PASS: TestValidateDictionaryItemMaxSize (0.01s)
    --- PASS: TestValidateDictionaryItemMaxSize/Ten_hundred_dictionary_items (0.00s)
    --- PASS: TestValidateDictionaryItemMaxSize/Ten_thousand_dictionary_items (0.00s)
    --- PASS: TestValidateDictionaryItemMaxSize/Ten_thousand_and_one_dictionary_items (0.00s)
FAIL
FAIL	github.com/terraform-providers/terraform-provider-fastly/fastly	2951.466s

Please add an acceptance test that mimics exactly the scenario of #143. The test should create three backends and one director. Then one backend should be updated and one should be deleted and one should stay the same. The assertion should test if the connection between the director and the two backends is still intact.

@phamann
Copy link
Member Author

phamann commented Sep 2, 2020

Fixed in #304

@phamann phamann closed this Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants