fastly / terraform-provider-fastly

Terraform Fastly provider
https://www.terraform.io/docs/providers/fastly/
Mozilla Public License 2.0
119 stars 139 forks source link

s3logging changes on each apply even if HCL did not change #10

Closed DanielRussell closed 7 years ago

DanielRussell commented 7 years ago

Terraform Version

0.9.9

Affected Resource(s)

Terraform Configuration Files

...
  # NOTE: This config defines the S3 destination, but no
  # logging happens here (it's done in custom VCL)
  s3logging {
    name               = "S3 Logs"
    bucket_name        = "my_bucket"
    s3_access_key      = "foo"
    s3_secret_key      = "bar"
    path               = "logs/fastly/"
    period             = "900"
    gzip_level         = "1"
    response_condition = "Priority 20 Always False"
    format             = "%h %l %u %t %r %>s req.http.x-log-host resp.http.X-Cache req.http.x-forwarded-for req.http.range"
  }
...

Debug Output

~ fastly_service_v1.pl
    s3logging.1412920004.bucket_name:        "" => "my_bucket"
    s3logging.1412920004.domain:             "" => ""
    s3logging.1412920004.format:             "" => "%h %l %u %t %r %>s req.http.x-log-host resp.http.X-Cache req.http.x-forwarded-for req.http.range"
    s3logging.1412920004.format_version:     "" => "1"
    s3logging.1412920004.gzip_level:         "" => "1"
    s3logging.1412920004.name:               "" => "S3 Logs"
    s3logging.1412920004.path:               "" => "logs/fastly/"
    s3logging.1412920004.period:             "" => "900"
    s3logging.1412920004.response_condition: "" => "Priority 20 Always False"
    s3logging.1412920004.s3_access_key:      "<sensitive>" => "<sensitive>" (attribute changed)
    s3logging.1412920004.s3_secret_key:      "<sensitive>" => "<sensitive>" (attribute changed)
    s3logging.1412920004.timestamp_format:   "" => "%Y-%m-%dT%H:%M:%S.000"
    s3logging.3742254017.bucket_name:        "my_bucket" => ""
    s3logging.3742254017.domain:             "s3.amazonaws.com" => ""
    s3logging.3742254017.format:             "%h %l %u %t %r %>s req.http.x-log-host resp.http.X-Cache req.http.x-forwarded-for req.http.range" => ""
    s3logging.3742254017.format_version:     "1" => "0"
    s3logging.3742254017.gzip_level:         "1" => "0"
    s3logging.3742254017.name:               "S3 Logs" => ""
    s3logging.3742254017.path:               "logs/fastly/" => ""
    s3logging.3742254017.period:             "900" => "0"
    s3logging.3742254017.response_condition: "Priority 20 Always False" => ""
    s3logging.3742254017.s3_access_key:      "" => ""
    s3logging.3742254017.s3_secret_key:      "" => ""
    s3logging.3742254017.timestamp_format:   "%Y-%m-%dT%H:%M:%S.000" => ""

Panic Output

n/a

Expected Behavior

The resource should not be changed

Actual Behavior

Terraform changes the resources, even though the contents of the old and new resources are the same.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

n/a

References

cc @catsby, we just talked about this during the break in your presentation at Altitude

mtougeron commented 7 years ago

@DanielRussell it looks like you may have accidentally pasted in your AWS key and secret.

msuterski commented 7 years ago

@DanielRussell please, rotate the keys. They are in many people's mailboxes now.

catsby commented 7 years ago

Hey @DanielRussell it looks like one entry has a domain specified and the other does not, can you double check why that is? It's listed as optional in the Terraform docs, I'll double check the code to see why it's picking that up, and if it should be computed

catsby commented 7 years ago

Also please rotate any keys that was shared. I didn't see it in my email, but others have reported it ..

DanielRussell commented 7 years ago

Confirmed that adding domain resolves the perpetual diff. Haven't had a chance to try #12 yet.

Rotated key and will continue to hang my head in shame for a while...

catsby commented 7 years ago

Should be patched in https://github.com/terraform-providers/terraform-provider-fastly/pull/12 , we'll now include a default.