Merge pull request #10419 from hashicorp/b-update-hcl

update HCL
This commit is contained in:
Mitchell Hashimoto 2016-11-29 10:37:25 -08:00 committed by GitHub
commit a057fb3868
4 changed files with 66 additions and 25 deletions

View File

@ -480,7 +480,7 @@ func (s *Scanner) scanString() {
// read character after quote // read character after quote
ch := s.next() ch := s.next()
if ch < 0 || ch == eof { if (ch == '\n' && braces == 0) || ch < 0 || ch == eof {
s.err("literal not terminated") s.err("literal not terminated")
return return
} }

View File

@ -27,6 +27,9 @@ func Unquote(s string) (t string, err error) {
if quote != '"' { if quote != '"' {
return "", ErrSyntax return "", ErrSyntax
} }
if !contains(s, '$') && !contains(s, '{') && contains(s, '\n') {
return "", ErrSyntax
}
// Is it trivial? Avoid allocation. // Is it trivial? Avoid allocation.
if !contains(s, '\\') && !contains(s, quote) && !contains(s, '$') { if !contains(s, '\\') && !contains(s, quote) && !contains(s, '$') {
@ -84,6 +87,10 @@ func Unquote(s string) (t string, err error) {
} }
} }
if s[0] == '\n' {
return "", ErrSyntax
}
c, multibyte, ss, err := unquoteChar(s, quote) c, multibyte, ss, err := unquoteChar(s, quote)
if err != nil { if err != nil {
return "", err return "", err

48
vendor/vendor.json vendored
View File

@ -1514,68 +1514,68 @@
{ {
"checksumSHA1": "8OPDk+bKyRGJoKcS4QNw9F7dpE8=", "checksumSHA1": "8OPDk+bKyRGJoKcS4QNw9F7dpE8=",
"path": "github.com/hashicorp/hcl", "path": "github.com/hashicorp/hcl",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "XQmjDva9JCGGkIecOgwtBEMCJhU=", "checksumSHA1": "XQmjDva9JCGGkIecOgwtBEMCJhU=",
"path": "github.com/hashicorp/hcl/hcl/ast", "path": "github.com/hashicorp/hcl/hcl/ast",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "5HVecyfmcTm6OTffEi6LGayQf5M=", "checksumSHA1": "5HVecyfmcTm6OTffEi6LGayQf5M=",
"path": "github.com/hashicorp/hcl/hcl/fmtcmd", "path": "github.com/hashicorp/hcl/hcl/fmtcmd",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "croNloscHsjX87X+4/cKOURf1EY=", "checksumSHA1": "croNloscHsjX87X+4/cKOURf1EY=",
"path": "github.com/hashicorp/hcl/hcl/parser", "path": "github.com/hashicorp/hcl/hcl/parser",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "1k1PQRPdYEjeTbXsYz5ZP+Won1w=", "checksumSHA1": "1k1PQRPdYEjeTbXsYz5ZP+Won1w=",
"path": "github.com/hashicorp/hcl/hcl/printer", "path": "github.com/hashicorp/hcl/hcl/printer",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "Zz4271B4Kc+rwwK7cbaRv7STfO8=", "checksumSHA1": "z6wdP4mRw4GVjShkNHDaOWkbxS0=",
"path": "github.com/hashicorp/hcl/hcl/scanner", "path": "github.com/hashicorp/hcl/hcl/scanner",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "/e0ULfQnGeUKiM1+iMnQhImo62k=", "checksumSHA1": "oS3SCN9Wd6D8/LG0Yx1fu84a7gI=",
"path": "github.com/hashicorp/hcl/hcl/strconv", "path": "github.com/hashicorp/hcl/hcl/strconv",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=", "checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=",
"path": "github.com/hashicorp/hcl/hcl/token", "path": "github.com/hashicorp/hcl/hcl/token",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "138aCV5n8n7tkGYMsMVQQnnLq+0=", "checksumSHA1": "138aCV5n8n7tkGYMsMVQQnnLq+0=",
"path": "github.com/hashicorp/hcl/json/parser", "path": "github.com/hashicorp/hcl/json/parser",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "YdvFsNOMSWMLnY6fcliWQa0O5Fw=", "checksumSHA1": "YdvFsNOMSWMLnY6fcliWQa0O5Fw=",
"path": "github.com/hashicorp/hcl/json/scanner", "path": "github.com/hashicorp/hcl/json/scanner",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=", "checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=",
"path": "github.com/hashicorp/hcl/json/token", "path": "github.com/hashicorp/hcl/json/token",
"revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", "revision": "5550aaba7896ad2a161888b40954bc0f0787bb81",
"revisionTime": "2016-11-22T02:11:24Z" "revisionTime": "2016-11-29T18:26:28Z"
}, },
{ {
"checksumSHA1": "/TJCBetWCMVsOpehJzVk3S/xtWM=", "checksumSHA1": "/TJCBetWCMVsOpehJzVk3S/xtWM=",

View File

@ -23,6 +23,40 @@ list of changes will always be the
After reviewing this guide, we recommend reviewing the Changelog to check on After reviewing this guide, we recommend reviewing the Changelog to check on
specific notes about the resources and providers you use. specific notes about the resources and providers you use.
## Newlines in Strings
Newlines are no longer allowed in strings unless it is a heredoc or an
interpolation. This improves the performance of IDE syntax highlighting
of Terraform configurations and simplifies parsing.
**Behavior that no longer works in Terraform 0.8:**
```
resource "null_resource" "foo" {
value = "foo
bar"
}
```
**Valid Terraform 0.8 configuration:**
```
resource "null_resource" "foo" {
value = "foo\nbar"
value2 = <<EOF
foo
bar
EOF
# You can still have newlines within interpolations.
value3 = "${lookup(
var.foo, var.bar)}"
}
```
**Action:** Use heredocs or escape sequences when you have a string with newlines.
## Math Order of Operations ## Math Order of Operations
Math operations now follow standard mathematical order of operations. Math operations now follow standard mathematical order of operations.