mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-07-01 07:42:40 +00:00
Update helper/schema vendor.
Update the version of helper/schema we have vendored to take advantage of fixes to the ResourceDiff.Clear function.
This commit is contained in:
parent
5cf6a5d131
commit
75c20b4246
2
vendor/github.com/hashicorp/terraform/helper/schema/data_source_resource_shim.go
generated
vendored
2
vendor/github.com/hashicorp/terraform/helper/schema/data_source_resource_shim.go
generated
vendored
|
@ -32,7 +32,7 @@ func DataSourceResourceShim(name string, dataSource *Resource) *Resource {
|
|||
|
||||
// FIXME: Link to some further docs either on the website or in the
|
||||
// changelog, once such a thing exists.
|
||||
dataSource.deprecationMessage = fmt.Sprintf(
|
||||
dataSource.DeprecationMessage = fmt.Sprintf(
|
||||
"using %s as a resource is deprecated; consider using the data source instead",
|
||||
name,
|
||||
)
|
||||
|
|
8
vendor/github.com/hashicorp/terraform/helper/schema/resource.go
generated
vendored
8
vendor/github.com/hashicorp/terraform/helper/schema/resource.go
generated
vendored
|
@ -124,9 +124,7 @@ type Resource struct {
|
|||
Importer *ResourceImporter
|
||||
|
||||
// If non-empty, this string is emitted as a warning during Validate.
|
||||
// This is a private interface for now, for use by DataSourceResourceShim,
|
||||
// and not for general use. (But maybe later...)
|
||||
deprecationMessage string
|
||||
DeprecationMessage string
|
||||
|
||||
// Timeouts allow users to specify specific time durations in which an
|
||||
// operation should time out, to allow them to extend an action to suit their
|
||||
|
@ -269,8 +267,8 @@ func (r *Resource) Diff(
|
|||
func (r *Resource) Validate(c *terraform.ResourceConfig) ([]string, []error) {
|
||||
warns, errs := schemaMap(r.Schema).Validate(c)
|
||||
|
||||
if r.deprecationMessage != "" {
|
||||
warns = append(warns, r.deprecationMessage)
|
||||
if r.DeprecationMessage != "" {
|
||||
warns = append(warns, r.DeprecationMessage)
|
||||
}
|
||||
|
||||
return warns, errs
|
||||
|
|
1
vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go
generated
vendored
1
vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go
generated
vendored
|
@ -315,6 +315,7 @@ func (d *ResourceData) State() *terraform.InstanceState {
|
|||
|
||||
mapW := &MapFieldWriter{Schema: d.schema}
|
||||
if err := mapW.WriteField(nil, rawMap); err != nil {
|
||||
log.Printf("[ERR] Error writing fields: %s", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
26
vendor/github.com/hashicorp/terraform/helper/schema/resource_diff.go
generated
vendored
26
vendor/github.com/hashicorp/terraform/helper/schema/resource_diff.go
generated
vendored
|
@ -231,7 +231,7 @@ func (d *ResourceDiff) UpdatedKeys() []string {
|
|||
// Note that this does not wipe an override. This function is only allowed on
|
||||
// computed keys.
|
||||
func (d *ResourceDiff) Clear(key string) error {
|
||||
if err := d.checkKey(key, "Clear"); err != nil {
|
||||
if err := d.checkKey(key, "Clear", true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ func (d *ResourceDiff) diffChange(key string) (interface{}, interface{}, bool, b
|
|||
//
|
||||
// This function is only allowed on computed attributes.
|
||||
func (d *ResourceDiff) SetNew(key string, value interface{}) error {
|
||||
if err := d.checkKey(key, "SetNew"); err != nil {
|
||||
if err := d.checkKey(key, "SetNew", false); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ func (d *ResourceDiff) SetNew(key string, value interface{}) error {
|
|||
//
|
||||
// This function is only allowed on computed attributes.
|
||||
func (d *ResourceDiff) SetNewComputed(key string) error {
|
||||
if err := d.checkKey(key, "SetNewComputed"); err != nil {
|
||||
if err := d.checkKey(key, "SetNewComputed", false); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -535,12 +535,24 @@ func childAddrOf(child, parent string) bool {
|
|||
}
|
||||
|
||||
// checkKey checks the key to make sure it exists and is computed.
|
||||
func (d *ResourceDiff) checkKey(key, caller string) error {
|
||||
s, ok := d.schema[key]
|
||||
if !ok {
|
||||
func (d *ResourceDiff) checkKey(key, caller string, nested bool) error {
|
||||
var schema *Schema
|
||||
if nested {
|
||||
keyParts := strings.Split(key, ".")
|
||||
schemaL := addrToSchema(keyParts, d.schema)
|
||||
if len(schemaL) > 0 {
|
||||
schema = schemaL[len(schemaL)-1]
|
||||
}
|
||||
} else {
|
||||
s, ok := d.schema[key]
|
||||
if ok {
|
||||
schema = s
|
||||
}
|
||||
}
|
||||
if schema == nil {
|
||||
return fmt.Errorf("%s: invalid key: %s", caller, key)
|
||||
}
|
||||
if !s.Computed {
|
||||
if !schema.Computed {
|
||||
return fmt.Errorf("%s only operates on computed keys - %s is not one", caller, key)
|
||||
}
|
||||
return nil
|
||||
|
|
2
vendor/github.com/hashicorp/terraform/helper/schema/schema.go
generated
vendored
2
vendor/github.com/hashicorp/terraform/helper/schema/schema.go
generated
vendored
|
@ -199,7 +199,7 @@ type Schema struct {
|
|||
Sensitive bool
|
||||
}
|
||||
|
||||
// SchemaDiffSuppresFunc is a function which can be used to determine
|
||||
// SchemaDiffSuppressFunc is a function which can be used to determine
|
||||
// whether a detected diff on a schema element is "valid" or not, and
|
||||
// suppress it from the plan if necessary.
|
||||
//
|
||||
|
|
6
vendor/github.com/hashicorp/terraform/helper/schema/set.go
generated
vendored
6
vendor/github.com/hashicorp/terraform/helper/schema/set.go
generated
vendored
|
@ -17,6 +17,12 @@ func HashString(v interface{}) int {
|
|||
return hashcode.String(v.(string))
|
||||
}
|
||||
|
||||
// HashInt hashes integers. If you want a Set of integers, this is the
|
||||
// SchemaSetFunc you want.
|
||||
func HashInt(v interface{}) int {
|
||||
return hashcode.String(strconv.Itoa(v.(int)))
|
||||
}
|
||||
|
||||
// HashResource hashes complex structures that are described using
|
||||
// a *Resource. This is the default set implementation used when a set's
|
||||
// element type is a full resource.
|
||||
|
|
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
|
@ -665,10 +665,10 @@
|
|||
"versionExact": "v0.11.2"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "JHxGzmxcIS8NyLX9pGhK5beIra4=",
|
||||
"checksumSHA1": "OOwTGBTHcUmQTPBdyscTMkjApbI=",
|
||||
"path": "github.com/hashicorp/terraform/helper/schema",
|
||||
"revision": "41e50bd32a8825a84535e353c3674af8ce799161",
|
||||
"revisionTime": "2018-04-10T16:50:42Z",
|
||||
"revision": "35d82b055591e9d47a254e68754216d8849ba67a",
|
||||
"revisionTime": "2018-09-26T21:21:28Z",
|
||||
"version": "v0.11.2",
|
||||
"versionExact": "v0.11.2"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user