From acb36e7eb3d514eb8971fd8a061a759241e97eab Mon Sep 17 00:00:00 2001 From: Christian Glombek Date: Mon, 20 Jan 2020 03:41:00 +0100 Subject: [PATCH] Migrate to terraform-plugin-sdk In order to make tests pass , this PR also updates the null and random providers and removes the template provider which can't be used with the plugin sdk, yet. See: https://github.com/terraform-providers/terraform-provider-template/issues/75 --- go.mod | 12 +- go.sum | 233 +- main.go | 2 +- .../aws/aws-sdk-go/aws/awserr/types.go | 2 +- .../aws/aws-sdk-go/aws/awsutil/path_value.go | 11 +- .../aws/aws-sdk-go/aws/client/client.go | 2 +- .../aws-sdk-go/aws/client/default_retryer.go | 151 +- .../aws/aws-sdk-go/aws/client/logger.go | 12 +- .../aws-sdk-go/aws/client/no_op_retryer.go | 28 - .../github.com/aws/aws-sdk-go/aws/config.go | 4 +- .../aws/aws-sdk-go/aws/convert_types.go | 531 -- .../aws-sdk-go/aws/corehandlers/handlers.go | 60 +- .../aws-sdk-go/aws/credentials/credentials.go | 9 +- .../aws/credentials/endpointcreds/provider.go | 4 +- .../stscreds/assume_role_provider.go | 3 +- .../stscreds/web_identity_provider.go | 100 - .../github.com/aws/aws-sdk-go/aws/csm/doc.go | 65 +- .../aws/aws-sdk-go/aws/csm/enable.go | 34 +- .../aws/aws-sdk-go/aws/csm/metric_chan.go | 11 +- .../aws/aws-sdk-go/aws/csm/reporter.go | 27 +- .../aws/aws-sdk-go/aws/ec2metadata/api.go | 29 +- .../aws/aws-sdk-go/aws/ec2metadata/service.go | 4 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 1447 +---- .../aws/aws-sdk-go/aws/endpoints/endpoints.go | 7 +- .../aws/aws-sdk-go/aws/endpoints/v3model.go | 5 +- .../aws/request/connection_reset_error.go | 17 +- .../request/connection_reset_error_other.go | 11 + .../aws/aws-sdk-go/aws/request/handlers.go | 49 +- .../aws-sdk-go/aws/request/offset_reader.go | 15 +- .../aws/aws-sdk-go/aws/request/request.go | 139 +- .../aws/aws-sdk-go/aws/request/request_1_8.go | 5 +- .../aws/request/request_pagination.go | 2 +- .../aws/aws-sdk-go/aws/request/retryer.go | 165 +- .../aws/aws-sdk-go/aws/session/credentials.go | 259 - .../aws/aws-sdk-go/aws/session/doc.go | 208 +- .../aws/aws-sdk-go/aws/session/env_config.go | 63 +- .../aws/aws-sdk-go/aws/session/session.go | 287 +- .../aws-sdk-go/aws/session/shared_config.go | 366 +- .../aws/aws-sdk-go/aws/signer/v4/v4.go | 20 +- vendor/github.com/aws/aws-sdk-go/aws/types.go | 20 +- .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws/aws-sdk-go/internal/ini/ini_parser.go | 6 +- .../aws/aws-sdk-go/internal/sdkio/byte.go | 12 - .../aws/aws-sdk-go/internal/sdkmath/floor.go | 15 - .../internal/sdkmath/floor_go1.9.go | 56 - .../aws/aws-sdk-go/internal/sdkrand/read.go | 11 - .../aws-sdk-go/internal/sdkrand/read_1_5.go | 24 - .../private/protocol/rest/unmarshal.go | 24 +- .../private/protocol/restxml/restxml.go | 2 +- .../aws-sdk-go/private/protocol/timestamp.go | 20 +- .../private/protocol/xml/xmlutil/sort.go | 32 - .../protocol/xml/xmlutil/xml_to_struct.go | 13 +- .../aws/aws-sdk-go/service/s3/api.go | 706 +-- .../aws/aws-sdk-go/service/s3/doc_custom.go | 14 - .../aws/aws-sdk-go/service/sts/api.go | 184 +- .../aws-sdk-go/service/sts/customizations.go | 11 - .../service/sts/stsiface/interface.go | 96 - vendor/github.com/blang/semver/.travis.yml | 21 - vendor/github.com/blang/semver/LICENSE | 22 - vendor/github.com/blang/semver/README.md | 194 - vendor/github.com/blang/semver/json.go | 23 - vendor/github.com/blang/semver/package.json | 17 - vendor/github.com/blang/semver/range.go | 416 -- vendor/github.com/blang/semver/semver.go | 418 -- vendor/github.com/blang/semver/sort.go | 28 - vendor/github.com/blang/semver/sql.go | 30 - .../github.com/bmatcuk/doublestar/.travis.yml | 15 - vendor/github.com/bmatcuk/doublestar/LICENSE | 22 - .../github.com/bmatcuk/doublestar/README.md | 109 - .../bmatcuk/doublestar/doublestar.go | 476 -- vendor/github.com/bmatcuk/doublestar/go.mod | 3 - .../google/go-cmp/cmp/internal/value/sort.go | 4 +- .../google/go-cmp/cmp/internal/value/zero.go | 9 +- .../google/go-cmp/cmp/report_compare.go | 2 +- .../google/go-cmp/cmp/report_reflect.go | 1 + .../google/go-cmp/cmp/report_slices.go | 4 +- .../google/go-cmp/cmp/report_text.go | 7 +- .../github.com/hashicorp/go-hclog/README.md | 15 + .../github.com/hashicorp/go-hclog/context.go | 38 + .../github.com/hashicorp/go-hclog/global.go | 26 +- .../go-hclog/{int.go => intlogger.go} | 332 +- .../hashicorp/go-hclog/{log.go => logger.go} | 45 +- .../hashicorp/go-hclog/nulllogger.go | 7 +- .../hashicorp/go-hclog/stacktrace.go | 9 +- .../github.com/hashicorp/go-hclog/stdlog.go | 43 +- .../github.com/hashicorp/go-hclog/writer.go | 74 + .../github.com/hashicorp/go-plugin/.gitignore | 1 + .../hashicorp/go-plugin/grpc_client.go | 6 + vendor/github.com/hashicorp/hcl/.travis.yml | 3 +- vendor/github.com/hashicorp/hcl/decoder.go | 37 +- vendor/github.com/hashicorp/hcl/go.mod | 3 + vendor/github.com/hashicorp/hcl/go.sum | 2 + .../hashicorp/hcl/hcl/parser/parser.go | 20 +- .../hashicorp/hcl/hcl/scanner/scanner.go | 31 +- .../hashicorp/hcl/json/scanner/scanner.go | 2 +- .../github.com/hashicorp/hcl/v2/CHANGELOG.md | 23 - vendor/github.com/hashicorp/hcl/v2/README.md | 204 - .../github.com/hashicorp/hcl/v2/diagnostic.go | 143 - .../hashicorp/hcl/v2/diagnostic_text.go | 311 - .../github.com/hashicorp/hcl/v2/didyoumean.go | 24 - vendor/github.com/hashicorp/hcl/v2/doc.go | 34 - .../hashicorp/hcl/v2/eval_context.go | 25 - .../github.com/hashicorp/hcl/v2/expr_call.go | 46 - .../github.com/hashicorp/hcl/v2/expr_list.go | 37 - .../github.com/hashicorp/hcl/v2/expr_map.go | 44 - .../hashicorp/hcl/v2/expr_unwrap.go | 68 - vendor/github.com/hashicorp/hcl/v2/go.mod | 21 - vendor/github.com/hashicorp/hcl/v2/go.sum | 51 - .../hashicorp/hcl/v2/gohcl/decode.go | 304 - .../github.com/hashicorp/hcl/v2/gohcl/doc.go | 53 - .../hashicorp/hcl/v2/gohcl/encode.go | 191 - .../hashicorp/hcl/v2/gohcl/schema.go | 174 - .../hashicorp/hcl/v2/gohcl/types.go | 16 - .../hashicorp/hcl/v2/hclparse/parser.go | 135 - .../hashicorp/hcl/v2/hclsyntax/diagnostics.go | 23 - .../hashicorp/hcl/v2/hclsyntax/didyoumean.go | 24 - .../hashicorp/hcl/v2/hclsyntax/doc.go | 7 - .../hashicorp/hcl/v2/hclsyntax/expression.go | 1477 ----- .../hcl/v2/hclsyntax/expression_ops.go | 268 - .../hcl/v2/hclsyntax/expression_template.go | 220 - .../hcl/v2/hclsyntax/expression_vars.go | 76 - .../hashicorp/hcl/v2/hclsyntax/file.go | 20 - .../hashicorp/hcl/v2/hclsyntax/generate.go | 9 - .../hashicorp/hcl/v2/hclsyntax/keywords.go | 21 - .../hashicorp/hcl/v2/hclsyntax/navigation.go | 59 - .../hashicorp/hcl/v2/hclsyntax/node.go | 22 - .../hashicorp/hcl/v2/hclsyntax/parser.go | 2054 ------- .../hcl/v2/hclsyntax/parser_template.go | 799 --- .../hcl/v2/hclsyntax/parser_traversal.go | 159 - .../hashicorp/hcl/v2/hclsyntax/peeker.go | 212 - .../hashicorp/hcl/v2/hclsyntax/public.go | 171 - .../hcl/v2/hclsyntax/scan_string_lit.go | 301 - .../hcl/v2/hclsyntax/scan_string_lit.rl | 105 - .../hashicorp/hcl/v2/hclsyntax/scan_tokens.go | 5265 ----------------- .../hashicorp/hcl/v2/hclsyntax/scan_tokens.rl | 395 -- .../hashicorp/hcl/v2/hclsyntax/spec.md | 941 --- .../hashicorp/hcl/v2/hclsyntax/structure.go | 394 -- .../hcl/v2/hclsyntax/structure_at_pos.go | 118 - .../hashicorp/hcl/v2/hclsyntax/token.go | 320 - .../hcl/v2/hclsyntax/token_type_string.go | 131 - .../hcl/v2/hclsyntax/unicode2ragel.rb | 335 -- .../hcl/v2/hclsyntax/unicode_derived.rl | 2135 ------- .../hashicorp/hcl/v2/hclsyntax/variables.go | 86 - .../hashicorp/hcl/v2/hclsyntax/walk.go | 41 - .../hashicorp/hcl/v2/hclwrite/ast.go | 121 - .../hcl/v2/hclwrite/ast_attribute.go | 48 - .../hashicorp/hcl/v2/hclwrite/ast_block.go | 118 - .../hashicorp/hcl/v2/hclwrite/ast_body.go | 219 - .../hcl/v2/hclwrite/ast_expression.go | 201 - .../hashicorp/hcl/v2/hclwrite/doc.go | 11 - .../hashicorp/hcl/v2/hclwrite/format.go | 463 -- .../hashicorp/hcl/v2/hclwrite/generate.go | 250 - .../hcl/v2/hclwrite/native_node_sorter.go | 23 - .../hashicorp/hcl/v2/hclwrite/node.go | 260 - .../hashicorp/hcl/v2/hclwrite/parser.go | 599 -- .../hashicorp/hcl/v2/hclwrite/public.go | 44 - .../hashicorp/hcl/v2/hclwrite/tokens.go | 122 - .../github.com/hashicorp/hcl/v2/json/ast.go | 121 - .../hashicorp/hcl/v2/json/didyoumean.go | 33 - .../github.com/hashicorp/hcl/v2/json/doc.go | 12 - .../hashicorp/hcl/v2/json/navigation.go | 70 - .../hashicorp/hcl/v2/json/parser.go | 496 -- .../hashicorp/hcl/v2/json/peeker.go | 25 - .../hashicorp/hcl/v2/json/public.go | 94 - .../hashicorp/hcl/v2/json/scanner.go | 297 - .../github.com/hashicorp/hcl/v2/json/spec.md | 405 -- .../hashicorp/hcl/v2/json/structure.go | 637 -- .../hashicorp/hcl/v2/json/tokentype_string.go | 29 - vendor/github.com/hashicorp/hcl/v2/merged.go | 226 - vendor/github.com/hashicorp/hcl/v2/ops.go | 288 - vendor/github.com/hashicorp/hcl/v2/pos.go | 275 - .../hashicorp/hcl/v2/pos_scanner.go | 152 - vendor/github.com/hashicorp/hcl/v2/schema.go | 21 - vendor/github.com/hashicorp/hcl/v2/spec.md | 691 --- .../hashicorp/hcl/v2/static_expr.go | 40 - .../github.com/hashicorp/hcl/v2/structure.go | 151 - .../hashicorp/hcl/v2/structure_at_pos.go | 117 - .../github.com/hashicorp/hcl/v2/traversal.go | 293 - .../hashicorp/hcl/v2/traversal_for_expr.go | 124 - .../{hcl/v2 => hcl2}/ext/dynblock/README.md | 0 .../v2 => hcl2}/ext/dynblock/expand_body.go | 2 +- .../v2 => hcl2}/ext/dynblock/expand_spec.go | 2 +- .../v2 => hcl2}/ext/dynblock/expr_wrap.go | 2 +- .../v2 => hcl2}/ext/dynblock/iteration.go | 2 +- .../{hcl/v2 => hcl2}/ext/dynblock/public.go | 5 +- .../{hcl/v2 => hcl2}/ext/dynblock/schema.go | 2 +- .../v2 => hcl2}/ext/dynblock/unknown_body.go | 2 +- .../v2 => hcl2}/ext/dynblock/variables.go | 2 +- .../ext/dynblock/variables_hcldec.go | 4 +- .../{hcl/v2 => hcl2}/ext/typeexpr/README.md | 2 +- .../{hcl/v2 => hcl2}/ext/typeexpr/doc.go | 0 .../{hcl/v2 => hcl2}/ext/typeexpr/get_type.go | 2 +- .../{hcl/v2 => hcl2}/ext/typeexpr/public.go | 4 +- .../{hcl/v2 => hcl2}/hcldec/block_labels.go | 2 +- .../{hcl/v2 => hcl2}/hcldec/decode.go | 2 +- .../hashicorp/{hcl/v2 => hcl2}/hcldec/doc.go | 0 .../hashicorp/{hcl/v2 => hcl2}/hcldec/gob.go | 0 .../{hcl/v2 => hcl2}/hcldec/public.go | 2 +- .../{hcl/v2 => hcl2}/hcldec/schema.go | 2 +- .../hashicorp/{hcl/v2 => hcl2}/hcldec/spec.go | 2 +- .../{hcl/v2 => hcl2}/hcldec/variables.go | 2 +- .../hashicorp/{hcl/v2 => hcl2}/hcled/doc.go | 0 .../{hcl/v2 => hcl2}/hcled/navigation.go | 2 +- vendor/github.com/hashicorp/hil/.gitignore | 3 - vendor/github.com/hashicorp/hil/.travis.yml | 3 - vendor/github.com/hashicorp/hil/README.md | 102 - vendor/github.com/hashicorp/hil/appveyor.yml | 18 - vendor/github.com/hashicorp/hil/builtins.go | 331 -- .../hashicorp/hil/check_identifier.go | 88 - .../github.com/hashicorp/hil/check_types.go | 668 --- vendor/github.com/hashicorp/hil/convert.go | 174 - vendor/github.com/hashicorp/hil/eval.go | 472 -- vendor/github.com/hashicorp/hil/eval_type.go | 16 - .../hashicorp/hil/evaltype_string.go | 42 - vendor/github.com/hashicorp/hil/go.mod | 6 - vendor/github.com/hashicorp/hil/go.sum | 4 - vendor/github.com/hashicorp/hil/parse.go | 29 - .../hashicorp/hil/parser/binary_op.go | 45 - .../github.com/hashicorp/hil/parser/error.go | 38 - .../github.com/hashicorp/hil/parser/fuzz.go | 28 - .../github.com/hashicorp/hil/parser/parser.go | 522 -- .../hashicorp/hil/scanner/peeker.go | 55 - .../hashicorp/hil/scanner/scanner.go | 556 -- .../github.com/hashicorp/hil/scanner/token.go | 105 - .../hashicorp/hil/scanner/tokentype_string.go | 51 - .../hashicorp/hil/transform_fixed.go | 29 - vendor/github.com/hashicorp/hil/walk.go | 266 - .../logutils}/.gitignore | 10 - .../hashicorp/{terraform => logutils}/LICENSE | 0 .../github.com/hashicorp/logutils/README.md | 36 + vendor/github.com/hashicorp/logutils/go.mod | 1 + vendor/github.com/hashicorp/logutils/level.go | 81 + .../{hcl/v2 => terraform-plugin-sdk}/LICENSE | 1 + .../helper/acctest/acctest.go | 0 .../helper/acctest/random.go | 0 .../helper/acctest/remotetests.go | 0 .../helper/hashcode/hashcode.go | 0 .../helper/logging/logging.go | 31 +- .../helper/logging/transport.go | 0 .../helper/resource/error.go | 0 .../helper/resource/grpc_test_provider.go | 10 +- .../helper/resource/id.go | 0 .../helper/resource/map.go | 2 +- .../helper/resource/resource.go | 4 +- .../helper/resource/state.go | 0 .../helper/resource/state_shim.go | 14 +- .../helper/resource/testing.go | 33 +- .../helper/resource/testing_config.go | 12 +- .../helper/resource/testing_import_state.go | 17 +- .../helper/resource/wait.go | 0 .../helper/schema/README.md | 0 .../helper/schema/backend.go | 8 +- .../helper/schema/core_schema.go | 2 +- .../schema/data_source_resource_shim.go | 0 .../helper/schema/equal.go | 0 .../helper/schema/field_reader.go | 0 .../helper/schema/field_reader_config.go | 2 +- .../helper/schema/field_reader_diff.go | 2 +- .../helper/schema/field_reader_map.go | 0 .../helper/schema/field_reader_multi.go | 0 .../helper/schema/field_writer.go | 0 .../helper/schema/field_writer_map.go | 0 .../helper/schema/getsource_string.go | 0 .../helper/schema/provider.go | 9 +- .../helper/schema/resource.go | 2 +- .../helper/schema/resource_data.go | 2 +- .../helper/schema/resource_data_get_source.go | 0 .../helper/schema/resource_diff.go | 2 +- .../helper/schema/resource_importer.go | 0 .../helper/schema/resource_timeout.go | 4 +- .../helper/schema/schema.go | 4 +- .../helper/schema/serialize.go | 0 .../helper/schema/set.go | 6 +- .../helper/schema/shims.go | 6 +- .../helper/schema/testing.go | 2 +- .../helper/schema/valuetype.go | 0 .../helper/schema/valuetype_string.go | 0 .../helper/structure/expand_json.go | 0 .../helper/structure/flatten_json.go | 0 .../helper/structure/normalize_json.go | 0 .../helper/structure/suppress_json_diff.go | 2 +- .../helper/validation/validation.go | 4 +- .../internal}/addrs/count_attr.go | 0 .../internal}/addrs/doc.go | 0 .../internal}/addrs/for_each_attr.go | 0 .../internal}/addrs/input_variable.go | 0 .../internal}/addrs/instance_key.go | 0 .../internal}/addrs/local_value.go | 0 .../internal}/addrs/module.go | 0 .../internal}/addrs/module_call.go | 0 .../internal}/addrs/module_instance.go | 8 +- .../internal}/addrs/output_value.go | 0 .../internal}/addrs/parse_ref.go | 8 +- .../internal}/addrs/parse_target.go | 6 +- .../internal}/addrs/path_attr.go | 0 .../internal}/addrs/provider_config.go | 104 +- .../internal/addrs/provider_type.go | 7 + .../internal}/addrs/referenceable.go | 0 .../internal}/addrs/resource.go | 3 +- .../internal}/addrs/resource_phase.go | 0 .../internal}/addrs/resourcemode_string.go | 0 .../internal}/addrs/self.go | 0 .../internal}/addrs/targetable.go | 0 .../internal}/addrs/terraform_attr.go | 0 .../internal}/command/format/diagnostic.go | 53 +- .../internal}/command/format/diff.go | 76 +- .../internal}/command/format/format.go | 0 .../internal}/command/format/object_id.go | 0 .../internal/command/format/plan.go | 306 + .../internal}/command/format/state.go | 126 +- .../internal}/configs/backend.go | 6 +- .../internal}/configs/compat_shim.go | 96 +- .../internal}/configs/config.go | 8 +- .../internal}/configs/config_build.go | 4 +- .../internal}/configs/configload/copy_dir.go | 10 + .../internal}/configs/configload/doc.go | 0 .../internal}/configs/configload/inode.go | 0 .../configs/configload/inode_freebsd.go | 0 .../configs/configload/inode_windows.go | 0 .../internal}/configs/configload/loader.go | 6 +- .../configs/configload/loader_load.go | 4 +- .../configs/configload/loader_snapshot.go | 6 +- .../configs/configload/module_mgr.go | 20 +- .../internal}/configs/configload/testing.go | 0 .../configs/configschema/coerce_value.go | 0 .../configs/configschema/decoder_spec.go | 2 +- .../internal}/configs/configschema/doc.go | 0 .../configs/configschema/empty_value.go | 0 .../configs/configschema/implied_type.go | 2 +- .../configs/configschema/internal_validate.go | 0 .../configschema/nestingmode_string.go | 0 .../configs/configschema/none_required.go | 0 .../internal}/configs/configschema/schema.go | 0 .../configschema/validate_traversal.go | 8 +- .../internal}/configs/depends_on.go | 2 +- .../internal}/configs/doc.go | 0 .../internal}/configs/hcl2shim/flatmap.go | 0 .../internal}/configs/hcl2shim/paths.go | 0 .../configs/hcl2shim/single_attr_body.go | 2 +- .../internal}/configs/hcl2shim/values.go | 2 +- .../configs/hcl2shim/values_equiv.go | 0 .../internal}/configs/module.go | 13 +- .../internal}/configs/module_call.go | 6 +- .../internal}/configs/module_merge.go | 4 +- .../internal}/configs/module_merge_body.go | 2 +- .../internal}/configs/named_values.go | 36 +- .../internal}/configs/parser.go | 4 +- .../internal}/configs/parser_config.go | 35 +- .../internal}/configs/parser_config_dir.go | 8 +- .../internal}/configs/parser_values.go | 2 +- .../internal/configs/provider.go | 144 + .../internal}/configs/provisioner.go | 60 +- .../configs/provisioneronfailure_string.go | 0 .../configs/provisionerwhen_string.go | 0 .../internal}/configs/resource.go | 34 +- .../internal}/configs/synth_body.go | 4 +- .../internal}/configs/util.go | 4 +- .../internal}/configs/variable_type_hint.go | 0 .../configs/variabletypehint_string.go | 0 .../internal}/configs/version_constraint.go | 2 +- .../internal}/dag/dag.go | 2 +- .../internal}/dag/dot.go | 0 .../internal}/dag/edge.go | 0 .../internal}/dag/graph.go | 0 .../internal}/dag/marshal.go | 0 .../internal}/dag/set.go | 0 .../internal}/dag/tarjan.go | 0 .../internal}/dag/walk.go | 7 +- .../internal/earlyconfig/config.go | 8 +- .../internal/earlyconfig/config_build.go | 4 +- .../internal/earlyconfig/diagnostics.go | 2 +- .../internal/earlyconfig/doc.go | 0 .../internal/earlyconfig/module.go | 2 +- .../internal}/flatmap/expand.go | 2 +- .../internal}/flatmap/flatten.go | 0 .../internal}/flatmap/map.go | 0 .../internal}/helper/config/decode.go | 0 .../internal}/helper/config/validator.go | 4 +- .../helper/didyoumean/name_suggestion.go | 0 .../internal}/helper/plugin/doc.go | 0 .../internal}/helper/plugin/grpc_provider.go | 14 +- .../internal}/helper/plugin/unknown.go | 2 +- .../internal/httpclient/client.go} | 29 +- .../internal/initwd/copy_dir.go | 0 .../internal/initwd/doc.go | 0 .../internal/initwd/from_module.go | 8 +- .../internal/initwd/getter.go | 10 +- .../internal/initwd/inode.go | 0 .../internal/initwd/inode_freebsd.go | 0 .../internal/initwd/inode_windows.go | 0 .../internal/initwd/load_config.go | 6 +- .../internal/initwd/module_install.go | 12 +- .../internal/initwd/module_install_hooks.go | 0 .../internal/initwd/testing.go | 8 +- .../internal/initwd/version_required.go | 6 +- .../internal}/lang/blocktoattr/doc.go | 0 .../internal}/lang/blocktoattr/fixup.go | 6 +- .../internal}/lang/blocktoattr/schema.go | 4 +- .../internal}/lang/blocktoattr/variables.go | 8 +- .../internal}/lang/data.go | 6 +- .../internal}/lang/doc.go | 0 .../internal}/lang/eval.go | 112 +- .../internal}/lang/funcs/cidr.go | 0 .../internal}/lang/funcs/collection.go | 9 +- .../internal}/lang/funcs/conversion.go | 0 .../internal}/lang/funcs/crypto.go | 0 .../internal}/lang/funcs/datetime.go | 0 .../internal}/lang/funcs/encoding.go | 0 .../internal}/lang/funcs/filesystem.go | 83 +- .../internal}/lang/funcs/number.go | 0 .../internal}/lang/funcs/string.go | 90 +- .../internal}/lang/functions.go | 17 +- .../internal}/lang/references.go | 10 +- .../internal}/lang/scope.go | 2 +- .../internal/modsdir/doc.go | 0 .../internal/modsdir/manifest.go | 2 +- .../internal/modsdir/paths.go | 0 .../internal}/moduledeps/dependencies.go | 2 +- .../internal}/moduledeps/doc.go | 0 .../internal}/moduledeps/module.go | 2 +- .../internal}/moduledeps/provider.go | 0 .../internal}/plans/action.go | 0 .../internal}/plans/action_string.go | 0 .../internal}/plans/changes.go | 4 +- .../internal}/plans/changes_src.go | 4 +- .../internal}/plans/changes_state.go | 2 +- .../internal}/plans/changes_sync.go | 4 +- .../internal}/plans/doc.go | 0 .../internal}/plans/dynamic_value.go | 0 .../internal}/plans/objchange/all_null.go | 2 +- .../internal}/plans/objchange/compatible.go | 2 +- .../internal}/plans/objchange/doc.go | 0 .../internal}/plans/objchange/lcs.go | 0 .../plans/objchange/normalize_obj.go | 2 +- .../internal}/plans/objchange/objchange.go | 2 +- .../internal}/plans/objchange/plan_valid.go | 2 +- .../internal}/plans/plan.go | 4 +- .../internal}/plugin/convert/diagnostics.go | 4 +- .../internal}/plugin/convert/schema.go | 6 +- .../internal}/plugin/discovery/error.go | 0 .../internal}/plugin/discovery/find.go | 0 .../internal}/plugin/discovery/get.go | 61 +- .../internal}/plugin/discovery/get_cache.go | 0 .../internal}/plugin/discovery/hashicorp.go | 0 .../internal}/plugin/discovery/meta.go | 0 .../internal}/plugin/discovery/meta_set.go | 0 .../plugin/discovery/requirements.go | 0 .../internal}/plugin/discovery/signature.go | 0 .../internal}/plugin/discovery/version.go | 0 .../internal}/plugin/discovery/version_set.go | 0 .../internal}/providers/addressed_types.go | 6 +- .../internal}/providers/doc.go | 0 .../internal}/providers/provider.go | 6 +- .../internal}/providers/resolver.go | 20 +- .../internal}/provisioners/doc.go | 0 .../internal}/provisioners/factory.go | 0 .../internal}/provisioners/provisioner.go | 4 +- .../internal}/registry/client.go | 14 +- .../internal}/registry/errors.go | 4 +- .../registry/regsrc/friendly_host.go | 2 +- .../internal}/registry/regsrc/module.go | 2 +- .../internal}/registry/regsrc/regsrc.go | 0 .../registry/regsrc/terraform_provider.go | 2 +- .../internal}/registry/response/module.go | 0 .../registry/response/module_list.go | 0 .../registry/response/module_provider.go | 0 .../registry/response/module_versions.go | 0 .../internal}/registry/response/pagination.go | 0 .../internal}/registry/response/provider.go | 0 .../registry/response/provider_list.go | 0 .../internal}/registry/response/redirect.go | 0 .../registry/response/terraform_provider.go | 0 .../internal}/states/doc.go | 0 .../internal}/states/eachmode_string.go | 0 .../internal}/states/instance_generation.go | 4 - .../internal}/states/instance_object.go | 19 +- .../internal}/states/instance_object_src.go | 9 +- .../internal}/states/module.go | 67 +- .../internal}/states/objectstatus_string.go | 0 .../internal}/states/output_value.go | 0 .../internal}/states/resource.go | 9 +- .../internal}/states/state.go | 2 +- .../internal}/states/state_deepcopy.go | 20 +- .../internal}/states/state_equal.go | 0 .../internal}/states/state_string.go | 4 +- .../internal}/states/statefile/diagnostics.go | 2 +- .../internal}/states/statefile/doc.go | 0 .../internal}/states/statefile/file.go | 4 +- .../states/statefile/marshal_equal.go | 2 +- .../internal}/states/statefile/read.go | 4 +- .../internal}/states/statefile/version0.go | 0 .../internal}/states/statefile/version1.go | 9 +- .../states/statefile/version1_upgrade.go | 0 .../internal}/states/statefile/version2.go | 7 +- .../states/statefile/version2_upgrade.go | 0 .../internal}/states/statefile/version3.go | 2 +- .../states/statefile/version3_upgrade.go | 62 +- .../internal}/states/statefile/version4.go | 34 +- .../internal}/states/statefile/write.go | 2 +- .../internal}/states/sync.go | 2 +- .../internal/svchost}/auth/cache.go | 18 +- .../internal/svchost}/auth/credentials.go | 57 +- .../internal/svchost/auth/from_map.go | 18 + .../internal/svchost}/auth/helper_program.go | 71 +- .../internal/svchost}/auth/static.go | 12 +- .../svchost/auth/token_credentials.go | 25 + .../internal/svchost}/disco/disco.go | 28 +- .../internal/svchost}/disco/host.go | 160 +- .../internal/svchost}/label_iter.go | 20 - .../internal/svchost}/svchost.go | 0 .../internal}/tfdiags/config_traversals.go | 0 .../internal}/tfdiags/contextual.go | 6 +- .../internal}/tfdiags/diagnostic.go | 2 +- .../internal}/tfdiags/diagnostic_base.go | 0 .../internal}/tfdiags/diagnostics.go | 2 +- .../internal}/tfdiags/doc.go | 0 .../internal}/tfdiags/error.go | 0 .../internal}/tfdiags/hcl.go | 2 +- .../internal}/tfdiags/rpc_friendly.go | 0 .../internal}/tfdiags/severity_string.go | 0 .../internal}/tfdiags/simple_warning.go | 0 .../internal}/tfdiags/source_range.go | 0 .../internal}/tfdiags/sourceless.go | 0 .../internal/tfplugin5/generate.sh | 0 .../internal/tfplugin5/tfplugin5.pb.go | 0 .../internal/tfplugin5/tfplugin5.proto | 353 ++ .../internal}/version/version.go | 4 +- .../plugin/client.go | 2 +- .../plugin/grpc_provider.go | 6 +- .../plugin/grpc_provisioner.go | 8 +- .../plugin/plugin.go | 0 .../plugin/resource_provider.go | 2 +- .../plugin/serve.go | 35 +- .../plugin/ui_input.go | 2 +- .../plugin/ui_output.go | 2 +- .../terraform/context.go | 68 +- .../terraform/context_components.go | 16 +- .../terraform/context_graph_type.go | 0 .../terraform/context_import.go | 8 +- .../terraform/context_input.go | 106 +- .../terraform/diff.go | 16 +- .../terraform/edge_destroy.go | 2 +- .../terraform/eval.go | 2 +- .../terraform/eval_apply.go | 89 +- .../terraform/eval_check_prevent_destroy.go | 12 +- .../terraform/eval_context.go | 18 +- .../terraform/eval_context_builtin.go | 35 +- .../terraform/eval_context_mock.go | 20 +- .../terraform/eval_count.go | 6 +- .../terraform/eval_count_boundary.go | 4 +- .../terraform/eval_diff.go | 40 +- .../terraform/eval_error.go | 0 .../terraform/eval_filter.go | 0 .../terraform/eval_filter_operation.go | 0 .../terraform/eval_for_each.go | 14 +- .../terraform/eval_if.go | 0 .../terraform/eval_import_state.go | 8 +- .../terraform/eval_lang.go | 6 +- .../terraform/eval_local.go | 8 +- .../terraform/eval_noop.go | 0 .../terraform/eval_output.go | 8 +- .../terraform/eval_provider.go | 12 +- .../terraform/eval_provisioner.go | 4 +- .../terraform/eval_read_data.go | 45 +- .../terraform/eval_refresh.go | 9 +- .../terraform/eval_sequence.go | 2 +- .../terraform/eval_state.go | 71 +- .../terraform/eval_state_upgrade.go | 10 +- .../terraform/eval_validate.go | 14 +- .../terraform/eval_validate_selfref.go | 10 +- .../terraform/eval_variable.go | 30 +- .../terraform/evaltree_provider.go | 8 +- .../terraform/evaluate.go | 307 +- .../terraform/evaluate_valid.go | 12 +- .../terraform/features.go | 0 .../terraform/graph.go | 6 +- .../terraform/graph_builder.go | 8 +- .../terraform/graph_builder_apply.go | 42 +- .../terraform/graph_builder_destroy_plan.go | 10 +- .../terraform/graph_builder_eval.go | 10 +- .../terraform/graph_builder_import.go | 8 +- .../terraform/graph_builder_plan.go | 10 +- .../terraform/graph_builder_refresh.go | 11 +- .../terraform/graph_builder_validate.go | 2 +- .../terraform/graph_dot.go | 2 +- .../terraform/graph_interface_subgraph.go | 2 +- .../terraform/graph_walk.go | 6 +- .../terraform/graph_walk_context.go | 16 +- .../terraform/graph_walk_operation.go | 0 .../terraform/graphtype_string.go | 0 .../terraform/hook.go | 24 +- .../terraform/hook_mock.go | 8 +- .../terraform/hook_stop.go | 8 +- .../terraform/instancetype.go | 0 .../terraform/instancetype_string.go | 0 .../terraform/module_dependencies.go | 10 +- .../terraform/node_count_boundary.go | 2 +- .../terraform/node_data_destroy.go | 4 +- .../terraform/node_data_refresh.go | 12 +- .../terraform/node_local.go | 8 +- .../terraform/node_module_removed.go | 10 +- .../terraform/node_module_variable.go | 10 +- .../terraform/node_output.go | 8 +- .../terraform/node_output_orphan.go | 2 +- .../terraform/node_provider.go | 0 .../terraform/node_provider_abstract.go | 8 +- .../terraform/node_provider_disabled.go | 2 +- .../terraform/node_provider_eval.go | 2 +- .../terraform/node_provisioner.go | 2 +- .../terraform/node_resource_abstract.go | 148 +- .../terraform/node_resource_apply.go | 6 +- .../terraform/node_resource_apply_instance.go | 54 +- .../terraform/node_resource_destroy.go | 10 +- .../node_resource_destroy_deposed.go | 12 +- .../terraform/node_resource_plan.go | 4 +- .../terraform/node_resource_plan_destroy.go | 12 +- .../terraform/node_resource_plan_instance.go | 13 +- .../terraform/node_resource_plan_orphan.go | 6 +- .../terraform/node_resource_refresh.go | 30 +- .../terraform/node_resource_validate.go | 8 +- .../terraform/node_root_variable.go | 6 +- .../terraform-plugin-sdk/terraform/path.go | 17 + .../terraform/plan.go | 30 +- .../terraform/provider_mock.go | 6 +- .../terraform/provisioner_mock.go | 2 +- .../terraform/resource.go | 47 +- .../terraform/resource_address.go | 4 +- .../terraform/resource_mode.go | 0 .../terraform/resource_mode_string.go | 0 .../terraform/resource_provider.go | 27 +- .../terraform/resource_provider_mock.go | 0 .../terraform/resource_provisioner.go | 4 +- .../terraform/resource_provisioner_mock.go | 2 +- .../terraform/schemas.go | 12 +- .../terraform/state.go | 54 +- .../terraform/state_filter.go | 0 .../terraform/state_upgrade_v1_to_v2.go | 0 .../terraform/state_upgrade_v2_to_v3.go | 0 .../terraform/state_v1.go | 0 .../terraform/testing.go | 0 .../terraform/transform.go | 5 +- .../transform_attach_config_provider.go | 4 +- .../transform_attach_config_resource.go | 4 +- .../terraform/transform_attach_schema.go | 8 +- .../terraform/transform_attach_state.go | 4 +- .../terraform/transform_config.go | 6 +- .../terraform/transform_config_flat.go | 71 + .../terraform/transform_count_boundary.go | 4 +- .../terraform/transform_destroy_cbd.go | 105 +- .../terraform/transform_destroy_edge.go | 135 +- .../terraform/transform_diff.go | 16 +- .../terraform/transform_expand.go | 2 +- .../terraform/transform_import_provider.go | 6 +- .../terraform/transform_import_state.go | 8 +- .../terraform/transform_local.go | 2 +- .../terraform/transform_module_variable.go | 8 +- .../terraform/transform_orphan_count.go | 6 +- .../terraform/transform_orphan_output.go | 6 +- .../terraform/transform_orphan_resource.go | 6 +- .../terraform/transform_output.go | 4 +- .../terraform/transform_provider.go | 26 +- .../terraform/transform_provisioner.go | 42 +- .../terraform/transform_reference.go | 107 +- .../terraform/transform_removed_modules.go | 4 +- .../terraform/transform_resource_count.go | 6 +- .../terraform/transform_root.go | 2 +- .../terraform/transform_state.go | 2 +- .../terraform/transform_targets.go | 4 +- .../transform_transitive_reduction.go | 0 .../terraform/transform_variable.go | 4 +- .../terraform/transform_vertex.go | 2 +- .../terraform/ui_input.go | 0 .../terraform/ui_input_mock.go | 0 .../terraform/ui_input_prefix.go | 0 .../terraform/ui_output.go | 0 .../terraform/ui_output_callback.go | 0 .../terraform/ui_output_mock.go | 0 .../terraform/ui_output_provisioner.go | 2 +- .../terraform/util.go | 0 .../terraform/valuesourcetype_string.go | 0 .../terraform/variables.go | 6 +- .../terraform/version_required.go | 8 +- .../terraform/walkoperation_string.go | 0 .../terraform-svchost/auth/from_map.go | 48 - .../auth/token_credentials.go | 43 - .../terraform-svchost/disco/http_transport.go | 30 - .../terraform-svchost/disco/oauth_client.go | 178 - .../hashicorp/terraform-svchost/go.mod | 12 - .../hashicorp/terraform-svchost/go.sum | 36 - .../hashicorp/terraform/addrs/provider.go | 49 - .../hashicorp/terraform/config/append.go | 92 - .../hashicorp/terraform/config/config.go | 1171 ---- .../terraform/config/config_string.go | 378 -- .../terraform/config/config_terraform.go | 117 - .../hashicorp/terraform/config/config_tree.go | 43 - .../hashicorp/terraform/config/import_tree.go | 151 - .../hashicorp/terraform/config/interpolate.go | 439 -- .../terraform/config/interpolate_funcs.go | 54 - .../terraform/config/interpolate_walk.go | 282 - .../hashicorp/terraform/config/lang.go | 11 - .../hashicorp/terraform/config/loader.go | 212 - .../hashicorp/terraform/config/loader_hcl.go | 1270 ---- .../hashicorp/terraform/config/loader_hcl2.go | 473 -- .../hashicorp/terraform/config/merge.go | 204 - .../hashicorp/terraform/config/providers.go | 61 - .../terraform/config/provisioner_enums.go | 40 - .../hashicorp/terraform/config/raw_config.go | 419 -- .../terraform/config/resource_mode.go | 9 - .../terraform/config/resource_mode_string.go | 24 - .../hashicorp/terraform/config/testing.go | 17 - .../terraform/configs/configload/getter.go | 152 - .../configs/configload/source_addr.go | 45 - .../terraform/configs/experiments.go | 143 - .../hashicorp/terraform/configs/provider.go | 209 - .../configs/provider_requirements.go | 32 - .../hashicorp/terraform/experiments/doc.go | 9 - .../hashicorp/terraform/experiments/errors.go | 26 - .../terraform/experiments/experiment.go | 93 - .../hashicorp/terraform/experiments/set.go | 46 - .../terraform/experiments/testing.go | 33 - .../helper/hilmapstructure/hilmapstructure.go | 41 - .../terraform/helper/logging/indent.go | 23 - .../terraform/helper/logging/level.go | 159 - .../terraform/helper/pathorcontents/read.go | 40 - .../helper/plugin/grpc_provisioner.go | 201 - .../terraform/helper/schema/provisioner.go | 205 - .../hashicorp/terraform/httpclient/client.go | 18 - .../terraform/plugin/resource_provisioner.go | 182 - .../terraform/terraform/user_agent.go | 12 - .../hashicorp/terraform/terraform/version.go | 10 - .../terraform/tfdiags/consolidate_warnings.go | 146 - vendor/github.com/hashicorp/yamux/go.mod | 1 + vendor/github.com/hashicorp/yamux/mux.go | 13 +- vendor/github.com/hashicorp/yamux/session.go | 7 +- .../mitchellh/hashstructure/LICENSE | 21 - .../mitchellh/hashstructure/README.md | 65 - .../github.com/mitchellh/hashstructure/go.mod | 1 - .../mitchellh/hashstructure/hashstructure.go | 358 -- .../mitchellh/hashstructure/include.go | 15 - .../mitchellh/reflectwalk/reflectwalk.go | 3 +- vendor/github.com/pkg/errors/.travis.yml | 9 +- vendor/github.com/pkg/errors/Makefile | 44 + vendor/github.com/pkg/errors/README.md | 15 +- vendor/github.com/pkg/errors/errors.go | 51 +- vendor/github.com/pkg/errors/go113.go | 38 + vendor/github.com/pkg/errors/stack.go | 109 +- vendor/github.com/spf13/afero/unionFile.go | 10 +- .../null/data_source.go | 10 +- .../terraform-provider-null/null/provider.go | 4 +- .../terraform-provider-null/null/resource.go | 4 +- .../random/provider.go | 17 +- .../random/resource_id.go | 2 +- .../random/resource_integer.go | 8 +- .../random/resource_password.go | 14 + .../random/resource_pet.go | 2 +- .../random/resource_shuffle.go | 2 +- .../random/resource_string.go | 176 +- .../random/resource_string_migration.go | 2 +- .../random/resource_uuid.go | 8 +- .../random/string.go | 187 + .../terraform-provider-template/LICENSE | 373 -- .../template/datasource_cloudinit_config.go | 185 - .../template/datasource_template_file.go | 165 - .../template/provider.go | 26 - .../template/resource_template_dir.go | 234 - vendor/golang.org/x/net/http2/hpack/encode.go | 2 +- vendor/golang.org/x/net/http2/server.go | 12 +- vendor/golang.org/x/net/http2/transport.go | 26 +- .../x/net/http2/writesched_priority.go | 2 +- .../x/net/http2/writesched_random.go | 9 +- .../golang.org/x/sys/unix/affinity_linux.go | 8 +- vendor/golang.org/x/sys/unix/dirent.go | 91 +- vendor/golang.org/x/sys/unix/endian_little.go | 2 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 3 - vendor/golang.org/x/sys/unix/syscall_aix.go | 16 - .../golang.org/x/sys/unix/syscall_darwin.go | 12 - .../x/sys/unix/syscall_dragonfly.go | 16 - .../golang.org/x/sys/unix/syscall_freebsd.go | 12 - vendor/golang.org/x/sys/unix/syscall_linux.go | 16 - .../golang.org/x/sys/unix/syscall_netbsd.go | 12 - .../golang.org/x/sys/unix/syscall_openbsd.go | 12 - .../golang.org/x/sys/unix/syscall_solaris.go | 16 - .../x/sys/unix/zerrors_linux_386.go | 34 - .../x/sys/unix/zerrors_linux_amd64.go | 34 - .../x/sys/unix/zerrors_linux_arm.go | 34 - .../x/sys/unix/zerrors_linux_arm64.go | 34 - .../x/sys/unix/zerrors_linux_mips.go | 34 - .../x/sys/unix/zerrors_linux_mips64.go | 34 - .../x/sys/unix/zerrors_linux_mips64le.go | 34 - .../x/sys/unix/zerrors_linux_mipsle.go | 34 - .../x/sys/unix/zerrors_linux_ppc64.go | 34 - .../x/sys/unix/zerrors_linux_ppc64le.go | 34 - .../x/sys/unix/zerrors_linux_riscv64.go | 34 - .../x/sys/unix/zerrors_linux_s390x.go | 34 - .../x/sys/unix/zerrors_linux_sparc64.go | 34 - .../x/sys/unix/zsysnum_linux_386.go | 6 - .../x/sys/unix/zsysnum_linux_amd64.go | 6 - .../x/sys/unix/zsysnum_linux_arm.go | 6 - .../x/sys/unix/zsysnum_linux_arm64.go | 6 - .../x/sys/unix/zsysnum_linux_mips.go | 6 - .../x/sys/unix/zsysnum_linux_mips64.go | 6 - .../x/sys/unix/zsysnum_linux_mips64le.go | 6 - .../x/sys/unix/zsysnum_linux_mipsle.go | 6 - .../x/sys/unix/zsysnum_linux_ppc64.go | 6 - .../x/sys/unix/zsysnum_linux_ppc64le.go | 6 - .../x/sys/unix/zsysnum_linux_riscv64.go | 6 - .../x/sys/unix/zsysnum_linux_s390x.go | 6 - .../x/sys/unix/zsysnum_linux_sparc64.go | 6 - .../golang.org/x/sys/unix/ztypes_linux_386.go | 37 - .../x/sys/unix/ztypes_linux_amd64.go | 38 - .../golang.org/x/sys/unix/ztypes_linux_arm.go | 37 - .../x/sys/unix/ztypes_linux_arm64.go | 38 - .../x/sys/unix/ztypes_linux_mips.go | 37 - .../x/sys/unix/ztypes_linux_mips64.go | 38 - .../x/sys/unix/ztypes_linux_mips64le.go | 38 - .../x/sys/unix/ztypes_linux_mipsle.go | 37 - .../x/sys/unix/ztypes_linux_ppc64.go | 38 - .../x/sys/unix/ztypes_linux_ppc64le.go | 38 - .../x/sys/unix/ztypes_linux_riscv64.go | 38 - .../x/sys/unix/ztypes_linux_s390x.go | 38 - .../x/sys/unix/ztypes_linux_sparc64.go | 38 - vendor/golang.org/x/sys/windows/service.go | 4 - .../golang.org/x/sys/windows/types_windows.go | 7 +- vendor/google.golang.org/grpc/.travis.yml | 10 +- vendor/google.golang.org/grpc/balancer.go | 8 +- .../grpc/balancer/balancer.go | 36 +- .../grpc/balancer/base/balancer.go | 20 +- .../grpc/balancer_conn_wrappers.go | 19 +- vendor/google.golang.org/grpc/clientconn.go | 290 +- .../grpc/credentials/credentials.go | 6 +- vendor/google.golang.org/grpc/dialoptions.go | 48 +- vendor/google.golang.org/grpc/go.mod | 5 +- vendor/google.golang.org/grpc/go.sum | 10 +- .../google.golang.org/grpc/health/client.go | 22 +- .../grpc/internal/envconfig/envconfig.go | 33 +- .../grpc/internal/internal.go | 19 +- .../grpc/internal/transport/controlbuf.go | 84 +- .../grpc/internal/transport/flowcontrol.go | 3 +- .../grpc/internal/transport/handler_server.go | 5 +- .../grpc/internal/transport/http2_client.go | 55 +- .../grpc/internal/transport/http2_server.go | 68 +- .../grpc/internal/transport/transport.go | 67 +- .../google.golang.org/grpc/naming/naming.go | 3 +- vendor/google.golang.org/grpc/pickfirst.go | 16 +- .../grpc/resolver/resolver.go | 11 +- .../grpc/resolver_conn_wrapper.go | 15 +- vendor/google.golang.org/grpc/server.go | 94 +- .../google.golang.org/grpc/service_config.go | 72 +- .../grpc/serviceconfig/serviceconfig.go | 48 + .../google.golang.org/grpc/status/status.go | 22 +- vendor/google.golang.org/grpc/stream.go | 92 +- vendor/google.golang.org/grpc/version.go | 2 +- vendor/google.golang.org/grpc/vet.sh | 11 +- vendor/modules.txt | 160 +- vsphere/config.go | 2 +- vsphere/config_test.go | 2 +- .../data_source_vsphere_compute_cluster.go | 2 +- ...ata_source_vsphere_compute_cluster_test.go | 2 +- .../data_source_vsphere_custom_attribute.go | 2 +- ...ta_source_vsphere_custom_attribute_test.go | 2 +- vsphere/data_source_vsphere_datacenter.go | 2 +- .../data_source_vsphere_datacenter_test.go | 2 +- vsphere/data_source_vsphere_datastore.go | 2 +- .../data_source_vsphere_datastore_cluster.go | 2 +- ...a_source_vsphere_datastore_cluster_test.go | 2 +- vsphere/data_source_vsphere_datastore_test.go | 2 +- ...urce_vsphere_distributed_virtual_switch.go | 2 +- ...vsphere_distributed_virtual_switch_test.go | 2 +- vsphere/data_source_vsphere_folder.go | 2 +- vsphere/data_source_vsphere_folder_test.go | 2 +- vsphere/data_source_vsphere_host.go | 2 +- vsphere/data_source_vsphere_host_test.go | 2 +- vsphere/data_source_vsphere_network.go | 2 +- vsphere/data_source_vsphere_network_test.go | 2 +- vsphere/data_source_vsphere_resource_pool.go | 2 +- .../data_source_vsphere_resource_pool_test.go | 2 +- vsphere/data_source_vsphere_tag.go | 2 +- vsphere/data_source_vsphere_tag_category.go | 2 +- .../data_source_vsphere_tag_category_test.go | 2 +- vsphere/data_source_vsphere_tag_test.go | 2 +- vsphere/data_source_vsphere_vapp_container.go | 2 +- ...data_source_vsphere_vapp_container_test.go | 2 +- .../data_source_vsphere_virtual_machine.go | 2 +- ...ata_source_vsphere_virtual_machine_test.go | 2 +- vsphere/data_source_vsphere_vmfs_disks.go | 4 +- .../data_source_vsphere_vmfs_disks_test.go | 4 +- vsphere/datastore_structure.go | 2 +- vsphere/distributed_port_group_structure.go | 4 +- ...tributed_virtual_port_setting_structure.go | 4 +- .../distributed_virtual_switch_structure.go | 4 +- vsphere/helper_test.go | 4 +- vsphere/host_nas_volume_structure.go | 4 +- vsphere/host_network_policy_structure.go | 4 +- vsphere/host_port_group_structure.go | 6 +- vsphere/host_virtual_switch_structure.go | 4 +- .../custom_attributes_helper.go | 2 +- .../helper/structure/structure_helper.go | 2 +- .../virtual_machine_cdrom_subresource.go | 2 +- .../virtual_machine_device_subresource.go | 2 +- .../virtual_machine_disk_subresource.go | 4 +- ...l_machine_network_interface_subresource.go | 4 +- .../virtual_machine_clone_subresource.go | 4 +- .../virtual_machine_customize_subresource.go | 4 +- vsphere/provider.go | 4 +- vsphere/provider_test.go | 13 +- vsphere/resource_vsphere_compute_cluster.go | 4 +- ...urce_vsphere_compute_cluster_host_group.go | 2 +- ...vsphere_compute_cluster_host_group_test.go | 4 +- .../resource_vsphere_compute_cluster_test.go | 4 +- ...sphere_compute_cluster_vm_affinity_rule.go | 2 +- ...e_compute_cluster_vm_affinity_rule_test.go | 4 +- ...e_compute_cluster_vm_anti_affinity_rule.go | 2 +- ...pute_cluster_vm_anti_affinity_rule_test.go | 4 +- ...here_compute_cluster_vm_dependency_rule.go | 2 +- ...compute_cluster_vm_dependency_rule_test.go | 4 +- ...source_vsphere_compute_cluster_vm_group.go | 2 +- ...e_vsphere_compute_cluster_vm_group_test.go | 4 +- ...ce_vsphere_compute_cluster_vm_host_rule.go | 2 +- ...phere_compute_cluster_vm_host_rule_test.go | 4 +- vsphere/resource_vsphere_custom_attribute.go | 2 +- .../resource_vsphere_custom_attribute_test.go | 4 +- vsphere/resource_vsphere_datacenter.go | 4 +- vsphere/resource_vsphere_datacenter_test.go | 4 +- vsphere/resource_vsphere_datastore_cluster.go | 4 +- ...resource_vsphere_datastore_cluster_test.go | 4 +- ...datastore_cluster_vm_anti_affinity_rule.go | 2 +- ...tore_cluster_vm_anti_affinity_rule_test.go | 4 +- ...resource_vsphere_distributed_port_group.go | 2 +- ...rce_vsphere_distributed_port_group_test.go | 4 +- ...urce_vsphere_distributed_virtual_switch.go | 2 +- ...vsphere_distributed_virtual_switch_test.go | 4 +- vsphere/resource_vsphere_dpm_host_override.go | 4 +- ...resource_vsphere_dpm_host_override_test.go | 4 +- vsphere/resource_vsphere_drs_vm_override.go | 4 +- .../resource_vsphere_drs_vm_override_test.go | 4 +- vsphere/resource_vsphere_file.go | 2 +- vsphere/resource_vsphere_file_test.go | 4 +- vsphere/resource_vsphere_folder.go | 4 +- vsphere/resource_vsphere_folder_migrate.go | 2 +- .../resource_vsphere_folder_migrate_test.go | 2 +- vsphere/resource_vsphere_folder_test.go | 4 +- vsphere/resource_vsphere_ha_vm_override.go | 4 +- .../resource_vsphere_ha_vm_override_test.go | 4 +- vsphere/resource_vsphere_host.go | 4 +- vsphere/resource_vsphere_host_port_group.go | 2 +- .../resource_vsphere_host_port_group_test.go | 4 +- vsphere/resource_vsphere_host_test.go | 4 +- .../resource_vsphere_host_virtual_switch.go | 2 +- ...source_vsphere_host_virtual_switch_test.go | 4 +- vsphere/resource_vsphere_license.go | 2 +- vsphere/resource_vsphere_license_test.go | 4 +- vsphere/resource_vsphere_nas_datastore.go | 2 +- .../resource_vsphere_nas_datastore_test.go | 4 +- vsphere/resource_vsphere_resource_pool.go | 4 +- .../resource_vsphere_resource_pool_test.go | 4 +- ...esource_vsphere_storage_drs_vm_override.go | 4 +- ...ce_vsphere_storage_drs_vm_override_test.go | 4 +- vsphere/resource_vsphere_tag.go | 2 +- vsphere/resource_vsphere_tag_category.go | 4 +- vsphere/resource_vsphere_tag_category_test.go | 4 +- vsphere/resource_vsphere_tag_test.go | 4 +- vsphere/resource_vsphere_vapp_container.go | 4 +- .../resource_vsphere_vapp_container_test.go | 4 +- vsphere/resource_vsphere_vapp_entity.go | 2 +- vsphere/resource_vsphere_vapp_entity_test.go | 4 +- vsphere/resource_vsphere_virtual_disk.go | 2 +- vsphere/resource_vsphere_virtual_disk_test.go | 6 +- vsphere/resource_vsphere_virtual_machine.go | 4 +- ...esource_vsphere_virtual_machine_migrate.go | 2 +- ...ce_vsphere_virtual_machine_migrate_test.go | 2 +- ...source_vsphere_virtual_machine_snapshot.go | 2 +- ...e_vsphere_virtual_machine_snapshot_test.go | 4 +- .../resource_vsphere_virtual_machine_test.go | 4 +- vsphere/resource_vsphere_vmfs_datastore.go | 4 +- .../resource_vsphere_vmfs_datastore_test.go | 4 +- vsphere/resource_vsphere_vnic.go | 2 +- vsphere/resource_vsphere_vnic_test.go | 4 +- vsphere/tags_helper.go | 2 +- vsphere/virtual_machine_config_structure.go | 6 +- vsphere/virtual_machine_guest_structure.go | 2 +- 980 files changed, 5867 insertions(+), 49756 deletions(-) delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/client/no_op_retryer.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go create mode 100644 vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read_1_5.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/sort.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go delete mode 100644 vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go delete mode 100644 vendor/github.com/blang/semver/.travis.yml delete mode 100644 vendor/github.com/blang/semver/LICENSE delete mode 100644 vendor/github.com/blang/semver/README.md delete mode 100644 vendor/github.com/blang/semver/json.go delete mode 100644 vendor/github.com/blang/semver/package.json delete mode 100644 vendor/github.com/blang/semver/range.go delete mode 100644 vendor/github.com/blang/semver/semver.go delete mode 100644 vendor/github.com/blang/semver/sort.go delete mode 100644 vendor/github.com/blang/semver/sql.go delete mode 100644 vendor/github.com/bmatcuk/doublestar/.travis.yml delete mode 100644 vendor/github.com/bmatcuk/doublestar/LICENSE delete mode 100644 vendor/github.com/bmatcuk/doublestar/README.md delete mode 100644 vendor/github.com/bmatcuk/doublestar/doublestar.go delete mode 100644 vendor/github.com/bmatcuk/doublestar/go.mod create mode 100644 vendor/github.com/hashicorp/go-hclog/context.go rename vendor/github.com/hashicorp/go-hclog/{int.go => intlogger.go} (62%) rename vendor/github.com/hashicorp/go-hclog/{log.go => logger.go} (73%) create mode 100644 vendor/github.com/hashicorp/go-hclog/writer.go create mode 100644 vendor/github.com/hashicorp/hcl/go.mod create mode 100644 vendor/github.com/hashicorp/hcl/go.sum delete mode 100644 vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md delete mode 100644 vendor/github.com/hashicorp/hcl/v2/README.md delete mode 100644 vendor/github.com/hashicorp/hcl/v2/diagnostic.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/diagnostic_text.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/didyoumean.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/doc.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/eval_context.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/expr_call.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/expr_list.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/expr_map.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/expr_unwrap.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/go.mod delete mode 100644 vendor/github.com/hashicorp/hcl/v2/go.sum delete mode 100644 vendor/github.com/hashicorp/hcl/v2/gohcl/decode.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/gohcl/doc.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/gohcl/encode.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/gohcl/schema.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/gohcl/types.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclparse/parser.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/diagnostics.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/didyoumean.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/doc.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_ops.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_template.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_vars.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/file.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/generate.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/keywords.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/navigation.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/node.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_template.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_traversal.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/peeker.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/public.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_string_lit.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_string_lit.rl delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_tokens.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_tokens.rl delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/spec.md delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/structure.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/structure_at_pos.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/token.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/token_type_string.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/unicode2ragel.rb delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/unicode_derived.rl delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/variables.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/walk.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/ast.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/ast_attribute.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/ast_block.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/ast_body.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/ast_expression.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/doc.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/format.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/generate.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/native_node_sorter.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/node.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/parser.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/public.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/hclwrite/tokens.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/ast.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/didyoumean.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/doc.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/navigation.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/parser.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/peeker.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/public.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/scanner.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/spec.md delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/structure.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/json/tokentype_string.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/merged.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/ops.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/pos.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/pos_scanner.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/schema.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/spec.md delete mode 100644 vendor/github.com/hashicorp/hcl/v2/static_expr.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/structure.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/structure_at_pos.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/traversal.go delete mode 100644 vendor/github.com/hashicorp/hcl/v2/traversal_for_expr.go rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/dynblock/README.md (100%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/dynblock/expand_body.go (99%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/dynblock/expand_spec.go (99%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/dynblock/expr_wrap.go (96%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/dynblock/iteration.go (97%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/dynblock/public.go (87%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/dynblock/schema.go (95%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/dynblock/unknown_body.go (98%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/dynblock/variables.go (99%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/dynblock/variables_hcldec.go (95%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/typeexpr/README.md (98%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/typeexpr/doc.go (100%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/typeexpr/get_type.go (99%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/ext/typeexpr/public.go (97%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/hcldec/block_labels.go (90%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/hcldec/decode.go (96%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/hcldec/doc.go (100%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/hcldec/gob.go (100%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/hcldec/public.go (98%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/hcldec/schema.go (96%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/hcldec/spec.go (99%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/hcldec/variables.go (97%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/hcled/doc.go (100%) rename vendor/github.com/hashicorp/{hcl/v2 => hcl2}/hcled/navigation.go (96%) delete mode 100644 vendor/github.com/hashicorp/hil/.gitignore delete mode 100644 vendor/github.com/hashicorp/hil/.travis.yml delete mode 100644 vendor/github.com/hashicorp/hil/README.md delete mode 100644 vendor/github.com/hashicorp/hil/appveyor.yml delete mode 100644 vendor/github.com/hashicorp/hil/builtins.go delete mode 100644 vendor/github.com/hashicorp/hil/check_identifier.go delete mode 100644 vendor/github.com/hashicorp/hil/check_types.go delete mode 100644 vendor/github.com/hashicorp/hil/convert.go delete mode 100644 vendor/github.com/hashicorp/hil/eval.go delete mode 100644 vendor/github.com/hashicorp/hil/eval_type.go delete mode 100644 vendor/github.com/hashicorp/hil/evaltype_string.go delete mode 100644 vendor/github.com/hashicorp/hil/go.mod delete mode 100644 vendor/github.com/hashicorp/hil/go.sum delete mode 100644 vendor/github.com/hashicorp/hil/parse.go delete mode 100644 vendor/github.com/hashicorp/hil/parser/binary_op.go delete mode 100644 vendor/github.com/hashicorp/hil/parser/error.go delete mode 100644 vendor/github.com/hashicorp/hil/parser/fuzz.go delete mode 100644 vendor/github.com/hashicorp/hil/parser/parser.go delete mode 100644 vendor/github.com/hashicorp/hil/scanner/peeker.go delete mode 100644 vendor/github.com/hashicorp/hil/scanner/scanner.go delete mode 100644 vendor/github.com/hashicorp/hil/scanner/token.go delete mode 100644 vendor/github.com/hashicorp/hil/scanner/tokentype_string.go delete mode 100644 vendor/github.com/hashicorp/hil/transform_fixed.go delete mode 100644 vendor/github.com/hashicorp/hil/walk.go rename vendor/github.com/{bmatcuk/doublestar => hashicorp/logutils}/.gitignore (81%) rename vendor/github.com/hashicorp/{terraform => logutils}/LICENSE (100%) create mode 100644 vendor/github.com/hashicorp/logutils/README.md create mode 100644 vendor/github.com/hashicorp/logutils/go.mod create mode 100644 vendor/github.com/hashicorp/logutils/level.go rename vendor/github.com/hashicorp/{hcl/v2 => terraform-plugin-sdk}/LICENSE (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/acctest/acctest.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/acctest/random.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/acctest/remotetests.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/hashcode/hashcode.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/logging/logging.go (66%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/logging/transport.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/error.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/grpc_test_provider.go (75%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/id.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/map.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/resource.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/state.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/state_shim.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/testing.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/testing_config.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/testing_import_state.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/wait.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/README.md (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/backend.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/core_schema.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/data_source_resource_shim.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/equal.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/field_reader.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/field_reader_config.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/field_reader_diff.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/field_reader_map.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/field_reader_multi.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/field_writer.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/field_writer_map.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/getsource_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/provider.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/resource.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/resource_data.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/resource_data_get_source.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/resource_diff.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/resource_importer.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/resource_timeout.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/schema.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/serialize.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/set.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/shims.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/testing.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/valuetype.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/schema/valuetype_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/structure/expand_json.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/structure/flatten_json.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/structure/normalize_json.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/structure/suppress_json_diff.go (84%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/validation/validation.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/count_attr.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/for_each_attr.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/input_variable.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/instance_key.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/local_value.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/module.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/module_call.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/module_instance.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/output_value.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/parse_ref.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/parse_target.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/path_attr.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/provider_config.go (68%) create mode 100644 vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/provider_type.go rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/referenceable.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/resource.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/resource_phase.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/resourcemode_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/self.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/targetable.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/terraform_attr.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/command/format/diagnostic.go (85%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/command/format/diff.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/command/format/format.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/command/format/object_id.go (100%) create mode 100644 vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/plan.go rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/command/format/state.go (63%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/backend.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/compat_shim.go (50%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/config.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/config_build.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/copy_dir.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/inode.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/inode_freebsd.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/inode_windows.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/loader.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/loader_load.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/loader_snapshot.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/module_mgr.go (75%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/testing.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/coerce_value.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/decoder_spec.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/empty_value.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/implied_type.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/internal_validate.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/nestingmode_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/none_required.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/schema.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/validate_traversal.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/depends_on.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/hcl2shim/flatmap.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/hcl2shim/paths.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/hcl2shim/single_attr_body.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/hcl2shim/values.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/hcl2shim/values_equiv.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/module.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/module_call.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/module_merge.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/module_merge_body.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/named_values.go (84%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/parser.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/parser_config.go (85%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/parser_config_dir.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/parser_values.go (97%) create mode 100644 vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provider.go rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/provisioner.go (69%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/provisioneronfailure_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/provisionerwhen_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/resource.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/synth_body.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/util.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/variable_type_hint.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/variabletypehint_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/version_constraint.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/dag/dag.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/dag/dot.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/dag/edge.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/dag/graph.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/dag/marshal.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/dag/set.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/dag/tarjan.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/dag/walk.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/earlyconfig/config.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/earlyconfig/config_build.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/earlyconfig/diagnostics.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/earlyconfig/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/earlyconfig/module.go (83%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/flatmap/expand.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/flatmap/flatten.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/flatmap/map.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/helper/config/decode.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/helper/config/validator.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/helper/didyoumean/name_suggestion.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/helper/plugin/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/helper/plugin/grpc_provider.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/helper/plugin/unknown.go (97%) rename vendor/github.com/hashicorp/{terraform/httpclient/useragent.go => terraform-plugin-sdk/internal/httpclient/client.go} (66%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/copy_dir.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/from_module.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/getter.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/inode.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/inode_freebsd.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/inode_windows.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/load_config.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/module_install.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/module_install_hooks.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/testing.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/initwd/version_required.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/blocktoattr/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/blocktoattr/fixup.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/blocktoattr/schema.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/blocktoattr/variables.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/data.go (88%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/eval.go (88%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/cidr.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/collection.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/conversion.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/crypto.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/datetime.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/encoding.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/filesystem.go (83%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/number.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/string.go (73%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/functions.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/references.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/scope.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/modsdir/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/modsdir/manifest.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/modsdir/paths.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/moduledeps/dependencies.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/moduledeps/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/moduledeps/module.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/moduledeps/provider.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/action.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/action_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/changes.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/changes_src.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/changes_state.go (88%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/changes_sync.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/dynamic_value.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/objchange/all_null.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/objchange/compatible.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/objchange/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/objchange/lcs.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/objchange/normalize_obj.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/objchange/objchange.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/objchange/plan_valid.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plans/plan.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/convert/diagnostics.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/convert/schema.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/error.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/find.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/get.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/get_cache.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/hashicorp.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/meta.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/meta_set.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/requirements.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/signature.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/version.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/plugin/discovery/version_set.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/providers/addressed_types.go (88%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/providers/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/providers/provider.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/providers/resolver.go (86%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/provisioners/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/provisioners/factory.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/provisioners/provisioner.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/client.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/errors.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/regsrc/friendly_host.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/regsrc/module.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/regsrc/regsrc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/regsrc/terraform_provider.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/response/module.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/response/module_list.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/response/module_provider.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/response/module_versions.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/response/pagination.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/response/provider.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/response/provider_list.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/response/redirect.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/registry/response/terraform_provider.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/eachmode_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/instance_generation.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/instance_object.go (87%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/instance_object_src.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/module.go (82%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/objectstatus_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/output_value.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/resource.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/state.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/state_deepcopy.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/state_equal.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/state_string.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/diagnostics.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/file.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/marshal_equal.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/read.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/version0.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/version1.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/version1_upgrade.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/version2.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/version2_upgrade.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/version3.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/version3_upgrade.go (79%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/version4.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/write.go (82%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/sync.go (99%) rename vendor/github.com/hashicorp/{terraform-svchost => terraform-plugin-sdk/internal/svchost}/auth/cache.go (63%) rename vendor/github.com/hashicorp/{terraform-svchost => terraform-plugin-sdk/internal/svchost}/auth/credentials.go (52%) create mode 100644 vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/from_map.go rename vendor/github.com/hashicorp/{terraform-svchost => terraform-plugin-sdk/internal/svchost}/auth/helper_program.go (54%) rename vendor/github.com/hashicorp/{terraform-svchost => terraform-plugin-sdk/internal/svchost}/auth/static.go (63%) create mode 100644 vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/token_credentials.go rename vendor/github.com/hashicorp/{terraform-svchost => terraform-plugin-sdk/internal/svchost}/disco/disco.go (91%) rename vendor/github.com/hashicorp/{terraform-svchost => terraform-plugin-sdk/internal/svchost}/disco/host.go (59%) rename vendor/github.com/hashicorp/{terraform-svchost => terraform-plugin-sdk/internal/svchost}/label_iter.go (78%) rename vendor/github.com/hashicorp/{terraform-svchost => terraform-plugin-sdk/internal/svchost}/svchost.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/config_traversals.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/contextual.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/diagnostic.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/diagnostic_base.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/diagnostics.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/doc.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/error.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/hcl.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/rpc_friendly.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/severity_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/simple_warning.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/source_range.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/sourceless.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/tfplugin5/generate.sh (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/internal/tfplugin5/tfplugin5.pb.go (100%) create mode 100644 vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.proto rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/version/version.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/plugin/client.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/plugin/grpc_provider.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/plugin/grpc_provisioner.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/plugin/plugin.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/plugin/resource_provider.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/plugin/serve.go (74%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/plugin/ui_input.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/plugin/ui_output.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/context.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/context_components.go (84%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/context_graph_type.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/context_import.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/context_input.go (68%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/diff.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/edge_destroy.go (88%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_apply.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_check_prevent_destroy.go (72%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_context.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_context_builtin.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_context_mock.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_count.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_count_boundary.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_diff.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_error.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_filter.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_filter_operation.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_for_each.go (88%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_if.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_import_state.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_lang.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_local.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_noop.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_output.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_provider.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_provisioner.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_read_data.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_refresh.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_sequence.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_state.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_state_upgrade.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_validate.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_validate_selfref.go (86%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_variable.go (75%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/evaltree_provider.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/evaluate.go (77%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/evaluate_valid.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/features.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_builder.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_builder_apply.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_builder_destroy_plan.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_builder_eval.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_builder_import.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_builder_plan.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_builder_refresh.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_builder_validate.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_dot.go (77%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_interface_subgraph.go (79%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_walk.go (86%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_walk_context.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_walk_operation.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graphtype_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/hook.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/hook_mock.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/hook_stop.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/instancetype.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/instancetype_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/module_dependencies.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_count_boundary.go (88%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_data_destroy.go (87%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_data_refresh.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_local.go (86%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_module_removed.go (88%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_module_variable.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_output.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_output_orphan.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_provider.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_provider_abstract.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_provider_disabled.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_provider_eval.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_provisioner.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_abstract.go (78%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_apply.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_apply_instance.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_destroy.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_destroy_deposed.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_plan.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_plan_destroy.go (87%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_plan_instance.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_plan_orphan.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_refresh.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_validate.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_root_variable.go (83%) create mode 100644 vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/path.go rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/plan.go (84%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/provider_mock.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/provisioner_mock.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/resource.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/resource_address.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/resource_mode.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/resource_mode_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/resource_provider.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/resource_provider_mock.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/resource_provisioner.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/resource_provisioner_mock.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/schemas.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/state.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/state_filter.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/state_upgrade_v1_to_v2.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/state_upgrade_v2_to_v3.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/state_v1.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/testing.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_attach_config_provider.go (78%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_attach_config_resource.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_attach_schema.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_attach_state.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_config.go (94%) create mode 100644 vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_config_flat.go rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_count_boundary.go (84%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_destroy_cbd.go (81%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_destroy_edge.go (70%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_diff.go (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_expand.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_import_provider.go (87%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_import_state.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_local.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_module_variable.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_orphan_count.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_orphan_output.go (87%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_orphan_resource.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_output.go (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_provider.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_provisioner.go (81%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_reference.go (84%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_removed_modules.go (84%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_resource_count.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_root.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_state.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_targets.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_transitive_reduction.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_variable.go (87%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_vertex.go (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/ui_input.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/ui_input_mock.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/ui_input_prefix.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/ui_output.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/ui_output_callback.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/ui_output_mock.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/ui_output_provisioner.go (87%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/util.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/valuesourcetype_string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/variables.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/version_required.go (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/walkoperation_string.go (100%) delete mode 100644 vendor/github.com/hashicorp/terraform-svchost/auth/from_map.go delete mode 100644 vendor/github.com/hashicorp/terraform-svchost/auth/token_credentials.go delete mode 100644 vendor/github.com/hashicorp/terraform-svchost/disco/http_transport.go delete mode 100644 vendor/github.com/hashicorp/terraform-svchost/disco/oauth_client.go delete mode 100644 vendor/github.com/hashicorp/terraform-svchost/go.mod delete mode 100644 vendor/github.com/hashicorp/terraform-svchost/go.sum delete mode 100644 vendor/github.com/hashicorp/terraform/addrs/provider.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/append.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/config.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/config_string.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/config_terraform.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/config_tree.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/import_tree.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/interpolate.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/interpolate_funcs.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/interpolate_walk.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/lang.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/loader.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/loader_hcl.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/loader_hcl2.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/merge.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/providers.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/provisioner_enums.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/raw_config.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/resource_mode.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/resource_mode_string.go delete mode 100644 vendor/github.com/hashicorp/terraform/config/testing.go delete mode 100644 vendor/github.com/hashicorp/terraform/configs/configload/getter.go delete mode 100644 vendor/github.com/hashicorp/terraform/configs/configload/source_addr.go delete mode 100644 vendor/github.com/hashicorp/terraform/configs/experiments.go delete mode 100644 vendor/github.com/hashicorp/terraform/configs/provider.go delete mode 100644 vendor/github.com/hashicorp/terraform/configs/provider_requirements.go delete mode 100644 vendor/github.com/hashicorp/terraform/experiments/doc.go delete mode 100644 vendor/github.com/hashicorp/terraform/experiments/errors.go delete mode 100644 vendor/github.com/hashicorp/terraform/experiments/experiment.go delete mode 100644 vendor/github.com/hashicorp/terraform/experiments/set.go delete mode 100644 vendor/github.com/hashicorp/terraform/experiments/testing.go delete mode 100644 vendor/github.com/hashicorp/terraform/helper/hilmapstructure/hilmapstructure.go delete mode 100644 vendor/github.com/hashicorp/terraform/helper/logging/indent.go delete mode 100644 vendor/github.com/hashicorp/terraform/helper/logging/level.go delete mode 100644 vendor/github.com/hashicorp/terraform/helper/pathorcontents/read.go delete mode 100644 vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provisioner.go delete mode 100644 vendor/github.com/hashicorp/terraform/helper/schema/provisioner.go delete mode 100644 vendor/github.com/hashicorp/terraform/httpclient/client.go delete mode 100644 vendor/github.com/hashicorp/terraform/plugin/resource_provisioner.go delete mode 100644 vendor/github.com/hashicorp/terraform/terraform/user_agent.go delete mode 100644 vendor/github.com/hashicorp/terraform/terraform/version.go delete mode 100644 vendor/github.com/hashicorp/terraform/tfdiags/consolidate_warnings.go create mode 100644 vendor/github.com/hashicorp/yamux/go.mod delete mode 100644 vendor/github.com/mitchellh/hashstructure/LICENSE delete mode 100644 vendor/github.com/mitchellh/hashstructure/README.md delete mode 100644 vendor/github.com/mitchellh/hashstructure/go.mod delete mode 100644 vendor/github.com/mitchellh/hashstructure/hashstructure.go delete mode 100644 vendor/github.com/mitchellh/hashstructure/include.go create mode 100644 vendor/github.com/pkg/errors/Makefile create mode 100644 vendor/github.com/pkg/errors/go113.go create mode 100644 vendor/github.com/terraform-providers/terraform-provider-random/random/resource_password.go create mode 100644 vendor/github.com/terraform-providers/terraform-provider-random/random/string.go delete mode 100644 vendor/github.com/terraform-providers/terraform-provider-template/LICENSE delete mode 100644 vendor/github.com/terraform-providers/terraform-provider-template/template/datasource_cloudinit_config.go delete mode 100644 vendor/github.com/terraform-providers/terraform-provider-template/template/datasource_template_file.go delete mode 100644 vendor/github.com/terraform-providers/terraform-provider-template/template/provider.go delete mode 100644 vendor/github.com/terraform-providers/terraform-provider-template/template/resource_template_dir.go create mode 100644 vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go diff --git a/go.mod b/go.mod index af6214094..625d48987 100644 --- a/go.mod +++ b/go.mod @@ -6,13 +6,17 @@ replace github.com/Sirupsen/logrus => github.com/sirupsen/logrus v1.3.0 require ( github.com/Sirupsen/logrus v0.0.0-00010101000000-000000000000 // indirect + github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 // indirect github.com/davecgh/go-spew v1.1.1 github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0 // indirect - github.com/hashicorp/terraform v0.12.18 + github.com/hashicorp/terraform-plugin-sdk v1.1.0 + github.com/mattn/go-colorable v0.1.1 // indirect github.com/mitchellh/copystructure v1.0.0 - github.com/terraform-providers/terraform-provider-null v1.0.0 - github.com/terraform-providers/terraform-provider-random v2.0.0+incompatible - github.com/terraform-providers/terraform-provider-template v1.0.0 + github.com/pkg/errors v0.9.1 // indirect + github.com/sirupsen/logrus v1.4.2 // indirect + github.com/terraform-providers/terraform-provider-null v1.0.1-0.20191204185112-e5c592237f62 + github.com/terraform-providers/terraform-provider-random v1.3.2-0.20190925210718-83518d96ae4f + github.com/vmihailenco/msgpack v4.0.1+incompatible // indirect github.com/vmware/govmomi v0.21.0 github.com/vmware/vic v1.5.4 ) diff --git a/go.sum b/go.sum index 5def930be..0a4dd2cb2 100644 --- a/go.sum +++ b/go.sum @@ -7,114 +7,63 @@ cloud.google.com/go v0.45.1 h1:lRi0CHyU+ytlvylOlFKKq0af6JncuyoRh1J+QJBqQx0= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -github.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go v36.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest v0.9.2/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI= -github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0= -github.com/Azure/go-autorest/autorest/adal v0.8.1-0.20191028180845-3492b2aff503/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc= -github.com/Azure/go-autorest/autorest/azure/cli v0.2.0/go.mod h1:WWTbGPvkAg3I4ms2j2s+Zr5xCGwGqTQh+6M2ZqOczkE= -github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA= -github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g= -github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0= -github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM= -github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA= -github.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRYq3HT1WyXAvT7LLY3tl70hw6tQIbjI= -github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc= -github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= -github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= -github.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292/go.mod h1:KYCjqMOeHpNuTOiFQU6WEcTG7poCJrUs0YgyHNtn1no= -github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/agl/ed25519 v0.0.0-20150830182803-278e1ec8e8a6/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190329064014-6e358769c32a/go.mod h1:T9M45xf79ahXVelWoOBmH0y4aC1t5kXO5BxwyakgIGA= -github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190103054945-8205d1f41e70/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= -github.com/aliyun/aliyun-tablestore-go-sdk v4.1.2+incompatible/go.mod h1:LDQHRZylxvcg8H7wBIDfvO5g/cy4/sz1iucBlc2l3Jw= -github.com/antchfx/xpath v0.0.0-20190129040759-c8489ed3251e/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= -github.com/antchfx/xquery v0.0.0-20180515051857-ad5b8c7a47b0/go.mod h1:LzD22aAzDP8/dyiCKFp31He4m2GPjl0AFyzDtZzUu9M= +github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= github.com/apparentlymart/go-cidr v1.0.1 h1:NmIwLZ/KdsjIUlhf+/Np40atNXm/+lZ5txfTJ/SpF+U= github.com/apparentlymart/go-cidr v1.0.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= +github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 h1:ZSTrOEhiM5J5RFxEaFvMZVEAM1KvT1YzbEOwB2EAGjA= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= +github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= -github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= -github.com/aws/aws-sdk-go v1.25.3 h1:uM16hIw9BotjZKMZlX05SN2EFtaWfi/NonPKIARiBLQ= -github.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/aws/aws-sdk-go v1.19.39 h1:pIez14zQWSd/TER2Scohm7aCEG2TgoyXSOX6srOKt6o= +github.com/aws/aws-sdk-go v1.19.39/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= -github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmatcuk/doublestar v1.1.5 h1:2bNwBOmhyFEFcoB3tGvTD5xanq+4kyOZlB8wFYbMjkk= -github.com/bmatcuk/doublestar v1.1.5/go.mod h1:wiQtGV+rzVYxB7WIlirSN++5HPtPlXEo9MEoZQC/PmE= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/bsm/go-vlq v0.0.0-20150828105119-ec6e8d4f5f4e/go.mod h1:N+BjUcTjSxc2mtRGSCPsat1kze3CUtvJN3/jTXlp29k= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.0/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892/go.mod h1:CTDl0pzVzE5DEzZhPfvhY/9sPFMQIxaJ9VAMs9AagrE= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= -github.com/dnaeon/go-vcr v0.0.0-20180920040454-5637cf3d8a31/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/dustinkirkland/golang-petname v0.0.0-20170105215008-242afa0b4f8a/go.mod h1:V+Qd57rJe8gd4eiGzZyg4h54VLHmYVVw54iMnlAMrF8= github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0 h1:90Ly+6UfUypEF6vvvW5rQIv9opIL8CbmW9FT20LDQoY= github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0/go.mod h1:V+Qd57rJe8gd4eiGzZyg4h54VLHmYVVw54iMnlAMrF8= -github.com/dylanmei/iso8601 v0.1.0/go.mod h1:w9KhXSgIyROl1DefbMYIE7UVSIvELTbMrCfx+QkYnoQ= -github.com/dylanmei/winrmtest v0.0.0-20190225150635-99b7fe2fddf1/go.mod h1:lcy9/2gH1jn/VCLouHA6tOEwLoNVd4GW6zhuKLmHC2Y= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20180513044358-24b0969c4cb7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -124,43 +73,24 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gophercloud/gophercloud v0.0.0-20190208042652-bc37892e1968/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= -github.com/gophercloud/utils v0.0.0-20190128072930-fbb6ab446f01/go.mod h1:wjDF8z83zTeg5eMLml5EBSlAhbF7G8DobyI1YsMuyzw= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/aws-sdk-go-base v0.4.0/go.mod h1:eRhlz3c4nhqxFZJAahJEFL7gh6Jyj5rQmQc7F9eHFyQ= -github.com/hashicorp/consul v0.0.0-20171026175957-610f3c86a089/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI= github.com/hashicorp/errwrap v0.0.0-20180715044906-d6c0cd880357/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-azure-helpers v0.10.0/go.mod h1:YuAtHxm2v74s+IjQwUG88dHBJPd5jL+cXr5BGVzSKhE= -github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-getter v1.4.0 h1:ENHNi8494porjD0ZhIrjlAHnveSFhY7hvOJrV/fsKkw= github.com/hashicorp/go-getter v1.4.0/go.mod h1:7qxyCd8rBfcShwsvxgIguu4KbS3l8bUCwg2Umn7RjeY= github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= -github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f h1:Yv9YzBlAETjy6AOX9eLBZ3nshNVRREgerT/3nvxlGho= -github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= -github.com/hashicorp/go-immutable-radix v0.0.0-20180129170900-7f3cd4390caa/go.mod h1:6ij3Z20p+OhOkCSrA0gImAWoHYQRGbnlcuk6XYTiaRw= -github.com/hashicorp/go-msgpack v0.5.4/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-multierror v0.0.0-20180717150148-3d5d8f294aa0/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-plugin v1.0.1-0.20190610192547-a1bc61569a26 h1:hRho44SAoNu1CBtn5r8Q9J3rCs4ZverWZ4R+UeeNuWM= -github.com/hashicorp/go-plugin v1.0.1-0.20190610192547-a1bc61569a26/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= -github.com/hashicorp/go-retryablehttp v0.5.2/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= -github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-plugin v1.0.1 h1:4OtAfUGbnKC6yS48p0CtMX2oFYtzFZVv6rok3cRWgnE= +github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= -github.com/hashicorp/go-slug v0.4.1/go.mod h1:I5tq5Lv0E2xcNXNkmx7BSfzi1PsJ2cNjs3cC3LwyhK8= -github.com/hashicorp/go-sockaddr v0.0.0-20180320115054-6d291a969b86/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= -github.com/hashicorp/go-tfe v0.3.27/go.mod h1:DVPSW2ogH+M9W1/i50ASgMht8cHP7NxxK0nrY9aFikQ= -github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -171,59 +101,52 @@ github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f h1:UdxlrJz4JOnY8W+DbLISwf2B8WXEolNRA8BGCwI9jws= github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= -github.com/hashicorp/hcl/v2 v2.0.0 h1:efQznTz+ydmQXq3BOnRa3AXzvCeTq1P4dKj/z5GLlY8= -github.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl2 v0.0.0-20190821123243-0c888d1241f6 h1:JImQpEeUQ+0DPFMaWzLA0GdUNPaUlCXLpfiqkSZBUfc= github.com/hashicorp/hcl2 v0.0.0-20190821123243-0c888d1241f6/go.mod h1:Cxv+IJLuBiEhQ7pBYGEuORa0nr4U994pE8mYLuFd7v0= github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590 h1:2yzhWGdgQUWZUCNK+AoO35V+HTsgEmcM4J9IkArh7PI= github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590/go.mod h1:n2TSygSNwsLJ76m8qFXTSc7beTb+auJxYdqrnoqwZWE= -github.com/hashicorp/memberlist v0.1.0/go.mod h1:ncdBp14cuox2iFOq3kDiquKU6fqsTBc3W6JvZwjxxsE= -github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE= -github.com/hashicorp/terraform v0.12.18 h1:U9gd/12wfT0Q7JYM43Hob6rcirICKCnxSDY+sJlYh6A= -github.com/hashicorp/terraform v0.12.18/go.mod h1:wA1HxKwR2a21mNFaKyv1lQ+dAwtQKCKFfUAuTqPeP2U= +github.com/hashicorp/hil v0.0.0-20190212132231-97b3a9cdfa93 h1:T1Q6ag9tCwun16AW+XK3tAql24P4uTGUMIn1/92WsQQ= +github.com/hashicorp/hil v0.0.0-20190212132231-97b3a9cdfa93/go.mod h1:n2TSygSNwsLJ76m8qFXTSc7beTb+auJxYdqrnoqwZWE= +github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/terraform-config-inspect v0.0.0-20190821133035-82a99dc22ef4 h1:fTkL0YwjohGyN7AqsDhz6bwcGBpT+xBqi3Qhpw58Juw= github.com/hashicorp/terraform-config-inspect v0.0.0-20190821133035-82a99dc22ef4/go.mod h1:JDmizlhaP5P0rYTTZB0reDMefAiJyfWPEtugV4in1oI= -github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596 h1:hjyO2JsNZUKT1ym+FAdlBEkGPevazYsmVgIMw7dVELg= -github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= -github.com/hashicorp/vault v0.10.4/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0= +github.com/hashicorp/terraform-plugin-sdk v1.0.0/go.mod h1:NuwtLpEpPsFaKJPJNGtMcn9vlhe6Ofe+Y6NqXhJgV2M= +github.com/hashicorp/terraform-plugin-sdk v1.1.0 h1:fFn2JYcwTnIuRKgc3pX2SJDsrc1FckfaJ8aStN1HInw= +github.com/hashicorp/terraform-plugin-sdk v1.1.0/go.mod h1:NuwtLpEpPsFaKJPJNGtMcn9vlhe6Ofe+Y6NqXhJgV2M= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= +github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/joyent/triton-go v0.0.0-20180313100802-d8f9c0314926/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= -github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lusis/go-artifactory v0.0.0-20160115162124-7e4ce345df82/go.mod h1:y54tfGmO3NKssKveTEFFzH8C/akrSOy/iW9qEAUDV84= -github.com/masterzen/simplexml v0.0.0-20160608183007-4572e39b1ab9/go.mod h1:kCEbxUJlNDEBNbdQMkPSp6yaKcRXVI6f4ddk8Riv4bc= -github.com/masterzen/winrm v0.0.0-20190223112901-5e5c9a7fe54b/go.mod h1:wr1VqkwW0AB5JS0QLy5GpVMS9E3VtRoSYXUYyVk46KY= +github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1 h1:G1f5SKeVxmagw/IyvzvtZE4Gybcc4Tr1tf7I8z0XgOg= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.5 h1:tHXDdz1cpzGaovsTB+TVB8q90WEokoVmfMqoVcrLUgw= github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-shellwords v1.0.4/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/miekg/dns v1.0.8/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0 h1:iGBIsUe3+HZ/AD/Vd7DErOt5sU9fa8Uj7A2s1aggv1Y= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ= @@ -233,76 +156,53 @@ github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFW github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-linereader v0.0.0-20190213213312-1b945b3263eb/go.mod h1:OaY7UOoTkkrX3wRwjpYRKafIkkyeD0UtweSHAWWiqQM= github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/hashstructure v1.0.0 h1:ZkRJX1CyOoTkar7p/mLS5TZU4nJ1Rn/F8u9dGS02Q3Y= -github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/panicwrap v1.0.0/go.mod h1:pKvZHwWrZowLUzftuFq7coarnxbBXU4aQh3N0BJOeeA= -github.com/mitchellh/prefixedio v0.0.0-20190213213902-5733675afd51/go.mod h1:kB1naBgV9ORnkiTVeyJOI1DavaJkG4oNIq0Af6ZVKUo= github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= +github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE= +github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58/go.mod h1:f6Izs6JvFTdnRbziASagjZ2vmf55NSIkC/weStxCHqk= -github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= -github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/posener/complete v1.2.1 h1:LrvDIY//XNo65Lq84G/akBuMGlawHvGBABv8f/ZN6DI= github.com/posener/complete v1.2.1/go.mod h1:6gapUrK/U1TAN7ciCoNRIdVC5sbdBTUh1DKN0g6uH7E= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME= github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spf13/afero v1.2.1 h1:qgMbHoJbPbw579P+1zVY+6n4nIFuIchaIjzZ/I/Yq8M= -github.com/spf13/afero v1.2.1/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= +github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/svanharmelen/jsonapi v0.0.0-20180618144545-0c0828c3f16d/go.mod h1:BSTlc8jOjh0niykqEGVXOLXdi9o0r0kR8tCYiMvjFgw= -github.com/terraform-providers/terraform-provider-null v1.0.0 h1:c7XmnCO+ekLmqxdRHNw4ncDsR/EW+C+iCCVYYkqhTik= -github.com/terraform-providers/terraform-provider-null v1.0.0/go.mod h1:Vc1GOnkR+wRoZAIqbuAZVVKic8oGbbPPaPDvaPEeGkI= -github.com/terraform-providers/terraform-provider-openstack v1.15.0/go.mod h1:2aQ6n/BtChAl1y2S60vebhyJyZXBsuAI5G4+lHrT1Ew= -github.com/terraform-providers/terraform-provider-random v2.0.0+incompatible h1:4wuExSWk/NHYS95P2H4KGv22bsabuDjGk5cFikIYzuU= -github.com/terraform-providers/terraform-provider-random v2.0.0+incompatible/go.mod h1:1U2balY0mfjMnO5iotT60EuFqDJxqP433wJcybviCTw= -github.com/terraform-providers/terraform-provider-template v1.0.0 h1:g2pyFaAJu369iAb7qGWmVwtQ15/35lRAfW91Je8wLjE= -github.com/terraform-providers/terraform-provider-template v1.0.0/go.mod h1:/J+B8me5DCMa0rEBH5ic2aKPjhtpWNeScmxFJWxB1EU= -github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= +github.com/terraform-providers/terraform-provider-null v1.0.1-0.20191204185112-e5c592237f62 h1:vi12lh3hnvMclOqFwEf73s8JCUTPTchOhEmf/7uMPn0= +github.com/terraform-providers/terraform-provider-null v1.0.1-0.20191204185112-e5c592237f62/go.mod h1:RaAgicYv+oKLyZpaQB5BOkwL/t5WKYHQ+Q0kgMgXgR4= +github.com/terraform-providers/terraform-provider-random v1.3.2-0.20190925210718-83518d96ae4f h1:oqZwtMD9/XcOcCzm/9cz8+pQWRTGF60N1RNcYLg+BCw= +github.com/terraform-providers/terraform-provider-random v1.3.2-0.20190925210718-83518d96ae4f/go.mod h1:F4KE9YftuJyMiBth4W1kCrsyOHndtTjAmZ+ZzjqWY+4= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvcciqcxEHac4CYj89xI= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.1+incompatible h1:RMF1enSPeKTlXrXdOcqjFUElywVZjjC6pqse21bKbEU= github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= @@ -311,9 +211,6 @@ github.com/vmware/govmomi v0.21.0/go.mod h1:zbnFoBQ9GIjs2RVETy8CNEpb+L+Lwkjs3XZU github.com/vmware/vic v1.5.4 h1:y546pkye0aes2j2h2n6fWz++v8WxMZTLFl1mLOMzqYQ= github.com/vmware/vic v1.5.4/go.mod h1:AiTDrZuV13NkqRzseA5ZmF2QqLpTydaaGN75xgV6Ork= github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk= -github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= -github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xlab/treeprint v0.0.0-20161029104018-1d6e34225557/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.1.0 h1:uJwc9HiBOCpoKIObTQaLR+tsEXx1HBHnOsOOpcdhZgw= github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= @@ -322,17 +219,12 @@ github.com/zclconf/go-cty-yaml v1.0.1/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgK go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc= -golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0= +golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -346,10 +238,7 @@ golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -358,8 +247,8 @@ golang.org/x/net v0.0.0-20190502183928-7f726cade0ab/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191009170851-d66e71096ffb h1:TR699M2v0qoKTOHxeLgp6zPqaQNs74f01a/ob9W0qko= -golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= @@ -373,21 +262,18 @@ golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 h1:HyfiK1WMnHj5FXFXatD+Qs1A/xC2Run6RzeW1SyHxpc= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa h1:KIDDMLT1O0Nr7TSxp8xM5tJcdn8tgyAONntO829og1M= -golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= @@ -402,6 +288,7 @@ golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -427,19 +314,19 @@ google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZi google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/main.go b/main.go index efd6565b3..1ec40ebe2 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/hashicorp/terraform/plugin" + "github.com/hashicorp/terraform-plugin-sdk/plugin" "github.com/terraform-providers/terraform-provider-vsphere/vsphere" ) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go index 9cf7eaf40..a2c5817c4 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go @@ -208,7 +208,7 @@ func (e errorList) Error() string { // How do we want to handle the array size being zero if size := len(e); size > 0 { for i := 0; i < size; i++ { - msg += e[i].Error() + msg += fmt.Sprintf("%s", e[i].Error()) // We check the next index to see if it is within the slice. // If it is, then we append a newline. We do this, because unit tests // could be broken with the additional '\n' diff --git a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go index 285e54d67..11c52c389 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go @@ -185,12 +185,13 @@ func ValuesAtPath(i interface{}, path string) ([]interface{}, error) { // SetValueAtPath sets a value at the case insensitive lexical path inside // of a structure. func SetValueAtPath(i interface{}, path string, v interface{}) { - rvals := rValuesAtPath(i, path, true, false, v == nil) - for _, rval := range rvals { - if rval.Kind() == reflect.Ptr && rval.IsNil() { - continue + if rvals := rValuesAtPath(i, path, true, false, v == nil); rvals != nil { + for _, rval := range rvals { + if rval.Kind() == reflect.Ptr && rval.IsNil() { + continue + } + setValue(rval, v) } - setValue(rval, v) } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go b/vendor/github.com/aws/aws-sdk-go/aws/client/client.go index c022407f5..709605384 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/client.go @@ -64,7 +64,7 @@ func New(cfg aws.Config, info metadata.ClientInfo, handlers request.Handlers, op default: maxRetries := aws.IntValue(cfg.MaxRetries) if cfg.MaxRetries == nil || maxRetries == aws.UseServiceDefaultRetries { - maxRetries = DefaultRetryerMaxNumRetries + maxRetries = 3 } svc.Retryer = DefaultRetryer{NumMaxRetries: maxRetries} } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go index 0fda42510..a397b0d04 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go @@ -1,7 +1,6 @@ package client import ( - "math" "strconv" "time" @@ -10,142 +9,82 @@ import ( ) // DefaultRetryer implements basic retry logic using exponential backoff for -// most services. If you want to implement custom retry logic, you can implement the -// request.Retryer interface. +// most services. If you want to implement custom retry logic, implement the +// request.Retryer interface or create a structure type that composes this +// struct and override the specific methods. For example, to override only +// the MaxRetries method: // +// type retryer struct { +// client.DefaultRetryer +// } +// +// // This implementation always has 100 max retries +// func (d retryer) MaxRetries() int { return 100 } type DefaultRetryer struct { - // Num max Retries is the number of max retries that will be performed. - // By default, this is zero. - NumMaxRetries int - - // MinRetryDelay is the minimum retry delay after which retry will be performed. - // If not set, the value is 0ns. - MinRetryDelay time.Duration - - // MinThrottleRetryDelay is the minimum retry delay when throttled. - // If not set, the value is 0ns. - MinThrottleDelay time.Duration - - // MaxRetryDelay is the maximum retry delay before which retry must be performed. - // If not set, the value is 0ns. - MaxRetryDelay time.Duration - - // MaxThrottleDelay is the maximum retry delay when throttled. - // If not set, the value is 0ns. - MaxThrottleDelay time.Duration + NumMaxRetries int } -const ( - // DefaultRetryerMaxNumRetries sets maximum number of retries - DefaultRetryerMaxNumRetries = 3 - - // DefaultRetryerMinRetryDelay sets minimum retry delay - DefaultRetryerMinRetryDelay = 30 * time.Millisecond - - // DefaultRetryerMinThrottleDelay sets minimum delay when throttled - DefaultRetryerMinThrottleDelay = 500 * time.Millisecond - - // DefaultRetryerMaxRetryDelay sets maximum retry delay - DefaultRetryerMaxRetryDelay = 300 * time.Second - - // DefaultRetryerMaxThrottleDelay sets maximum delay when throttled - DefaultRetryerMaxThrottleDelay = 300 * time.Second -) - // MaxRetries returns the number of maximum returns the service will use to make // an individual API request. func (d DefaultRetryer) MaxRetries() int { return d.NumMaxRetries } -// setRetryerDefaults sets the default values of the retryer if not set -func (d *DefaultRetryer) setRetryerDefaults() { - if d.MinRetryDelay == 0 { - d.MinRetryDelay = DefaultRetryerMinRetryDelay - } - if d.MaxRetryDelay == 0 { - d.MaxRetryDelay = DefaultRetryerMaxRetryDelay - } - if d.MinThrottleDelay == 0 { - d.MinThrottleDelay = DefaultRetryerMinThrottleDelay - } - if d.MaxThrottleDelay == 0 { - d.MaxThrottleDelay = DefaultRetryerMaxThrottleDelay - } -} - // RetryRules returns the delay duration before retrying this request again func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { - - // if number of max retries is zero, no retries will be performed. - if d.NumMaxRetries == 0 { - return 0 - } - - // Sets default value for retryer members - d.setRetryerDefaults() - - // minDelay is the minimum retryer delay - minDelay := d.MinRetryDelay - - var initialDelay time.Duration - - isThrottle := r.IsErrorThrottle() - if isThrottle { - if delay, ok := getRetryAfterDelay(r); ok { - initialDelay = delay + // Set the upper limit of delay in retrying at ~five minutes + minTime := 30 + throttle := d.shouldThrottle(r) + if throttle { + if delay, ok := getRetryDelay(r); ok { + return delay } - minDelay = d.MinThrottleDelay - } - - retryCount := r.RetryCount - // maxDelay the maximum retryer delay - maxDelay := d.MaxRetryDelay - - if isThrottle { - maxDelay = d.MaxThrottleDelay + minTime = 500 } - var delay time.Duration - - // Logic to cap the retry count based on the minDelay provided - actualRetryCount := int(math.Log2(float64(minDelay))) + 1 - if actualRetryCount < 63-retryCount { - delay = time.Duration(1< maxDelay { - delay = getJitterDelay(maxDelay / 2) - } - } else { - delay = getJitterDelay(maxDelay / 2) + retryCount := r.RetryCount + if throttle && retryCount > 8 { + retryCount = 8 + } else if retryCount > 13 { + retryCount = 13 } - return delay + initialDelay -} -// getJitterDelay returns a jittered delay for retry -func getJitterDelay(duration time.Duration) time.Duration { - return time.Duration(sdkrand.SeededRand.Int63n(int64(duration)) + int64(duration)) + delay := (1 << uint(retryCount)) * (sdkrand.SeededRand.Intn(minTime) + minTime) + return time.Duration(delay) * time.Millisecond } // ShouldRetry returns true if the request should be retried. func (d DefaultRetryer) ShouldRetry(r *request.Request) bool { - - // ShouldRetry returns false if number of max retries is 0. - if d.NumMaxRetries == 0 { - return false - } - // If one of the other handlers already set the retry state // we don't want to override it based on the service's state if r.Retryable != nil { return *r.Retryable } - return r.IsErrorRetryable() || r.IsErrorThrottle() + + if r.HTTPResponse.StatusCode >= 500 && r.HTTPResponse.StatusCode != 501 { + return true + } + return r.IsErrorRetryable() || d.shouldThrottle(r) +} + +// ShouldThrottle returns true if the request should be throttled. +func (d DefaultRetryer) shouldThrottle(r *request.Request) bool { + switch r.HTTPResponse.StatusCode { + case 429: + case 502: + case 503: + case 504: + default: + return r.IsErrorThrottle() + } + + return true } // This will look in the Retry-After header, RFC 7231, for how long // it will wait before attempting another request -func getRetryAfterDelay(r *request.Request) (time.Duration, bool) { +func getRetryDelay(r *request.Request) (time.Duration, bool) { if !canUseRetryAfterHeader(r) { return 0, false } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go index 8958c32d4..7b5e1276a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go @@ -67,14 +67,10 @@ func logRequest(r *request.Request) { if !bodySeekable { r.SetReaderBody(aws.ReadSeekCloser(r.HTTPRequest.Body)) } - // Reset the request body because dumpRequest will re-wrap the - // r.HTTPRequest's Body as a NoOpCloser and will not be reset after - // read by the HTTP client reader. - if err := r.Error; err != nil { - r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, - r.ClientInfo.ServiceName, r.Operation.Name, err)) - return - } + // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's + // Body as a NoOpCloser and will not be reset after read by the HTTP + // client reader. + r.ResetBody() } r.Config.Logger.Log(fmt.Sprintf(logReqMsg, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/no_op_retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/client/no_op_retryer.go deleted file mode 100644 index 881d575f0..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/no_op_retryer.go +++ /dev/null @@ -1,28 +0,0 @@ -package client - -import ( - "time" - - "github.com/aws/aws-sdk-go/aws/request" -) - -// NoOpRetryer provides a retryer that performs no retries. -// It should be used when we do not want retries to be performed. -type NoOpRetryer struct{} - -// MaxRetries returns the number of maximum returns the service will use to make -// an individual API; For NoOpRetryer the MaxRetries will always be zero. -func (d NoOpRetryer) MaxRetries() int { - return 0 -} - -// ShouldRetry will always return false for NoOpRetryer, as it should never retry. -func (d NoOpRetryer) ShouldRetry(_ *request.Request) bool { - return false -} - -// RetryRules returns the delay duration before retrying this request again; -// since NoOpRetryer does not retry, RetryRules always returns 0. -func (d NoOpRetryer) RetryRules(_ *request.Request) time.Duration { - return 0 -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config.go b/vendor/github.com/aws/aws-sdk-go/aws/config.go index fd1e240f6..10634d173 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/config.go @@ -20,7 +20,7 @@ type RequestRetryer interface{} // A Config provides service configuration for service clients. By default, // all clients will use the defaults.DefaultConfig structure. // -// // Create Session with MaxRetries configuration to be shared by multiple +// // Create Session with MaxRetry configuration to be shared by multiple // // service clients. // sess := session.Must(session.NewSession(&aws.Config{ // MaxRetries: aws.Int(3), @@ -251,7 +251,7 @@ type Config struct { // NewConfig returns a new Config pointer that can be chained with builder // methods to set multiple configuration values inline without using pointers. // -// // Create Session with MaxRetries configuration to be shared by multiple +// // Create Session with MaxRetry configuration to be shared by multiple // // service clients. // sess := session.Must(session.NewSession(aws.NewConfig(). // WithMaxRetries(3), diff --git a/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go b/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go index 4e076c183..ff5d58e06 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go @@ -179,242 +179,6 @@ func IntValueMap(src map[string]*int) map[string]int { return dst } -// Uint returns a pointer to the uint value passed in. -func Uint(v uint) *uint { - return &v -} - -// UintValue returns the value of the uint pointer passed in or -// 0 if the pointer is nil. -func UintValue(v *uint) uint { - if v != nil { - return *v - } - return 0 -} - -// UintSlice converts a slice of uint values uinto a slice of -// uint pointers -func UintSlice(src []uint) []*uint { - dst := make([]*uint, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// UintValueSlice converts a slice of uint pointers uinto a slice of -// uint values -func UintValueSlice(src []*uint) []uint { - dst := make([]uint, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// UintMap converts a string map of uint values uinto a string -// map of uint pointers -func UintMap(src map[string]uint) map[string]*uint { - dst := make(map[string]*uint) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// UintValueMap converts a string map of uint pointers uinto a string -// map of uint values -func UintValueMap(src map[string]*uint) map[string]uint { - dst := make(map[string]uint) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int8 returns a pointer to the int8 value passed in. -func Int8(v int8) *int8 { - return &v -} - -// Int8Value returns the value of the int8 pointer passed in or -// 0 if the pointer is nil. -func Int8Value(v *int8) int8 { - if v != nil { - return *v - } - return 0 -} - -// Int8Slice converts a slice of int8 values into a slice of -// int8 pointers -func Int8Slice(src []int8) []*int8 { - dst := make([]*int8, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Int8ValueSlice converts a slice of int8 pointers into a slice of -// int8 values -func Int8ValueSlice(src []*int8) []int8 { - dst := make([]int8, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Int8Map converts a string map of int8 values into a string -// map of int8 pointers -func Int8Map(src map[string]int8) map[string]*int8 { - dst := make(map[string]*int8) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Int8ValueMap converts a string map of int8 pointers into a string -// map of int8 values -func Int8ValueMap(src map[string]*int8) map[string]int8 { - dst := make(map[string]int8) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int16 returns a pointer to the int16 value passed in. -func Int16(v int16) *int16 { - return &v -} - -// Int16Value returns the value of the int16 pointer passed in or -// 0 if the pointer is nil. -func Int16Value(v *int16) int16 { - if v != nil { - return *v - } - return 0 -} - -// Int16Slice converts a slice of int16 values into a slice of -// int16 pointers -func Int16Slice(src []int16) []*int16 { - dst := make([]*int16, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Int16ValueSlice converts a slice of int16 pointers into a slice of -// int16 values -func Int16ValueSlice(src []*int16) []int16 { - dst := make([]int16, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Int16Map converts a string map of int16 values into a string -// map of int16 pointers -func Int16Map(src map[string]int16) map[string]*int16 { - dst := make(map[string]*int16) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Int16ValueMap converts a string map of int16 pointers into a string -// map of int16 values -func Int16ValueMap(src map[string]*int16) map[string]int16 { - dst := make(map[string]int16) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Int32 returns a pointer to the int32 value passed in. -func Int32(v int32) *int32 { - return &v -} - -// Int32Value returns the value of the int32 pointer passed in or -// 0 if the pointer is nil. -func Int32Value(v *int32) int32 { - if v != nil { - return *v - } - return 0 -} - -// Int32Slice converts a slice of int32 values into a slice of -// int32 pointers -func Int32Slice(src []int32) []*int32 { - dst := make([]*int32, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Int32ValueSlice converts a slice of int32 pointers into a slice of -// int32 values -func Int32ValueSlice(src []*int32) []int32 { - dst := make([]int32, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Int32Map converts a string map of int32 values into a string -// map of int32 pointers -func Int32Map(src map[string]int32) map[string]*int32 { - dst := make(map[string]*int32) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Int32ValueMap converts a string map of int32 pointers into a string -// map of int32 values -func Int32ValueMap(src map[string]*int32) map[string]int32 { - dst := make(map[string]int32) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - // Int64 returns a pointer to the int64 value passed in. func Int64(v int64) *int64 { return &v @@ -474,301 +238,6 @@ func Int64ValueMap(src map[string]*int64) map[string]int64 { return dst } -// Uint8 returns a pointer to the uint8 value passed in. -func Uint8(v uint8) *uint8 { - return &v -} - -// Uint8Value returns the value of the uint8 pointer passed in or -// 0 if the pointer is nil. -func Uint8Value(v *uint8) uint8 { - if v != nil { - return *v - } - return 0 -} - -// Uint8Slice converts a slice of uint8 values into a slice of -// uint8 pointers -func Uint8Slice(src []uint8) []*uint8 { - dst := make([]*uint8, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Uint8ValueSlice converts a slice of uint8 pointers into a slice of -// uint8 values -func Uint8ValueSlice(src []*uint8) []uint8 { - dst := make([]uint8, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Uint8Map converts a string map of uint8 values into a string -// map of uint8 pointers -func Uint8Map(src map[string]uint8) map[string]*uint8 { - dst := make(map[string]*uint8) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Uint8ValueMap converts a string map of uint8 pointers into a string -// map of uint8 values -func Uint8ValueMap(src map[string]*uint8) map[string]uint8 { - dst := make(map[string]uint8) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint16 returns a pointer to the uint16 value passed in. -func Uint16(v uint16) *uint16 { - return &v -} - -// Uint16Value returns the value of the uint16 pointer passed in or -// 0 if the pointer is nil. -func Uint16Value(v *uint16) uint16 { - if v != nil { - return *v - } - return 0 -} - -// Uint16Slice converts a slice of uint16 values into a slice of -// uint16 pointers -func Uint16Slice(src []uint16) []*uint16 { - dst := make([]*uint16, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Uint16ValueSlice converts a slice of uint16 pointers into a slice of -// uint16 values -func Uint16ValueSlice(src []*uint16) []uint16 { - dst := make([]uint16, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Uint16Map converts a string map of uint16 values into a string -// map of uint16 pointers -func Uint16Map(src map[string]uint16) map[string]*uint16 { - dst := make(map[string]*uint16) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Uint16ValueMap converts a string map of uint16 pointers into a string -// map of uint16 values -func Uint16ValueMap(src map[string]*uint16) map[string]uint16 { - dst := make(map[string]uint16) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint32 returns a pointer to the uint32 value passed in. -func Uint32(v uint32) *uint32 { - return &v -} - -// Uint32Value returns the value of the uint32 pointer passed in or -// 0 if the pointer is nil. -func Uint32Value(v *uint32) uint32 { - if v != nil { - return *v - } - return 0 -} - -// Uint32Slice converts a slice of uint32 values into a slice of -// uint32 pointers -func Uint32Slice(src []uint32) []*uint32 { - dst := make([]*uint32, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Uint32ValueSlice converts a slice of uint32 pointers into a slice of -// uint32 values -func Uint32ValueSlice(src []*uint32) []uint32 { - dst := make([]uint32, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Uint32Map converts a string map of uint32 values into a string -// map of uint32 pointers -func Uint32Map(src map[string]uint32) map[string]*uint32 { - dst := make(map[string]*uint32) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Uint32ValueMap converts a string map of uint32 pointers into a string -// map of uint32 values -func Uint32ValueMap(src map[string]*uint32) map[string]uint32 { - dst := make(map[string]uint32) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Uint64 returns a pointer to the uint64 value passed in. -func Uint64(v uint64) *uint64 { - return &v -} - -// Uint64Value returns the value of the uint64 pointer passed in or -// 0 if the pointer is nil. -func Uint64Value(v *uint64) uint64 { - if v != nil { - return *v - } - return 0 -} - -// Uint64Slice converts a slice of uint64 values into a slice of -// uint64 pointers -func Uint64Slice(src []uint64) []*uint64 { - dst := make([]*uint64, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Uint64ValueSlice converts a slice of uint64 pointers into a slice of -// uint64 values -func Uint64ValueSlice(src []*uint64) []uint64 { - dst := make([]uint64, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Uint64Map converts a string map of uint64 values into a string -// map of uint64 pointers -func Uint64Map(src map[string]uint64) map[string]*uint64 { - dst := make(map[string]*uint64) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Uint64ValueMap converts a string map of uint64 pointers into a string -// map of uint64 values -func Uint64ValueMap(src map[string]*uint64) map[string]uint64 { - dst := make(map[string]uint64) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - -// Float32 returns a pointer to the float32 value passed in. -func Float32(v float32) *float32 { - return &v -} - -// Float32Value returns the value of the float32 pointer passed in or -// 0 if the pointer is nil. -func Float32Value(v *float32) float32 { - if v != nil { - return *v - } - return 0 -} - -// Float32Slice converts a slice of float32 values into a slice of -// float32 pointers -func Float32Slice(src []float32) []*float32 { - dst := make([]*float32, len(src)) - for i := 0; i < len(src); i++ { - dst[i] = &(src[i]) - } - return dst -} - -// Float32ValueSlice converts a slice of float32 pointers into a slice of -// float32 values -func Float32ValueSlice(src []*float32) []float32 { - dst := make([]float32, len(src)) - for i := 0; i < len(src); i++ { - if src[i] != nil { - dst[i] = *(src[i]) - } - } - return dst -} - -// Float32Map converts a string map of float32 values into a string -// map of float32 pointers -func Float32Map(src map[string]float32) map[string]*float32 { - dst := make(map[string]*float32) - for k, val := range src { - v := val - dst[k] = &v - } - return dst -} - -// Float32ValueMap converts a string map of float32 pointers into a string -// map of float32 values -func Float32ValueMap(src map[string]*float32) map[string]float32 { - dst := make(map[string]float32) - for k, val := range src { - if val != nil { - dst[k] = *val - } - } - return dst -} - // Float64 returns a pointer to the float64 value passed in. func Float64(v float64) *float64 { return &v diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go index 0c60e612e..f8853d78a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -159,9 +159,9 @@ func handleSendError(r *request.Request, err error) { Body: ioutil.NopCloser(bytes.NewReader([]byte{})), } } - // Catch all request errors, and let the default retrier determine - // if the error is retryable. + // Catch all other request errors. r.Error = awserr.New("RequestError", "send request failed", err) + r.Retryable = aws.Bool(true) // network errors are retryable // Override the error with a context canceled error, if that was canceled. ctx := r.Context() @@ -184,39 +184,37 @@ var ValidateResponseHandler = request.NamedHandler{Name: "core.ValidateResponseH // AfterRetryHandler performs final checks to determine if the request should // be retried and how long to delay. -var AfterRetryHandler = request.NamedHandler{ - Name: "core.AfterRetryHandler", - Fn: func(r *request.Request) { - // If one of the other handlers already set the retry state - // we don't want to override it based on the service's state - if r.Retryable == nil || aws.BoolValue(r.Config.EnforceShouldRetryCheck) { - r.Retryable = aws.Bool(r.ShouldRetry(r)) - } - - if r.WillRetry() { - r.RetryDelay = r.RetryRules(r) +var AfterRetryHandler = request.NamedHandler{Name: "core.AfterRetryHandler", Fn: func(r *request.Request) { + // If one of the other handlers already set the retry state + // we don't want to override it based on the service's state + if r.Retryable == nil || aws.BoolValue(r.Config.EnforceShouldRetryCheck) { + r.Retryable = aws.Bool(r.ShouldRetry(r)) + } - if sleepFn := r.Config.SleepDelay; sleepFn != nil { - // Support SleepDelay for backwards compatibility and testing - sleepFn(r.RetryDelay) - } else if err := aws.SleepWithContext(r.Context(), r.RetryDelay); err != nil { - r.Error = awserr.New(request.CanceledErrorCode, - "request context canceled", err) - r.Retryable = aws.Bool(false) - return - } + if r.WillRetry() { + r.RetryDelay = r.RetryRules(r) - // when the expired token exception occurs the credentials - // need to be expired locally so that the next request to - // get credentials will trigger a credentials refresh. - if r.IsErrorExpired() { - r.Config.Credentials.Expire() - } + if sleepFn := r.Config.SleepDelay; sleepFn != nil { + // Support SleepDelay for backwards compatibility and testing + sleepFn(r.RetryDelay) + } else if err := aws.SleepWithContext(r.Context(), r.RetryDelay); err != nil { + r.Error = awserr.New(request.CanceledErrorCode, + "request context canceled", err) + r.Retryable = aws.Bool(false) + return + } - r.RetryCount++ - r.Error = nil + // when the expired token exception occurs the credentials + // need to be expired locally so that the next request to + // get credentials will trigger a credentials refresh. + if r.IsErrorExpired() { + r.Config.Credentials.Expire() } - }} + + r.RetryCount++ + r.Error = nil + } +}} // ValidateEndpointHandler is a request handler to validate a request had the // appropriate Region and Endpoint set. Will set r.Error if the endpoint or diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go index 4af592158..894bbc7f8 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go @@ -50,10 +50,9 @@ package credentials import ( "fmt" + "github.com/aws/aws-sdk-go/aws/awserr" "sync" "time" - - "github.com/aws/aws-sdk-go/aws/awserr" ) // AnonymousCredentials is an empty Credential object that can be used as @@ -84,12 +83,6 @@ type Value struct { ProviderName string } -// HasKeys returns if the credentials Value has both AccessKeyID and -// SecretAccessKey value set. -func (v Value) HasKeys() bool { - return len(v.AccessKeyID) != 0 && len(v.SecretAccessKey) != 0 -} - // A Provider is the interface for any component which will provide credentials // Value. A provider is required to manage its own Expired state, and what to // be expired means. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go index 1a7af53a4..c2b2c5d65 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go @@ -98,8 +98,8 @@ func NewProviderClient(cfg aws.Config, handlers request.Handlers, endpoint strin return p } -// NewCredentialsClient returns a pointer to a new Credentials object -// wrapping the endpoint credentials Provider. +// NewCredentialsClient returns a Credentials wrapper for retrieving credentials +// from an arbitrary endpoint concurrently. The client will request the func NewCredentialsClient(cfg aws.Config, handlers request.Handlers, endpoint string, options ...func(*Provider)) *credentials.Credentials { return credentials.NewCredentials(NewProviderClient(cfg, handlers, endpoint, options...)) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go index 2e528d130..b6dbfd246 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go @@ -200,7 +200,7 @@ type AssumeRoleProvider struct { // by a random percentage between 0 and MaxJitterFraction. MaxJitterFrac must // have a value between 0 and 1. Any other value may lead to expected behavior. // With a MaxJitterFrac value of 0, default) will no jitter will be used. - // + // // For example, with a Duration of 30m and a MaxJitterFrac of 0.1, the // AssumeRole call will be made with an arbitrary Duration between 27m and // 30m. @@ -258,6 +258,7 @@ func NewCredentialsWithClient(svc AssumeRoler, roleARN string, options ...func(* // Retrieve generates a new set of temporary credentials using STS. func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { + // Apply defaults where parameters are not set. if p.RoleSessionName == "" { // Try to work out a role name that will hopefully end up unique. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go deleted file mode 100644 index b20b63394..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go +++ /dev/null @@ -1,100 +0,0 @@ -package stscreds - -import ( - "fmt" - "io/ioutil" - "strconv" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/service/sts" - "github.com/aws/aws-sdk-go/service/sts/stsiface" -) - -const ( - // ErrCodeWebIdentity will be used as an error code when constructing - // a new error to be returned during session creation or retrieval. - ErrCodeWebIdentity = "WebIdentityErr" - - // WebIdentityProviderName is the web identity provider name - WebIdentityProviderName = "WebIdentityCredentials" -) - -// now is used to return a time.Time object representing -// the current time. This can be used to easily test and -// compare test values. -var now = time.Now - -// WebIdentityRoleProvider is used to retrieve credentials using -// an OIDC token. -type WebIdentityRoleProvider struct { - credentials.Expiry - - client stsiface.STSAPI - ExpiryWindow time.Duration - - tokenFilePath string - roleARN string - roleSessionName string -} - -// NewWebIdentityCredentials will return a new set of credentials with a given -// configuration, role arn, and token file path. -func NewWebIdentityCredentials(c client.ConfigProvider, roleARN, roleSessionName, path string) *credentials.Credentials { - svc := sts.New(c) - p := NewWebIdentityRoleProvider(svc, roleARN, roleSessionName, path) - return credentials.NewCredentials(p) -} - -// NewWebIdentityRoleProvider will return a new WebIdentityRoleProvider with the -// provided stsiface.STSAPI -func NewWebIdentityRoleProvider(svc stsiface.STSAPI, roleARN, roleSessionName, path string) *WebIdentityRoleProvider { - return &WebIdentityRoleProvider{ - client: svc, - tokenFilePath: path, - roleARN: roleARN, - roleSessionName: roleSessionName, - } -} - -// Retrieve will attempt to assume a role from a token which is located at -// 'WebIdentityTokenFilePath' specified destination and if that is empty an -// error will be returned. -func (p *WebIdentityRoleProvider) Retrieve() (credentials.Value, error) { - b, err := ioutil.ReadFile(p.tokenFilePath) - if err != nil { - errMsg := fmt.Sprintf("unable to read file at %s", p.tokenFilePath) - return credentials.Value{}, awserr.New(ErrCodeWebIdentity, errMsg, err) - } - - sessionName := p.roleSessionName - if len(sessionName) == 0 { - // session name is used to uniquely identify a session. This simply - // uses unix time in nanoseconds to uniquely identify sessions. - sessionName = strconv.FormatInt(now().UnixNano(), 10) - } - req, resp := p.client.AssumeRoleWithWebIdentityRequest(&sts.AssumeRoleWithWebIdentityInput{ - RoleArn: &p.roleARN, - RoleSessionName: &sessionName, - WebIdentityToken: aws.String(string(b)), - }) - // InvalidIdentityToken error is a temporary error that can occur - // when assuming an Role with a JWT web identity token. - req.RetryErrorCodes = append(req.RetryErrorCodes, sts.ErrCodeInvalidIdentityTokenException) - if err := req.Send(); err != nil { - return credentials.Value{}, awserr.New(ErrCodeWebIdentity, "failed to retrieve credentials", err) - } - - p.SetExpiration(aws.TimeValue(resp.Credentials.Expiration), p.ExpiryWindow) - - value := credentials.Value{ - AccessKeyID: aws.StringValue(resp.Credentials.AccessKeyId), - SecretAccessKey: aws.StringValue(resp.Credentials.SecretAccessKey), - SessionToken: aws.StringValue(resp.Credentials.SessionToken), - ProviderName: WebIdentityProviderName, - } - return value, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go index 25a66d1dd..152d785b3 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go @@ -1,61 +1,30 @@ -// Package csm provides the Client Side Monitoring (CSM) client which enables -// sending metrics via UDP connection to the CSM agent. This package provides -// control options, and configuration for the CSM client. The client can be -// controlled manually, or automatically via the SDK's Session configuration. +// Package csm provides Client Side Monitoring (CSM) which enables sending metrics +// via UDP connection. Using the Start function will enable the reporting of +// metrics on a given port. If Start is called, with different parameters, again, +// a panic will occur. // -// Enabling CSM client via SDK's Session configuration -// -// The CSM client can be enabled automatically via SDK's Session configuration. -// The SDK's session configuration enables the CSM client if the AWS_CSM_PORT -// environment variable is set to a non-empty value. -// -// The configuration options for the CSM client via the SDK's session -// configuration are: -// -// * AWS_CSM_PORT= -// The port number the CSM agent will receive metrics on. -// -// * AWS_CSM_HOST= -// The hostname, or IP address the CSM agent will receive metrics on. -// Without port number. -// -// Manually enabling the CSM client -// -// The CSM client can be started, paused, and resumed manually. The Start -// function will enable the CSM client to publish metrics to the CSM agent. It -// is safe to call Start concurrently, but if Start is called additional times -// with different ClientID or address it will panic. +// Pause can be called to pause any metrics publishing on a given port. Sessions +// that have had their handlers modified via InjectHandlers may still be used. +// However, the handlers will act as a no-op meaning no metrics will be published. // +// Example: // r, err := csm.Start("clientID", ":31000") // if err != nil { // panic(fmt.Errorf("failed starting CSM: %v", err)) // } // -// When controlling the CSM client manually, you must also inject its request -// handlers into the SDK's Session configuration for the SDK's API clients to -// publish metrics. -// // sess, err := session.NewSession(&aws.Config{}) // if err != nil { // panic(fmt.Errorf("failed loading session: %v", err)) // } // -// // Add CSM client's metric publishing request handlers to the SDK's -// // Session Configuration. // r.InjectHandlers(&sess.Handlers) // -// Controlling CSM client -// -// Once the CSM client has been enabled the Get function will return a Reporter -// value that you can use to pause and resume the metrics published to the CSM -// agent. If Get function is called before the reporter is enabled with the -// Start function or via SDK's Session configuration nil will be returned. -// -// The Pause method can be called to stop the CSM client publishing metrics to -// the CSM agent. The Continue method will resume metric publishing. -// -// // Get the CSM client Reporter. -// r := csm.Get() +// client := s3.New(sess) +// resp, err := client.GetObject(&s3.GetObjectInput{ +// Bucket: aws.String("bucket"), +// Key: aws.String("key"), +// }) // // // Will pause monitoring // r.Pause() @@ -66,4 +35,12 @@ // // // Resume monitoring // r.Continue() +// +// Start returns a Reporter that is used to enable or disable monitoring. If +// access to the Reporter is required later, calling Get will return the Reporter +// singleton. +// +// Example: +// r := csm.Get() +// r.Continue() package csm diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go index 4b19e2800..2f0c6eac9 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go @@ -2,7 +2,6 @@ package csm import ( "fmt" - "strings" "sync" ) @@ -10,40 +9,19 @@ var ( lock sync.Mutex ) +// Client side metric handler names const ( - // DefaultPort is used when no port is specified. - DefaultPort = "31000" - - // DefaultHost is the host that will be used when none is specified. - DefaultHost = "127.0.0.1" + APICallMetricHandlerName = "awscsm.SendAPICallMetric" + APICallAttemptMetricHandlerName = "awscsm.SendAPICallAttemptMetric" ) -// AddressWithDefaults returns a CSM address built from the host and port -// values. If the host or port is not set, default values will be used -// instead. If host is "localhost" it will be replaced with "127.0.0.1". -func AddressWithDefaults(host, port string) string { - if len(host) == 0 || strings.EqualFold(host, "localhost") { - host = DefaultHost - } - - if len(port) == 0 { - port = DefaultPort - } - - // Only IP6 host can contain a colon - if strings.Contains(host, ":") { - return "[" + host + "]:" + port - } - - return host + ":" + port -} - -// Start will start a long running go routine to capture +// Start will start the a long running go routine to capture // client side metrics. Calling start multiple time will only // start the metric listener once and will panic if a different // client ID or port is passed in. // -// r, err := csm.Start("clientID", "127.0.0.1:31000") +// Example: +// r, err := csm.Start("clientID", "127.0.0.1:8094") // if err != nil { // panic(fmt.Errorf("expected no error, but received %v", err)) // } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan.go index 82a3e345e..514fc3739 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan.go @@ -16,26 +16,25 @@ var ( type metricChan struct { ch chan metric - paused *int64 + paused int64 } func newMetricChan(size int) metricChan { return metricChan{ - ch: make(chan metric, size), - paused: new(int64), + ch: make(chan metric, size), } } func (ch *metricChan) Pause() { - atomic.StoreInt64(ch.paused, pausedEnum) + atomic.StoreInt64(&ch.paused, pausedEnum) } func (ch *metricChan) Continue() { - atomic.StoreInt64(ch.paused, runningEnum) + atomic.StoreInt64(&ch.paused, runningEnum) } func (ch *metricChan) IsPaused() bool { - v := atomic.LoadInt64(ch.paused) + v := atomic.LoadInt64(&ch.paused) return v == pausedEnum } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go index c7008d8c3..d9aa5b062 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go @@ -10,6 +10,11 @@ import ( "github.com/aws/aws-sdk-go/aws/request" ) +const ( + // DefaultPort is used when no port is specified + DefaultPort = "31000" +) + // Reporter will gather metrics of API requests made and // send those metrics to the CSM endpoint. type Reporter struct { @@ -118,7 +123,7 @@ func (rep *Reporter) sendAPICallMetric(r *request.Request) { Type: aws.String("ApiCall"), AttemptCount: aws.Int(r.RetryCount + 1), Region: r.Config.Region, - Latency: aws.Int(int(time.Since(r.Time) / time.Millisecond)), + Latency: aws.Int(int(time.Now().Sub(r.Time) / time.Millisecond)), XAmzRequestID: aws.String(r.RequestID), MaxRetriesExceeded: aws.Int(boolIntValue(r.RetryCount >= r.MaxRetries())), } @@ -185,9 +190,8 @@ func (rep *Reporter) start() { } } -// Pause will pause the metric channel preventing any new metrics from being -// added. It is safe to call concurrently with other calls to Pause, but if -// called concurently with Continue can lead to unexpected state. +// Pause will pause the metric channel preventing any new metrics from +// being added. func (rep *Reporter) Pause() { lock.Lock() defer lock.Unlock() @@ -199,9 +203,8 @@ func (rep *Reporter) Pause() { rep.close() } -// Continue will reopen the metric channel and allow for monitoring to be -// resumed. It is safe to call concurrently with other calls to Continue, but -// if called concurently with Pause can lead to unexpected state. +// Continue will reopen the metric channel and allow for monitoring +// to be resumed. func (rep *Reporter) Continue() { lock.Lock() defer lock.Unlock() @@ -216,18 +219,10 @@ func (rep *Reporter) Continue() { rep.metricsCh.Continue() } -// Client side metric handler names -const ( - APICallMetricHandlerName = "awscsm.SendAPICallMetric" - APICallAttemptMetricHandlerName = "awscsm.SendAPICallAttemptMetric" -) - // InjectHandlers will will enable client side metrics and inject the proper // handlers to handle how metrics are sent. // -// InjectHandlers is NOT safe to call concurrently. Calling InjectHandlers -// multiple times may lead to unexpected behavior, (e.g. duplicate metrics). -// +// Example: // // Start must be called in order to inject the correct handlers // r, err := csm.Start("clientID", "127.0.0.1:8094") // if err != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go index d126764ce..2c8d5f56d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go @@ -152,19 +152,18 @@ type EC2IAMInfo struct { // An EC2InstanceIdentityDocument provides the shape for unmarshaling // an instance identity document type EC2InstanceIdentityDocument struct { - DevpayProductCodes []string `json:"devpayProductCodes"` - MarketplaceProductCodes []string `json:"marketplaceProductCodes"` - AvailabilityZone string `json:"availabilityZone"` - PrivateIP string `json:"privateIp"` - Version string `json:"version"` - Region string `json:"region"` - InstanceID string `json:"instanceId"` - BillingProducts []string `json:"billingProducts"` - InstanceType string `json:"instanceType"` - AccountID string `json:"accountId"` - PendingTime time.Time `json:"pendingTime"` - ImageID string `json:"imageId"` - KernelID string `json:"kernelId"` - RamdiskID string `json:"ramdiskId"` - Architecture string `json:"architecture"` + DevpayProductCodes []string `json:"devpayProductCodes"` + AvailabilityZone string `json:"availabilityZone"` + PrivateIP string `json:"privateIp"` + Version string `json:"version"` + Region string `json:"region"` + InstanceID string `json:"instanceId"` + BillingProducts []string `json:"billingProducts"` + InstanceType string `json:"instanceType"` + AccountID string `json:"accountId"` + PendingTime time.Time `json:"pendingTime"` + ImageID string `json:"imageId"` + KernelID string `json:"kernelId"` + RamdiskID string `json:"ramdiskId"` + Architecture string `json:"architecture"` } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go index 4c5636e35..f0c1d31e7 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go @@ -123,7 +123,7 @@ func unmarshalHandler(r *request.Request) { defer r.HTTPResponse.Body.Close() b := &bytes.Buffer{} if _, err := io.Copy(b, r.HTTPResponse.Body); err != nil { - r.Error = awserr.New(request.ErrCodeSerialization, "unable to unmarshal EC2 metadata response", err) + r.Error = awserr.New(request.ErrCodeSerialization, "unable to unmarshal EC2 metadata respose", err) return } @@ -136,7 +136,7 @@ func unmarshalError(r *request.Request) { defer r.HTTPResponse.Body.Close() b := &bytes.Buffer{} if _, err := io.Copy(b, r.HTTPResponse.Body); err != nil { - r.Error = awserr.New(request.ErrCodeSerialization, "unable to unmarshal EC2 metadata error response", err) + r.Error = awserr.New(request.ErrCodeSerialization, "unable to unmarshal EC2 metadata error respose", err) return } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 452cefda6..14e32bc42 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -11,8 +11,6 @@ const ( AwsPartitionID = "aws" // AWS Standard partition. AwsCnPartitionID = "aws-cn" // AWS China partition. AwsUsGovPartitionID = "aws-us-gov" // AWS GovCloud (US) partition. - AwsIsoPartitionID = "aws-iso" // AWS ISO (US) partition. - AwsIsoBPartitionID = "aws-iso-b" // AWS ISOB (US) partition. ) // AWS Standard partition's regions. @@ -29,7 +27,6 @@ const ( EuWest1RegionID = "eu-west-1" // EU (Ireland). EuWest2RegionID = "eu-west-2" // EU (London). EuWest3RegionID = "eu-west-3" // EU (Paris). - MeSouth1RegionID = "me-south-1" // Middle East (Bahrain). SaEast1RegionID = "sa-east-1" // South America (Sao Paulo). UsEast1RegionID = "us-east-1" // US East (N. Virginia). UsEast2RegionID = "us-east-2" // US East (Ohio). @@ -49,18 +46,8 @@ const ( UsGovWest1RegionID = "us-gov-west-1" // AWS GovCloud (US). ) -// AWS ISO (US) partition's regions. -const ( - UsIsoEast1RegionID = "us-iso-east-1" // US ISO East. -) - -// AWS ISOB (US) partition's regions. -const ( - UsIsobEast1RegionID = "us-isob-east-1" // US ISOB East (Ohio). -) - // DefaultResolver returns an Endpoint resolver that will be able -// to resolve endpoints for: AWS Standard, AWS China, AWS GovCloud (US), AWS ISO (US), and AWS ISOB (US). +// to resolve endpoints for: AWS Standard, AWS China, and AWS GovCloud (US). // // Use DefaultPartitions() to get the list of the default partitions. func DefaultResolver() Resolver { @@ -68,7 +55,7 @@ func DefaultResolver() Resolver { } // DefaultPartitions returns a list of the partitions the SDK is bundled -// with. The available partitions are: AWS Standard, AWS China, AWS GovCloud (US), AWS ISO (US), and AWS ISOB (US). +// with. The available partitions are: AWS Standard, AWS China, and AWS GovCloud (US). // // partitions := endpoints.DefaultPartitions // for _, p := range partitions { @@ -82,8 +69,6 @@ var defaultPartitions = partitions{ awsPartition, awscnPartition, awsusgovPartition, - awsisoPartition, - awsisobPartition, } // AwsPartition returns the Resolver for AWS Standard. @@ -97,7 +82,7 @@ var awsPartition = partition{ DNSSuffix: "amazonaws.com", RegionRegex: regionRegex{ Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^(us|eu|ap|sa|ca|me)\\-\\w+\\-\\d+$") + reg, _ := regexp.Compile("^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$") return reg }(), }, @@ -143,9 +128,6 @@ var awsPartition = partition{ "eu-west-3": region{ Description: "EU (Paris)", }, - "me-south-1": region{ - Description: "Middle East (Bahrain)", - }, "sa-east-1": region{ Description: "South America (Sao Paulo)", }, @@ -184,7 +166,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -197,7 +178,6 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -290,12 +270,6 @@ var awsPartition = partition{ Region: "eu-west-3", }, }, - "me-south-1": endpoint{ - Hostname: "api.ecr.me-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "me-south-1", - }, - }, "sa-east-1": endpoint{ Hostname: "api.ecr.sa-east-1.amazonaws.com", CredentialScope: credentialScope{ @@ -334,7 +308,6 @@ var awsPartition = partition{ "ap-northeast-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, "us-west-2": endpoint{}, @@ -354,7 +327,6 @@ var awsPartition = partition{ "api.sagemaker": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -362,11 +334,8 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-1-fips": endpoint{ Hostname: "api-fips.sagemaker.us-east-1.amazonaws.com", @@ -412,7 +381,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -441,7 +409,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -504,7 +471,6 @@ var awsPartition = partition{ "athena": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -512,7 +478,6 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "us-east-1": endpoint{}, @@ -537,7 +502,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -569,27 +533,9 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "backup": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, "batch": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -601,7 +547,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -693,7 +638,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -749,7 +693,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -786,7 +729,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -797,7 +739,6 @@ var awsPartition = partition{ "codebuild": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -809,7 +750,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-1-fips": endpoint{ @@ -851,7 +791,6 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -883,7 +822,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-1-fips": endpoint{ @@ -925,7 +863,6 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1022,13 +959,10 @@ var awsPartition = partition{ "comprehendmedical": service{ Endpoints: endpoints{ - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "config": service{ @@ -1046,7 +980,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1054,16 +987,6 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "connect": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, "cur": service{ Endpoints: endpoints{ @@ -1102,35 +1025,10 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "datasync-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "datasync-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "datasync-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "datasync-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "dax": service{ @@ -1158,7 +1056,6 @@ var awsPartition = partition{ "directconnect": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1170,7 +1067,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1199,7 +1095,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1222,12 +1117,6 @@ var awsPartition = partition{ Region: "ap-northeast-2", }, }, - "ap-southeast-2": endpoint{ - Hostname: "rds.ap-southeast-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-southeast-2", - }, - }, "eu-central-1": endpoint{ Hostname: "rds.eu-central-1.amazonaws.com", CredentialScope: credentialScope{ @@ -1240,12 +1129,6 @@ var awsPartition = partition{ Region: "eu-west-1", }, }, - "eu-west-2": endpoint{ - Hostname: "rds.eu-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-2", - }, - }, "us-east-1": endpoint{ Hostname: "rds.us-east-1.amazonaws.com", CredentialScope: credentialScope{ @@ -1276,7 +1159,6 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, @@ -1298,17 +1180,11 @@ var awsPartition = partition{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, - "ca-central-1-fips": endpoint{ - Hostname: "dynamodb-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "local": endpoint{ Hostname: "localhost:8000", Protocols: []string{"http"}, @@ -1316,36 +1192,11 @@ var awsPartition = partition{ Region: "us-east-1", }, }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "dynamodb-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "dynamodb-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "dynamodb-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "dynamodb-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, }, }, "ec2": service{ @@ -1365,7 +1216,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1399,7 +1249,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1428,12 +1277,11 @@ var awsPartition = partition{ Region: "us-west-1", }, }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "elasticbeanstalk": service{ @@ -1451,7 +1299,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1464,14 +1311,12 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -1495,7 +1340,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1523,7 +1367,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{ SSLCommonName: "{service}.{region}.{dnsSuffix}", @@ -1588,12 +1431,11 @@ var awsPartition = partition{ Region: "us-west-1", }, }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "events": service{ @@ -1611,7 +1453,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1622,7 +1463,6 @@ var awsPartition = partition{ "firehose": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1663,15 +1503,10 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, - "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -1711,7 +1546,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1722,7 +1556,6 @@ var awsPartition = partition{ "glue": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1730,12 +1563,9 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -1749,32 +1579,19 @@ var awsPartition = partition{ }, Endpoints: endpoints{ "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, "us-east-1": endpoint{}, - "us-east-2": endpoint{}, "us-west-2": endpoint{}, }, }, - "groundstation": service{ - - Endpoints: endpoints{ - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, "guardduty": service{ IsRegionalized: boxedTrue, Defaults: endpoint{ Protocols: []string{"https"}, }, Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1786,36 +1603,11 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "guardduty-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "guardduty-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "guardduty-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "guardduty-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "health": service{ @@ -1860,9 +1652,7 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -1875,6 +1665,45 @@ var awsPartition = partition{ Service: "execute-api", }, }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "iotanalytics": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "kafka": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "kinesis": service{ + Endpoints: endpoints{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, @@ -1888,7 +1717,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1896,18 +1724,22 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "iotanalytics": service{ + "kinesisanalytics": service{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, }, }, - "iotevents": service{ + "kinesisvideo": service{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, @@ -1915,144 +1747,18 @@ var awsPartition = partition{ "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, - "us-east-2": endpoint{}, "us-west-2": endpoint{}, }, }, - "ioteventsdata": service{ + "kms": service{ Endpoints: endpoints{ - "ap-northeast-1": endpoint{ - Hostname: "data.iotevents.ap-northeast-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ap-northeast-1", - }, - }, - "ap-southeast-2": endpoint{ - Hostname: "data.iotevents.ap-southeast-2.amazonaws.com", + "ProdFips": endpoint{ + Hostname: "kms-fips.ca-central-1.amazonaws.com", CredentialScope: credentialScope{ - Region: "ap-southeast-2", + Region: "ca-central-1", }, }, - "eu-central-1": endpoint{ - Hostname: "data.iotevents.eu-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-central-1", - }, - }, - "eu-west-1": endpoint{ - Hostname: "data.iotevents.eu-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-west-1", - }, - }, - "us-east-1": endpoint{ - Hostname: "data.iotevents.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{ - Hostname: "data.iotevents.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-2": endpoint{ - Hostname: "data.iotevents.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - }, - }, - "iotthingsgraph": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "iotthingsgraph", - }, - }, - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kafka": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "ap-east-1": endpoint{}, - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kinesisanalytics": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kinesisvideo": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "kms": service{ - - Endpoints: endpoints{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, @@ -2065,7 +1771,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2073,16 +1778,6 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "lakeformation": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, "lambda": service{ Endpoints: endpoints{ @@ -2098,7 +1793,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2109,7 +1803,6 @@ var awsPartition = partition{ "license-manager": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2121,7 +1814,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2162,7 +1854,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2192,7 +1883,6 @@ var awsPartition = partition{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2232,7 +1922,6 @@ var awsPartition = partition{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, @@ -2249,7 +1938,6 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, @@ -2289,7 +1977,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2338,7 +2025,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2351,14 +2037,11 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -2414,12 +2097,6 @@ var awsPartition = partition{ Region: "eu-central-1", }, }, - "eu-north-1": endpoint{ - Hostname: "rds.eu-north-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "eu-north-1", - }, - }, "eu-west-1": endpoint{ Hostname: "rds.eu-west-1.amazonaws.com", CredentialScope: credentialScope{ @@ -2547,16 +2224,6 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "qldb": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, "ram": service{ Endpoints: endpoints{ @@ -2567,7 +2234,6 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2592,7 +2258,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{ SSLCommonName: "{service}.{dnsSuffix}", @@ -2617,7 +2282,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -2631,14 +2295,10 @@ var awsPartition = partition{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, - "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, - "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, - "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -2657,47 +2317,19 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "resource-groups-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-east-2": endpoint{ - Hostname: "resource-groups-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "fips-us-west-1": endpoint{ - Hostname: "resource-groups-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "resource-groups-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "robomaker": service{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, - "ap-southeast-1": endpoint{}, - "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, - "us-east-2": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -2756,7 +2388,6 @@ var awsPartition = partition{ "runtime.sagemaker": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2764,39 +2395,12 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "runtime-fips.sagemaker.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "runtime-fips.sagemaker.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, - "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "runtime-fips.sagemaker.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, - "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "runtime-fips.sagemaker.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "s3": service{ @@ -2832,9 +2436,8 @@ var awsPartition = partition{ Hostname: "s3.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "s3-external-1": endpoint{ Hostname: "s3-external-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, @@ -3078,7 +2681,6 @@ var awsPartition = partition{ "securityhub": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -3086,7 +2688,6 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -3200,7 +2801,6 @@ var awsPartition = partition{ "servicediscovery": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -3208,11 +2808,9 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -3220,16 +2818,6 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "session.qldb": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, "shield": service{ IsRegionalized: boxedFalse, Defaults: endpoint{ @@ -3243,7 +2831,6 @@ var awsPartition = partition{ "sms": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -3255,7 +2842,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -3267,7 +2853,6 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, - "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -3300,7 +2885,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -3350,8 +2934,7 @@ var awsPartition = partition{ Region: "us-west-2", }, }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{ SSLCommonName: "queue.{dnsSuffix}", }, @@ -3375,7 +2958,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -3398,7 +2980,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -3409,7 +2990,6 @@ var awsPartition = partition{ "storagegateway": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -3421,7 +3001,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -3443,17 +3022,11 @@ var awsPartition = partition{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, - "ca-central-1-fips": endpoint{ - Hostname: "dynamodb-fips.ca-central-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "ca-central-1", - }, - }, - "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "local": endpoint{ Hostname: "localhost:8000", Protocols: []string{"http"}, @@ -3461,36 +3034,11 @@ var awsPartition = partition{ Region: "us-east-1", }, }, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-1-fips": endpoint{ - Hostname: "dynamodb-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, "us-east-2": endpoint{}, - "us-east-2-fips": endpoint{ - Hostname: "dynamodb-fips.us-east-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-2", - }, - }, "us-west-1": endpoint{}, - "us-west-1-fips": endpoint{ - Hostname: "dynamodb-fips.us-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-1", - }, - }, "us-west-2": endpoint{}, - "us-west-2-fips": endpoint{ - Hostname: "dynamodb-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, }, }, "sts": service{ @@ -3525,14 +3073,8 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{ - Hostname: "sts.me-south-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "me-south-1", - }, - }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, "us-east-1-fips": endpoint{ Hostname: "sts-fips.us-east-1.amazonaws.com", CredentialScope: credentialScope{ @@ -3563,15 +3105,9 @@ var awsPartition = partition{ }, }, "support": service{ - PartitionEndpoint: "aws-global", Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "support.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, + "us-east-1": endpoint{}, }, }, "swf": service{ @@ -3589,7 +3125,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -3612,7 +3147,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -3630,11 +3164,9 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, - "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -3694,16 +3226,12 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, - "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, - "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -3750,7 +3278,6 @@ var awsPartition = partition{ "xray": service{ Endpoints: endpoints{ - "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -3762,7 +3289,6 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -4028,15 +3554,6 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, - "greengrass": service{ - IsRegionalized: boxedTrue, - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, "iam": service{ PartitionEndpoint: "aws-cn-global", IsRegionalized: boxedFalse, @@ -4057,8 +3574,7 @@ var awscnPartition = partition{ }, }, Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, + "cn-north-1": endpoint{}, }, }, "kinesis": service{ @@ -4068,13 +3584,6 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, - "kms": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, "lambda": service{ Endpoints: endpoints{ @@ -4082,13 +3591,6 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, - "license-manager": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, "logs": service{ Endpoints: endpoints{ @@ -4239,18 +3741,6 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, - "support": service{ - PartitionEndpoint: "aws-cn-global", - - Endpoints: endpoints{ - "aws-cn-global": endpoint{ - Hostname: "support.cn-north-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "cn-north-1", - }, - }, - }, - }, "swf": service{ Endpoints: endpoints{ @@ -4408,17 +3898,9 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, - "codebuild": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, "codecommit": service{ Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -4456,18 +3938,6 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, - "datasync": service{ - - Endpoints: endpoints{ - "fips-us-gov-west-1": endpoint{ - Hostname: "datasync-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - "us-gov-west-1": endpoint{}, - }, - }, "directconnect": service{ Endpoints: endpoints{ @@ -4493,12 +3963,6 @@ var awsusgovPartition = partition{ Endpoints: endpoints{ "us-gov-east-1": endpoint{}, - "us-gov-east-1-fips": endpoint{ - Hostname: "dynamodb.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, "us-gov-west-1": endpoint{}, "us-gov-west-1-fips": endpoint{ Hostname: "dynamodb.us-gov-west-1.amazonaws.com", @@ -4600,7 +4064,6 @@ var awsusgovPartition = partition{ "firehose": service{ Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -4615,16 +4078,6 @@ var awsusgovPartition = partition{ }, "glue": service{ - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, - "greengrass": service{ - IsRegionalized: boxedTrue, - Defaults: endpoint{ - Protocols: []string{"https"}, - }, Endpoints: endpoints{ "us-gov-west-1": endpoint{}, }, @@ -4638,12 +4091,6 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, - "health": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, "iam": service{ PartitionEndpoint: "aws-us-gov-global", IsRegionalized: boxedFalse, @@ -4728,7 +4175,6 @@ var awsusgovPartition = partition{ }, }, Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -4739,23 +4185,6 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, - "neptune": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Hostname: "rds.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "us-gov-west-1": endpoint{ - Hostname: "rds.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, "organizations": service{ PartitionEndpoint: "aws-us-gov-global", IsRegionalized: boxedFalse, @@ -4775,13 +4204,6 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, - "ram": service{ - - Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, - }, - }, "rds": service{ Endpoints: endpoints{ @@ -4802,19 +4224,6 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, - "route53": service{ - PartitionEndpoint: "aws-us-gov-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-us-gov-global": endpoint{ - Hostname: "route53.us-gov.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, "runtime.sagemaker": service{ Endpoints: endpoints{ @@ -4878,43 +4287,6 @@ var awsusgovPartition = partition{ }, }, }, - "secretsmanager": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "secretsmanager-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "serverlessrepo": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "us-gov-east-1": endpoint{ - Protocols: []string{"https"}, - }, - "us-gov-west-1": endpoint{ - Protocols: []string{"https"}, - }, - }, - }, - "servicecatalog": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "servicecatalog-fips.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, "sms": service{ Endpoints: endpoints{ @@ -4976,12 +4348,6 @@ var awsusgovPartition = partition{ }, Endpoints: endpoints{ "us-gov-east-1": endpoint{}, - "us-gov-east-1-fips": endpoint{ - Hostname: "dynamodb.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, "us-gov-west-1": endpoint{}, "us-gov-west-1-fips": endpoint{ Hostname: "dynamodb.us-gov-west-1.amazonaws.com", @@ -5040,612 +4406,3 @@ var awsusgovPartition = partition{ }, }, } - -// AwsIsoPartition returns the Resolver for AWS ISO (US). -func AwsIsoPartition() Partition { - return awsisoPartition.Partition() -} - -var awsisoPartition = partition{ - ID: "aws-iso", - Name: "AWS ISO (US)", - DNSSuffix: "c2s.ic.gov", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^us\\-iso\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "us-iso-east-1": region{ - Description: "US ISO East", - }, - }, - Services: services{ - "api.ecr": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Hostname: "api.ecr.us-iso-east-1.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - }, - }, - "application-autoscaling": service{ - Defaults: endpoint{ - Hostname: "autoscaling.{region}.amazonaws.com", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "application-autoscaling", - }, - }, - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "autoscaling": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "codedeploy": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "datapipeline": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "dms": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "ds": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "dynamodb": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "ec2": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "ec2metadata": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - }, - "ecs": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "elasticache": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "elasticloadbalancing": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "elasticmapreduce": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"https"}, - }, - }, - }, - "events": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "glacier": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "health": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "iam": service{ - PartitionEndpoint: "aws-iso-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-iso-global": endpoint{ - Hostname: "iam.us-iso-east-1.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "kms": service{ - - Endpoints: endpoints{ - "ProdFips": endpoint{ - Hostname: "kms-fips.us-iso-east-1.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - "us-iso-east-1": endpoint{}, - }, - }, - "lambda": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "monitoring": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "route53": service{ - PartitionEndpoint: "aws-iso-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-iso-global": endpoint{ - Hostname: "route53.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - }, - }, - "s3": service{ - Defaults: endpoint{ - SignatureVersions: []string{"s3v4"}, - }, - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"s3v4"}, - }, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "sns": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "sqs": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "states": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "streams.dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "dynamodb", - }, - }, - Endpoints: endpoints{ - "us-iso-east-1": endpoint{ - Protocols: []string{"http", "https"}, - }, - }, - }, - "sts": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "support": service{ - PartitionEndpoint: "aws-iso-global", - - Endpoints: endpoints{ - "aws-iso-global": endpoint{ - Hostname: "support.us-iso-east-1.c2s.ic.gov", - CredentialScope: credentialScope{ - Region: "us-iso-east-1", - }, - }, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - "workspaces": service{ - - Endpoints: endpoints{ - "us-iso-east-1": endpoint{}, - }, - }, - }, -} - -// AwsIsoBPartition returns the Resolver for AWS ISOB (US). -func AwsIsoBPartition() Partition { - return awsisobPartition.Partition() -} - -var awsisobPartition = partition{ - ID: "aws-iso-b", - Name: "AWS ISOB (US)", - DNSSuffix: "sc2s.sgov.gov", - RegionRegex: regionRegex{ - Regexp: func() *regexp.Regexp { - reg, _ := regexp.Compile("^us\\-isob\\-\\w+\\-\\d+$") - return reg - }(), - }, - Defaults: endpoint{ - Hostname: "{service}.{region}.{dnsSuffix}", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - Regions: regions{ - "us-isob-east-1": region{ - Description: "US ISOB East (Ohio)", - }, - }, - Services: services{ - "application-autoscaling": service{ - Defaults: endpoint{ - Hostname: "autoscaling.{region}.amazonaws.com", - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "application-autoscaling", - }, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "dms": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "ec2": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "ec2metadata": service{ - PartitionEndpoint: "aws-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-global": endpoint{ - Hostname: "169.254.169.254/latest", - Protocols: []string{"http"}, - }, - }, - }, - "elasticache": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "elasticloadbalancing": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{ - Protocols: []string{"https"}, - }, - }, - }, - "elasticmapreduce": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "events": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "glacier": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "health": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "iam": service{ - PartitionEndpoint: "aws-iso-b-global", - IsRegionalized: boxedFalse, - - Endpoints: endpoints{ - "aws-iso-b-global": endpoint{ - Hostname: "iam.us-isob-east-1.sc2s.sgov.gov", - CredentialScope: credentialScope{ - Region: "us-isob-east-1", - }, - }, - }, - }, - "kinesis": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "kms": service{ - - Endpoints: endpoints{ - "ProdFips": endpoint{ - Hostname: "kms-fips.us-isob-east-1.sc2s.sgov.gov", - CredentialScope: credentialScope{ - Region: "us-isob-east-1", - }, - }, - "us-isob-east-1": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "monitoring": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "s3": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"s3v4"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "sns": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "sqs": service{ - Defaults: endpoint{ - SSLCommonName: "{region}.queue.{dnsSuffix}", - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "states": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "streams.dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - CredentialScope: credentialScope{ - Service: "dynamodb", - }, - }, - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "sts": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - "support": service{ - PartitionEndpoint: "aws-iso-b-global", - - Endpoints: endpoints{ - "aws-iso-b-global": endpoint{ - Hostname: "support.us-isob-east-1.sc2s.sgov.gov", - CredentialScope: credentialScope{ - Region: "us-isob-east-1", - }, - }, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "us-isob-east-1": endpoint{}, - }, - }, - }, -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go index 9c936be6c..f82babf6f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go @@ -170,13 +170,10 @@ func PartitionForRegion(ps []Partition, regionID string) (Partition, bool) { // A Partition provides the ability to enumerate the partition's regions // and services. type Partition struct { - id, dnsSuffix string - p *partition + id string + p *partition } -// DNSSuffix returns the base domain name of the partition. -func (p Partition) DNSSuffix() string { return p.dnsSuffix } - // ID returns the identifier of the partition. func (p Partition) ID() string { return p.id } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go index 523ad79ac..ff6f76db6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go @@ -54,9 +54,8 @@ type partition struct { func (p partition) Partition() Partition { return Partition{ - dnsSuffix: p.DNSSuffix, - id: p.ID, - p: &p, + id: p.ID, + p: &p, } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go index d9b37f4d3..271da432c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go @@ -1,17 +1,18 @@ +// +build !appengine,!plan9 + package request import ( - "strings" + "net" + "os" + "syscall" ) func isErrConnectionReset(err error) bool { - if strings.Contains(err.Error(), "read: connection reset") { - return false - } - - if strings.Contains(err.Error(), "connection reset") || - strings.Contains(err.Error(), "broken pipe") { - return true + if opErr, ok := err.(*net.OpError); ok { + if sysErr, ok := opErr.Err.(*os.SyscallError); ok { + return sysErr.Err == syscall.ECONNRESET + } } return false diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go new file mode 100644 index 000000000..daf9eca43 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go @@ -0,0 +1,11 @@ +// +build appengine plan9 + +package request + +import ( + "strings" +) + +func isErrConnectionReset(err error) bool { + return strings.Contains(err.Error(), "connection reset") +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go index 185b07318..8ef8548a9 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -23,7 +23,7 @@ type Handlers struct { Complete HandlerList } -// Copy returns a copy of this handler's lists. +// Copy returns of this handler's lists. func (h *Handlers) Copy() Handlers { return Handlers{ Validate: h.Validate.copy(), @@ -42,7 +42,7 @@ func (h *Handlers) Copy() Handlers { } } -// Clear removes callback functions for all handlers. +// Clear removes callback functions for all handlers func (h *Handlers) Clear() { h.Validate.Clear() h.Build.Clear() @@ -59,51 +59,6 @@ func (h *Handlers) Clear() { h.Complete.Clear() } -// IsEmpty returns if there are no handlers in any of the handlerlists. -func (h *Handlers) IsEmpty() bool { - if h.Validate.Len() != 0 { - return false - } - if h.Build.Len() != 0 { - return false - } - if h.Send.Len() != 0 { - return false - } - if h.Sign.Len() != 0 { - return false - } - if h.Unmarshal.Len() != 0 { - return false - } - if h.UnmarshalStream.Len() != 0 { - return false - } - if h.UnmarshalMeta.Len() != 0 { - return false - } - if h.UnmarshalError.Len() != 0 { - return false - } - if h.ValidateResponse.Len() != 0 { - return false - } - if h.Retry.Len() != 0 { - return false - } - if h.AfterRetry.Len() != 0 { - return false - } - if h.CompleteAttempt.Len() != 0 { - return false - } - if h.Complete.Len() != 0 { - return false - } - - return true -} - // A HandlerListRunItem represents an entry in the HandlerList which // is being run. type HandlerListRunItem struct { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go index 9370fa50c..b0c2ef4fe 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go @@ -15,15 +15,12 @@ type offsetReader struct { closed bool } -func newOffsetReader(buf io.ReadSeeker, offset int64) (*offsetReader, error) { +func newOffsetReader(buf io.ReadSeeker, offset int64) *offsetReader { reader := &offsetReader{} - _, err := buf.Seek(offset, sdkio.SeekStart) - if err != nil { - return nil, err - } + buf.Seek(offset, sdkio.SeekStart) reader.buf = buf - return reader, nil + return reader } // Close will close the instance of the offset reader's access to @@ -57,9 +54,7 @@ func (o *offsetReader) Seek(offset int64, whence int) (int64, error) { // CloseAndCopy will return a new offsetReader with a copy of the old buffer // and close the old buffer. -func (o *offsetReader) CloseAndCopy(offset int64) (*offsetReader, error) { - if err := o.Close(); err != nil { - return nil, err - } +func (o *offsetReader) CloseAndCopy(offset int64) *offsetReader { + o.Close() return newOffsetReader(o.buf, offset) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go index 8e332cce6..19da3fcd8 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -64,15 +64,6 @@ type Request struct { LastSignedAt time.Time DisableFollowRedirects bool - // Additional API error codes that should be retried. IsErrorRetryable - // will consider these codes in addition to its built in cases. - RetryErrorCodes []string - - // Additional API error codes that should be retried with throttle backoff - // delay. IsErrorThrottle will consider these codes in addition to its - // built in cases. - ThrottleErrorCodes []string - // A value greater than 0 instructs the request to be signed as Presigned URL // You should not set this field directly. Instead use Request's // Presign or PresignRequest methods. @@ -240,10 +231,6 @@ func (r *Request) WillRetry() bool { return r.Error != nil && aws.BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries() } -func fmtAttemptCount(retryCount, maxRetries int) string { - return fmt.Sprintf("attempt %v/%v", retryCount, maxRetries) -} - // ParamsFilled returns if the request's parameters have been populated // and the parameters are valid. False is returned if no parameters are // provided or invalid. @@ -272,18 +259,7 @@ func (r *Request) SetStringBody(s string) { // SetReaderBody will set the request's body reader. func (r *Request) SetReaderBody(reader io.ReadSeeker) { r.Body = reader - - if aws.IsReaderSeekable(reader) { - var err error - // Get the Bodies current offset so retries will start from the same - // initial position. - r.BodyStart, err = reader.Seek(0, sdkio.SeekCurrent) - if err != nil { - r.Error = awserr.New(ErrCodeSerialization, - "failed to determine start of request body", err) - return - } - } + r.BodyStart, _ = reader.Seek(0, sdkio.SeekCurrent) // Get the Bodies current offset. r.ResetBody() } @@ -354,15 +330,16 @@ func getPresignedURL(r *Request, expire time.Duration) (string, http.Header, err return r.HTTPRequest.URL.String(), r.SignedHeaderVals, nil } -const ( - notRetrying = "not retrying" -) - -func debugLogReqError(r *Request, stage, retryStr string, err error) { +func debugLogReqError(r *Request, stage string, retrying bool, err error) { if !r.Config.LogLevel.Matches(aws.LogDebugWithRequestErrors) { return } + retryStr := "not retrying" + if retrying { + retryStr = "will retry" + } + r.Config.Logger.Log(fmt.Sprintf("DEBUG: %s %s/%s failed, %s, error %v", stage, r.ClientInfo.ServiceName, r.Operation.Name, retryStr, err)) } @@ -381,12 +358,12 @@ func (r *Request) Build() error { if !r.built { r.Handlers.Validate.Run(r) if r.Error != nil { - debugLogReqError(r, "Validate Request", notRetrying, r.Error) + debugLogReqError(r, "Validate Request", false, r.Error) return r.Error } r.Handlers.Build.Run(r) if r.Error != nil { - debugLogReqError(r, "Build Request", notRetrying, r.Error) + debugLogReqError(r, "Build Request", false, r.Error) return r.Error } r.built = true @@ -402,7 +379,7 @@ func (r *Request) Build() error { func (r *Request) Sign() error { r.Build() if r.Error != nil { - debugLogReqError(r, "Build Request", notRetrying, r.Error) + debugLogReqError(r, "Build Request", false, r.Error) return r.Error } @@ -410,16 +387,12 @@ func (r *Request) Sign() error { return r.Error } -func (r *Request) getNextRequestBody() (body io.ReadCloser, err error) { +func (r *Request) getNextRequestBody() (io.ReadCloser, error) { if r.safeBody != nil { r.safeBody.Close() } - r.safeBody, err = newOffsetReader(r.Body, r.BodyStart) - if err != nil { - return nil, awserr.New(ErrCodeSerialization, - "failed to get next request body reader", err) - } + r.safeBody = newOffsetReader(r.Body, r.BodyStart) // Go 1.8 tightened and clarified the rules code needs to use when building // requests with the http package. Go 1.8 removed the automatic detection @@ -436,10 +409,10 @@ func (r *Request) getNextRequestBody() (body io.ReadCloser, err error) { // Related golang/go#18257 l, err := aws.SeekerLen(r.Body) if err != nil { - return nil, awserr.New(ErrCodeSerialization, - "failed to compute request body size", err) + return nil, awserr.New(ErrCodeSerialization, "failed to compute request body size", err) } + var body io.ReadCloser if l == 0 { body = NoBody } else if l > 0 { @@ -500,28 +473,29 @@ func (r *Request) Send() error { r.AttemptTime = time.Now() if err := r.Sign(); err != nil { - debugLogReqError(r, "Sign Request", notRetrying, err) + debugLogReqError(r, "Sign Request", false, err) return err } if err := r.sendRequest(); err == nil { return nil - } - r.Handlers.Retry.Run(r) - r.Handlers.AfterRetry.Run(r) + } else if !shouldRetryCancel(r.Error) { + return err + } else { + r.Handlers.Retry.Run(r) + r.Handlers.AfterRetry.Run(r) - if r.Error != nil || !aws.BoolValue(r.Retryable) { - return r.Error - } + if r.Error != nil || !aws.BoolValue(r.Retryable) { + return r.Error + } - if err := r.prepareRetry(); err != nil { - r.Error = err - return err + r.prepareRetry() + continue } } } -func (r *Request) prepareRetry() error { +func (r *Request) prepareRetry() { if r.Config.LogLevel.Matches(aws.LogDebugWithRequestRetries) { r.Config.Logger.Log(fmt.Sprintf("DEBUG: Retrying Request %s/%s, attempt %d", r.ClientInfo.ServiceName, r.Operation.Name, r.RetryCount)) @@ -532,19 +506,12 @@ func (r *Request) prepareRetry() error { // the request's body even though the Client's Do returned. r.HTTPRequest = copyHTTPRequest(r.HTTPRequest, nil) r.ResetBody() - if err := r.Error; err != nil { - return awserr.New(ErrCodeSerialization, - "failed to prepare body for retry", err) - - } // Closing response body to ensure that no response body is leaked // between retry attempts. if r.HTTPResponse != nil && r.HTTPResponse.Body != nil { r.HTTPResponse.Body.Close() } - - return nil } func (r *Request) sendRequest() (sendErr error) { @@ -553,9 +520,7 @@ func (r *Request) sendRequest() (sendErr error) { r.Retryable = nil r.Handlers.Send.Run(r) if r.Error != nil { - debugLogReqError(r, "Send Request", - fmtAttemptCount(r.RetryCount, r.MaxRetries()), - r.Error) + debugLogReqError(r, "Send Request", r.WillRetry(), r.Error) return r.Error } @@ -563,17 +528,13 @@ func (r *Request) sendRequest() (sendErr error) { r.Handlers.ValidateResponse.Run(r) if r.Error != nil { r.Handlers.UnmarshalError.Run(r) - debugLogReqError(r, "Validate Response", - fmtAttemptCount(r.RetryCount, r.MaxRetries()), - r.Error) + debugLogReqError(r, "Validate Response", r.WillRetry(), r.Error) return r.Error } r.Handlers.Unmarshal.Run(r) if r.Error != nil { - debugLogReqError(r, "Unmarshal Response", - fmtAttemptCount(r.RetryCount, r.MaxRetries()), - r.Error) + debugLogReqError(r, "Unmarshal Response", r.WillRetry(), r.Error) return r.Error } @@ -600,6 +561,48 @@ func AddToUserAgent(r *Request, s string) { r.HTTPRequest.Header.Set("User-Agent", s) } +type temporary interface { + Temporary() bool +} + +func shouldRetryCancel(err error) bool { + switch err := err.(type) { + case awserr.Error: + if err.Code() == CanceledErrorCode { + return false + } + return shouldRetryCancel(err.OrigErr()) + case *url.Error: + if strings.Contains(err.Error(), "connection refused") { + // Refused connections should be retried as the service may not yet + // be running on the port. Go TCP dial considers refused + // connections as not temporary. + return true + } + // *url.Error only implements Temporary after golang 1.6 but since + // url.Error only wraps the error: + return shouldRetryCancel(err.Err) + case temporary: + // If the error is temporary, we want to allow continuation of the + // retry process + return err.Temporary() + case nil: + // `awserr.Error.OrigErr()` can be nil, meaning there was an error but + // because we don't know the cause, it is marked as retryable. See + // TestRequest4xxUnretryable for an example. + return true + default: + switch err.Error() { + case "net/http: request canceled", + "net/http: request canceled while waiting for connection": + // known 1.5 error case when an http request is cancelled + return false + } + // here we don't know the error; so we allow a retry. + return true + } +} + // SanitizeHostForHeader removes default port from host and updates request.Host func SanitizeHostForHeader(r *http.Request) { host := getHost(r) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go index de1292f45..7c6a8000f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go @@ -4,8 +4,6 @@ package request import ( "net/http" - - "github.com/aws/aws-sdk-go/aws/awserr" ) // NoBody is a http.NoBody reader instructing Go HTTP client to not include @@ -26,8 +24,7 @@ var NoBody = http.NoBody func (r *Request) ResetBody() { body, err := r.getNextRequestBody() if err != nil { - r.Error = awserr.New(ErrCodeSerialization, - "failed to reset request body", err) + r.Error = err return } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go index f093fc542..a633ed5ac 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go @@ -146,7 +146,7 @@ func (r *Request) nextPageTokens() []interface{} { return nil } case bool: - if !v { + if v == false { return nil } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go index e84084da5..d0aa54c6d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -1,41 +1,23 @@ package request import ( - "net" - "net/url" - "strings" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" ) -// Retryer provides the interface drive the SDK's request retry behavior. The -// Retryer implementation is responsible for implementing exponential backoff, -// and determine if a request API error should be retried. -// -// client.DefaultRetryer is the SDK's default implementation of the Retryer. It -// uses the which uses the Request.IsErrorRetryable and Request.IsErrorThrottle -// methods to determine if the request is retried. +// Retryer is an interface to control retry logic for a given service. +// The default implementation used by most services is the client.DefaultRetryer +// structure, which contains basic retry logic using exponential backoff. type Retryer interface { - // RetryRules return the retry delay that should be used by the SDK before - // making another request attempt for the failed request. RetryRules(*Request) time.Duration - - // ShouldRetry returns if the failed request is retryable. - // - // Implementations may consider request attempt count when determining if a - // request is retryable, but the SDK will use MaxRetries to limit the - // number of attempts a request are made. ShouldRetry(*Request) bool - - // MaxRetries is the number of times a request may be retried before - // failing. MaxRetries() int } -// WithRetryer sets a Retryer value to the given Config returning the Config -// value for chaining. +// WithRetryer sets a config Retryer value to the given Config returning it +// for chaining. func WithRetryer(cfg *aws.Config, retryer Retryer) *aws.Config { cfg.Retryer = retryer return cfg @@ -94,6 +76,10 @@ var validParentCodes = map[string]struct{}{ ErrCodeRead: {}, } +type temporaryError interface { + Temporary() bool +} + func isNestedErrorRetryable(parentErr awserr.Error) bool { if parentErr == nil { return false @@ -112,7 +98,7 @@ func isNestedErrorRetryable(parentErr awserr.Error) bool { return isCodeRetryable(aerr.Code()) } - if t, ok := err.(temporary); ok { + if t, ok := err.(temporaryError); ok { return t.Temporary() || isErrConnectionReset(err) } @@ -122,90 +108,32 @@ func isNestedErrorRetryable(parentErr awserr.Error) bool { // IsErrorRetryable returns whether the error is retryable, based on its Code. // Returns false if error is nil. func IsErrorRetryable(err error) bool { - if err == nil { - return false - } - return shouldRetryError(err) -} - -type temporary interface { - Temporary() bool -} - -func shouldRetryError(origErr error) bool { - switch err := origErr.(type) { - case awserr.Error: - if err.Code() == CanceledErrorCode { - return false - } - if isNestedErrorRetryable(err) { - return true - } - - origErr := err.OrigErr() - var shouldRetry bool - if origErr != nil { - shouldRetry := shouldRetryError(origErr) - if err.Code() == "RequestError" && !shouldRetry { - return false - } - } - if isCodeRetryable(err.Code()) { - return true - } - return shouldRetry - - case *url.Error: - if strings.Contains(err.Error(), "connection refused") { - // Refused connections should be retried as the service may not yet - // be running on the port. Go TCP dial considers refused - // connections as not temporary. - return true - } - // *url.Error only implements Temporary after golang 1.6 but since - // url.Error only wraps the error: - return shouldRetryError(err.Err) - - case temporary: - if netErr, ok := err.(*net.OpError); ok && netErr.Op == "dial" { - return true + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeRetryable(aerr.Code()) || isNestedErrorRetryable(aerr) } - // If the error is temporary, we want to allow continuation of the - // retry process - return err.Temporary() || isErrConnectionReset(origErr) - - case nil: - // `awserr.Error.OrigErr()` can be nil, meaning there was an error but - // because we don't know the cause, it is marked as retryable. See - // TestRequest4xxUnretryable for an example. - return true - - default: - switch err.Error() { - case "net/http: request canceled", - "net/http: request canceled while waiting for connection": - // known 1.5 error case when an http request is cancelled - return false - } - // here we don't know the error; so we allow a retry. - return true } + return false } // IsErrorThrottle returns whether the error is to be throttled based on its code. // Returns false if error is nil. func IsErrorThrottle(err error) bool { - if aerr, ok := err.(awserr.Error); ok && aerr != nil { - return isCodeThrottle(aerr.Code()) + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeThrottle(aerr.Code()) + } } return false } -// IsErrorExpiredCreds returns whether the error code is a credential expiry -// error. Returns false if error is nil. +// IsErrorExpiredCreds returns whether the error code is a credential expiry error. +// Returns false if error is nil. func IsErrorExpiredCreds(err error) bool { - if aerr, ok := err.(awserr.Error); ok && aerr != nil { - return isCodeExpiredCreds(aerr.Code()) + if err != nil { + if aerr, ok := err.(awserr.Error); ok { + return isCodeExpiredCreds(aerr.Code()) + } } return false } @@ -215,58 +143,17 @@ func IsErrorExpiredCreds(err error) bool { // // Alias for the utility function IsErrorRetryable func (r *Request) IsErrorRetryable() bool { - if isErrCode(r.Error, r.RetryErrorCodes) { - return true - } - - // HTTP response status code 501 should not be retried. - // 501 represents Not Implemented which means the request method is not - // supported by the server and cannot be handled. - if r.HTTPResponse != nil { - // HTTP response status code 500 represents internal server error and - // should be retried without any throttle. - if r.HTTPResponse.StatusCode == 500 { - return true - } - } return IsErrorRetryable(r.Error) } -// IsErrorThrottle returns whether the error is to be throttled based on its -// code. Returns false if the request has no Error set. +// IsErrorThrottle returns whether the error is to be throttled based on its code. +// Returns false if the request has no Error set // // Alias for the utility function IsErrorThrottle func (r *Request) IsErrorThrottle() bool { - if isErrCode(r.Error, r.ThrottleErrorCodes) { - return true - } - - if r.HTTPResponse != nil { - switch r.HTTPResponse.StatusCode { - case - 429, // error caused due to too many requests - 502, // Bad Gateway error should be throttled - 503, // caused when service is unavailable - 504: // error occurred due to gateway timeout - return true - } - } - return IsErrorThrottle(r.Error) } -func isErrCode(err error, codes []string) bool { - if aerr, ok := err.(awserr.Error); ok && aerr != nil { - for _, code := range codes { - if code == aerr.Code() { - return true - } - } - } - - return false -} - // IsErrorExpired returns whether the error code is a credential expiry error. // Returns false if the request has no Error set. // diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go deleted file mode 100644 index 7713ccfca..000000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go +++ /dev/null @@ -1,259 +0,0 @@ -package session - -import ( - "fmt" - "os" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/credentials/processcreds" - "github.com/aws/aws-sdk-go/aws/credentials/stscreds" - "github.com/aws/aws-sdk-go/aws/defaults" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/internal/shareddefaults" -) - -func resolveCredentials(cfg *aws.Config, - envCfg envConfig, sharedCfg sharedConfig, - handlers request.Handlers, - sessOpts Options, -) (*credentials.Credentials, error) { - - switch { - case len(sessOpts.Profile) != 0: - // User explicitly provided an Profile in the session's configuration - // so load that profile from shared config first. - // Github(aws/aws-sdk-go#2727) - return resolveCredsFromProfile(cfg, envCfg, sharedCfg, handlers, sessOpts) - - case envCfg.Creds.HasKeys(): - // Environment credentials - return credentials.NewStaticCredentialsFromCreds(envCfg.Creds), nil - - case len(envCfg.WebIdentityTokenFilePath) != 0: - // Web identity token from environment, RoleARN required to also be - // set. - return assumeWebIdentity(cfg, handlers, - envCfg.WebIdentityTokenFilePath, - envCfg.RoleARN, - envCfg.RoleSessionName, - ) - - default: - // Fallback to the "default" credential resolution chain. - return resolveCredsFromProfile(cfg, envCfg, sharedCfg, handlers, sessOpts) - } -} - -// WebIdentityEmptyRoleARNErr will occur if 'AWS_WEB_IDENTITY_TOKEN_FILE' was set but -// 'AWS_IAM_ROLE_ARN' was not set. -var WebIdentityEmptyRoleARNErr = awserr.New(stscreds.ErrCodeWebIdentity, "role ARN is not set", nil) - -// WebIdentityEmptyTokenFilePathErr will occur if 'AWS_IAM_ROLE_ARN' was set but -// 'AWS_WEB_IDENTITY_TOKEN_FILE' was not set. -var WebIdentityEmptyTokenFilePathErr = awserr.New(stscreds.ErrCodeWebIdentity, "token file path is not set", nil) - -func assumeWebIdentity(cfg *aws.Config, handlers request.Handlers, - filepath string, - roleARN, sessionName string, -) (*credentials.Credentials, error) { - - if len(filepath) == 0 { - return nil, WebIdentityEmptyTokenFilePathErr - } - - if len(roleARN) == 0 { - return nil, WebIdentityEmptyRoleARNErr - } - - creds := stscreds.NewWebIdentityCredentials( - &Session{ - Config: cfg, - Handlers: handlers.Copy(), - }, - roleARN, - sessionName, - filepath, - ) - - return creds, nil -} - -func resolveCredsFromProfile(cfg *aws.Config, - envCfg envConfig, sharedCfg sharedConfig, - handlers request.Handlers, - sessOpts Options, -) (creds *credentials.Credentials, err error) { - - switch { - case sharedCfg.SourceProfile != nil: - // Assume IAM role with credentials source from a different profile. - creds, err = resolveCredsFromProfile(cfg, envCfg, - *sharedCfg.SourceProfile, handlers, sessOpts, - ) - - case sharedCfg.Creds.HasKeys(): - // Static Credentials from Shared Config/Credentials file. - creds = credentials.NewStaticCredentialsFromCreds( - sharedCfg.Creds, - ) - - case len(sharedCfg.CredentialProcess) != 0: - // Get credentials from CredentialProcess - creds = processcreds.NewCredentials(sharedCfg.CredentialProcess) - - case len(sharedCfg.CredentialSource) != 0: - creds, err = resolveCredsFromSource(cfg, envCfg, - sharedCfg, handlers, sessOpts, - ) - - case len(sharedCfg.WebIdentityTokenFile) != 0: - // Credentials from Assume Web Identity token require an IAM Role, and - // that roll will be assumed. May be wrapped with another assume role - // via SourceProfile. - return assumeWebIdentity(cfg, handlers, - sharedCfg.WebIdentityTokenFile, - sharedCfg.RoleARN, - sharedCfg.RoleSessionName, - ) - - default: - // Fallback to default credentials provider, include mock errors for - // the credential chain so user can identify why credentials failed to - // be retrieved. - creds = credentials.NewCredentials(&credentials.ChainProvider{ - VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), - Providers: []credentials.Provider{ - &credProviderError{ - Err: awserr.New("EnvAccessKeyNotFound", - "failed to find credentials in the environment.", nil), - }, - &credProviderError{ - Err: awserr.New("SharedCredsLoad", - fmt.Sprintf("failed to load profile, %s.", envCfg.Profile), nil), - }, - defaults.RemoteCredProvider(*cfg, handlers), - }, - }) - } - if err != nil { - return nil, err - } - - if len(sharedCfg.RoleARN) > 0 { - cfgCp := *cfg - cfgCp.Credentials = creds - return credsFromAssumeRole(cfgCp, handlers, sharedCfg, sessOpts) - } - - return creds, nil -} - -// valid credential source values -const ( - credSourceEc2Metadata = "Ec2InstanceMetadata" - credSourceEnvironment = "Environment" - credSourceECSContainer = "EcsContainer" -) - -func resolveCredsFromSource(cfg *aws.Config, - envCfg envConfig, sharedCfg sharedConfig, - handlers request.Handlers, - sessOpts Options, -) (creds *credentials.Credentials, err error) { - - switch sharedCfg.CredentialSource { - case credSourceEc2Metadata: - p := defaults.RemoteCredProvider(*cfg, handlers) - creds = credentials.NewCredentials(p) - - case credSourceEnvironment: - creds = credentials.NewStaticCredentialsFromCreds(envCfg.Creds) - - case credSourceECSContainer: - if len(os.Getenv(shareddefaults.ECSCredsProviderEnvVar)) == 0 { - return nil, ErrSharedConfigECSContainerEnvVarEmpty - } - - p := defaults.RemoteCredProvider(*cfg, handlers) - creds = credentials.NewCredentials(p) - - default: - return nil, ErrSharedConfigInvalidCredSource - } - - return creds, nil -} - -func credsFromAssumeRole(cfg aws.Config, - handlers request.Handlers, - sharedCfg sharedConfig, - sessOpts Options, -) (*credentials.Credentials, error) { - - if len(sharedCfg.MFASerial) != 0 && sessOpts.AssumeRoleTokenProvider == nil { - // AssumeRole Token provider is required if doing Assume Role - // with MFA. - return nil, AssumeRoleTokenProviderNotSetError{} - } - - return stscreds.NewCredentials( - &Session{ - Config: &cfg, - Handlers: handlers.Copy(), - }, - sharedCfg.RoleARN, - func(opt *stscreds.AssumeRoleProvider) { - opt.RoleSessionName = sharedCfg.RoleSessionName - opt.Duration = sessOpts.AssumeRoleDuration - - // Assume role with external ID - if len(sharedCfg.ExternalID) > 0 { - opt.ExternalID = aws.String(sharedCfg.ExternalID) - } - - // Assume role with MFA - if len(sharedCfg.MFASerial) > 0 { - opt.SerialNumber = aws.String(sharedCfg.MFASerial) - opt.TokenProvider = sessOpts.AssumeRoleTokenProvider - } - }, - ), nil -} - -// AssumeRoleTokenProviderNotSetError is an error returned when creating a -// session when the MFAToken option is not set when shared config is configured -// load assume a role with an MFA token. -type AssumeRoleTokenProviderNotSetError struct{} - -// Code is the short id of the error. -func (e AssumeRoleTokenProviderNotSetError) Code() string { - return "AssumeRoleTokenProviderNotSetError" -} - -// Message is the description of the error -func (e AssumeRoleTokenProviderNotSetError) Message() string { - return fmt.Sprintf("assume role with MFA enabled, but AssumeRoleTokenProvider session option not set.") -} - -// OrigErr is the underlying error that caused the failure. -func (e AssumeRoleTokenProviderNotSetError) OrigErr() error { - return nil -} - -// Error satisfies the error interface. -func (e AssumeRoleTokenProviderNotSetError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", nil) -} - -type credProviderError struct { - Err error -} - -func (c credProviderError) Retrieve() (credentials.Value, error) { - return credentials.Value{}, c.Err -} -func (c credProviderError) IsExpired() bool { - return true -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go index 7ec66e7e5..38a7b05a6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go @@ -1,93 +1,97 @@ /* -Package session provides configuration for the SDK's service clients. Sessions -can be shared across service clients that share the same base configuration. +Package session provides configuration for the SDK's service clients. -Sessions are safe to use concurrently as long as the Session is not being -modified. Sessions should be cached when possible, because creating a new -Session will load all configuration values from the environment, and config -files each time the Session is created. Sharing the Session value across all of -your service clients will ensure the configuration is loaded the fewest number -of times possible. +Sessions can be shared across all service clients that share the same base +configuration. The Session is built from the SDK's default configuration and +request handlers. -Sessions options from Shared Config +Sessions should be cached when possible, because creating a new Session will +load all configuration values from the environment, and config files each time +the Session is created. Sharing the Session value across all of your service +clients will ensure the configuration is loaded the fewest number of times possible. -By default NewSession will only load credentials from the shared credentials -file (~/.aws/credentials). If the AWS_SDK_LOAD_CONFIG environment variable is -set to a truthy value the Session will be created from the configuration -values from the shared config (~/.aws/config) and shared credentials -(~/.aws/credentials) files. Using the NewSessionWithOptions with -SharedConfigState set to SharedConfigEnable will create the session as if the -AWS_SDK_LOAD_CONFIG environment variable was set. +Concurrency -Credential and config loading order +Sessions are safe to use concurrently as long as the Session is not being +modified. The SDK will not modify the Session once the Session has been created. +Creating service clients concurrently from a shared Session is safe. -The Session will attempt to load configuration and credentials from the -environment, configuration files, and other credential sources. The order -configuration is loaded in is: +Sessions from Shared Config - * Environment Variables - * Shared Credentials file - * Shared Configuration file (if SharedConfig is enabled) - * EC2 Instance Metadata (credentials only) +Sessions can be created using the method above that will only load the +additional config if the AWS_SDK_LOAD_CONFIG environment variable is set. +Alternatively you can explicitly create a Session with shared config enabled. +To do this you can use NewSessionWithOptions to configure how the Session will +be created. Using the NewSessionWithOptions with SharedConfigState set to +SharedConfigEnable will create the session as if the AWS_SDK_LOAD_CONFIG +environment variable was set. -The Environment variables for credentials will have precedence over shared -config even if SharedConfig is enabled. To override this behavior, and use -shared config credentials instead specify the session.Options.Profile, (e.g. -when using credential_source=Environment to assume a role). +Creating Sessions - sess, err := session.NewSessionWithOptions(session.Options{ - Profile: "myProfile", - }) +When creating Sessions optional aws.Config values can be passed in that will +override the default, or loaded config values the Session is being created +with. This allows you to provide additional, or case based, configuration +as needed. -Creating Sessions +By default NewSession will only load credentials from the shared credentials +file (~/.aws/credentials). If the AWS_SDK_LOAD_CONFIG environment variable is +set to a truthy value the Session will be created from the configuration +values from the shared config (~/.aws/config) and shared credentials +(~/.aws/credentials) files. See the section Sessions from Shared Config for +more information. -Creating a Session without additional options will load credentials region, and -profile loaded from the environment and shared config automatically. See, -"Environment Variables" section for information on environment variables used -by Session. +Create a Session with the default config and request handlers. With credentials +region, and profile loaded from the environment and shared config automatically. +Requires the AWS_PROFILE to be set, or "default" is used. // Create Session - sess, err := session.NewSession() + sess := session.Must(session.NewSession()) + // Create a Session with a custom region + sess := session.Must(session.NewSession(&aws.Config{ + Region: aws.String("us-east-1"), + })) -When creating Sessions optional aws.Config values can be passed in that will -override the default, or loaded, config values the Session is being created -with. This allows you to provide additional, or case based, configuration -as needed. + // Create a S3 client instance from a session + sess := session.Must(session.NewSession()) - // Create a Session with a custom region - sess, err := session.NewSession(&aws.Config{ - Region: aws.String("us-west-2"), - }) + svc := s3.New(sess) + +Create Session With Option Overrides + +In addition to NewSession, Sessions can be created using NewSessionWithOptions. +This func allows you to control and override how the Session will be created +through code instead of being driven by environment variables only. -Use NewSessionWithOptions to provide additional configuration driving how the -Session's configuration will be loaded. Such as, specifying shared config -profile, or override the shared config state, (AWS_SDK_LOAD_CONFIG). +Use NewSessionWithOptions when you want to provide the config profile, or +override the shared config state (AWS_SDK_LOAD_CONFIG). // Equivalent to session.NewSession() - sess, err := session.NewSessionWithOptions(session.Options{ + sess := session.Must(session.NewSessionWithOptions(session.Options{ // Options - }) + })) - sess, err := session.NewSessionWithOptions(session.Options{ - // Specify profile to load for the session's config - Profile: "profile_name", + // Specify profile to load for the session's config + sess := session.Must(session.NewSessionWithOptions(session.Options{ + Profile: "profile_name", + })) - // Provide SDK Config options, such as Region. - Config: aws.Config{ - Region: aws.String("us-west-2"), - }, + // Specify profile for config and region for requests + sess := session.Must(session.NewSessionWithOptions(session.Options{ + Config: aws.Config{Region: aws.String("us-east-1")}, + Profile: "profile_name", + })) - // Force enable Shared Config support + // Force enable Shared Config support + sess := session.Must(session.NewSessionWithOptions(session.Options{ SharedConfigState: session.SharedConfigEnable, - }) + })) Adding Handlers -You can add handlers to a session to decorate API operation, (e.g. adding HTTP -headers). All clients that use the Session receive a copy of the Session's -handlers. For example, the following request handler added to the Session logs -every requests made. +You can add handlers to a session for processing HTTP requests. All service +clients that use the session inherit the handlers. For example, the following +handler logs every request and its payload made by a service client: // Create a session, and add additional handlers for all service // clients created with the Session to inherit. Adds logging handler. @@ -95,15 +99,22 @@ every requests made. sess.Handlers.Send.PushFront(func(r *request.Request) { // Log every request made and its payload - logger.Printf("Request: %s/%s, Params: %s", + logger.Printf("Request: %s/%s, Payload: %s", r.ClientInfo.ServiceName, r.Operation, r.Params) }) +Deprecated "New" function + +The New session function has been deprecated because it does not provide good +way to return errors that occur when loading the configuration files and values. +Because of this, NewSession was created so errors can be retrieved when +creating a session fails. + Shared Config Fields -By default the SDK will only load the shared credentials file's -(~/.aws/credentials) credentials values, and all other config is provided by -the environment variables, SDK defaults, and user provided aws.Config values. +By default the SDK will only load the shared credentials file's (~/.aws/credentials) +credentials values, and all other config is provided by the environment variables, +SDK defaults, and user provided aws.Config values. If the AWS_SDK_LOAD_CONFIG environment variable is set, or SharedConfigEnable option is used to create the Session the full shared config values will be @@ -114,31 +125,24 @@ files have the same format. If both config files are present the configuration from both files will be read. The Session will be created from configuration values from the shared -credentials file (~/.aws/credentials) over those in the shared config file -(~/.aws/config). +credentials file (~/.aws/credentials) over those in the shared config file (~/.aws/config). -Credentials are the values the SDK uses to authenticating requests with AWS -Services. When specified in a file, both aws_access_key_id and -aws_secret_access_key must be provided together in the same file to be -considered valid. They will be ignored if both are not present. -aws_session_token is an optional field that can be provided in addition to the -other two fields. +Credentials are the values the SDK should use for authenticating requests with +AWS Services. They are from a configuration file will need to include both +aws_access_key_id and aws_secret_access_key must be provided together in the +same file to be considered valid. The values will be ignored if not a complete +group. aws_session_token is an optional field that can be provided if both of +the other two fields are also provided. aws_access_key_id = AKID aws_secret_access_key = SECRET aws_session_token = TOKEN - ; region only supported if SharedConfigEnabled. - region = us-east-1 - -Assume Role configuration - -The role_arn field allows you to configure the SDK to assume an IAM role using -a set of credentials from another source. Such as when paired with static -credentials, "profile_source", "credential_process", or "credential_source" -fields. If "role_arn" is provided, a source of credentials must also be -specified, such as "source_profile", "credential_source", or -"credential_process". +Assume Role values allow you to configure the SDK to assume an IAM role using +a set of credentials provided in a config file via the source_profile field. +Both "role_arn" and "source_profile" are required. The SDK supports assuming +a role with MFA token if the session option AssumeRoleTokenProvider +is set. role_arn = arn:aws:iam:::role/ source_profile = profile_with_creds @@ -146,16 +150,40 @@ specified, such as "source_profile", "credential_source", or mfa_serial = role_session_name = session_name +Region is the region the SDK should use for looking up AWS service endpoints +and signing requests. + + region = us-east-1 + +Assume Role with MFA token -The SDK supports assuming a role with MFA token. If "mfa_serial" is set, you -must also set the Session Option.AssumeRoleTokenProvider. The Session will fail -to load if the AssumeRoleTokenProvider is not specified. +To create a session with support for assuming an IAM role with MFA set the +session option AssumeRoleTokenProvider to a function that will prompt for the +MFA token code when the SDK assumes the role and refreshes the role's credentials. +This allows you to configure the SDK via the shared config to assumea role +with MFA tokens. + +In order for the SDK to assume a role with MFA the SharedConfigState +session option must be set to SharedConfigEnable, or AWS_SDK_LOAD_CONFIG +environment variable set. + +The shared configuration instructs the SDK to assume an IAM role with MFA +when the mfa_serial configuration field is set in the shared config +(~/.aws/config) or shared credentials (~/.aws/credentials) file. + +If mfa_serial is set in the configuration, the SDK will assume the role, and +the AssumeRoleTokenProvider session option is not set an an error will +be returned when creating the session. sess := session.Must(session.NewSessionWithOptions(session.Options{ AssumeRoleTokenProvider: stscreds.StdinTokenProvider, })) -To setup Assume Role outside of a session see the stscreds.AssumeRoleProvider + // Create service client value configured for credentials + // from assumed role. + svc := s3.New(sess) + +To setup assume role outside of a session see the stscreds.AssumeRoleProvider documentation. Environment Variables diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go index 60a6f9ce2..e3959b959 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go @@ -99,41 +99,21 @@ type envConfig struct { CustomCABundle string csmEnabled string - CSMEnabled *bool + CSMEnabled bool CSMPort string - CSMHost string CSMClientID string + enableEndpointDiscovery string // Enables endpoint discovery via environment variables. // // AWS_ENABLE_ENDPOINT_DISCOVERY=true EnableEndpointDiscovery *bool - enableEndpointDiscovery string - - // Specifies the WebIdentity token the SDK should use to assume a role - // with. - // - // AWS_WEB_IDENTITY_TOKEN_FILE=file_path - WebIdentityTokenFilePath string - - // Specifies the IAM role arn to use when assuming an role. - // - // AWS_ROLE_ARN=role_arn - RoleARN string - - // Specifies the IAM role session name to use when assuming a role. - // - // AWS_ROLE_SESSION_NAME=session_name - RoleSessionName string } var ( csmEnabledEnvKey = []string{ "AWS_CSM_ENABLED", } - csmHostEnvKey = []string{ - "AWS_CSM_HOST", - } csmPortEnvKey = []string{ "AWS_CSM_PORT", } @@ -170,15 +150,6 @@ var ( sharedConfigFileEnvKey = []string{ "AWS_CONFIG_FILE", } - webIdentityTokenFilePathEnvKey = []string{ - "AWS_WEB_IDENTITY_TOKEN_FILE", - } - roleARNEnvKey = []string{ - "AWS_ROLE_ARN", - } - roleSessionNameEnvKey = []string{ - "AWS_ROLE_SESSION_NAME", - } ) // loadEnvConfig retrieves the SDK's environment configuration. @@ -207,33 +178,21 @@ func envConfigLoad(enableSharedConfig bool) envConfig { cfg.EnableSharedConfig = enableSharedConfig - // Static environment credentials - var creds credentials.Value - setFromEnvVal(&creds.AccessKeyID, credAccessEnvKey) - setFromEnvVal(&creds.SecretAccessKey, credSecretEnvKey) - setFromEnvVal(&creds.SessionToken, credSessionEnvKey) - if creds.HasKeys() { - // Require logical grouping of credentials - creds.ProviderName = EnvProviderName - cfg.Creds = creds - } - - // Role Metadata - setFromEnvVal(&cfg.RoleARN, roleARNEnvKey) - setFromEnvVal(&cfg.RoleSessionName, roleSessionNameEnvKey) - - // Web identity environment variables - setFromEnvVal(&cfg.WebIdentityTokenFilePath, webIdentityTokenFilePathEnvKey) + setFromEnvVal(&cfg.Creds.AccessKeyID, credAccessEnvKey) + setFromEnvVal(&cfg.Creds.SecretAccessKey, credSecretEnvKey) + setFromEnvVal(&cfg.Creds.SessionToken, credSessionEnvKey) // CSM environment variables setFromEnvVal(&cfg.csmEnabled, csmEnabledEnvKey) - setFromEnvVal(&cfg.CSMHost, csmHostEnvKey) setFromEnvVal(&cfg.CSMPort, csmPortEnvKey) setFromEnvVal(&cfg.CSMClientID, csmClientIDEnvKey) + cfg.CSMEnabled = len(cfg.csmEnabled) > 0 - if len(cfg.csmEnabled) != 0 { - v, _ := strconv.ParseBool(cfg.csmEnabled) - cfg.CSMEnabled = &v + // Require logical grouping of credentials + if len(cfg.Creds.AccessKeyID) == 0 || len(cfg.Creds.SecretAccessKey) == 0 { + cfg.Creds = credentials.Value{} + } else { + cfg.Creds.ProviderName = EnvProviderName } regionKeys := regionEnvKeys diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 7b0a942e2..be4b5f077 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -8,17 +8,19 @@ import ( "io/ioutil" "net/http" "os" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/credentials/processcreds" + "github.com/aws/aws-sdk-go/aws/credentials/stscreds" "github.com/aws/aws-sdk-go/aws/csm" "github.com/aws/aws-sdk-go/aws/defaults" "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/internal/shareddefaults" ) const ( @@ -104,20 +106,8 @@ func New(cfgs ...*aws.Config) *Session { } s := deprecatedNewSession(cfgs...) - - if csmCfg, err := loadCSMConfig(envCfg, []string{}); err != nil { - if l := s.Config.Logger; l != nil { - l.Log(fmt.Sprintf("ERROR: failed to load CSM configuration, %v", err)) - } - } else if csmCfg.Enabled { - err := enableCSM(&s.Handlers, csmCfg, s.Config.Logger) - if err != nil { - err = fmt.Errorf("failed to enable CSM, %v", err) - s.Config.Logger.Log("ERROR:", err.Error()) - s.Handlers.Validate.PushBack(func(r *request.Request) { - r.Error = err - }) - } + if envCfg.CSMEnabled { + enableCSM(&s.Handlers, envCfg.CSMClientID, envCfg.CSMPort, s.Config.Logger) } return s @@ -136,7 +126,7 @@ func New(cfgs ...*aws.Config) *Session { // to be built with retrieving credentials with AssumeRole set in the config. // // See the NewSessionWithOptions func for information on how to override or -// control through code how the Session will be created, such as specifying the +// control through code how the Session will be created. Such as specifying the // config profile, and controlling if shared config is enabled or not. func NewSession(cfgs ...*aws.Config) (*Session, error) { opts := Options{} @@ -220,12 +210,6 @@ type Options struct { // the config enables assume role wit MFA via the mfa_serial field. AssumeRoleTokenProvider func() (string, error) - // When the SDK's shared config is configured to assume a role this option - // may be provided to set the expiry duration of the STS credentials. - // Defaults to 15 minutes if not set as documented in the - // stscreds.AssumeRoleProvider. - AssumeRoleDuration time.Duration - // Reader for a custom Credentials Authority (CA) bundle in PEM format that // the SDK will use instead of the default system's root CA bundle. Use this // only if you want to replace the CA bundle the SDK uses for TLS requests. @@ -240,12 +224,6 @@ type Options struct { // to also enable this feature. CustomCABundle session option field has priority // over the AWS_CA_BUNDLE environment variable, and will be used if both are set. CustomCABundle io.Reader - - // The handlers that the session and all API clients will be created with. - // This must be a complete set of handlers. Use the defaults.Handlers() - // function to initialize this value before changing the handlers to be - // used by the SDK. - Handlers request.Handlers } // NewSessionWithOptions returns a new Session created from SDK defaults, config files, @@ -285,7 +263,7 @@ func NewSessionWithOptions(opts Options) (*Session, error) { envCfg = loadEnvConfig() } - if len(opts.Profile) != 0 { + if len(opts.Profile) > 0 { envCfg.Profile = opts.Profile } @@ -351,33 +329,27 @@ func deprecatedNewSession(cfgs ...*aws.Config) *Session { return s } -func enableCSM(handlers *request.Handlers, cfg csmConfig, logger aws.Logger) error { - if logger != nil { - logger.Log("Enabling CSM") +func enableCSM(handlers *request.Handlers, clientID string, port string, logger aws.Logger) { + logger.Log("Enabling CSM") + if len(port) == 0 { + port = csm.DefaultPort } - r, err := csm.Start(cfg.ClientID, csm.AddressWithDefaults(cfg.Host, cfg.Port)) + r, err := csm.Start(clientID, "127.0.0.1:"+port) if err != nil { - return err + return } r.InjectHandlers(handlers) - - return nil } func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { cfg := defaults.Config() - - handlers := opts.Handlers - if handlers.IsEmpty() { - handlers = defaults.Handlers() - } + handlers := defaults.Handlers() // Get a merged version of the user provided config to determine if // credentials were. userCfg := &aws.Config{} userCfg.MergeIn(cfgs...) - cfg.MergeIn(userCfg) // Ordered config files will be loaded in with later files overwriting // previous config file values. @@ -394,17 +366,9 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, } // Load additional config from file(s) - sharedCfg, err := loadSharedConfig(envCfg.Profile, cfgFiles, envCfg.EnableSharedConfig) + sharedCfg, err := loadSharedConfig(envCfg.Profile, cfgFiles) if err != nil { - if len(envCfg.Profile) == 0 && !envCfg.EnableSharedConfig && (envCfg.Creds.HasKeys() || userCfg.Credentials != nil) { - // Special case where the user has not explicitly specified an AWS_PROFILE, - // or session.Options.profile, shared config is not enabled, and the - // environment has credentials, allow the shared config file to fail to - // load since the user has already provided credentials, and nothing else - // is required to be read file. Github(aws/aws-sdk-go#2455) - } else if _, ok := err.(SharedConfigProfileNotExistsError); !ok { - return nil, err - } + return nil, err } if err := mergeConfigSrcs(cfg, userCfg, envCfg, sharedCfg, handlers, opts); err != nil { @@ -417,16 +381,8 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, } initHandlers(s) - - if csmCfg, err := loadCSMConfig(envCfg, cfgFiles); err != nil { - if l := s.Config.Logger; l != nil { - l.Log(fmt.Sprintf("ERROR: failed to load CSM configuration, %v", err)) - } - } else if csmCfg.Enabled { - err = enableCSM(&s.Handlers, csmCfg, s.Config.Logger) - if err != nil { - return nil, err - } + if envCfg.CSMEnabled { + enableCSM(&s.Handlers, envCfg.CSMClientID, envCfg.CSMPort, s.Config.Logger) } // Setup HTTP client with custom cert bundle if enabled @@ -439,46 +395,6 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, return s, nil } -type csmConfig struct { - Enabled bool - Host string - Port string - ClientID string -} - -var csmProfileName = "aws_csm" - -func loadCSMConfig(envCfg envConfig, cfgFiles []string) (csmConfig, error) { - if envCfg.CSMEnabled != nil { - if *envCfg.CSMEnabled { - return csmConfig{ - Enabled: true, - ClientID: envCfg.CSMClientID, - Host: envCfg.CSMHost, - Port: envCfg.CSMPort, - }, nil - } - return csmConfig{}, nil - } - - sharedCfg, err := loadSharedConfig(csmProfileName, cfgFiles, false) - if err != nil { - if _, ok := err.(SharedConfigProfileNotExistsError); !ok { - return csmConfig{}, err - } - } - if sharedCfg.CSMEnabled != nil && *sharedCfg.CSMEnabled == true { - return csmConfig{ - Enabled: true, - ClientID: sharedCfg.CSMClientID, - Host: sharedCfg.CSMHost, - Port: sharedCfg.CSMPort, - }, nil - } - - return csmConfig{}, nil -} - func loadCustomCABundle(s *Session, bundle io.Reader) error { var t *http.Transport switch v := s.Config.HTTPClient.Transport.(type) { @@ -527,11 +443,9 @@ func loadCertPool(r io.Reader) (*x509.CertPool, error) { return p, nil } -func mergeConfigSrcs(cfg, userCfg *aws.Config, - envCfg envConfig, sharedCfg sharedConfig, - handlers request.Handlers, - sessOpts Options, -) error { +func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers, sessOpts Options) error { + // Merge in user provided configuration + cfg.MergeIn(userCfg) // Region if not already set by user if len(aws.StringValue(cfg.Region)) == 0 { @@ -550,19 +464,164 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config, } } - // Configure credentials if not already set by the user when creating the - // Session. + // Configure credentials if not already set if cfg.Credentials == credentials.AnonymousCredentials && userCfg.Credentials == nil { - creds, err := resolveCredentials(cfg, envCfg, sharedCfg, handlers, sessOpts) - if err != nil { - return err + + // inspect the profile to see if a credential source has been specified. + if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.CredentialSource) > 0 { + + // if both credential_source and source_profile have been set, return an error + // as this is undefined behavior. + if len(sharedCfg.AssumeRole.SourceProfile) > 0 { + return ErrSharedConfigSourceCollision + } + + // valid credential source values + const ( + credSourceEc2Metadata = "Ec2InstanceMetadata" + credSourceEnvironment = "Environment" + credSourceECSContainer = "EcsContainer" + ) + + switch sharedCfg.AssumeRole.CredentialSource { + case credSourceEc2Metadata: + cfgCp := *cfg + p := defaults.RemoteCredProvider(cfgCp, handlers) + cfgCp.Credentials = credentials.NewCredentials(p) + + if len(sharedCfg.AssumeRole.MFASerial) > 0 && sessOpts.AssumeRoleTokenProvider == nil { + // AssumeRole Token provider is required if doing Assume Role + // with MFA. + return AssumeRoleTokenProviderNotSetError{} + } + + cfg.Credentials = assumeRoleCredentials(cfgCp, handlers, sharedCfg, sessOpts) + case credSourceEnvironment: + cfg.Credentials = credentials.NewStaticCredentialsFromCreds( + envCfg.Creds, + ) + case credSourceECSContainer: + if len(os.Getenv(shareddefaults.ECSCredsProviderEnvVar)) == 0 { + return ErrSharedConfigECSContainerEnvVarEmpty + } + + cfgCp := *cfg + p := defaults.RemoteCredProvider(cfgCp, handlers) + creds := credentials.NewCredentials(p) + + cfg.Credentials = creds + default: + return ErrSharedConfigInvalidCredSource + } + + return nil + } + + if len(envCfg.Creds.AccessKeyID) > 0 { + cfg.Credentials = credentials.NewStaticCredentialsFromCreds( + envCfg.Creds, + ) + } else if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.RoleARN) > 0 && sharedCfg.AssumeRoleSource != nil { + cfgCp := *cfg + cfgCp.Credentials = credentials.NewStaticCredentialsFromCreds( + sharedCfg.AssumeRoleSource.Creds, + ) + + if len(sharedCfg.AssumeRole.MFASerial) > 0 && sessOpts.AssumeRoleTokenProvider == nil { + // AssumeRole Token provider is required if doing Assume Role + // with MFA. + return AssumeRoleTokenProviderNotSetError{} + } + + cfg.Credentials = assumeRoleCredentials(cfgCp, handlers, sharedCfg, sessOpts) + } else if len(sharedCfg.Creds.AccessKeyID) > 0 { + cfg.Credentials = credentials.NewStaticCredentialsFromCreds( + sharedCfg.Creds, + ) + } else if len(sharedCfg.CredentialProcess) > 0 { + cfg.Credentials = processcreds.NewCredentials( + sharedCfg.CredentialProcess, + ) + } else { + // Fallback to default credentials provider, include mock errors + // for the credential chain so user can identify why credentials + // failed to be retrieved. + cfg.Credentials = credentials.NewCredentials(&credentials.ChainProvider{ + VerboseErrors: aws.BoolValue(cfg.CredentialsChainVerboseErrors), + Providers: []credentials.Provider{ + &credProviderError{Err: awserr.New("EnvAccessKeyNotFound", "failed to find credentials in the environment.", nil)}, + &credProviderError{Err: awserr.New("SharedCredsLoad", fmt.Sprintf("failed to load profile, %s.", envCfg.Profile), nil)}, + defaults.RemoteCredProvider(*cfg, handlers), + }, + }) } - cfg.Credentials = creds } return nil } +func assumeRoleCredentials(cfg aws.Config, handlers request.Handlers, sharedCfg sharedConfig, sessOpts Options) *credentials.Credentials { + return stscreds.NewCredentials( + &Session{ + Config: &cfg, + Handlers: handlers.Copy(), + }, + sharedCfg.AssumeRole.RoleARN, + func(opt *stscreds.AssumeRoleProvider) { + opt.RoleSessionName = sharedCfg.AssumeRole.RoleSessionName + + // Assume role with external ID + if len(sharedCfg.AssumeRole.ExternalID) > 0 { + opt.ExternalID = aws.String(sharedCfg.AssumeRole.ExternalID) + } + + // Assume role with MFA + if len(sharedCfg.AssumeRole.MFASerial) > 0 { + opt.SerialNumber = aws.String(sharedCfg.AssumeRole.MFASerial) + opt.TokenProvider = sessOpts.AssumeRoleTokenProvider + } + }, + ) +} + +// AssumeRoleTokenProviderNotSetError is an error returned when creating a session when the +// MFAToken option is not set when shared config is configured load assume a +// role with an MFA token. +type AssumeRoleTokenProviderNotSetError struct{} + +// Code is the short id of the error. +func (e AssumeRoleTokenProviderNotSetError) Code() string { + return "AssumeRoleTokenProviderNotSetError" +} + +// Message is the description of the error +func (e AssumeRoleTokenProviderNotSetError) Message() string { + return fmt.Sprintf("assume role with MFA enabled, but AssumeRoleTokenProvider session option not set.") +} + +// OrigErr is the underlying error that caused the failure. +func (e AssumeRoleTokenProviderNotSetError) OrigErr() error { + return nil +} + +// Error satisfies the error interface. +func (e AssumeRoleTokenProviderNotSetError) Error() string { + return awserr.SprintError(e.Code(), e.Message(), "", nil) +} + +type credProviderError struct { + Err error +} + +var emptyCreds = credentials.Value{} + +func (c credProviderError) Retrieve() (credentials.Value, error) { + return credentials.Value{}, c.Err +} +func (c credProviderError) IsExpired() bool { + return true +} + func initHandlers(s *Session) { // Add the Validate parameter handler if it is not disabled. s.Handlers.Validate.Remove(corehandlers.ValidateParametersHandler) @@ -571,7 +630,7 @@ func initHandlers(s *Session) { } } -// Copy creates and returns a copy of the current Session, copying the config +// Copy creates and returns a copy of the current Session, coping the config // and handlers. If any additional configs are provided they will be merged // on top of the Session's copied config. // diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go index d91ac93a5..7cb44021b 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go @@ -5,6 +5,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/internal/ini" ) @@ -22,23 +23,13 @@ const ( mfaSerialKey = `mfa_serial` // optional roleSessionNameKey = `role_session_name` // optional - // CSM options - csmEnabledKey = `csm_enabled` - csmHostKey = `csm_host` - csmPortKey = `csm_port` - csmClientIDKey = `csm_client_id` - // Additional Config fields regionKey = `region` // endpoint discovery group enableEndpointDiscoveryKey = `endpoint_discovery_enabled` // optional - // External Credential Process - credentialProcessKey = `credential_process` // optional - - // Web Identity Token File - webIdentityTokenFileKey = `web_identity_token_file` // optional + credentialProcessKey = `credential_process` // DefaultSharedConfigProfile is the default profile to be used when // loading configuration from the config files if another profile name @@ -46,33 +37,36 @@ const ( DefaultSharedConfigProfile = `default` ) +type assumeRoleConfig struct { + RoleARN string + SourceProfile string + CredentialSource string + ExternalID string + MFASerial string + RoleSessionName string +} + // sharedConfig represents the configuration fields of the SDK config files. type sharedConfig struct { - // Credentials values from the config file. Both aws_access_key_id and - // aws_secret_access_key must be provided together in the same file to be - // considered valid. The values will be ignored if not a complete group. - // aws_session_token is an optional field that can be provided if both of - // the other two fields are also provided. + // Credentials values from the config file. Both aws_access_key_id + // and aws_secret_access_key must be provided together in the same file + // to be considered valid. The values will be ignored if not a complete group. + // aws_session_token is an optional field that can be provided if both of the + // other two fields are also provided. // // aws_access_key_id // aws_secret_access_key // aws_session_token Creds credentials.Value - CredentialSource string - CredentialProcess string - WebIdentityTokenFile string + AssumeRole assumeRoleConfig + AssumeRoleSource *sharedConfig - RoleARN string - RoleSessionName string - ExternalID string - MFASerial string + // An external process to request credentials + CredentialProcess string - SourceProfileName string - SourceProfile *sharedConfig - - // Region is the region the SDK should use for looking up AWS service - // endpoints and signing requests. + // Region is the region the SDK should use for looking up AWS service endpoints + // and signing requests. // // region Region string @@ -82,12 +76,6 @@ type sharedConfig struct { // // endpoint_discovery_enabled = true EnableEndpointDiscovery *bool - - // CSM Options - CSMEnabled *bool - CSMHost string - CSMPort string - CSMClientID string } type sharedConfigFile struct { @@ -95,18 +83,17 @@ type sharedConfigFile struct { IniData ini.Sections } -// loadSharedConfig retrieves the configuration from the list of files using -// the profile provided. The order the files are listed will determine +// loadSharedConfig retrieves the configuration from the list of files +// using the profile provided. The order the files are listed will determine // precedence. Values in subsequent files will overwrite values defined in // earlier files. // // For example, given two files A and B. Both define credentials. If the order -// of the files are A then B, B's credential values will be used instead of -// A's. +// of the files are A then B, B's credential values will be used instead of A's. // // See sharedConfig.setFromFile for information how the config files // will be loaded. -func loadSharedConfig(profile string, filenames []string, exOpts bool) (sharedConfig, error) { +func loadSharedConfig(profile string, filenames []string) (sharedConfig, error) { if len(profile) == 0 { profile = DefaultSharedConfigProfile } @@ -117,11 +104,16 @@ func loadSharedConfig(profile string, filenames []string, exOpts bool) (sharedCo } cfg := sharedConfig{} - profiles := map[string]struct{}{} - if err = cfg.setFromIniFiles(profiles, profile, files, exOpts); err != nil { + if err = cfg.setFromIniFiles(profile, files); err != nil { return sharedConfig{}, err } + if len(cfg.AssumeRole.SourceProfile) > 0 { + if err := cfg.setAssumeRoleSource(profile, files); err != nil { + return sharedConfig{}, err + } + } + return cfg, nil } @@ -145,88 +137,60 @@ func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) { return files, nil } -func (cfg *sharedConfig) setFromIniFiles(profiles map[string]struct{}, profile string, files []sharedConfigFile, exOpts bool) error { - // Trim files from the list that don't exist. - var skippedFiles int - var profileNotFoundErr error - for _, f := range files { - if err := cfg.setFromIniFile(profile, f, exOpts); err != nil { - if _, ok := err.(SharedConfigProfileNotExistsError); ok { - // Ignore profiles not defined in individual files. - profileNotFoundErr = err - skippedFiles++ - continue - } - return err - } - } - if skippedFiles == len(files) { - // If all files were skipped because the profile is not found, return - // the original profile not found error. - return profileNotFoundErr +func (cfg *sharedConfig) setAssumeRoleSource(origProfile string, files []sharedConfigFile) error { + var assumeRoleSrc sharedConfig + + if len(cfg.AssumeRole.CredentialSource) > 0 { + // setAssumeRoleSource is only called when source_profile is found. + // If both source_profile and credential_source are set, then + // ErrSharedConfigSourceCollision will be returned + return ErrSharedConfigSourceCollision } - if _, ok := profiles[profile]; ok { - // if this is the second instance of the profile the Assume Role - // options must be cleared because they are only valid for the - // first reference of a profile. The self linked instance of the - // profile only have credential provider options. - cfg.clearAssumeRoleOptions() + // Multiple level assume role chains are not support + if cfg.AssumeRole.SourceProfile == origProfile { + assumeRoleSrc = *cfg + assumeRoleSrc.AssumeRole = assumeRoleConfig{} } else { - // First time a profile has been seen, It must either be a assume role - // or credentials. Assert if the credential type requires a role ARN, - // the ARN is also set. - if err := cfg.validateCredentialsRequireARN(profile); err != nil { + err := assumeRoleSrc.setFromIniFiles(cfg.AssumeRole.SourceProfile, files) + if err != nil { return err } } - profiles[profile] = struct{}{} - if err := cfg.validateCredentialType(); err != nil { - return err + if len(assumeRoleSrc.Creds.AccessKeyID) == 0 { + return SharedConfigAssumeRoleError{RoleARN: cfg.AssumeRole.RoleARN} } - // Link source profiles for assume roles - if len(cfg.SourceProfileName) != 0 { - // Linked profile via source_profile ignore credential provider - // options, the source profile must provide the credentials. - cfg.clearCredentialOptions() + cfg.AssumeRoleSource = &assumeRoleSrc - srcCfg := &sharedConfig{} - err := srcCfg.setFromIniFiles(profiles, cfg.SourceProfileName, files, exOpts) - if err != nil { - // SourceProfile that doesn't exist is an error in configuration. + return nil +} + +func (cfg *sharedConfig) setFromIniFiles(profile string, files []sharedConfigFile) error { + // Trim files from the list that don't exist. + for _, f := range files { + if err := cfg.setFromIniFile(profile, f); err != nil { if _, ok := err.(SharedConfigProfileNotExistsError); ok { - err = SharedConfigAssumeRoleError{ - RoleARN: cfg.RoleARN, - SourceProfile: cfg.SourceProfileName, - } + // Ignore proviles missings + continue } return err } - - if !srcCfg.hasCredentials() { - return SharedConfigAssumeRoleError{ - RoleARN: cfg.RoleARN, - SourceProfile: cfg.SourceProfileName, - } - } - - cfg.SourceProfile = srcCfg } return nil } -// setFromFile loads the configuration from the file using the profile -// provided. A sharedConfig pointer type value is used so that multiple config -// file loadings can be chained. +// setFromFile loads the configuration from the file using +// the profile provided. A sharedConfig pointer type value is used so that +// multiple config file loadings can be chained. // // Only loads complete logically grouped values, and will not set fields in cfg -// for incomplete grouped values in the config. Such as credentials. For -// example if a config file only includes aws_access_key_id but no -// aws_secret_access_key the aws_access_key_id will be ignored. -func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile, exOpts bool) error { +// for incomplete grouped values in the config. Such as credentials. For example +// if a config file only includes aws_access_key_id but no aws_secret_access_key +// the aws_access_key_id will be ignored. +func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile) error { section, ok := file.IniData.GetSection(profile) if !ok { // Fallback to to alternate profile name: profile @@ -236,141 +200,51 @@ func (cfg *sharedConfig) setFromIniFile(profile string, file sharedConfigFile, e } } - if exOpts { - // Assume Role Parameters - updateString(&cfg.RoleARN, section, roleArnKey) - updateString(&cfg.ExternalID, section, externalIDKey) - updateString(&cfg.MFASerial, section, mfaSerialKey) - updateString(&cfg.RoleSessionName, section, roleSessionNameKey) - updateString(&cfg.SourceProfileName, section, sourceProfileKey) - updateString(&cfg.CredentialSource, section, credentialSourceKey) - - updateString(&cfg.Region, section, regionKey) - } - - updateString(&cfg.CredentialProcess, section, credentialProcessKey) - updateString(&cfg.WebIdentityTokenFile, section, webIdentityTokenFileKey) - // Shared Credentials - creds := credentials.Value{ - AccessKeyID: section.String(accessKeyIDKey), - SecretAccessKey: section.String(secretAccessKey), - SessionToken: section.String(sessionTokenKey), - ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", file.Filename), - } - if creds.HasKeys() { - cfg.Creds = creds - } - - // Endpoint discovery - updateBoolPtr(&cfg.EnableEndpointDiscovery, section, enableEndpointDiscoveryKey) - - // CSM options - updateBoolPtr(&cfg.CSMEnabled, section, csmEnabledKey) - updateString(&cfg.CSMHost, section, csmHostKey) - updateString(&cfg.CSMPort, section, csmPortKey) - updateString(&cfg.CSMClientID, section, csmClientIDKey) - - return nil -} - -func (cfg *sharedConfig) validateCredentialsRequireARN(profile string) error { - var credSource string - - switch { - case len(cfg.SourceProfileName) != 0: - credSource = sourceProfileKey - case len(cfg.CredentialSource) != 0: - credSource = credentialSourceKey - case len(cfg.WebIdentityTokenFile) != 0: - credSource = webIdentityTokenFileKey + akid := section.String(accessKeyIDKey) + secret := section.String(secretAccessKey) + if len(akid) > 0 && len(secret) > 0 { + cfg.Creds = credentials.Value{ + AccessKeyID: akid, + SecretAccessKey: secret, + SessionToken: section.String(sessionTokenKey), + ProviderName: fmt.Sprintf("SharedConfigCredentials: %s", file.Filename), + } } - if len(credSource) != 0 && len(cfg.RoleARN) == 0 { - return CredentialRequiresARNError{ - Type: credSource, - Profile: profile, + // Assume Role + roleArn := section.String(roleArnKey) + srcProfile := section.String(sourceProfileKey) + credentialSource := section.String(credentialSourceKey) + hasSource := len(srcProfile) > 0 || len(credentialSource) > 0 + if len(roleArn) > 0 && hasSource { + cfg.AssumeRole = assumeRoleConfig{ + RoleARN: roleArn, + SourceProfile: srcProfile, + CredentialSource: credentialSource, + ExternalID: section.String(externalIDKey), + MFASerial: section.String(mfaSerialKey), + RoleSessionName: section.String(roleSessionNameKey), } } - return nil -} - -func (cfg *sharedConfig) validateCredentialType() error { - // Only one or no credential type can be defined. - if !oneOrNone( - len(cfg.SourceProfileName) != 0, - len(cfg.CredentialSource) != 0, - len(cfg.CredentialProcess) != 0, - len(cfg.WebIdentityTokenFile) != 0, - ) { - return ErrSharedConfigSourceCollision + // `credential_process` + if credProc := section.String(credentialProcessKey); len(credProc) > 0 { + cfg.CredentialProcess = credProc } - return nil -} - -func (cfg *sharedConfig) hasCredentials() bool { - switch { - case len(cfg.SourceProfileName) != 0: - case len(cfg.CredentialSource) != 0: - case len(cfg.CredentialProcess) != 0: - case len(cfg.WebIdentityTokenFile) != 0: - case cfg.Creds.HasKeys(): - default: - return false + // Region + if v := section.String(regionKey); len(v) > 0 { + cfg.Region = v } - return true -} - -func (cfg *sharedConfig) clearCredentialOptions() { - cfg.CredentialSource = "" - cfg.CredentialProcess = "" - cfg.WebIdentityTokenFile = "" - cfg.Creds = credentials.Value{} -} - -func (cfg *sharedConfig) clearAssumeRoleOptions() { - cfg.RoleARN = "" - cfg.ExternalID = "" - cfg.MFASerial = "" - cfg.RoleSessionName = "" - cfg.SourceProfileName = "" -} - -func oneOrNone(bs ...bool) bool { - var count int - - for _, b := range bs { - if b { - count++ - if count > 1 { - return false - } - } - } - - return true -} - -// updateString will only update the dst with the value in the section key, key -// is present in the section. -func updateString(dst *string, section ini.Section, key string) { - if !section.Has(key) { - return + // Endpoint discovery + if section.Has(enableEndpointDiscoveryKey) { + v := section.Bool(enableEndpointDiscoveryKey) + cfg.EnableEndpointDiscovery = &v } - *dst = section.String(key) -} -// updateBoolPtr will only update the dst with the value in the section key, -// key is present in the section. -func updateBoolPtr(dst **bool, section ini.Section, key string) { - if !section.Has(key) { - return - } - *dst = new(bool) - **dst = section.Bool(key) + return nil } // SharedConfigLoadError is an error for the shared config file failed to load. @@ -430,8 +304,7 @@ func (e SharedConfigProfileNotExistsError) Error() string { // profile contains assume role information, but that information is invalid // or not complete. type SharedConfigAssumeRoleError struct { - RoleARN string - SourceProfile string + RoleARN string } // Code is the short id of the error. @@ -441,10 +314,8 @@ func (e SharedConfigAssumeRoleError) Code() string { // Message is the description of the error func (e SharedConfigAssumeRoleError) Message() string { - return fmt.Sprintf( - "failed to load assume role for %s, source profile %s has no shared credentials", - e.RoleARN, e.SourceProfile, - ) + return fmt.Sprintf("failed to load assume role for %s, source profile has no shared credentials", + e.RoleARN) } // OrigErr is the underlying error that caused the failure. @@ -456,36 +327,3 @@ func (e SharedConfigAssumeRoleError) OrigErr() error { func (e SharedConfigAssumeRoleError) Error() string { return awserr.SprintError(e.Code(), e.Message(), "", nil) } - -// CredentialRequiresARNError provides the error for shared config credentials -// that are incorrectly configured in the shared config or credentials file. -type CredentialRequiresARNError struct { - // type of credentials that were configured. - Type string - - // Profile name the credentials were in. - Profile string -} - -// Code is the short id of the error. -func (e CredentialRequiresARNError) Code() string { - return "CredentialRequiresARNError" -} - -// Message is the description of the error -func (e CredentialRequiresARNError) Message() string { - return fmt.Sprintf( - "credential type %s requires role_arn, profile %s", - e.Type, e.Profile, - ) -} - -// OrigErr is the underlying error that caused the failure. -func (e CredentialRequiresARNError) OrigErr() error { - return nil -} - -// Error satisfies the error interface. -func (e CredentialRequiresARNError) Error() string { - return awserr.SprintError(e.Code(), e.Message(), "", nil) -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go index 8104793aa..523db79f8 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go @@ -687,11 +687,7 @@ func (ctx *signingCtx) buildBodyDigest() error { if !aws.IsReaderSeekable(ctx.Body) { return fmt.Errorf("cannot use unseekable request body %T, for signed request with body", ctx.Body) } - hashBytes, err := makeSha256Reader(ctx.Body) - if err != nil { - return err - } - hash = hex.EncodeToString(hashBytes) + hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) } if includeSHA256Header { @@ -738,16 +734,10 @@ func makeSha256(data []byte) []byte { return hash.Sum(nil) } -func makeSha256Reader(reader io.ReadSeeker) (hashBytes []byte, err error) { +func makeSha256Reader(reader io.ReadSeeker) []byte { hash := sha256.New() - start, err := reader.Seek(0, sdkio.SeekCurrent) - if err != nil { - return nil, err - } - defer func() { - // ensure error is return if unable to seek back to start of payload. - _, err = reader.Seek(start, sdkio.SeekStart) - }() + start, _ := reader.Seek(0, sdkio.SeekCurrent) + defer reader.Seek(start, sdkio.SeekStart) // Use CopyN to avoid allocating the 32KB buffer in io.Copy for bodies // smaller than 32KB. Fall back to io.Copy if we fail to determine the size. @@ -758,7 +748,7 @@ func makeSha256Reader(reader io.ReadSeeker) (hashBytes []byte, err error) { io.CopyN(hash, reader, size) } - return hash.Sum(nil), nil + return hash.Sum(nil) } const doubleSpace = " " diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types.go b/vendor/github.com/aws/aws-sdk-go/aws/types.go index 455091540..8b6f23425 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/types.go @@ -7,18 +7,13 @@ import ( "github.com/aws/aws-sdk-go/internal/sdkio" ) -// ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Allows the -// SDK to accept an io.Reader that is not also an io.Seeker for unsigned -// streaming payload API operations. +// ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Should +// only be used with an io.Reader that is also an io.Seeker. Doing so may +// cause request signature errors, or request body's not sent for GET, HEAD +// and DELETE HTTP methods. // -// A ReadSeekCloser wrapping an nonseekable io.Reader used in an API -// operation's input will prevent that operation being retried in the case of -// network errors, and cause operation requests to fail if the operation -// requires payload signing. -// -// Note: If using With S3 PutObject to stream an object upload The SDK's S3 -// Upload manager (s3manager.Uploader) provides support for streaming with the -// ability to retry network errors. +// Deprecated: Should only be used with io.ReadSeeker. If using for +// S3 PutObject to stream content use s3manager.Uploader instead. func ReadSeekCloser(r io.Reader) ReaderSeekerCloser { return ReaderSeekerCloser{r} } @@ -48,8 +43,7 @@ func IsReaderSeekable(r io.Reader) bool { // Read reads from the reader up to size of p. The number of bytes read, and // error if it occurred will be returned. // -// If the reader is not an io.Reader zero bytes read, and nil error will be -// returned. +// If the reader is not an io.Reader zero bytes read, and nil error will be returned. // // Performs the same functionality as io.Reader Read func (r ReaderSeekerCloser) Read(p []byte) (int, error) { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index d1548ebd8..b82d20b7f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.25.3" +const SDKVersion = "1.19.39" diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go index e56dcee2f..f99703372 100644 --- a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go @@ -304,9 +304,7 @@ loop: stmt := newCommentStatement(tok) stack.Push(stmt) default: - return nil, NewParseError( - fmt.Sprintf("invalid state with ASTKind %v and TokenType %v", - k, tok.Type())) + return nil, NewParseError(fmt.Sprintf("invalid state with ASTKind %v and TokenType %v", k, tok)) } if len(tokens) > 0 { @@ -316,7 +314,7 @@ loop: // this occurs when a statement has not been completed if stack.top > 1 { - return nil, NewParseError(fmt.Sprintf("incomplete ini expression")) + return nil, NewParseError(fmt.Sprintf("incomplete expression: %v", stack.container)) } // returns a sublist which excludes the start symbol diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go deleted file mode 100644 index 6c443988b..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go +++ /dev/null @@ -1,12 +0,0 @@ -package sdkio - -const ( - // Byte is 8 bits - Byte int64 = 1 - // KibiByte (KiB) is 1024 Bytes - KibiByte = Byte * 1024 - // MebiByte (MiB) is 1024 KiB - MebiByte = KibiByte * 1024 - // GibiByte (GiB) is 1024 MiB - GibiByte = MebiByte * 1024 -) diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go deleted file mode 100644 index 44898eed0..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build go1.10 - -package sdkmath - -import "math" - -// Round returns the nearest integer, rounding half away from zero. -// -// Special cases are: -// Round(±0) = ±0 -// Round(±Inf) = ±Inf -// Round(NaN) = NaN -func Round(x float64) float64 { - return math.Round(x) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go deleted file mode 100644 index 810ec7f08..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go +++ /dev/null @@ -1,56 +0,0 @@ -// +build !go1.10 - -package sdkmath - -import "math" - -// Copied from the Go standard library's (Go 1.12) math/floor.go for use in -// Go version prior to Go 1.10. -const ( - uvone = 0x3FF0000000000000 - mask = 0x7FF - shift = 64 - 11 - 1 - bias = 1023 - signMask = 1 << 63 - fracMask = 1<= 0.5 { - // return t + Copysign(1, x) - // } - // return t - // } - bits := math.Float64bits(x) - e := uint(bits>>shift) & mask - if e < bias { - // Round abs(x) < 1 including denormals. - bits &= signMask // +-0 - if e == bias-1 { - bits |= uvone // +-1 - } - } else if e < bias+shift { - // Round any abs(x) >= 1 containing a fractional component [0,1). - // - // Numbers with larger exponents are returned unchanged since they - // must be either an integer, infinity, or NaN. - const half = 1 << (shift - 1) - e -= bias - bits += half >> e - bits &^= fracMask >> e - } - return math.Float64frombits(bits) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read.go deleted file mode 100644 index f4651da2d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build go1.6 - -package sdkrand - -import "math/rand" - -// Read provides the stub for math.Rand.Read method support for go version's -// 1.6 and greater. -func Read(r *rand.Rand, p []byte) (int, error) { - return r.Read(p) -} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read_1_5.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read_1_5.go deleted file mode 100644 index b1d93a33d..000000000 --- a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read_1_5.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build !go1.6 - -package sdkrand - -import "math/rand" - -// Read backfills Go 1.6's math.Rand.Reader for Go 1.5 -func Read(r *rand.Rand, p []byte) (n int, err error) { - // Copy of Go standard libraries math package's read function not added to - // standard library until Go 1.6. - var pos int8 - var val int64 - for n = 0; n < len(p); n++ { - if pos == 0 { - val = r.Int63() - pos = 7 - } - p[n] = byte(val) - val >>= 8 - pos-- - } - - return n, err -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go index 74e361e07..de021367d 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go @@ -146,9 +146,6 @@ func unmarshalStatusCode(v reflect.Value, statusCode int) { } func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string) error { - if len(headers) == 0 { - return nil - } switch r.Interface().(type) { case map[string]*string: // we only support string map value types out := map[string]*string{} @@ -158,28 +155,19 @@ func unmarshalHeaderMap(r reflect.Value, headers http.Header, prefix string) err out[k[len(prefix):]] = &v[0] } } - if len(out) != 0 { - r.Set(reflect.ValueOf(out)) - } - + r.Set(reflect.ValueOf(out)) } return nil } func unmarshalHeader(v reflect.Value, header string, tag reflect.StructTag) error { - switch tag.Get("type") { - case "jsonvalue": - if len(header) == 0 { - return nil - } - case "blob": + isJSONValue := tag.Get("type") == "jsonvalue" + if isJSONValue { if len(header) == 0 { return nil } - default: - if !v.IsValid() || (header == "" && v.Elem().Kind() != reflect.String) { - return nil - } + } else if !v.IsValid() || (header == "" && v.Elem().Kind() != reflect.String) { + return nil } switch v.Interface().(type) { @@ -190,7 +178,7 @@ func unmarshalHeader(v reflect.Value, header string, tag reflect.StructTag) erro if err != nil { return err } - v.Set(reflect.ValueOf(b)) + v.Set(reflect.ValueOf(&b)) case *bool: b, err := strconv.ParseBool(header) if err != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go index 07a6187ea..cf569645d 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go @@ -39,7 +39,7 @@ func Build(r *request.Request) { r.Error = awserr.NewRequestFailure( awserr.New(request.ErrCodeSerialization, "failed to encode rest XML request", err), - 0, + r.HTTPResponse.StatusCode, r.RequestID, ) return diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go index 05d4ff519..b7ed6c6f8 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go @@ -1,11 +1,8 @@ package protocol import ( - "math" "strconv" "time" - - "github.com/aws/aws-sdk-go/internal/sdkmath" ) // Names of time formats supported by the SDK @@ -16,19 +13,12 @@ const ( ) // Time formats supported by the SDK -// Output time is intended to not contain decimals const ( // RFC 7231#section-7.1.1.1 timetamp format. e.g Tue, 29 Apr 2014 18:30:38 GMT RFC822TimeFormat = "Mon, 2 Jan 2006 15:04:05 GMT" - // This format is used for output time without seconds precision - RFC822OutputTimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT" - // RFC3339 a subset of the ISO8601 timestamp format. e.g 2014-04-29T18:30:38Z - ISO8601TimeFormat = "2006-01-02T15:04:05.999999999Z" - - // This format is used for output time without seconds precision - ISO8601OutputTimeFormat = "2006-01-02T15:04:05Z" + ISO8601TimeFormat = "2006-01-02T15:04:05Z" ) // IsKnownTimestampFormat returns if the timestamp format name @@ -52,9 +42,9 @@ func FormatTime(name string, t time.Time) string { switch name { case RFC822TimeFormatName: - return t.Format(RFC822OutputTimeFormat) + return t.Format(RFC822TimeFormat) case ISO8601TimeFormatName: - return t.Format(ISO8601OutputTimeFormat) + return t.Format(ISO8601TimeFormat) case UnixTimeFormatName: return strconv.FormatInt(t.Unix(), 10) default: @@ -72,12 +62,10 @@ func ParseTime(formatName, value string) (time.Time, error) { return time.Parse(ISO8601TimeFormat, value) case UnixTimeFormatName: v, err := strconv.ParseFloat(value, 64) - _, dec := math.Modf(v) - dec = sdkmath.Round(dec*1e3) / 1e3 //Rounds 0.1229999 to 0.123 if err != nil { return time.Time{}, err } - return time.Unix(int64(v), int64(dec*(1e9))), nil + return time.Unix(int64(v), 0), nil default: panic("unknown timestamp format name, " + formatName) } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/sort.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/sort.go deleted file mode 100644 index c1a511851..000000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/sort.go +++ /dev/null @@ -1,32 +0,0 @@ -package xmlutil - -import ( - "encoding/xml" - "strings" -) - -type xmlAttrSlice []xml.Attr - -func (x xmlAttrSlice) Len() int { - return len(x) -} - -func (x xmlAttrSlice) Less(i, j int) bool { - spaceI, spaceJ := x[i].Name.Space, x[j].Name.Space - localI, localJ := x[i].Name.Local, x[j].Name.Local - valueI, valueJ := x[i].Value, x[j].Value - - spaceCmp := strings.Compare(spaceI, spaceJ) - localCmp := strings.Compare(localI, localJ) - valueCmp := strings.Compare(valueI, valueJ) - - if spaceCmp == -1 || (spaceCmp == 0 && (localCmp == -1 || (localCmp == 0 && valueCmp == -1))) { - return true - } - - return false -} - -func (x xmlAttrSlice) Swap(i, j int) { - x[i], x[j] = x[j], x[i] -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go index 42f71648e..515ce1521 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go @@ -119,18 +119,7 @@ func (n *XMLNode) findElem(name string) (string, bool) { // StructToXML writes an XMLNode to a xml.Encoder as tokens. func StructToXML(e *xml.Encoder, node *XMLNode, sorted bool) error { - // Sort Attributes - attrs := node.Attr - if sorted { - sortedAttrs := make([]xml.Attr, len(attrs)) - for _, k := range node.Attr { - sortedAttrs = append(sortedAttrs, k) - } - sort.Sort(xmlAttrSlice(sortedAttrs)) - attrs = sortedAttrs - } - - e.EncodeToken(xml.StartElement{Name: node.Name, Attr: attrs}) + e.EncodeToken(xml.StartElement{Name: node.Name, Attr: node.Attr}) if node.Text != "" { e.EncodeToken(xml.CharData([]byte(node.Text))) diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go b/vendor/github.com/aws/aws-sdk-go/service/s3/api.go index b4a4e8c4a..06aabf1e6 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/api.go @@ -545,10 +545,6 @@ func (c *S3) DeleteBucketAnalyticsConfigurationRequest(input *DeleteBucketAnalyt // Deletes an analytics configuration for the bucket (specified by the analytics // configuration ID). // -// To use this operation, you must have permissions to perform the s3:PutAnalyticsConfiguration -// action. The bucket owner has this permission by default. The bucket owner -// can grant this permission to others. -// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -3339,8 +3335,8 @@ func (c *S3) GetObjectLockConfigurationRequest(input *GetObjectLockConfiguration // GetObjectLockConfiguration API operation for Amazon Simple Storage Service. // -// Gets the object lock configuration for a bucket. The rule specified in the -// object lock configuration will be applied by default to every new object +// Gets the Object Lock configuration for a bucket. The rule specified in the +// Object Lock configuration will be applied by default to every new object // placed in the specified bucket. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5758,7 +5754,8 @@ func (c *S3) PutBucketPolicyRequest(input *PutBucketPolicyInput) (req *request.R // PutBucketPolicy API operation for Amazon Simple Storage Service. // -// Applies an Amazon S3 bucket policy to an Amazon S3 bucket. +// Replaces a policy on a bucket. If the bucket already has a policy, the one +// in this request completely replaces it. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -6442,8 +6439,8 @@ func (c *S3) PutObjectLockConfigurationRequest(input *PutObjectLockConfiguration // PutObjectLockConfiguration API operation for Amazon Simple Storage Service. // -// Places an object lock configuration on the specified bucket. The rule specified -// in the object lock configuration will be applied by default to every new +// Places an Object Lock configuration on the specified bucket. The rule specified +// in the Object Lock configuration will be applied by default to every new // object placed in the specified bucket. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -7013,16 +7010,13 @@ func (c *S3) UploadPartCopyWithContext(ctx aws.Context, input *UploadPartCopyInp return out, req.Send() } -// Specifies the days since the initiation of an incomplete multipart upload -// that Amazon S3 will wait before permanently removing all parts of the upload. -// For more information, see Aborting Incomplete Multipart Uploads Using a Bucket -// Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) -// in the Amazon Simple Storage Service Developer Guide. +// Specifies the days since the initiation of an Incomplete Multipart Upload +// that Lifecycle will wait before permanently removing all parts of the upload. type AbortIncompleteMultipartUpload struct { _ struct{} `type:"structure"` - // Specifies the number of days after which Amazon S3 aborts an incomplete multipart - // upload. + // Indicates the number of days that must pass since initiation for Lifecycle + // to abort an Incomplete Multipart Upload. DaysAfterInitiation *int64 `type:"integer"` } @@ -7043,15 +7037,11 @@ func (s *AbortIncompleteMultipartUpload) SetDaysAfterInitiation(v int64) *AbortI } type AbortMultipartUploadInput struct { - _ struct{} `locationName:"AbortMultipartUploadRequest" type:"structure"` + _ struct{} `type:"structure"` - // Name of the bucket to which the multipart upload was initiated. - // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // Key of the object for which the multipart upload was initiated. - // // Key is a required field Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` @@ -7061,8 +7051,6 @@ type AbortMultipartUploadInput struct { // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - // Upload ID that identifies the multipart upload. - // // UploadId is a required field UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` } @@ -7157,13 +7145,10 @@ func (s *AbortMultipartUploadOutput) SetRequestCharged(v string) *AbortMultipart return s } -// Configures the transfer acceleration state for an Amazon S3 bucket. For more -// information, see Amazon S3 Transfer Acceleration (https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html) -// in the Amazon Simple Storage Service Developer Guide. type AccelerateConfiguration struct { _ struct{} `type:"structure"` - // Specifies the transfer acceleration status of the bucket. + // The accelerate configuration of the bucket. Status *string `type:"string" enum:"BucketAccelerateStatus"` } @@ -7183,14 +7168,12 @@ func (s *AccelerateConfiguration) SetStatus(v string) *AccelerateConfiguration { return s } -// Contains the elements that set the ACL permissions for an object per grantee. type AccessControlPolicy struct { _ struct{} `type:"structure"` // A list of grants. Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` - // Container for the bucket owner's display name and ID. Owner *Owner `type:"structure"` } @@ -7240,9 +7223,7 @@ func (s *AccessControlPolicy) SetOwner(v *Owner) *AccessControlPolicy { type AccessControlTranslation struct { _ struct{} `type:"structure"` - // Specifies the replica ownership. For default and valid values, see PUT bucket - // replication (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html) - // in the Amazon Simple Storage Service API Reference. + // The override value for the owner of the replica object. // // Owner is a required field Owner *string `type:"string" required:"true" enum:"OwnerOverride"` @@ -7277,14 +7258,10 @@ func (s *AccessControlTranslation) SetOwner(v string) *AccessControlTranslation return s } -// A conjunction (logical AND) of predicates, which is used in evaluating a -// metrics filter. The operator must have at least two predicates in any combination, -// and an object must match all of the predicates for the filter to apply. type AnalyticsAndOperator struct { _ struct{} `type:"structure"` - // The prefix to use when evaluating an AND predicate: The prefix that an object - // must have to be included in the metrics results. + // The prefix to use when evaluating an AND predicate. Prefix *string `type:"string"` // The list of tags to use when evaluating an AND predicate. @@ -7333,11 +7310,6 @@ func (s *AnalyticsAndOperator) SetTags(v []*Tag) *AnalyticsAndOperator { return s } -// Specifies the configuration and any analyses for the analytics filter of -// an Amazon S3 bucket. -// -// For more information, see GET Bucket analytics (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETAnalyticsConfig.html) -// in the Amazon Simple Storage Service API Reference. type AnalyticsConfiguration struct { _ struct{} `type:"structure"` @@ -7346,13 +7318,13 @@ type AnalyticsConfiguration struct { // If no filter is provided, all objects will be considered in any analysis. Filter *AnalyticsFilter `type:"structure"` - // The ID that identifies the analytics configuration. + // The identifier used to represent an analytics configuration. // // Id is a required field Id *string `type:"string" required:"true"` - // Contains data related to access patterns to be collected and made available - // to analyze the tradeoffs between different storage classes. + // If present, it indicates that data related to access patterns will be collected + // and made available to analyze the tradeoffs between different storage classes. // // StorageClassAnalysis is a required field StorageClassAnalysis *StorageClassAnalysis `type:"structure" required:"true"` @@ -7412,7 +7384,6 @@ func (s *AnalyticsConfiguration) SetStorageClassAnalysis(v *StorageClassAnalysis return s } -// Where to publish the analytics results. type AnalyticsExportDestination struct { _ struct{} `type:"structure"` @@ -7521,7 +7492,7 @@ func (s *AnalyticsFilter) SetTag(v *Tag) *AnalyticsFilter { type AnalyticsS3BucketDestination struct { _ struct{} `type:"structure"` - // The Amazon Resource Name (ARN) of the bucket to which data is exported. + // The Amazon resource name (ARN) of the bucket to which data is exported. // // Bucket is a required field Bucket *string `type:"string" required:"true"` @@ -7530,12 +7501,13 @@ type AnalyticsS3BucketDestination struct { // the owner will not be validated prior to exporting data. BucketAccountId *string `type:"string"` - // Specifies the file format used when exporting data to Amazon S3. + // The file format used when exporting data to Amazon S3. // // Format is a required field Format *string `type:"string" required:"true" enum:"AnalyticsS3ExportFileFormat"` - // The prefix to use when exporting data. The prefix is prepended to all results. + // The prefix to use when exporting data. The exported data begins with this + // prefix. Prefix *string `type:"string"` } @@ -7628,14 +7600,9 @@ func (s *Bucket) SetName(v string) *Bucket { return s } -// Specifies the lifecycle configuration for objects in an Amazon S3 bucket. -// For more information, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) -// in the Amazon Simple Storage Service Developer Guide. type BucketLifecycleConfiguration struct { _ struct{} `type:"structure"` - // A lifecycle rule for individual objects in an Amazon S3 bucket. - // // Rules is a required field Rules []*LifecycleRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` } @@ -7682,10 +7649,9 @@ func (s *BucketLifecycleConfiguration) SetRules(v []*LifecycleRule) *BucketLifec type BucketLoggingStatus struct { _ struct{} `type:"structure"` - // Describes where logs are stored and the prefix that Amazon S3 assigns to - // all log object keys for a bucket. For more information, see PUT Bucket logging - // (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) - // in the Amazon Simple Storage Service API Reference. + // Container for logging information. Presence of this element indicates that + // logging is enabled. Parameters TargetBucket and TargetPrefix are required + // in this case. LoggingEnabled *LoggingEnabled `type:"structure"` } @@ -7720,15 +7686,9 @@ func (s *BucketLoggingStatus) SetLoggingEnabled(v *LoggingEnabled) *BucketLoggin return s } -// Describes the cross-origin access configuration for objects in an Amazon -// S3 bucket. For more information, see Enabling Cross-Origin Resource Sharing -// (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) in the Amazon -// Simple Storage Service Developer Guide. type CORSConfiguration struct { _ struct{} `type:"structure"` - // A set of allowed origins and methods. - // // CORSRules is a required field CORSRules []*CORSRule `locationName:"CORSRule" type:"list" flattened:"true" required:"true"` } @@ -7772,18 +7732,14 @@ func (s *CORSConfiguration) SetCORSRules(v []*CORSRule) *CORSConfiguration { return s } -// Specifies a cross-origin access rule for an Amazon S3 bucket. type CORSRule struct { _ struct{} `type:"structure"` - // Headers that are specified in the Access-Control-Request-Headers header. - // These headers are allowed in a preflight OPTIONS request. In response to - // any preflight OPTIONS request, Amazon S3 returns any requested headers that - // are allowed. + // Specifies which headers are allowed in a pre-flight OPTIONS request. AllowedHeaders []*string `locationName:"AllowedHeader" type:"list" flattened:"true"` - // An HTTP method that you allow the origin to execute. Valid values are GET, - // PUT, HEAD, POST, and DELETE. + // Identifies HTTP methods that the domain/origin specified in the rule is allowed + // to execute. // // AllowedMethods is a required field AllowedMethods []*string `locationName:"AllowedMethod" type:"list" flattened:"true" required:"true"` @@ -8084,7 +8040,7 @@ func (s *CommonPrefix) SetPrefix(v string) *CommonPrefix { } type CompleteMultipartUploadInput struct { - _ struct{} `locationName:"CompleteMultipartUploadRequest" type:"structure" payload:"MultipartUpload"` + _ struct{} `type:"structure" payload:"MultipartUpload"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -8334,7 +8290,6 @@ func (s *CompletedPart) SetPartNumber(v int64) *CompletedPart { return s } -// Specifies a condition that must be met for a redirect to apply. type Condition struct { _ struct{} `type:"structure"` @@ -8404,7 +8359,7 @@ func (s *ContinuationEvent) UnmarshalEvent( } type CopyObjectInput struct { - _ struct{} `locationName:"CopyObjectRequest" type:"structure"` + _ struct{} `type:"structure"` // The canned ACL to apply to the object. ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` @@ -8489,10 +8444,10 @@ type CopyObjectInput struct { // Specifies whether you want to apply a Legal Hold to the copied object. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // The object lock mode that you want to apply to the copied object. + // The Object Lock mode that you want to apply to the copied object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // The date and time when you want the copied object's object lock to expire. + // The date and time when you want the copied object's Object Lock to expire. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // Confirms that the requester knows that she or he will be charged for the @@ -8516,11 +8471,6 @@ type CopyObjectInput struct { // key was transmitted without error. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - // Specifies the AWS KMS Encryption Context to use for object encryption. The - // value of this header is a base64-encoded UTF-8 string holding JSON with the - // encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT // requests for an object protected by AWS KMS will fail if not made via SSL // or using SigV4. Documentation on configuring any of the officially supported @@ -8785,12 +8735,6 @@ func (s *CopyObjectInput) SetSSECustomerKeyMD5(v string) *CopyObjectInput { return s } -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *CopyObjectInput) SetSSEKMSEncryptionContext(v string) *CopyObjectInput { - s.SSEKMSEncryptionContext = &v - return s -} - // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *CopyObjectInput) SetSSEKMSKeyId(v string) *CopyObjectInput { s.SSEKMSKeyId = &v @@ -8851,11 +8795,6 @@ type CopyObjectOutput struct { // verification of the customer-provided encryption key. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - // If present, specifies the AWS KMS Encryption Context to use for object encryption. - // The value of this header is a base64-encoded UTF-8 string holding JSON with - // the encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - // If present, specifies the ID of the AWS Key Management Service (KMS) master // encryption key that was used for the object. SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` @@ -8914,12 +8853,6 @@ func (s *CopyObjectOutput) SetSSECustomerKeyMD5(v string) *CopyObjectOutput { return s } -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *CopyObjectOutput) SetSSEKMSEncryptionContext(v string) *CopyObjectOutput { - s.SSEKMSEncryptionContext = &v - return s -} - // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *CopyObjectOutput) SetSSEKMSKeyId(v string) *CopyObjectOutput { s.SSEKMSKeyId = &v @@ -9025,7 +8958,7 @@ func (s *CreateBucketConfiguration) SetLocationConstraint(v string) *CreateBucke } type CreateBucketInput struct { - _ struct{} `locationName:"CreateBucketRequest" type:"structure" payload:"CreateBucketConfiguration"` + _ struct{} `type:"structure" payload:"CreateBucketConfiguration"` // The canned ACL to apply to the bucket. ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"BucketCannedACL"` @@ -9051,8 +8984,7 @@ type CreateBucketInput struct { // Allows grantee to write the ACL for the applicable bucket. GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - // Specifies whether you want Amazon S3 object lock to be enabled for the new - // bucket. + // Specifies whether you want S3 Object Lock to be enabled for the new bucket. ObjectLockEnabledForBucket *bool `location:"header" locationName:"x-amz-bucket-object-lock-enabled" type:"boolean"` } @@ -9166,7 +9098,7 @@ func (s *CreateBucketOutput) SetLocation(v string) *CreateBucketOutput { } type CreateMultipartUploadInput struct { - _ struct{} `locationName:"CreateMultipartUploadRequest" type:"structure"` + _ struct{} `type:"structure"` // The canned ACL to apply to the object. ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` @@ -9215,10 +9147,10 @@ type CreateMultipartUploadInput struct { // Specifies whether you want to apply a Legal Hold to the uploaded object. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // Specifies the object lock mode that you want to apply to the uploaded object. + // Specifies the Object Lock mode that you want to apply to the uploaded object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // Specifies the date and time when you want the object lock to expire. + // Specifies the date and time when you want the Object Lock to expire. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // Confirms that the requester knows that she or he will be charged for the @@ -9242,11 +9174,6 @@ type CreateMultipartUploadInput struct { // key was transmitted without error. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - // Specifies the AWS KMS Encryption Context to use for object encryption. The - // value of this header is a base64-encoded UTF-8 string holding JSON with the - // encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT // requests for an object protected by AWS KMS will fail if not made via SSL // or using SigV4. Documentation on configuring any of the officially supported @@ -9441,12 +9368,6 @@ func (s *CreateMultipartUploadInput) SetSSECustomerKeyMD5(v string) *CreateMulti return s } -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *CreateMultipartUploadInput) SetSSEKMSEncryptionContext(v string) *CreateMultipartUploadInput { - s.SSEKMSEncryptionContext = &v - return s -} - // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *CreateMultipartUploadInput) SetSSEKMSKeyId(v string) *CreateMultipartUploadInput { s.SSEKMSKeyId = &v @@ -9507,11 +9428,6 @@ type CreateMultipartUploadOutput struct { // verification of the customer-provided encryption key. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - // If present, specifies the AWS KMS Encryption Context to use for object encryption. - // The value of this header is a base64-encoded UTF-8 string holding JSON with - // the encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - // If present, specifies the ID of the AWS Key Management Service (KMS) master // encryption key that was used for the object. SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` @@ -9583,12 +9499,6 @@ func (s *CreateMultipartUploadOutput) SetSSECustomerKeyMD5(v string) *CreateMult return s } -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *CreateMultipartUploadOutput) SetSSEKMSEncryptionContext(v string) *CreateMultipartUploadOutput { - s.SSEKMSEncryptionContext = &v - return s -} - // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *CreateMultipartUploadOutput) SetSSEKMSKeyId(v string) *CreateMultipartUploadOutput { s.SSEKMSKeyId = &v @@ -9607,7 +9517,7 @@ func (s *CreateMultipartUploadOutput) SetUploadId(v string) *CreateMultipartUplo return s } -// The container element for specifying the default object lock retention settings +// The container element for specifying the default Object Lock retention settings // for new objects placed in the specified bucket. type DefaultRetention struct { _ struct{} `type:"structure"` @@ -9615,7 +9525,7 @@ type DefaultRetention struct { // The number of days that you want to specify for the default retention period. Days *int64 `type:"integer"` - // The default object lock retention mode you want to apply to new objects placed + // The default Object Lock retention mode you want to apply to new objects placed // in the specified bucket. Mode *string `type:"string" enum:"ObjectLockRetentionMode"` @@ -9708,14 +9618,14 @@ func (s *Delete) SetQuiet(v bool) *Delete { } type DeleteBucketAnalyticsConfigurationInput struct { - _ struct{} `locationName:"DeleteBucketAnalyticsConfigurationRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket from which an analytics configuration is deleted. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The ID that identifies the analytics configuration. + // The identifier used to represent an analytics configuration. // // Id is a required field Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` @@ -9784,7 +9694,7 @@ func (s DeleteBucketAnalyticsConfigurationOutput) GoString() string { } type DeleteBucketCorsInput struct { - _ struct{} `locationName:"DeleteBucketCorsRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -9844,7 +9754,7 @@ func (s DeleteBucketCorsOutput) GoString() string { } type DeleteBucketEncryptionInput struct { - _ struct{} `locationName:"DeleteBucketEncryptionRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket containing the server-side encryption configuration // to delete. @@ -9907,7 +9817,7 @@ func (s DeleteBucketEncryptionOutput) GoString() string { } type DeleteBucketInput struct { - _ struct{} `locationName:"DeleteBucketRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -9953,7 +9863,7 @@ func (s *DeleteBucketInput) getBucket() (v string) { } type DeleteBucketInventoryConfigurationInput struct { - _ struct{} `locationName:"DeleteBucketInventoryConfigurationRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket containing the inventory configuration to delete. // @@ -10029,7 +9939,7 @@ func (s DeleteBucketInventoryConfigurationOutput) GoString() string { } type DeleteBucketLifecycleInput struct { - _ struct{} `locationName:"DeleteBucketLifecycleRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -10089,7 +9999,7 @@ func (s DeleteBucketLifecycleOutput) GoString() string { } type DeleteBucketMetricsConfigurationInput struct { - _ struct{} `locationName:"DeleteBucketMetricsConfigurationRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket containing the metrics configuration to delete. // @@ -10179,7 +10089,7 @@ func (s DeleteBucketOutput) GoString() string { } type DeleteBucketPolicyInput struct { - _ struct{} `locationName:"DeleteBucketPolicyRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -10239,7 +10149,7 @@ func (s DeleteBucketPolicyOutput) GoString() string { } type DeleteBucketReplicationInput struct { - _ struct{} `locationName:"DeleteBucketReplicationRequest" type:"structure"` + _ struct{} `type:"structure"` // The bucket name. // @@ -10304,7 +10214,7 @@ func (s DeleteBucketReplicationOutput) GoString() string { } type DeleteBucketTaggingInput struct { - _ struct{} `locationName:"DeleteBucketTaggingRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -10364,7 +10274,7 @@ func (s DeleteBucketTaggingOutput) GoString() string { } type DeleteBucketWebsiteInput struct { - _ struct{} `locationName:"DeleteBucketWebsiteRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -10510,12 +10420,12 @@ func (s *DeleteMarkerReplication) SetStatus(v string) *DeleteMarkerReplication { } type DeleteObjectInput struct { - _ struct{} `locationName:"DeleteObjectRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // Indicates whether Amazon S3 object lock should bypass governance-mode restrictions + // Indicates whether S3 Object Lock should bypass Governance-mode restrictions // to process this operation. BypassGovernanceRetention *bool `location:"header" locationName:"x-amz-bypass-governance-retention" type:"boolean"` @@ -10656,7 +10566,7 @@ func (s *DeleteObjectOutput) SetVersionId(v string) *DeleteObjectOutput { } type DeleteObjectTaggingInput struct { - _ struct{} `locationName:"DeleteObjectTaggingRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -10749,13 +10659,13 @@ func (s *DeleteObjectTaggingOutput) SetVersionId(v string) *DeleteObjectTaggingO } type DeleteObjectsInput struct { - _ struct{} `locationName:"DeleteObjectsRequest" type:"structure" payload:"Delete"` + _ struct{} `type:"structure" payload:"Delete"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` // Specifies whether you want to delete this object even if it has a Governance-type - // object lock in place. You must have sufficient permissions to perform this + // Object Lock in place. You must have sufficient permissions to perform this // operation. BypassGovernanceRetention *bool `location:"header" locationName:"x-amz-bypass-governance-retention" type:"boolean"` @@ -10885,7 +10795,7 @@ func (s *DeleteObjectsOutput) SetRequestCharged(v string) *DeleteObjectsOutput { } type DeletePublicAccessBlockInput struct { - _ struct{} `locationName:"DeletePublicAccessBlockRequest" type:"structure"` + _ struct{} `type:"structure"` // The Amazon S3 bucket whose PublicAccessBlock configuration you want to delete. // @@ -10992,33 +10902,33 @@ func (s *DeletedObject) SetVersionId(v string) *DeletedObject { return s } -// Specifies information about where to publish analysis or configuration results -// for an Amazon S3 bucket. +// A container for information about the replication destination. type Destination struct { _ struct{} `type:"structure"` - // Specify this only in a cross-account scenario (where source and destination - // bucket owners are not the same), and you want to change replica ownership - // to the AWS account that owns the destination bucket. If this is not specified - // in the replication configuration, the replicas are owned by same AWS account - // that owns the source object. + // A container for information about access control for replicas. + // + // Use this element only in a cross-account scenario where source and destination + // bucket owners are not the same to change replica ownership to the AWS account + // that owns the destination bucket. If you don't add this element to the replication + // configuration, the replicas are owned by same AWS account that owns the source + // object. AccessControlTranslation *AccessControlTranslation `type:"structure"` - // Destination bucket owner account ID. In a cross-account scenario, if you - // direct Amazon S3 to change replica ownership to the AWS account that owns - // the destination bucket by specifying the AccessControlTranslation property, - // this is the account ID of the destination bucket owner. For more information, - // see Cross-Region Replication Additional Configuration: Change Replica Owner - // (https://docs.aws.amazon.com/AmazonS3/latest/dev/crr-change-owner.html) in - // the Amazon Simple Storage Service Developer Guide. + // The account ID of the destination bucket. Currently, Amazon S3 verifies this + // value only if Access Control Translation is enabled. + // + // In a cross-account scenario, if you change replica ownership to the AWS account + // that owns the destination bucket by adding the AccessControlTranslation element, + // this is the account ID of the owner of the destination bucket. Account *string `type:"string"` // The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to // store replicas of the object identified by the rule. // - // A replication configuration can replicate objects to only one destination - // bucket. If there are multiple rules in your replication configuration, all - // rules must specify the same destination bucket. + // If there are multiple rules in your replication configuration, all rules + // must specify the same bucket as the destination. A replication configuration + // can replicate objects to only one destination bucket. // // Bucket is a required field Bucket *string `type:"string" required:"true"` @@ -11027,13 +10937,8 @@ type Destination struct { // is specified, you must specify this element. EncryptionConfiguration *EncryptionConfiguration `type:"structure"` - // The storage class to use when replicating objects, such as standard or reduced - // redundancy. By default, Amazon S3 uses the storage class of the source object - // to create the object replica. - // - // For valid values, see the StorageClass element of the PUT Bucket replication - // (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html) - // action in the Amazon Simple Storage Service API Reference. + // The class of storage used to store the object. By default Amazon S3 uses + // storage class of the source object when creating a replica. StorageClass *string `type:"string" enum:"StorageClass"` } @@ -11163,13 +11068,13 @@ func (s *Encryption) SetKMSKeyId(v string) *Encryption { return s } -// Specifies encryption-related information for an Amazon S3 bucket that is -// a destination for replicated objects. +// A container for information about the encryption-based configuration for +// replicas. type EncryptionConfiguration struct { _ struct{} `type:"structure"` - // Specifies the AWS KMS Key ID (Key ARN or Alias ARN) for the destination bucket. - // Amazon S3 uses this key to encrypt replica objects. + // The ID of the AWS KMS key for the AWS Region where the destination bucket + // resides. Amazon S3 uses this key to encrypt the replica object. ReplicaKmsKeyID *string `type:"string"` } @@ -11302,19 +11207,18 @@ func (s *ErrorDocument) SetKey(v string) *ErrorDocument { return s } -// Specifies the Amazon S3 object key name to filter on and whether to filter -// on the suffix or prefix of the key name. +// A container for a key value pair that defines the criteria for the filter +// rule. type FilterRule struct { _ struct{} `type:"structure"` // The object key name prefix or suffix identifying one or more objects to which - // the filtering rule applies. The maximum length is 1,024 characters. Overlapping - // prefixes and suffixes are not supported. For more information, see Configuring - // Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // the filtering rule applies. The maximum prefix length is 1,024 characters. + // Overlapping prefixes and suffixes are not supported. For more information, + // see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon Simple Storage Service Developer Guide. Name *string `type:"string" enum:"FilterRuleName"` - // The value that the filter searches for in object key names. Value *string `type:"string"` } @@ -11341,7 +11245,7 @@ func (s *FilterRule) SetValue(v string) *FilterRule { } type GetBucketAccelerateConfigurationInput struct { - _ struct{} `locationName:"GetBucketAccelerateConfigurationRequest" type:"structure"` + _ struct{} `type:"structure"` // Name of the bucket for which the accelerate configuration is retrieved. // @@ -11412,7 +11316,7 @@ func (s *GetBucketAccelerateConfigurationOutput) SetStatus(v string) *GetBucketA } type GetBucketAclInput struct { - _ struct{} `locationName:"GetBucketAclRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -11489,14 +11393,14 @@ func (s *GetBucketAclOutput) SetOwner(v *Owner) *GetBucketAclOutput { } type GetBucketAnalyticsConfigurationInput struct { - _ struct{} `locationName:"GetBucketAnalyticsConfigurationRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket from which an analytics configuration is retrieved. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The ID that identifies the analytics configuration. + // The identifier used to represent an analytics configuration. // // Id is a required field Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` @@ -11574,7 +11478,7 @@ func (s *GetBucketAnalyticsConfigurationOutput) SetAnalyticsConfiguration(v *Ana } type GetBucketCorsInput struct { - _ struct{} `locationName:"GetBucketCorsRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -11642,7 +11546,7 @@ func (s *GetBucketCorsOutput) SetCORSRules(v []*CORSRule) *GetBucketCorsOutput { } type GetBucketEncryptionInput struct { - _ struct{} `locationName:"GetBucketEncryptionRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket from which the server-side encryption configuration // is retrieved. @@ -11693,7 +11597,8 @@ func (s *GetBucketEncryptionInput) getBucket() (v string) { type GetBucketEncryptionOutput struct { _ struct{} `type:"structure" payload:"ServerSideEncryptionConfiguration"` - // Specifies the default server-side-encryption configuration. + // Container for server-side encryption configuration rules. Currently S3 supports + // one rule only. ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `type:"structure"` } @@ -11714,7 +11619,7 @@ func (s *GetBucketEncryptionOutput) SetServerSideEncryptionConfiguration(v *Serv } type GetBucketInventoryConfigurationInput struct { - _ struct{} `locationName:"GetBucketInventoryConfigurationRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket containing the inventory configuration to retrieve. // @@ -11799,7 +11704,7 @@ func (s *GetBucketInventoryConfigurationOutput) SetInventoryConfiguration(v *Inv } type GetBucketLifecycleConfigurationInput struct { - _ struct{} `locationName:"GetBucketLifecycleConfigurationRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -11867,7 +11772,7 @@ func (s *GetBucketLifecycleConfigurationOutput) SetRules(v []*LifecycleRule) *Ge } type GetBucketLifecycleInput struct { - _ struct{} `locationName:"GetBucketLifecycleRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -11935,7 +11840,7 @@ func (s *GetBucketLifecycleOutput) SetRules(v []*Rule) *GetBucketLifecycleOutput } type GetBucketLocationInput struct { - _ struct{} `locationName:"GetBucketLocationRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -12003,7 +11908,7 @@ func (s *GetBucketLocationOutput) SetLocationConstraint(v string) *GetBucketLoca } type GetBucketLoggingInput struct { - _ struct{} `locationName:"GetBucketLoggingRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -12051,10 +11956,9 @@ func (s *GetBucketLoggingInput) getBucket() (v string) { type GetBucketLoggingOutput struct { _ struct{} `type:"structure"` - // Describes where logs are stored and the prefix that Amazon S3 assigns to - // all log object keys for a bucket. For more information, see PUT Bucket logging - // (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) - // in the Amazon Simple Storage Service API Reference. + // Container for logging information. Presence of this element indicates that + // logging is enabled. Parameters TargetBucket and TargetPrefix are required + // in this case. LoggingEnabled *LoggingEnabled `type:"structure"` } @@ -12075,7 +11979,7 @@ func (s *GetBucketLoggingOutput) SetLoggingEnabled(v *LoggingEnabled) *GetBucket } type GetBucketMetricsConfigurationInput struct { - _ struct{} `locationName:"GetBucketMetricsConfigurationRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket containing the metrics configuration to retrieve. // @@ -12160,7 +12064,7 @@ func (s *GetBucketMetricsConfigurationOutput) SetMetricsConfiguration(v *Metrics } type GetBucketNotificationConfigurationRequest struct { - _ struct{} `locationName:"GetBucketNotificationConfigurationRequest" type:"structure"` + _ struct{} `type:"structure"` // Name of the bucket to get the notification configuration for. // @@ -12208,7 +12112,7 @@ func (s *GetBucketNotificationConfigurationRequest) getBucket() (v string) { } type GetBucketPolicyInput struct { - _ struct{} `locationName:"GetBucketPolicyRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -12277,7 +12181,7 @@ func (s *GetBucketPolicyOutput) SetPolicy(v string) *GetBucketPolicyOutput { } type GetBucketPolicyStatusInput struct { - _ struct{} `locationName:"GetBucketPolicyStatusRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the Amazon S3 bucket whose policy status you want to retrieve. // @@ -12348,7 +12252,7 @@ func (s *GetBucketPolicyStatusOutput) SetPolicyStatus(v *PolicyStatus) *GetBucke } type GetBucketReplicationInput struct { - _ struct{} `locationName:"GetBucketReplicationRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -12418,7 +12322,7 @@ func (s *GetBucketReplicationOutput) SetReplicationConfiguration(v *ReplicationC } type GetBucketRequestPaymentInput struct { - _ struct{} `locationName:"GetBucketRequestPaymentRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -12487,7 +12391,7 @@ func (s *GetBucketRequestPaymentOutput) SetPayer(v string) *GetBucketRequestPaym } type GetBucketTaggingInput struct { - _ struct{} `locationName:"GetBucketTaggingRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -12556,7 +12460,7 @@ func (s *GetBucketTaggingOutput) SetTagSet(v []*Tag) *GetBucketTaggingOutput { } type GetBucketVersioningInput struct { - _ struct{} `locationName:"GetBucketVersioningRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -12636,7 +12540,7 @@ func (s *GetBucketVersioningOutput) SetStatus(v string) *GetBucketVersioningOutp } type GetBucketWebsiteInput struct { - _ struct{} `locationName:"GetBucketWebsiteRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -12688,8 +12592,6 @@ type GetBucketWebsiteOutput struct { IndexDocument *IndexDocument `type:"structure"` - // Specifies the redirect behavior of all requests to a website endpoint of - // an Amazon S3 bucket. RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` RoutingRules []*RoutingRule `locationNameList:"RoutingRule" type:"list"` @@ -12730,7 +12632,7 @@ func (s *GetBucketWebsiteOutput) SetRoutingRules(v []*RoutingRule) *GetBucketWeb } type GetObjectAclInput struct { - _ struct{} `locationName:"GetObjectAclRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -12853,7 +12755,7 @@ func (s *GetObjectAclOutput) SetRequestCharged(v string) *GetObjectAclOutput { } type GetObjectInput struct { - _ struct{} `locationName:"GetObjectRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -13090,7 +12992,7 @@ func (s *GetObjectInput) SetVersionId(v string) *GetObjectInput { } type GetObjectLegalHoldInput struct { - _ struct{} `locationName:"GetObjectLegalHoldRequest" type:"structure"` + _ struct{} `type:"structure"` // The bucket containing the object whose Legal Hold status you want to retrieve. // @@ -13199,9 +13101,9 @@ func (s *GetObjectLegalHoldOutput) SetLegalHold(v *ObjectLockLegalHold) *GetObje } type GetObjectLockConfigurationInput struct { - _ struct{} `locationName:"GetObjectLockConfigurationRequest" type:"structure"` + _ struct{} `type:"structure"` - // The bucket whose object lock configuration you want to retrieve. + // The bucket whose Object Lock configuration you want to retrieve. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -13249,7 +13151,7 @@ func (s *GetObjectLockConfigurationInput) getBucket() (v string) { type GetObjectLockConfigurationOutput struct { _ struct{} `type:"structure" payload:"ObjectLockConfiguration"` - // The specified bucket's object lock configuration. + // The specified bucket's Object Lock configuration. ObjectLockConfiguration *ObjectLockConfiguration `type:"structure"` } @@ -13333,10 +13235,10 @@ type GetObjectOutput struct { // returned if you have permission to view an object's legal hold status. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // The object lock mode currently in place for this object. + // The Object Lock mode currently in place for this object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // The date and time when this object's object lock will expire. + // The date and time when this object's Object Lock will expire. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // The count of parts this object has. @@ -13581,7 +13483,7 @@ func (s *GetObjectOutput) SetWebsiteRedirectLocation(v string) *GetObjectOutput } type GetObjectRetentionInput struct { - _ struct{} `locationName:"GetObjectRetentionRequest" type:"structure"` + _ struct{} `type:"structure"` // The bucket containing the object whose retention settings you want to retrieve. // @@ -13690,7 +13592,7 @@ func (s *GetObjectRetentionOutput) SetRetention(v *ObjectLockRetention) *GetObje } type GetObjectTaggingInput struct { - _ struct{} `locationName:"GetObjectTaggingRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -13790,7 +13692,7 @@ func (s *GetObjectTaggingOutput) SetVersionId(v string) *GetObjectTaggingOutput } type GetObjectTorrentInput struct { - _ struct{} `locationName:"GetObjectTorrentRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -13895,7 +13797,7 @@ func (s *GetObjectTorrentOutput) SetRequestCharged(v string) *GetObjectTorrentOu } type GetPublicAccessBlockInput struct { - _ struct{} `locationName:"GetPublicAccessBlockRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the Amazon S3 bucket whose PublicAccessBlock configuration you // want to retrieve. @@ -14126,7 +14028,7 @@ func (s *Grantee) SetURI(v string) *Grantee { } type HeadBucketInput struct { - _ struct{} `locationName:"HeadBucketRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -14186,7 +14088,7 @@ func (s HeadBucketOutput) GoString() string { } type HeadObjectInput struct { - _ struct{} `locationName:"HeadObjectRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -14426,10 +14328,10 @@ type HeadObjectOutput struct { // The Legal Hold status for the specified object. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // The object lock mode currently in place for this object. + // The Object Lock mode currently in place for this object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // The date and time when this object's object lock expires. + // The date and time when this object's Object Lock will expire. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // The count of parts this object has. @@ -14778,9 +14680,6 @@ func (s *InputSerialization) SetParquet(v *ParquetInput) *InputSerialization { return s } -// Specifies the inventory configuration for an Amazon S3 bucket. For more information, -// see GET Bucket inventory (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETInventoryConfig.html) -// in the Amazon Simple Storage Service API Reference. type InventoryConfiguration struct { _ struct{} `type:"structure"` @@ -14798,16 +14697,12 @@ type InventoryConfiguration struct { // Id is a required field Id *string `type:"string" required:"true"` - // Object versions to include in the inventory list. If set to All, the list - // includes all the object versions, which adds the version-related fields VersionId, - // IsLatest, and DeleteMarker to the list. If set to Current, the list does - // not contain these version-related fields. + // Specifies which object version(s) to included in the inventory results. // // IncludedObjectVersions is a required field IncludedObjectVersions *string `type:"string" required:"true" enum:"InventoryIncludedObjectVersions"` - // Specifies whether the inventory is enabled or disabled. If set to True, an - // inventory list is generated. If set to False, no inventory list is generated. + // Specifies whether the inventory is enabled or disabled. // // IsEnabled is a required field IsEnabled *bool `type:"boolean" required:"true"` @@ -15250,15 +15145,11 @@ func (s *KeyFilter) SetFilterRules(v []*FilterRule) *KeyFilter { type LambdaFunctionConfiguration struct { _ struct{} `type:"structure"` - // The Amazon S3 bucket event for which to invoke the AWS Lambda function. For - // more information, see Supported Event Types (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. - // // Events is a required field Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - // Specifies object key name filtering rules. For information about key name - // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // A container for object key name filtering rules. For information about key + // name filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon Simple Storage Service Developer Guide. Filter *NotificationConfigurationFilter `type:"structure"` @@ -15266,8 +15157,8 @@ type LambdaFunctionConfiguration struct { // If you don't provide one, Amazon S3 will assign an ID. Id *string `type:"string"` - // The Amazon Resource Name (ARN) of the AWS Lambda function that Amazon S3 - // invokes when the specified event type occurs. + // The Amazon Resource Name (ARN) of the Lambda cloud function that Amazon S3 + // can invoke when it detects events of the specified type. // // LambdaFunctionArn is a required field LambdaFunctionArn *string `locationName:"CloudFunction" type:"string" required:"true"` @@ -15418,11 +15309,8 @@ func (s *LifecycleExpiration) SetExpiredObjectDeleteMarker(v bool) *LifecycleExp type LifecycleRule struct { _ struct{} `type:"structure"` - // Specifies the days since the initiation of an incomplete multipart upload - // that Amazon S3 will wait before permanently removing all parts of the upload. - // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket - // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) - // in the Amazon Simple Storage Service Developer Guide. + // Specifies the days since the initiation of an Incomplete Multipart Upload + // that Lifecycle will wait before permanently removing all parts of the upload. AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` Expiration *LifecycleExpiration `type:"structure"` @@ -15661,7 +15549,7 @@ func (s *LifecycleRuleFilter) SetTag(v *Tag) *LifecycleRuleFilter { } type ListBucketAnalyticsConfigurationsInput struct { - _ struct{} `locationName:"ListBucketAnalyticsConfigurationsRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket from which analytics configurations are retrieved. // @@ -15773,7 +15661,7 @@ func (s *ListBucketAnalyticsConfigurationsOutput) SetNextContinuationToken(v str } type ListBucketInventoryConfigurationsInput struct { - _ struct{} `locationName:"ListBucketInventoryConfigurationsRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket containing the inventory configurations to retrieve. // @@ -15887,7 +15775,7 @@ func (s *ListBucketInventoryConfigurationsOutput) SetNextContinuationToken(v str } type ListBucketMetricsConfigurationsInput struct { - _ struct{} `locationName:"ListBucketMetricsConfigurationsRequest" type:"structure"` + _ struct{} `type:"structure"` // The name of the bucket containing the metrics configurations to retrieve. // @@ -16047,7 +15935,7 @@ func (s *ListBucketsOutput) SetOwner(v *Owner) *ListBucketsOutput { } type ListMultipartUploadsInput struct { - _ struct{} `locationName:"ListMultipartUploadsRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -16291,7 +16179,7 @@ func (s *ListMultipartUploadsOutput) SetUploads(v []*MultipartUpload) *ListMulti } type ListObjectVersionsInput struct { - _ struct{} `locationName:"ListObjectVersionsRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -16524,7 +16412,7 @@ func (s *ListObjectVersionsOutput) SetVersions(v []*ObjectVersion) *ListObjectVe } type ListObjectsInput struct { - _ struct{} `locationName:"ListObjectsRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -16736,7 +16624,7 @@ func (s *ListObjectsOutput) SetPrefix(v string) *ListObjectsOutput { } type ListObjectsV2Input struct { - _ struct{} `locationName:"ListObjectsV2Request" type:"structure"` + _ struct{} `type:"structure"` // Name of the bucket to list. // @@ -16997,7 +16885,7 @@ func (s *ListObjectsV2Output) SetStartAfter(v string) *ListObjectsV2Output { } type ListPartsInput struct { - _ struct{} `locationName:"ListPartsRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -17379,10 +17267,9 @@ func (s *Location) SetUserMetadata(v []*MetadataEntry) *Location { return s } -// Describes where logs are stored and the prefix that Amazon S3 assigns to -// all log object keys for a bucket. For more information, see PUT Bucket logging -// (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) -// in the Amazon Simple Storage Service API Reference. +// Container for logging information. Presence of this element indicates that +// logging is enabled. Parameters TargetBucket and TargetPrefix are required +// in this case. type LoggingEnabled struct { _ struct{} `type:"structure"` @@ -17398,9 +17285,8 @@ type LoggingEnabled struct { TargetGrants []*TargetGrant `locationNameList:"Grant" type:"list"` - // A prefix for all log object keys. If you store log files from multiple Amazon - // S3 buckets in a single bucket, you can use a prefix to distinguish which - // log files came from which bucket. + // This element lets you specify a prefix for the keys that the log files will + // be stored under. // // TargetPrefix is a required field TargetPrefix *string `type:"string" required:"true"` @@ -17543,13 +17429,6 @@ func (s *MetricsAndOperator) SetTags(v []*Tag) *MetricsAndOperator { return s } -// Specifies a metrics configuration for the CloudWatch request metrics (specified -// by the metrics configuration ID) from an Amazon S3 bucket. If you're updating -// an existing metrics configuration, note that this is a full replacement of -// the existing metrics configuration. If you don't include the elements you -// want to keep, they are erased. For more information, see PUT Bucket metrics -// (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTMetricConfiguration.html) -// in the Amazon Simple Storage Service API Reference. type MetricsConfiguration struct { _ struct{} `type:"structure"` @@ -17767,11 +17646,11 @@ func (s *NoncurrentVersionExpiration) SetNoncurrentDays(v int64) *NoncurrentVers } // Container for the transition rule that describes when noncurrent objects -// transition to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, -// or DEEP_ARCHIVE storage class. If your bucket is versioning-enabled (or versioning +// transition to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER or +// DEEP_ARCHIVE storage class. If your bucket is versioning-enabled (or versioning // is suspended), you can set this action to request that Amazon S3 transition // noncurrent object versions to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, -// GLACIER, or DEEP_ARCHIVE storage class at a specific period in the object's +// GLACIER or DEEP_ARCHIVE storage class at a specific period in the object's // lifetime. type NoncurrentVersionTransition struct { _ struct{} `type:"structure"` @@ -17814,16 +17693,10 @@ func (s *NoncurrentVersionTransition) SetStorageClass(v string) *NoncurrentVersi type NotificationConfiguration struct { _ struct{} `type:"structure"` - // Describes the AWS Lambda functions to invoke and the events for which to - // invoke them. LambdaFunctionConfigurations []*LambdaFunctionConfiguration `locationName:"CloudFunctionConfiguration" type:"list" flattened:"true"` - // The Amazon Simple Queue Service queues to publish messages to and the events - // for which to publish messages. QueueConfigurations []*QueueConfiguration `locationName:"QueueConfiguration" type:"list" flattened:"true"` - // The topic to which notifications are sent and the events for which notifications - // are generated. TopicConfigurations []*TopicConfiguration `locationName:"TopicConfiguration" type:"list" flattened:"true"` } @@ -17933,8 +17806,8 @@ func (s *NotificationConfigurationDeprecated) SetTopicConfiguration(v *TopicConf return s } -// Specifies object key name filtering rules. For information about key name -// filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) +// A container for object key name filtering rules. For information about key +// name filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon Simple Storage Service Developer Guide. type NotificationConfigurationFilter struct { _ struct{} `type:"structure"` @@ -18072,14 +17945,14 @@ func (s *ObjectIdentifier) SetVersionId(v string) *ObjectIdentifier { return s } -// The container element for object lock configuration parameters. +// The container element for Object Lock configuration parameters. type ObjectLockConfiguration struct { _ struct{} `type:"structure"` - // Indicates whether this bucket has an object lock configuration enabled. + // Indicates whether this bucket has an Object Lock configuration enabled. ObjectLockEnabled *string `type:"string" enum:"ObjectLockEnabled"` - // The object lock rule in place for the specified object. + // The Object Lock rule in place for the specified object. Rule *ObjectLockRule `type:"structure"` } @@ -18136,7 +18009,7 @@ type ObjectLockRetention struct { // Indicates the Retention mode for the specified object. Mode *string `type:"string" enum:"ObjectLockRetentionMode"` - // The date on which this object lock retention expires. + // The date on which this Object Lock Retention will expire. RetainUntilDate *time.Time `type:"timestamp" timestampFormat:"iso8601"` } @@ -18162,7 +18035,7 @@ func (s *ObjectLockRetention) SetRetainUntilDate(v time.Time) *ObjectLockRetenti return s } -// The container element for an object lock rule. +// The container element for an Object Lock rule. type ObjectLockRule struct { _ struct{} `type:"structure"` @@ -18545,7 +18418,6 @@ func (s *ProgressEvent) UnmarshalEvent( return nil } -// Specifies the Block Public Access configuration for an Amazon S3 bucket. type PublicAccessBlockConfiguration struct { _ struct{} `type:"structure"` @@ -18622,7 +18494,7 @@ func (s *PublicAccessBlockConfiguration) SetRestrictPublicBuckets(v bool) *Publi } type PutBucketAccelerateConfigurationInput struct { - _ struct{} `locationName:"PutBucketAccelerateConfigurationRequest" type:"structure" payload:"AccelerateConfiguration"` + _ struct{} `type:"structure" payload:"AccelerateConfiguration"` // Specifies the Accelerate Configuration you want to set for the bucket. // @@ -18698,12 +18570,11 @@ func (s PutBucketAccelerateConfigurationOutput) GoString() string { } type PutBucketAclInput struct { - _ struct{} `locationName:"PutBucketAclRequest" type:"structure" payload:"AccessControlPolicy"` + _ struct{} `type:"structure" payload:"AccessControlPolicy"` // The canned ACL to apply to the bucket. ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"BucketCannedACL"` - // Contains the elements that set the ACL permissions for an object per grantee. AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` // Bucket is a required field @@ -18827,7 +18698,7 @@ func (s PutBucketAclOutput) GoString() string { } type PutBucketAnalyticsConfigurationInput struct { - _ struct{} `locationName:"PutBucketAnalyticsConfigurationRequest" type:"structure" payload:"AnalyticsConfiguration"` + _ struct{} `type:"structure" payload:"AnalyticsConfiguration"` // The configuration and any analyses for the analytics filter. // @@ -18839,7 +18710,7 @@ type PutBucketAnalyticsConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The ID that identifies the analytics configuration. + // The identifier used to represent an analytics configuration. // // Id is a required field Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` @@ -18922,16 +18793,11 @@ func (s PutBucketAnalyticsConfigurationOutput) GoString() string { } type PutBucketCorsInput struct { - _ struct{} `locationName:"PutBucketCorsRequest" type:"structure" payload:"CORSConfiguration"` + _ struct{} `type:"structure" payload:"CORSConfiguration"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // Describes the cross-origin access configuration for objects in an Amazon - // S3 bucket. For more information, see Enabling Cross-Origin Resource Sharing - // (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) in the Amazon - // Simple Storage Service Developer Guide. - // // CORSConfiguration is a required field CORSConfiguration *CORSConfiguration `locationName:"CORSConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` } @@ -19004,18 +18870,16 @@ func (s PutBucketCorsOutput) GoString() string { } type PutBucketEncryptionInput struct { - _ struct{} `locationName:"PutBucketEncryptionRequest" type:"structure" payload:"ServerSideEncryptionConfiguration"` + _ struct{} `type:"structure" payload:"ServerSideEncryptionConfiguration"` - // Specifies default encryption for a bucket using server-side encryption with - // Amazon S3-managed keys (SSE-S3) or AWS KMS-managed keys (SSE-KMS). For information - // about the Amazon S3 default encryption feature, see Amazon S3 Default Bucket - // Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html) - // in the Amazon Simple Storage Service Developer Guide. + // The name of the bucket for which the server-side encryption configuration + // is set. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // Specifies the default server-side-encryption configuration. + // Container for server-side encryption configuration rules. Currently S3 supports + // one rule only. // // ServerSideEncryptionConfiguration is a required field ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `locationName:"ServerSideEncryptionConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` @@ -19089,7 +18953,7 @@ func (s PutBucketEncryptionOutput) GoString() string { } type PutBucketInventoryConfigurationInput struct { - _ struct{} `locationName:"PutBucketInventoryConfigurationRequest" type:"structure" payload:"InventoryConfiguration"` + _ struct{} `type:"structure" payload:"InventoryConfiguration"` // The name of the bucket where the inventory configuration will be stored. // @@ -19184,14 +19048,11 @@ func (s PutBucketInventoryConfigurationOutput) GoString() string { } type PutBucketLifecycleConfigurationInput struct { - _ struct{} `locationName:"PutBucketLifecycleConfigurationRequest" type:"structure" payload:"LifecycleConfiguration"` + _ struct{} `type:"structure" payload:"LifecycleConfiguration"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // Specifies the lifecycle configuration for objects in an Amazon S3 bucket. - // For more information, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) - // in the Amazon Simple Storage Service Developer Guide. LifecycleConfiguration *BucketLifecycleConfiguration `locationName:"LifecycleConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` } @@ -19260,7 +19121,7 @@ func (s PutBucketLifecycleConfigurationOutput) GoString() string { } type PutBucketLifecycleInput struct { - _ struct{} `locationName:"PutBucketLifecycleRequest" type:"structure" payload:"LifecycleConfiguration"` + _ struct{} `type:"structure" payload:"LifecycleConfiguration"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -19333,7 +19194,7 @@ func (s PutBucketLifecycleOutput) GoString() string { } type PutBucketLoggingInput struct { - _ struct{} `locationName:"PutBucketLoggingRequest" type:"structure" payload:"BucketLoggingStatus"` + _ struct{} `type:"structure" payload:"BucketLoggingStatus"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -19410,7 +19271,7 @@ func (s PutBucketLoggingOutput) GoString() string { } type PutBucketMetricsConfigurationInput struct { - _ struct{} `locationName:"PutBucketMetricsConfigurationRequest" type:"structure" payload:"MetricsConfiguration"` + _ struct{} `type:"structure" payload:"MetricsConfiguration"` // The name of the bucket for which the metrics configuration is set. // @@ -19505,7 +19366,7 @@ func (s PutBucketMetricsConfigurationOutput) GoString() string { } type PutBucketNotificationConfigurationInput struct { - _ struct{} `locationName:"PutBucketNotificationConfigurationRequest" type:"structure" payload:"NotificationConfiguration"` + _ struct{} `type:"structure" payload:"NotificationConfiguration"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -19585,7 +19446,7 @@ func (s PutBucketNotificationConfigurationOutput) GoString() string { } type PutBucketNotificationInput struct { - _ struct{} `locationName:"PutBucketNotificationRequest" type:"structure" payload:"NotificationConfiguration"` + _ struct{} `type:"structure" payload:"NotificationConfiguration"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -19657,7 +19518,7 @@ func (s PutBucketNotificationOutput) GoString() string { } type PutBucketPolicyInput struct { - _ struct{} `locationName:"PutBucketPolicyRequest" type:"structure" payload:"Policy"` + _ struct{} `type:"structure" payload:"Policy"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -19741,7 +19602,7 @@ func (s PutBucketPolicyOutput) GoString() string { } type PutBucketReplicationInput struct { - _ struct{} `locationName:"PutBucketReplicationRequest" type:"structure" payload:"ReplicationConfiguration"` + _ struct{} `type:"structure" payload:"ReplicationConfiguration"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -19752,7 +19613,6 @@ type PutBucketReplicationInput struct { // ReplicationConfiguration is a required field ReplicationConfiguration *ReplicationConfiguration `locationName:"ReplicationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - // A token that allows Amazon S3 object lock to be enabled for an existing bucket. Token *string `location:"header" locationName:"x-amz-bucket-object-lock-token" type:"string"` } @@ -19830,7 +19690,7 @@ func (s PutBucketReplicationOutput) GoString() string { } type PutBucketRequestPaymentInput struct { - _ struct{} `locationName:"PutBucketRequestPaymentRequest" type:"structure" payload:"RequestPaymentConfiguration"` + _ struct{} `type:"structure" payload:"RequestPaymentConfiguration"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -19907,7 +19767,7 @@ func (s PutBucketRequestPaymentOutput) GoString() string { } type PutBucketTaggingInput struct { - _ struct{} `locationName:"PutBucketTaggingRequest" type:"structure" payload:"Tagging"` + _ struct{} `type:"structure" payload:"Tagging"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -19984,7 +19844,7 @@ func (s PutBucketTaggingOutput) GoString() string { } type PutBucketVersioningInput struct { - _ struct{} `locationName:"PutBucketVersioningRequest" type:"structure" payload:"VersioningConfiguration"` + _ struct{} `type:"structure" payload:"VersioningConfiguration"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -19993,10 +19853,6 @@ type PutBucketVersioningInput struct { // and the value that is displayed on your authentication device. MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` - // Describes the versioning state of an Amazon S3 bucket. For more information, - // see PUT Bucket versioning (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTVersioningStatus.html) - // in the Amazon Simple Storage Service API Reference. - // // VersioningConfiguration is a required field VersioningConfiguration *VersioningConfiguration `locationName:"VersioningConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` } @@ -20070,13 +19926,11 @@ func (s PutBucketVersioningOutput) GoString() string { } type PutBucketWebsiteInput struct { - _ struct{} `locationName:"PutBucketWebsiteRequest" type:"structure" payload:"WebsiteConfiguration"` + _ struct{} `type:"structure" payload:"WebsiteConfiguration"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // Specifies website configuration parameters for an Amazon S3 bucket. - // // WebsiteConfiguration is a required field WebsiteConfiguration *WebsiteConfiguration `locationName:"WebsiteConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` } @@ -20149,12 +20003,11 @@ func (s PutBucketWebsiteOutput) GoString() string { } type PutObjectAclInput struct { - _ struct{} `locationName:"PutObjectAclRequest" type:"structure" payload:"AccessControlPolicy"` + _ struct{} `type:"structure" payload:"AccessControlPolicy"` // The canned ACL to apply to the object. ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` - // Contains the elements that set the ACL permissions for an object per grantee. AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` // Bucket is a required field @@ -20324,7 +20177,7 @@ func (s *PutObjectAclOutput) SetRequestCharged(v string) *PutObjectAclOutput { } type PutObjectInput struct { - _ struct{} `locationName:"PutObjectRequest" type:"structure" payload:"Body"` + _ struct{} `type:"structure" payload:"Body"` // The canned ACL to apply to the object. ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` @@ -20356,8 +20209,7 @@ type PutObjectInput struct { ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` // The base64-encoded 128-bit MD5 digest of the part data. This parameter is - // auto-populated when using the command from the CLI. This parameted is required - // if object lock parameters are specified. + // auto-populated when using the command from the CLI ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` // A standard MIME type describing the format of the object data. @@ -20389,10 +20241,10 @@ type PutObjectInput struct { // The Legal Hold status that you want to apply to the specified object. ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` - // The object lock mode that you want to apply to this object. + // The Object Lock mode that you want to apply to this object. ObjectLockMode *string `location:"header" locationName:"x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` - // The date and time when you want this object's object lock to expire. + // The date and time when you want this object's Object Lock to expire. ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` // Confirms that the requester knows that she or he will be charged for the @@ -20416,11 +20268,6 @@ type PutObjectInput struct { // key was transmitted without error. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - // Specifies the AWS KMS Encryption Context to use for object encryption. The - // value of this header is a base64-encoded UTF-8 string holding JSON with the - // encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT // requests for an object protected by AWS KMS will fail if not made via SSL // or using SigV4. Documentation on configuring any of the officially supported @@ -20634,12 +20481,6 @@ func (s *PutObjectInput) SetSSECustomerKeyMD5(v string) *PutObjectInput { return s } -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *PutObjectInput) SetSSEKMSEncryptionContext(v string) *PutObjectInput { - s.SSEKMSEncryptionContext = &v - return s -} - // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *PutObjectInput) SetSSEKMSKeyId(v string) *PutObjectInput { s.SSEKMSKeyId = &v @@ -20671,7 +20512,7 @@ func (s *PutObjectInput) SetWebsiteRedirectLocation(v string) *PutObjectInput { } type PutObjectLegalHoldInput struct { - _ struct{} `locationName:"PutObjectLegalHoldRequest" type:"structure" payload:"LegalHold"` + _ struct{} `type:"structure" payload:"LegalHold"` // The bucket containing the object that you want to place a Legal Hold on. // @@ -20791,14 +20632,14 @@ func (s *PutObjectLegalHoldOutput) SetRequestCharged(v string) *PutObjectLegalHo } type PutObjectLockConfigurationInput struct { - _ struct{} `locationName:"PutObjectLockConfigurationRequest" type:"structure" payload:"ObjectLockConfiguration"` + _ struct{} `type:"structure" payload:"ObjectLockConfiguration"` - // The bucket whose object lock configuration you want to create or replace. + // The bucket whose Object Lock configuration you want to create or replace. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The object lock configuration that you want to apply to the specified bucket. + // The Object Lock configuration that you want to apply to the specified bucket. ObjectLockConfiguration *ObjectLockConfiguration `locationName:"ObjectLockConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` // Confirms that the requester knows that she or he will be charged for the @@ -20807,7 +20648,7 @@ type PutObjectLockConfigurationInput struct { // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - // A token to allow Amazon S3 object lock to be enabled for an existing bucket. + // A token to allow Object Lock to be enabled for an existing bucket. Token *string `location:"header" locationName:"x-amz-bucket-object-lock-token" type:"string"` } @@ -20916,11 +20757,6 @@ type PutObjectOutput struct { // verification of the customer-provided encryption key. SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - // If present, specifies the AWS KMS Encryption Context to use for object encryption. - // The value of this header is a base64-encoded UTF-8 string holding JSON with - // the encryption context key-value pairs. - SSEKMSEncryptionContext *string `location:"header" locationName:"x-amz-server-side-encryption-context" type:"string" sensitive:"true"` - // If present, specifies the ID of the AWS Key Management Service (KMS) master // encryption key that was used for the object. SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` @@ -20973,12 +20809,6 @@ func (s *PutObjectOutput) SetSSECustomerKeyMD5(v string) *PutObjectOutput { return s } -// SetSSEKMSEncryptionContext sets the SSEKMSEncryptionContext field's value. -func (s *PutObjectOutput) SetSSEKMSEncryptionContext(v string) *PutObjectOutput { - s.SSEKMSEncryptionContext = &v - return s -} - // SetSSEKMSKeyId sets the SSEKMSKeyId field's value. func (s *PutObjectOutput) SetSSEKMSKeyId(v string) *PutObjectOutput { s.SSEKMSKeyId = &v @@ -20998,7 +20828,7 @@ func (s *PutObjectOutput) SetVersionId(v string) *PutObjectOutput { } type PutObjectRetentionInput struct { - _ struct{} `locationName:"PutObjectRetentionRequest" type:"structure" payload:"Retention"` + _ struct{} `type:"structure" payload:"Retention"` // The bucket that contains the object you want to apply this Object Retention // configuration to. @@ -21129,7 +20959,7 @@ func (s *PutObjectRetentionOutput) SetRequestCharged(v string) *PutObjectRetenti } type PutObjectTaggingInput struct { - _ struct{} `locationName:"PutObjectTaggingRequest" type:"structure" payload:"Tagging"` + _ struct{} `type:"structure" payload:"Tagging"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -21237,7 +21067,7 @@ func (s *PutObjectTaggingOutput) SetVersionId(v string) *PutObjectTaggingOutput } type PutPublicAccessBlockInput struct { - _ struct{} `locationName:"PutPublicAccessBlockRequest" type:"structure" payload:"PublicAccessBlockConfiguration"` + _ struct{} `type:"structure" payload:"PublicAccessBlockConfiguration"` // The name of the Amazon S3 bucket whose PublicAccessBlock configuration you // want to set. @@ -21317,16 +21147,17 @@ func (s PutPublicAccessBlockOutput) GoString() string { return s.String() } -// Specifies the configuration for publishing messages to an Amazon Simple Queue -// Service (Amazon SQS) queue when Amazon S3 detects specified events. +// A container for specifying the configuration for publication of messages +// to an Amazon Simple Queue Service (Amazon SQS) queue.when Amazon S3 detects +// specified events. type QueueConfiguration struct { _ struct{} `type:"structure"` // Events is a required field Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - // Specifies object key name filtering rules. For information about key name - // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // A container for object key name filtering rules. For information about key + // name filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon Simple Storage Service Developer Guide. Filter *NotificationConfigurationFilter `type:"structure"` @@ -21335,7 +21166,7 @@ type QueueConfiguration struct { Id *string `type:"string"` // The Amazon Resource Name (ARN) of the Amazon SQS queue to which Amazon S3 - // publishes a message when it detects events of the specified type. + // will publish a message when it detects events of the specified type. // // QueueArn is a required field QueueArn *string `locationName:"Queue" type:"string" required:"true"` @@ -21481,8 +21312,6 @@ func (s *RecordsEvent) UnmarshalEvent( return nil } -// Specifies how requests are redirected. In the event of an error, you can -// specify a different error code to return. type Redirect struct { _ struct{} `type:"structure"` @@ -21493,8 +21322,8 @@ type Redirect struct { // siblings is present. HttpRedirectCode *string `type:"string"` - // Protocol to use when redirecting requests. The default is the protocol that - // is used in the original request. + // Protocol to use (http, https) when redirecting requests. The default is the + // protocol that is used in the original request. Protocol *string `type:"string" enum:"Protocol"` // The object key prefix to use in the redirect request. For example, to redirect @@ -21506,7 +21335,7 @@ type Redirect struct { ReplaceKeyPrefixWith *string `type:"string"` // The specific object key to use in the redirect request. For example, redirect - // request to error.html. Not required if one of the siblings is present. Can + // request to error.html. Not required if one of the sibling is present. Can // be present only if ReplaceKeyPrefixWith is not provided. ReplaceKeyWith *string `type:"string"` } @@ -21551,18 +21380,16 @@ func (s *Redirect) SetReplaceKeyWith(v string) *Redirect { return s } -// Specifies the redirect behavior of all requests to a website endpoint of -// an Amazon S3 bucket. type RedirectAllRequestsTo struct { _ struct{} `type:"structure"` - // Name of the host where requests are redirected. + // Name of the host where requests will be redirected. // // HostName is a required field HostName *string `type:"string" required:"true"` - // Protocol to use when redirecting requests. The default is the protocol that - // is used in the original request. + // Protocol to use (http, https) when redirecting requests. The default is the + // protocol that is used in the original request. Protocol *string `type:"string" enum:"Protocol"` } @@ -21607,9 +21434,7 @@ type ReplicationConfiguration struct { _ struct{} `type:"structure"` // The Amazon Resource Name (ARN) of the AWS Identity and Access Management - // (IAM) role that Amazon S3 assumes when replicating objects. For more information, - // see How to Set Up Cross-Region Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/crr-how-setup.html) - // in the Amazon Simple Storage Service Developer Guide. + // (IAM) role that Amazon S3 can assume when replicating the objects. // // Role is a required field Role *string `type:"string" required:"true"` @@ -21669,7 +21494,7 @@ func (s *ReplicationConfiguration) SetRules(v []*ReplicationRule) *ReplicationCo return s } -// Specifies which Amazon S3 objects to replicate and where to store the replicas. +// A container for information about a specific replication rule. type ReplicationRule struct { _ struct{} `type:"structure"` @@ -21689,8 +21514,7 @@ type ReplicationRule struct { ID *string `type:"string"` // An object keyname prefix that identifies the object or objects to which the - // rule applies. The maximum prefix length is 1,024 characters. To include all - // objects in a bucket, specify an empty string. + // rule applies. The maximum prefix length is 1,024 characters. // // Deprecated: Prefix has been deprecated Prefix *string `deprecated:"true" type:"string"` @@ -21715,9 +21539,12 @@ type ReplicationRule struct { // replication of these objects. Currently, Amazon S3 supports only the filter // that you can specify for objects created with server-side encryption using // an AWS KMS-Managed Key (SSE-KMS). + // + // If you want Amazon S3 to replicate objects created with server-side encryption + // using AWS KMS-Managed Keys. SourceSelectionCriteria *SourceSelectionCriteria `type:"structure"` - // Specifies whether the rule is enabled. + // If status isn't enabled, the rule is ignored. // // Status is a required field Status *string `type:"string" required:"true" enum:"ReplicationRuleStatus"` @@ -21999,7 +21826,7 @@ func (s *RequestProgress) SetEnabled(v bool) *RequestProgress { } type RestoreObjectInput struct { - _ struct{} `locationName:"RestoreObjectRequest" type:"structure" payload:"RestoreRequest"` + _ struct{} `type:"structure" payload:"RestoreRequest"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -22232,7 +22059,6 @@ func (s *RestoreRequest) SetType(v string) *RestoreRequest { return s } -// Specifies the redirect behavior and when a redirect is applied. type RoutingRule struct { _ struct{} `type:"structure"` @@ -22285,22 +22111,16 @@ func (s *RoutingRule) SetRedirect(v *Redirect) *RoutingRule { return s } -// Specifies lifecycle rules for an Amazon S3 bucket. For more information, -// see PUT Bucket lifecycle (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html) -// in the Amazon Simple Storage Service API Reference. type Rule struct { _ struct{} `type:"structure"` - // Specifies the days since the initiation of an incomplete multipart upload - // that Amazon S3 will wait before permanently removing all parts of the upload. - // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket - // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) - // in the Amazon Simple Storage Service Developer Guide. + // Specifies the days since the initiation of an Incomplete Multipart Upload + // that Lifecycle will wait before permanently removing all parts of the upload. AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` Expiration *LifecycleExpiration `type:"structure"` - // Unique identifier for the rule. The value can't be longer than 255 characters. + // Unique identifier for the rule. The value cannot be longer than 255 characters. ID *string `type:"string"` // Specifies when noncurrent object versions expire. Upon expiration, Amazon @@ -22311,27 +22131,25 @@ type Rule struct { NoncurrentVersionExpiration *NoncurrentVersionExpiration `type:"structure"` // Container for the transition rule that describes when noncurrent objects - // transition to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, - // or DEEP_ARCHIVE storage class. If your bucket is versioning-enabled (or versioning + // transition to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER or + // DEEP_ARCHIVE storage class. If your bucket is versioning-enabled (or versioning // is suspended), you can set this action to request that Amazon S3 transition // noncurrent object versions to the STANDARD_IA, ONEZONE_IA, INTELLIGENT_TIERING, - // GLACIER, or DEEP_ARCHIVE storage class at a specific period in the object's + // GLACIER or DEEP_ARCHIVE storage class at a specific period in the object's // lifetime. NoncurrentVersionTransition *NoncurrentVersionTransition `type:"structure"` - // Object key prefix that identifies one or more objects to which this rule - // applies. + // Prefix identifying one or more objects to which the rule applies. // // Prefix is a required field Prefix *string `type:"string" required:"true"` - // If Enabled, the rule is currently being applied. If Disabled, the rule is - // not currently being applied. + // If 'Enabled', the rule is currently being applied. If 'Disabled', the rule + // is not currently being applied. // // Status is a required field Status *string `type:"string" required:"true" enum:"ExpirationStatus"` - // Specifies when an object transitions to a specified storage class. Transition *Transition `type:"structure"` } @@ -22982,15 +22800,13 @@ func (s *SelectParameters) SetOutputSerialization(v *OutputSerialization) *Selec } // Describes the default server-side encryption to apply to new objects in the -// bucket. If a PUT Object request doesn't specify any server-side encryption, -// this default encryption will be applied. For more information, see PUT Bucket -// encryption (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTencryption.html) -// in the Amazon Simple Storage Service API Reference. +// bucket. If Put Object request does not specify any server-side encryption, +// this default encryption will be applied. type ServerSideEncryptionByDefault struct { _ struct{} `type:"structure"` // KMS master key ID to use for the default encryption. This parameter is allowed - // if and only if SSEAlgorithm is set to aws:kms. + // if SSEAlgorithm is aws:kms. KMSMasterKeyID *string `type:"string" sensitive:"true"` // Server-side encryption algorithm to use for the default encryption. @@ -23034,7 +22850,8 @@ func (s *ServerSideEncryptionByDefault) SetSSEAlgorithm(v string) *ServerSideEnc return s } -// Specifies the default server-side-encryption configuration. +// Container for server-side encryption configuration rules. Currently S3 supports +// one rule only. type ServerSideEncryptionConfiguration struct { _ struct{} `type:"structure"` @@ -23084,12 +22901,13 @@ func (s *ServerSideEncryptionConfiguration) SetRules(v []*ServerSideEncryptionRu return s } -// Specifies the default server-side encryption configuration. +// Container for information about a particular server-side encryption configuration +// rule. type ServerSideEncryptionRule struct { _ struct{} `type:"structure"` - // Specifies the default server-side encryption to apply to new objects in the - // bucket. If a PUT Object request doesn't specify any server-side encryption, + // Describes the default server-side encryption to apply to new objects in the + // bucket. If Put Object request does not specify any server-side encryption, // this default encryption will be applied. ApplyServerSideEncryptionByDefault *ServerSideEncryptionByDefault `type:"structure"` } @@ -23125,17 +22943,13 @@ func (s *ServerSideEncryptionRule) SetApplyServerSideEncryptionByDefault(v *Serv return s } -// A container that describes additional filters for identifying the source -// objects that you want to replicate. You can choose to enable or disable the -// replication of these objects. Currently, Amazon S3 supports only the filter -// that you can specify for objects created with server-side encryption using -// an AWS KMS-Managed Key (SSE-KMS). +// A container for filters that define which source objects should be replicated. type SourceSelectionCriteria struct { _ struct{} `type:"structure"` - // A container for filter information for the selection of Amazon S3 objects - // encrypted with AWS KMS. If you include SourceSelectionCriteria in the replication - // configuration, this element is required. + // A container for filter information for the selection of S3 objects encrypted + // with AWS KMS. If you include SourceSelectionCriteria in the replication configuration, + // this element is required. SseKmsEncryptedObjects *SseKmsEncryptedObjects `type:"structure"` } @@ -23175,8 +22989,8 @@ func (s *SourceSelectionCriteria) SetSseKmsEncryptedObjects(v *SseKmsEncryptedOb type SseKmsEncryptedObjects struct { _ struct{} `type:"structure"` - // Specifies whether Amazon S3 replicates objects created with server-side encryption - // using an AWS KMS-managed key. + // If the status is not Enabled, replication for S3 objects encrypted with AWS + // KMS is disabled. // // Status is a required field Status *string `type:"string" required:"true" enum:"SseKmsEncryptedObjectsStatus"` @@ -23292,14 +23106,11 @@ func (s *StatsEvent) UnmarshalEvent( return nil } -// Specifies data related to access patterns to be collected and made available -// to analyze the tradeoffs between different storage classes for an Amazon -// S3 bucket. type StorageClassAnalysis struct { _ struct{} `type:"structure"` - // Specifies how data related to the storage class analysis for an Amazon S3 - // bucket should be exported. + // A container used to describe how data related to the storage class analysis + // should be exported. DataExport *StorageClassAnalysisDataExport `type:"structure"` } @@ -23539,20 +23350,16 @@ func (s *TargetGrant) SetPermission(v string) *TargetGrant { } // A container for specifying the configuration for publication of messages -// to an Amazon Simple Notification Service (Amazon SNS) topic when Amazon S3 +// to an Amazon Simple Notification Service (Amazon SNS) topic.when Amazon S3 // detects specified events. type TopicConfiguration struct { _ struct{} `type:"structure"` - // The Amazon S3 bucket event about which to send notifications. For more information, - // see Supported Event Types (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. - // // Events is a required field Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - // Specifies object key name filtering rules. For information about key name - // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) + // A container for object key name filtering rules. For information about key + // name filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon Simple Storage Service Developer Guide. Filter *NotificationConfigurationFilter `type:"structure"` @@ -23561,7 +23368,7 @@ type TopicConfiguration struct { Id *string `type:"string"` // The Amazon Resource Name (ARN) of the Amazon SNS topic to which Amazon S3 - // publishes a message when it detects events of the specified type. + // will publish a message when it detects events of the specified type. // // TopicArn is a required field TopicArn *string `locationName:"Topic" type:"string" required:"true"` @@ -23670,19 +23477,18 @@ func (s *TopicConfigurationDeprecated) SetTopic(v string) *TopicConfigurationDep return s } -// Specifies when an object transitions to a specified storage class. type Transition struct { _ struct{} `type:"structure"` - // Indicates when objects are transitioned to the specified storage class. The - // date value must be in ISO 8601 format. The time is always midnight UTC. + // Indicates at what date the object is to be moved or deleted. Should be in + // GMT ISO 8601 Format. Date *time.Time `type:"timestamp" timestampFormat:"iso8601"` - // Indicates the number of days after creation when objects are transitioned - // to the specified storage class. The value must be a positive integer. + // Indicates the lifetime, in days, of the objects that are subject to the rule. + // The value must be a non-zero positive integer. Days *int64 `type:"integer"` - // The storage class to which you want the object to transition. + // The class of storage used to store the object. StorageClass *string `type:"string" enum:"TransitionStorageClass"` } @@ -23715,7 +23521,7 @@ func (s *Transition) SetStorageClass(v string) *Transition { } type UploadPartCopyInput struct { - _ struct{} `locationName:"UploadPartCopyRequest" type:"structure"` + _ struct{} `type:"structure"` // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -24045,7 +23851,7 @@ func (s *UploadPartCopyOutput) SetServerSideEncryption(v string) *UploadPartCopy } type UploadPartInput struct { - _ struct{} `locationName:"UploadPartRequest" type:"structure" payload:"Body"` + _ struct{} `type:"structure" payload:"Body"` // Object data. Body io.ReadSeeker `type:"blob"` @@ -24059,9 +23865,7 @@ type UploadPartInput struct { // body cannot be determined automatically. ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - // The base64-encoded 128-bit MD5 digest of the part data. This parameter is - // auto-populated when using the command from the CLI. This parameted is required - // if object lock parameters are specified. + // The base64-encoded 128-bit MD5 digest of the part data. ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` // Object key for which the multipart upload was initiated. @@ -24296,9 +24100,6 @@ func (s *UploadPartOutput) SetServerSideEncryption(v string) *UploadPartOutput { return s } -// Describes the versioning state of an Amazon S3 bucket. For more information, -// see PUT Bucket versioning (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTVersioningStatus.html) -// in the Amazon Simple Storage Service API Reference. type VersioningConfiguration struct { _ struct{} `type:"structure"` @@ -24333,22 +24134,15 @@ func (s *VersioningConfiguration) SetStatus(v string) *VersioningConfiguration { return s } -// Specifies website configuration parameters for an Amazon S3 bucket. type WebsiteConfiguration struct { _ struct{} `type:"structure"` - // The name of the error document for the website. ErrorDocument *ErrorDocument `type:"structure"` - // The name of the index document for the website. IndexDocument *IndexDocument `type:"structure"` - // The redirect behavior for every request to this bucket's website endpoint. - // - // If you specify this property, you can't specify any other property. RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` - // Rules that define when a redirect is applied and the redirect behavior. RoutingRules []*RoutingRule `locationNameList:"RoutingRule" type:"list"` } diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go b/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go index 4b65f7153..39b912c26 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go @@ -63,20 +63,6 @@ // See the s3manager package's Downloader type documentation for more information. // https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Downloader // -// Automatic URI cleaning -// -// Interacting with objects whose keys contain adjacent slashes (e.g. bucketname/foo//bar/objectname) -// requires setting DisableRestProtocolURICleaning to true in the aws.Config struct -// used by the service client. -// -// svc := s3.New(sess, &aws.Config{ -// DisableRestProtocolURICleaning: aws.Bool(true), -// }) -// out, err := svc.GetObject(&s3.GetObjectInput { -// Bucket: aws.String("bucketname"), -// Key: aws.String("//foo//bar//moo"), -// }) -// // Get Bucket Region // // GetBucketRegion will attempt to get the region for a bucket using a region diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go index eb0a6a417..9e610591a 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go @@ -702,102 +702,6 @@ func (c *STS) DecodeAuthorizationMessageWithContext(ctx aws.Context, input *Deco return out, req.Send() } -const opGetAccessKeyInfo = "GetAccessKeyInfo" - -// GetAccessKeyInfoRequest generates a "aws/request.Request" representing the -// client's request for the GetAccessKeyInfo operation. The "output" return -// value will be populated with the request's response once the request completes -// successfully. -// -// Use "Send" method on the returned Request to send the API call to the service. -// the "output" return value is not valid until after Send returns without error. -// -// See GetAccessKeyInfo for more information on using the GetAccessKeyInfo -// API call, and error handling. -// -// This method is useful when you want to inject custom logic or configuration -// into the SDK's request lifecycle. Such as custom headers, or retry logic. -// -// -// // Example sending a request using the GetAccessKeyInfoRequest method. -// req, resp := client.GetAccessKeyInfoRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetAccessKeyInfo -func (c *STS) GetAccessKeyInfoRequest(input *GetAccessKeyInfoInput) (req *request.Request, output *GetAccessKeyInfoOutput) { - op := &request.Operation{ - Name: opGetAccessKeyInfo, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &GetAccessKeyInfoInput{} - } - - output = &GetAccessKeyInfoOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetAccessKeyInfo API operation for AWS Security Token Service. -// -// Returns the account identifier for the specified access key ID. -// -// Access keys consist of two parts: an access key ID (for example, AKIAIOSFODNN7EXAMPLE) -// and a secret access key (for example, wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY). -// For more information about access keys, see Managing Access Keys for IAM -// Users (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) -// in the IAM User Guide. -// -// When you pass an access key ID to this operation, it returns the ID of the -// AWS account to which the keys belong. Access key IDs beginning with AKIA -// are long-term credentials for an IAM user or the AWS account root user. Access -// key IDs beginning with ASIA are temporary credentials that are created using -// STS operations. If the account in the response belongs to you, you can sign -// in as the root user and review your root user access keys. Then, you can -// pull a credentials report (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html) -// to learn which IAM user owns the keys. To learn who requested the temporary -// credentials for an ASIA access key, view the STS events in your CloudTrail -// logs (https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html). -// -// This operation does not indicate the state of the access key. The key might -// be active, inactive, or deleted. Active keys might not have permissions to -// perform an operation. Providing a deleted access key might return an error -// that the key doesn't exist. -// -// Returns awserr.Error for service API and SDK errors. Use runtime type assertions -// with awserr.Error's Code and Message methods to get detailed information about -// the error. -// -// See the AWS API reference guide for AWS Security Token Service's -// API operation GetAccessKeyInfo for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetAccessKeyInfo -func (c *STS) GetAccessKeyInfo(input *GetAccessKeyInfoInput) (*GetAccessKeyInfoOutput, error) { - req, out := c.GetAccessKeyInfoRequest(input) - return out, req.Send() -} - -// GetAccessKeyInfoWithContext is the same as GetAccessKeyInfo with the addition of -// the ability to pass a context and additional request options. -// -// See GetAccessKeyInfo for details on how to use this API operation. -// -// The context must be non-nil and will be used for request cancellation. If -// the context is nil a panic will occur. In the future the SDK may create -// sub-contexts for http.Requests. See https://golang.org/pkg/context/ -// for more information on using Contexts. -func (c *STS) GetAccessKeyInfoWithContext(ctx aws.Context, input *GetAccessKeyInfoInput, opts ...request.Option) (*GetAccessKeyInfoOutput, error) { - req, out := c.GetAccessKeyInfoRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - const opGetCallerIdentity = "GetCallerIdentity" // GetCallerIdentityRequest generates a "aws/request.Request" representing the @@ -842,15 +746,8 @@ func (c *STS) GetCallerIdentityRequest(input *GetCallerIdentityInput) (req *requ // GetCallerIdentity API operation for AWS Security Token Service. // -// Returns details about the IAM user or role whose credentials are used to -// call the operation. -// -// No permissions are required to perform this operation. If an administrator -// adds a policy to your IAM user or role that explicitly denies access to the -// sts:GetCallerIdentity action, you can still perform this operation. Permissions -// are not required because the same information is returned when an IAM user -// or role is denied access. To view an example response, see I Am Not Authorized -// to Perform: iam:DeleteVirtualMFADevice (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_access-denied-delete-mfa). +// Returns details about the IAM identity whose credentials are used to call +// the API. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1232,7 +1129,7 @@ type AssumeRoleInput struct { // This parameter is optional. You can provide up to 10 managed policy ARNs. // However, the plain text that you use for both inline and managed session // policies shouldn't exceed 2048 characters. For more information about ARNs, - // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // see Amazon Resource Names (ARNs) and AWS Service Namespaces (general/latest/gr/aws-arns-and-namespaces.html) // in the AWS General Reference. // // The characters in this parameter count towards the 2048 character session @@ -1510,7 +1407,7 @@ type AssumeRoleWithSAMLInput struct { // This parameter is optional. You can provide up to 10 managed policy ARNs. // However, the plain text that you use for both inline and managed session // policies shouldn't exceed 2048 characters. For more information about ARNs, - // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // see Amazon Resource Names (ARNs) and AWS Service Namespaces (general/latest/gr/aws-arns-and-namespaces.html) // in the AWS General Reference. // // The characters in this parameter count towards the 2048 character session @@ -1805,7 +1702,7 @@ type AssumeRoleWithWebIdentityInput struct { // This parameter is optional. You can provide up to 10 managed policy ARNs. // However, the plain text that you use for both inline and managed session // policies shouldn't exceed 2048 characters. For more information about ARNs, - // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // see Amazon Resource Names (ARNs) and AWS Service Namespaces (general/latest/gr/aws-arns-and-namespaces.html) // in the AWS General Reference. // // The characters in this parameter count towards the 2048 character session @@ -2259,73 +2156,6 @@ func (s *FederatedUser) SetFederatedUserId(v string) *FederatedUser { return s } -type GetAccessKeyInfoInput struct { - _ struct{} `type:"structure"` - - // The identifier of an access key. - // - // This parameter allows (through its regex pattern) a string of characters - // that can consist of any upper- or lowercased letter or digit. - // - // AccessKeyId is a required field - AccessKeyId *string `min:"16" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetAccessKeyInfoInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetAccessKeyInfoInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetAccessKeyInfoInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetAccessKeyInfoInput"} - if s.AccessKeyId == nil { - invalidParams.Add(request.NewErrParamRequired("AccessKeyId")) - } - if s.AccessKeyId != nil && len(*s.AccessKeyId) < 16 { - invalidParams.Add(request.NewErrParamMinLen("AccessKeyId", 16)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccessKeyId sets the AccessKeyId field's value. -func (s *GetAccessKeyInfoInput) SetAccessKeyId(v string) *GetAccessKeyInfoInput { - s.AccessKeyId = &v - return s -} - -type GetAccessKeyInfoOutput struct { - _ struct{} `type:"structure"` - - // The number used to identify the AWS account. - Account *string `type:"string"` -} - -// String returns the string representation -func (s GetAccessKeyInfoOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetAccessKeyInfoOutput) GoString() string { - return s.String() -} - -// SetAccount sets the Account field's value. -func (s *GetAccessKeyInfoOutput) SetAccount(v string) *GetAccessKeyInfoOutput { - s.Account = &v - return s -} - type GetCallerIdentityInput struct { _ struct{} `type:"structure"` } @@ -2454,7 +2284,7 @@ type GetFederationTokenInput struct { // use as managed session policies. The plain text that you use for both inline // and managed session policies shouldn't exceed 2048 characters. You can provide // up to 10 managed policy ARNs. For more information about ARNs, see Amazon - // Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // Resource Names (ARNs) and AWS Service Namespaces (general/latest/gr/aws-arns-and-namespaces.html) // in the AWS General Reference. // // This parameter is optional. However, if you do not pass any session policies, @@ -2715,7 +2545,7 @@ type PolicyDescriptorType struct { // The Amazon Resource Name (ARN) of the IAM managed policy to use as a session // policy for the role. For more information about ARNs, see Amazon Resource - // Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) + // Names (ARNs) and AWS Service Namespaces (general/latest/gr/aws-arns-and-namespaces.html) // in the AWS General Reference. Arn *string `locationName:"arn" min:"20" type:"string"` } diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go deleted file mode 100644 index d5307fcaa..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go +++ /dev/null @@ -1,11 +0,0 @@ -package sts - -import "github.com/aws/aws-sdk-go/aws/request" - -func init() { - initRequest = customizeRequest -} - -func customizeRequest(r *request.Request) { - r.RetryErrorCodes = append(r.RetryErrorCodes, ErrCodeIDPCommunicationErrorException) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go deleted file mode 100644 index e2e1d6efe..000000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go +++ /dev/null @@ -1,96 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package stsiface provides an interface to enable mocking the AWS Security Token Service service client -// for testing your code. -// -// It is important to note that this interface will have breaking changes -// when the service model is updated and adds new API operations, paginators, -// and waiters. -package stsiface - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/service/sts" -) - -// STSAPI provides an interface to enable mocking the -// sts.STS service client's API operation, -// paginators, and waiters. This make unit testing your code that calls out -// to the SDK's service client's calls easier. -// -// The best way to use this interface is so the SDK's service client's calls -// can be stubbed out for unit testing your code with the SDK without needing -// to inject custom request handlers into the SDK's request pipeline. -// -// // myFunc uses an SDK service client to make a request to -// // AWS Security Token Service. -// func myFunc(svc stsiface.STSAPI) bool { -// // Make svc.AssumeRole request -// } -// -// func main() { -// sess := session.New() -// svc := sts.New(sess) -// -// myFunc(svc) -// } -// -// In your _test.go file: -// -// // Define a mock struct to be used in your unit tests of myFunc. -// type mockSTSClient struct { -// stsiface.STSAPI -// } -// func (m *mockSTSClient) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) { -// // mock response/functionality -// } -// -// func TestMyFunc(t *testing.T) { -// // Setup Test -// mockSvc := &mockSTSClient{} -// -// myfunc(mockSvc) -// -// // Verify myFunc's functionality -// } -// -// It is important to note that this interface will have breaking changes -// when the service model is updated and adds new API operations, paginators, -// and waiters. Its suggested to use the pattern above for testing, or using -// tooling to generate mocks to satisfy the interfaces. -type STSAPI interface { - AssumeRole(*sts.AssumeRoleInput) (*sts.AssumeRoleOutput, error) - AssumeRoleWithContext(aws.Context, *sts.AssumeRoleInput, ...request.Option) (*sts.AssumeRoleOutput, error) - AssumeRoleRequest(*sts.AssumeRoleInput) (*request.Request, *sts.AssumeRoleOutput) - - AssumeRoleWithSAML(*sts.AssumeRoleWithSAMLInput) (*sts.AssumeRoleWithSAMLOutput, error) - AssumeRoleWithSAMLWithContext(aws.Context, *sts.AssumeRoleWithSAMLInput, ...request.Option) (*sts.AssumeRoleWithSAMLOutput, error) - AssumeRoleWithSAMLRequest(*sts.AssumeRoleWithSAMLInput) (*request.Request, *sts.AssumeRoleWithSAMLOutput) - - AssumeRoleWithWebIdentity(*sts.AssumeRoleWithWebIdentityInput) (*sts.AssumeRoleWithWebIdentityOutput, error) - AssumeRoleWithWebIdentityWithContext(aws.Context, *sts.AssumeRoleWithWebIdentityInput, ...request.Option) (*sts.AssumeRoleWithWebIdentityOutput, error) - AssumeRoleWithWebIdentityRequest(*sts.AssumeRoleWithWebIdentityInput) (*request.Request, *sts.AssumeRoleWithWebIdentityOutput) - - DecodeAuthorizationMessage(*sts.DecodeAuthorizationMessageInput) (*sts.DecodeAuthorizationMessageOutput, error) - DecodeAuthorizationMessageWithContext(aws.Context, *sts.DecodeAuthorizationMessageInput, ...request.Option) (*sts.DecodeAuthorizationMessageOutput, error) - DecodeAuthorizationMessageRequest(*sts.DecodeAuthorizationMessageInput) (*request.Request, *sts.DecodeAuthorizationMessageOutput) - - GetAccessKeyInfo(*sts.GetAccessKeyInfoInput) (*sts.GetAccessKeyInfoOutput, error) - GetAccessKeyInfoWithContext(aws.Context, *sts.GetAccessKeyInfoInput, ...request.Option) (*sts.GetAccessKeyInfoOutput, error) - GetAccessKeyInfoRequest(*sts.GetAccessKeyInfoInput) (*request.Request, *sts.GetAccessKeyInfoOutput) - - GetCallerIdentity(*sts.GetCallerIdentityInput) (*sts.GetCallerIdentityOutput, error) - GetCallerIdentityWithContext(aws.Context, *sts.GetCallerIdentityInput, ...request.Option) (*sts.GetCallerIdentityOutput, error) - GetCallerIdentityRequest(*sts.GetCallerIdentityInput) (*request.Request, *sts.GetCallerIdentityOutput) - - GetFederationToken(*sts.GetFederationTokenInput) (*sts.GetFederationTokenOutput, error) - GetFederationTokenWithContext(aws.Context, *sts.GetFederationTokenInput, ...request.Option) (*sts.GetFederationTokenOutput, error) - GetFederationTokenRequest(*sts.GetFederationTokenInput) (*request.Request, *sts.GetFederationTokenOutput) - - GetSessionToken(*sts.GetSessionTokenInput) (*sts.GetSessionTokenOutput, error) - GetSessionTokenWithContext(aws.Context, *sts.GetSessionTokenInput, ...request.Option) (*sts.GetSessionTokenOutput, error) - GetSessionTokenRequest(*sts.GetSessionTokenInput) (*request.Request, *sts.GetSessionTokenOutput) -} - -var _ STSAPI = (*sts.STS)(nil) diff --git a/vendor/github.com/blang/semver/.travis.yml b/vendor/github.com/blang/semver/.travis.yml deleted file mode 100644 index 102fb9a69..000000000 --- a/vendor/github.com/blang/semver/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: go -matrix: - include: - - go: 1.4.3 - - go: 1.5.4 - - go: 1.6.3 - - go: 1.7 - - go: tip - allow_failures: - - go: tip -install: -- go get golang.org/x/tools/cmd/cover -- go get github.com/mattn/goveralls -script: -- echo "Test and track coverage" ; $HOME/gopath/bin/goveralls -package "." -service=travis-ci - -repotoken $COVERALLS_TOKEN -- echo "Build examples" ; cd examples && go build -- echo "Check if gofmt'd" ; diff -u <(echo -n) <(gofmt -d -s .) -env: - global: - secure: HroGEAUQpVq9zX1b1VIkraLiywhGbzvNnTZq2TMxgK7JHP8xqNplAeF1izrR2i4QLL9nsY+9WtYss4QuPvEtZcVHUobw6XnL6radF7jS1LgfYZ9Y7oF+zogZ2I5QUMRLGA7rcxQ05s7mKq3XZQfeqaNts4bms/eZRefWuaFZbkw= diff --git a/vendor/github.com/blang/semver/LICENSE b/vendor/github.com/blang/semver/LICENSE deleted file mode 100644 index 5ba5c86fc..000000000 --- a/vendor/github.com/blang/semver/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License - -Copyright (c) 2014 Benedikt Lang - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/vendor/github.com/blang/semver/README.md b/vendor/github.com/blang/semver/README.md deleted file mode 100644 index 08b2e4a3d..000000000 --- a/vendor/github.com/blang/semver/README.md +++ /dev/null @@ -1,194 +0,0 @@ -semver for golang [![Build Status](https://travis-ci.org/blang/semver.svg?branch=master)](https://travis-ci.org/blang/semver) [![GoDoc](https://godoc.org/github.com/blang/semver?status.png)](https://godoc.org/github.com/blang/semver) [![Coverage Status](https://img.shields.io/coveralls/blang/semver.svg)](https://coveralls.io/r/blang/semver?branch=master) -====== - -semver is a [Semantic Versioning](http://semver.org/) library written in golang. It fully covers spec version `2.0.0`. - -Usage ------ -```bash -$ go get github.com/blang/semver -``` -Note: Always vendor your dependencies or fix on a specific version tag. - -```go -import github.com/blang/semver -v1, err := semver.Make("1.0.0-beta") -v2, err := semver.Make("2.0.0-beta") -v1.Compare(v2) -``` - -Also check the [GoDocs](http://godoc.org/github.com/blang/semver). - -Why should I use this lib? ------ - -- Fully spec compatible -- No reflection -- No regex -- Fully tested (Coverage >99%) -- Readable parsing/validation errors -- Fast (See [Benchmarks](#benchmarks)) -- Only Stdlib -- Uses values instead of pointers -- Many features, see below - - -Features ------ - -- Parsing and validation at all levels -- Comparator-like comparisons -- Compare Helper Methods -- InPlace manipulation -- Ranges `>=1.0.0 <2.0.0 || >=3.0.0 !3.0.1-beta.1` -- Wildcards `>=1.x`, `<=2.5.x` -- Sortable (implements sort.Interface) -- database/sql compatible (sql.Scanner/Valuer) -- encoding/json compatible (json.Marshaler/Unmarshaler) - -Ranges ------- - -A `Range` is a set of conditions which specify which versions satisfy the range. - -A condition is composed of an operator and a version. The supported operators are: - -- `<1.0.0` Less than `1.0.0` -- `<=1.0.0` Less than or equal to `1.0.0` -- `>1.0.0` Greater than `1.0.0` -- `>=1.0.0` Greater than or equal to `1.0.0` -- `1.0.0`, `=1.0.0`, `==1.0.0` Equal to `1.0.0` -- `!1.0.0`, `!=1.0.0` Not equal to `1.0.0`. Excludes version `1.0.0`. - -Note that spaces between the operator and the version will be gracefully tolerated. - -A `Range` can link multiple `Ranges` separated by space: - -Ranges can be linked by logical AND: - - - `>1.0.0 <2.0.0` would match between both ranges, so `1.1.1` and `1.8.7` but not `1.0.0` or `2.0.0` - - `>1.0.0 <3.0.0 !2.0.3-beta.2` would match every version between `1.0.0` and `3.0.0` except `2.0.3-beta.2` - -Ranges can also be linked by logical OR: - - - `<2.0.0 || >=3.0.0` would match `1.x.x` and `3.x.x` but not `2.x.x` - -AND has a higher precedence than OR. It's not possible to use brackets. - -Ranges can be combined by both AND and OR - - - `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1` - -Range usage: - -``` -v, err := semver.Parse("1.2.3") -range, err := semver.ParseRange(">1.0.0 <2.0.0 || >=3.0.0") -if range(v) { - //valid -} - -``` - -Example ------ - -Have a look at full examples in [examples/main.go](examples/main.go) - -```go -import github.com/blang/semver - -v, err := semver.Make("0.0.1-alpha.preview+123.github") -fmt.Printf("Major: %d\n", v.Major) -fmt.Printf("Minor: %d\n", v.Minor) -fmt.Printf("Patch: %d\n", v.Patch) -fmt.Printf("Pre: %s\n", v.Pre) -fmt.Printf("Build: %s\n", v.Build) - -// Prerelease versions array -if len(v.Pre) > 0 { - fmt.Println("Prerelease versions:") - for i, pre := range v.Pre { - fmt.Printf("%d: %q\n", i, pre) - } -} - -// Build meta data array -if len(v.Build) > 0 { - fmt.Println("Build meta data:") - for i, build := range v.Build { - fmt.Printf("%d: %q\n", i, build) - } -} - -v001, err := semver.Make("0.0.1") -// Compare using helpers: v.GT(v2), v.LT, v.GTE, v.LTE -v001.GT(v) == true -v.LT(v001) == true -v.GTE(v) == true -v.LTE(v) == true - -// Or use v.Compare(v2) for comparisons (-1, 0, 1): -v001.Compare(v) == 1 -v.Compare(v001) == -1 -v.Compare(v) == 0 - -// Manipulate Version in place: -v.Pre[0], err = semver.NewPRVersion("beta") -if err != nil { - fmt.Printf("Error parsing pre release version: %q", err) -} - -fmt.Println("\nValidate versions:") -v.Build[0] = "?" - -err = v.Validate() -if err != nil { - fmt.Printf("Validation failed: %s\n", err) -} -``` - - -Benchmarks ------ - - BenchmarkParseSimple-4 5000000 390 ns/op 48 B/op 1 allocs/op - BenchmarkParseComplex-4 1000000 1813 ns/op 256 B/op 7 allocs/op - BenchmarkParseAverage-4 1000000 1171 ns/op 163 B/op 4 allocs/op - BenchmarkStringSimple-4 20000000 119 ns/op 16 B/op 1 allocs/op - BenchmarkStringLarger-4 10000000 206 ns/op 32 B/op 2 allocs/op - BenchmarkStringComplex-4 5000000 324 ns/op 80 B/op 3 allocs/op - BenchmarkStringAverage-4 5000000 273 ns/op 53 B/op 2 allocs/op - BenchmarkValidateSimple-4 200000000 9.33 ns/op 0 B/op 0 allocs/op - BenchmarkValidateComplex-4 3000000 469 ns/op 0 B/op 0 allocs/op - BenchmarkValidateAverage-4 5000000 256 ns/op 0 B/op 0 allocs/op - BenchmarkCompareSimple-4 100000000 11.8 ns/op 0 B/op 0 allocs/op - BenchmarkCompareComplex-4 50000000 30.8 ns/op 0 B/op 0 allocs/op - BenchmarkCompareAverage-4 30000000 41.5 ns/op 0 B/op 0 allocs/op - BenchmarkSort-4 3000000 419 ns/op 256 B/op 2 allocs/op - BenchmarkRangeParseSimple-4 2000000 850 ns/op 192 B/op 5 allocs/op - BenchmarkRangeParseAverage-4 1000000 1677 ns/op 400 B/op 10 allocs/op - BenchmarkRangeParseComplex-4 300000 5214 ns/op 1440 B/op 30 allocs/op - BenchmarkRangeMatchSimple-4 50000000 25.6 ns/op 0 B/op 0 allocs/op - BenchmarkRangeMatchAverage-4 30000000 56.4 ns/op 0 B/op 0 allocs/op - BenchmarkRangeMatchComplex-4 10000000 153 ns/op 0 B/op 0 allocs/op - -See benchmark cases at [semver_test.go](semver_test.go) - - -Motivation ------ - -I simply couldn't find any lib supporting the full spec. Others were just wrong or used reflection and regex which i don't like. - - -Contribution ------ - -Feel free to make a pull request. For bigger changes create a issue first to discuss about it. - - -License ------ - -See [LICENSE](LICENSE) file. diff --git a/vendor/github.com/blang/semver/json.go b/vendor/github.com/blang/semver/json.go deleted file mode 100644 index a74bf7c44..000000000 --- a/vendor/github.com/blang/semver/json.go +++ /dev/null @@ -1,23 +0,0 @@ -package semver - -import ( - "encoding/json" -) - -// MarshalJSON implements the encoding/json.Marshaler interface. -func (v Version) MarshalJSON() ([]byte, error) { - return json.Marshal(v.String()) -} - -// UnmarshalJSON implements the encoding/json.Unmarshaler interface. -func (v *Version) UnmarshalJSON(data []byte) (err error) { - var versionString string - - if err = json.Unmarshal(data, &versionString); err != nil { - return - } - - *v, err = Parse(versionString) - - return -} diff --git a/vendor/github.com/blang/semver/package.json b/vendor/github.com/blang/semver/package.json deleted file mode 100644 index 1cf8ebdd9..000000000 --- a/vendor/github.com/blang/semver/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "author": "blang", - "bugs": { - "URL": "https://github.com/blang/semver/issues", - "url": "https://github.com/blang/semver/issues" - }, - "gx": { - "dvcsimport": "github.com/blang/semver" - }, - "gxVersion": "0.10.0", - "language": "go", - "license": "MIT", - "name": "semver", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "3.5.1" -} - diff --git a/vendor/github.com/blang/semver/range.go b/vendor/github.com/blang/semver/range.go deleted file mode 100644 index fca406d47..000000000 --- a/vendor/github.com/blang/semver/range.go +++ /dev/null @@ -1,416 +0,0 @@ -package semver - -import ( - "fmt" - "strconv" - "strings" - "unicode" -) - -type wildcardType int - -const ( - noneWildcard wildcardType = iota - majorWildcard wildcardType = 1 - minorWildcard wildcardType = 2 - patchWildcard wildcardType = 3 -) - -func wildcardTypefromInt(i int) wildcardType { - switch i { - case 1: - return majorWildcard - case 2: - return minorWildcard - case 3: - return patchWildcard - default: - return noneWildcard - } -} - -type comparator func(Version, Version) bool - -var ( - compEQ comparator = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) == 0 - } - compNE = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) != 0 - } - compGT = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) == 1 - } - compGE = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) >= 0 - } - compLT = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) == -1 - } - compLE = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) <= 0 - } -) - -type versionRange struct { - v Version - c comparator -} - -// rangeFunc creates a Range from the given versionRange. -func (vr *versionRange) rangeFunc() Range { - return Range(func(v Version) bool { - return vr.c(v, vr.v) - }) -} - -// Range represents a range of versions. -// A Range can be used to check if a Version satisfies it: -// -// range, err := semver.ParseRange(">1.0.0 <2.0.0") -// range(semver.MustParse("1.1.1") // returns true -type Range func(Version) bool - -// OR combines the existing Range with another Range using logical OR. -func (rf Range) OR(f Range) Range { - return Range(func(v Version) bool { - return rf(v) || f(v) - }) -} - -// AND combines the existing Range with another Range using logical AND. -func (rf Range) AND(f Range) Range { - return Range(func(v Version) bool { - return rf(v) && f(v) - }) -} - -// ParseRange parses a range and returns a Range. -// If the range could not be parsed an error is returned. -// -// Valid ranges are: -// - "<1.0.0" -// - "<=1.0.0" -// - ">1.0.0" -// - ">=1.0.0" -// - "1.0.0", "=1.0.0", "==1.0.0" -// - "!1.0.0", "!=1.0.0" -// -// A Range can consist of multiple ranges separated by space: -// Ranges can be linked by logical AND: -// - ">1.0.0 <2.0.0" would match between both ranges, so "1.1.1" and "1.8.7" but not "1.0.0" or "2.0.0" -// - ">1.0.0 <3.0.0 !2.0.3-beta.2" would match every version between 1.0.0 and 3.0.0 except 2.0.3-beta.2 -// -// Ranges can also be linked by logical OR: -// - "<2.0.0 || >=3.0.0" would match "1.x.x" and "3.x.x" but not "2.x.x" -// -// AND has a higher precedence than OR. It's not possible to use brackets. -// -// Ranges can be combined by both AND and OR -// -// - `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1` -func ParseRange(s string) (Range, error) { - parts := splitAndTrim(s) - orParts, err := splitORParts(parts) - if err != nil { - return nil, err - } - expandedParts, err := expandWildcardVersion(orParts) - if err != nil { - return nil, err - } - var orFn Range - for _, p := range expandedParts { - var andFn Range - for _, ap := range p { - opStr, vStr, err := splitComparatorVersion(ap) - if err != nil { - return nil, err - } - vr, err := buildVersionRange(opStr, vStr) - if err != nil { - return nil, fmt.Errorf("Could not parse Range %q: %s", ap, err) - } - rf := vr.rangeFunc() - - // Set function - if andFn == nil { - andFn = rf - } else { // Combine with existing function - andFn = andFn.AND(rf) - } - } - if orFn == nil { - orFn = andFn - } else { - orFn = orFn.OR(andFn) - } - - } - return orFn, nil -} - -// splitORParts splits the already cleaned parts by '||'. -// Checks for invalid positions of the operator and returns an -// error if found. -func splitORParts(parts []string) ([][]string, error) { - var ORparts [][]string - last := 0 - for i, p := range parts { - if p == "||" { - if i == 0 { - return nil, fmt.Errorf("First element in range is '||'") - } - ORparts = append(ORparts, parts[last:i]) - last = i + 1 - } - } - if last == len(parts) { - return nil, fmt.Errorf("Last element in range is '||'") - } - ORparts = append(ORparts, parts[last:]) - return ORparts, nil -} - -// buildVersionRange takes a slice of 2: operator and version -// and builds a versionRange, otherwise an error. -func buildVersionRange(opStr, vStr string) (*versionRange, error) { - c := parseComparator(opStr) - if c == nil { - return nil, fmt.Errorf("Could not parse comparator %q in %q", opStr, strings.Join([]string{opStr, vStr}, "")) - } - v, err := Parse(vStr) - if err != nil { - return nil, fmt.Errorf("Could not parse version %q in %q: %s", vStr, strings.Join([]string{opStr, vStr}, ""), err) - } - - return &versionRange{ - v: v, - c: c, - }, nil - -} - -// inArray checks if a byte is contained in an array of bytes -func inArray(s byte, list []byte) bool { - for _, el := range list { - if el == s { - return true - } - } - return false -} - -// splitAndTrim splits a range string by spaces and cleans whitespaces -func splitAndTrim(s string) (result []string) { - last := 0 - var lastChar byte - excludeFromSplit := []byte{'>', '<', '='} - for i := 0; i < len(s); i++ { - if s[i] == ' ' && !inArray(lastChar, excludeFromSplit) { - if last < i-1 { - result = append(result, s[last:i]) - } - last = i + 1 - } else if s[i] != ' ' { - lastChar = s[i] - } - } - if last < len(s)-1 { - result = append(result, s[last:]) - } - - for i, v := range result { - result[i] = strings.Replace(v, " ", "", -1) - } - - // parts := strings.Split(s, " ") - // for _, x := range parts { - // if s := strings.TrimSpace(x); len(s) != 0 { - // result = append(result, s) - // } - // } - return -} - -// splitComparatorVersion splits the comparator from the version. -// Input must be free of leading or trailing spaces. -func splitComparatorVersion(s string) (string, string, error) { - i := strings.IndexFunc(s, unicode.IsDigit) - if i == -1 { - return "", "", fmt.Errorf("Could not get version from string: %q", s) - } - return strings.TrimSpace(s[0:i]), s[i:], nil -} - -// getWildcardType will return the type of wildcard that the -// passed version contains -func getWildcardType(vStr string) wildcardType { - parts := strings.Split(vStr, ".") - nparts := len(parts) - wildcard := parts[nparts-1] - - possibleWildcardType := wildcardTypefromInt(nparts) - if wildcard == "x" { - return possibleWildcardType - } - - return noneWildcard -} - -// createVersionFromWildcard will convert a wildcard version -// into a regular version, replacing 'x's with '0's, handling -// special cases like '1.x.x' and '1.x' -func createVersionFromWildcard(vStr string) string { - // handle 1.x.x - vStr2 := strings.Replace(vStr, ".x.x", ".x", 1) - vStr2 = strings.Replace(vStr2, ".x", ".0", 1) - parts := strings.Split(vStr2, ".") - - // handle 1.x - if len(parts) == 2 { - return vStr2 + ".0" - } - - return vStr2 -} - -// incrementMajorVersion will increment the major version -// of the passed version -func incrementMajorVersion(vStr string) (string, error) { - parts := strings.Split(vStr, ".") - i, err := strconv.Atoi(parts[0]) - if err != nil { - return "", err - } - parts[0] = strconv.Itoa(i + 1) - - return strings.Join(parts, "."), nil -} - -// incrementMajorVersion will increment the minor version -// of the passed version -func incrementMinorVersion(vStr string) (string, error) { - parts := strings.Split(vStr, ".") - i, err := strconv.Atoi(parts[1]) - if err != nil { - return "", err - } - parts[1] = strconv.Itoa(i + 1) - - return strings.Join(parts, "."), nil -} - -// expandWildcardVersion will expand wildcards inside versions -// following these rules: -// -// * when dealing with patch wildcards: -// >= 1.2.x will become >= 1.2.0 -// <= 1.2.x will become < 1.3.0 -// > 1.2.x will become >= 1.3.0 -// < 1.2.x will become < 1.2.0 -// != 1.2.x will become < 1.2.0 >= 1.3.0 -// -// * when dealing with minor wildcards: -// >= 1.x will become >= 1.0.0 -// <= 1.x will become < 2.0.0 -// > 1.x will become >= 2.0.0 -// < 1.0 will become < 1.0.0 -// != 1.x will become < 1.0.0 >= 2.0.0 -// -// * when dealing with wildcards without -// version operator: -// 1.2.x will become >= 1.2.0 < 1.3.0 -// 1.x will become >= 1.0.0 < 2.0.0 -func expandWildcardVersion(parts [][]string) ([][]string, error) { - var expandedParts [][]string - for _, p := range parts { - var newParts []string - for _, ap := range p { - if strings.Index(ap, "x") != -1 { - opStr, vStr, err := splitComparatorVersion(ap) - if err != nil { - return nil, err - } - - versionWildcardType := getWildcardType(vStr) - flatVersion := createVersionFromWildcard(vStr) - - var resultOperator string - var shouldIncrementVersion bool - switch opStr { - case ">": - resultOperator = ">=" - shouldIncrementVersion = true - case ">=": - resultOperator = ">=" - case "<": - resultOperator = "<" - case "<=": - resultOperator = "<" - shouldIncrementVersion = true - case "", "=", "==": - newParts = append(newParts, ">="+flatVersion) - resultOperator = "<" - shouldIncrementVersion = true - case "!=", "!": - newParts = append(newParts, "<"+flatVersion) - resultOperator = ">=" - shouldIncrementVersion = true - } - - var resultVersion string - if shouldIncrementVersion { - switch versionWildcardType { - case patchWildcard: - resultVersion, _ = incrementMinorVersion(flatVersion) - case minorWildcard: - resultVersion, _ = incrementMajorVersion(flatVersion) - } - } else { - resultVersion = flatVersion - } - - ap = resultOperator + resultVersion - } - newParts = append(newParts, ap) - } - expandedParts = append(expandedParts, newParts) - } - - return expandedParts, nil -} - -func parseComparator(s string) comparator { - switch s { - case "==": - fallthrough - case "": - fallthrough - case "=": - return compEQ - case ">": - return compGT - case ">=": - return compGE - case "<": - return compLT - case "<=": - return compLE - case "!": - fallthrough - case "!=": - return compNE - } - - return nil -} - -// MustParseRange is like ParseRange but panics if the range cannot be parsed. -func MustParseRange(s string) Range { - r, err := ParseRange(s) - if err != nil { - panic(`semver: ParseRange(` + s + `): ` + err.Error()) - } - return r -} diff --git a/vendor/github.com/blang/semver/semver.go b/vendor/github.com/blang/semver/semver.go deleted file mode 100644 index 8ee0842e6..000000000 --- a/vendor/github.com/blang/semver/semver.go +++ /dev/null @@ -1,418 +0,0 @@ -package semver - -import ( - "errors" - "fmt" - "strconv" - "strings" -) - -const ( - numbers string = "0123456789" - alphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" - alphanum = alphas + numbers -) - -// SpecVersion is the latest fully supported spec version of semver -var SpecVersion = Version{ - Major: 2, - Minor: 0, - Patch: 0, -} - -// Version represents a semver compatible version -type Version struct { - Major uint64 - Minor uint64 - Patch uint64 - Pre []PRVersion - Build []string //No Precendence -} - -// Version to string -func (v Version) String() string { - b := make([]byte, 0, 5) - b = strconv.AppendUint(b, v.Major, 10) - b = append(b, '.') - b = strconv.AppendUint(b, v.Minor, 10) - b = append(b, '.') - b = strconv.AppendUint(b, v.Patch, 10) - - if len(v.Pre) > 0 { - b = append(b, '-') - b = append(b, v.Pre[0].String()...) - - for _, pre := range v.Pre[1:] { - b = append(b, '.') - b = append(b, pre.String()...) - } - } - - if len(v.Build) > 0 { - b = append(b, '+') - b = append(b, v.Build[0]...) - - for _, build := range v.Build[1:] { - b = append(b, '.') - b = append(b, build...) - } - } - - return string(b) -} - -// Equals checks if v is equal to o. -func (v Version) Equals(o Version) bool { - return (v.Compare(o) == 0) -} - -// EQ checks if v is equal to o. -func (v Version) EQ(o Version) bool { - return (v.Compare(o) == 0) -} - -// NE checks if v is not equal to o. -func (v Version) NE(o Version) bool { - return (v.Compare(o) != 0) -} - -// GT checks if v is greater than o. -func (v Version) GT(o Version) bool { - return (v.Compare(o) == 1) -} - -// GTE checks if v is greater than or equal to o. -func (v Version) GTE(o Version) bool { - return (v.Compare(o) >= 0) -} - -// GE checks if v is greater than or equal to o. -func (v Version) GE(o Version) bool { - return (v.Compare(o) >= 0) -} - -// LT checks if v is less than o. -func (v Version) LT(o Version) bool { - return (v.Compare(o) == -1) -} - -// LTE checks if v is less than or equal to o. -func (v Version) LTE(o Version) bool { - return (v.Compare(o) <= 0) -} - -// LE checks if v is less than or equal to o. -func (v Version) LE(o Version) bool { - return (v.Compare(o) <= 0) -} - -// Compare compares Versions v to o: -// -1 == v is less than o -// 0 == v is equal to o -// 1 == v is greater than o -func (v Version) Compare(o Version) int { - if v.Major != o.Major { - if v.Major > o.Major { - return 1 - } - return -1 - } - if v.Minor != o.Minor { - if v.Minor > o.Minor { - return 1 - } - return -1 - } - if v.Patch != o.Patch { - if v.Patch > o.Patch { - return 1 - } - return -1 - } - - // Quick comparison if a version has no prerelease versions - if len(v.Pre) == 0 && len(o.Pre) == 0 { - return 0 - } else if len(v.Pre) == 0 && len(o.Pre) > 0 { - return 1 - } else if len(v.Pre) > 0 && len(o.Pre) == 0 { - return -1 - } - - i := 0 - for ; i < len(v.Pre) && i < len(o.Pre); i++ { - if comp := v.Pre[i].Compare(o.Pre[i]); comp == 0 { - continue - } else if comp == 1 { - return 1 - } else { - return -1 - } - } - - // If all pr versions are the equal but one has further prversion, this one greater - if i == len(v.Pre) && i == len(o.Pre) { - return 0 - } else if i == len(v.Pre) && i < len(o.Pre) { - return -1 - } else { - return 1 - } - -} - -// Validate validates v and returns error in case -func (v Version) Validate() error { - // Major, Minor, Patch already validated using uint64 - - for _, pre := range v.Pre { - if !pre.IsNum { //Numeric prerelease versions already uint64 - if len(pre.VersionStr) == 0 { - return fmt.Errorf("Prerelease can not be empty %q", pre.VersionStr) - } - if !containsOnly(pre.VersionStr, alphanum) { - return fmt.Errorf("Invalid character(s) found in prerelease %q", pre.VersionStr) - } - } - } - - for _, build := range v.Build { - if len(build) == 0 { - return fmt.Errorf("Build meta data can not be empty %q", build) - } - if !containsOnly(build, alphanum) { - return fmt.Errorf("Invalid character(s) found in build meta data %q", build) - } - } - - return nil -} - -// New is an alias for Parse and returns a pointer, parses version string and returns a validated Version or error -func New(s string) (vp *Version, err error) { - v, err := Parse(s) - vp = &v - return -} - -// Make is an alias for Parse, parses version string and returns a validated Version or error -func Make(s string) (Version, error) { - return Parse(s) -} - -// ParseTolerant allows for certain version specifications that do not strictly adhere to semver -// specs to be parsed by this library. It does so by normalizing versions before passing them to -// Parse(). It currently trims spaces, removes a "v" prefix, and adds a 0 patch number to versions -// with only major and minor components specified -func ParseTolerant(s string) (Version, error) { - s = strings.TrimSpace(s) - s = strings.TrimPrefix(s, "v") - - // Split into major.minor.(patch+pr+meta) - parts := strings.SplitN(s, ".", 3) - if len(parts) < 3 { - if strings.ContainsAny(parts[len(parts)-1], "+-") { - return Version{}, errors.New("Short version cannot contain PreRelease/Build meta data") - } - for len(parts) < 3 { - parts = append(parts, "0") - } - s = strings.Join(parts, ".") - } - - return Parse(s) -} - -// Parse parses version string and returns a validated Version or error -func Parse(s string) (Version, error) { - if len(s) == 0 { - return Version{}, errors.New("Version string empty") - } - - // Split into major.minor.(patch+pr+meta) - parts := strings.SplitN(s, ".", 3) - if len(parts) != 3 { - return Version{}, errors.New("No Major.Minor.Patch elements found") - } - - // Major - if !containsOnly(parts[0], numbers) { - return Version{}, fmt.Errorf("Invalid character(s) found in major number %q", parts[0]) - } - if hasLeadingZeroes(parts[0]) { - return Version{}, fmt.Errorf("Major number must not contain leading zeroes %q", parts[0]) - } - major, err := strconv.ParseUint(parts[0], 10, 64) - if err != nil { - return Version{}, err - } - - // Minor - if !containsOnly(parts[1], numbers) { - return Version{}, fmt.Errorf("Invalid character(s) found in minor number %q", parts[1]) - } - if hasLeadingZeroes(parts[1]) { - return Version{}, fmt.Errorf("Minor number must not contain leading zeroes %q", parts[1]) - } - minor, err := strconv.ParseUint(parts[1], 10, 64) - if err != nil { - return Version{}, err - } - - v := Version{} - v.Major = major - v.Minor = minor - - var build, prerelease []string - patchStr := parts[2] - - if buildIndex := strings.IndexRune(patchStr, '+'); buildIndex != -1 { - build = strings.Split(patchStr[buildIndex+1:], ".") - patchStr = patchStr[:buildIndex] - } - - if preIndex := strings.IndexRune(patchStr, '-'); preIndex != -1 { - prerelease = strings.Split(patchStr[preIndex+1:], ".") - patchStr = patchStr[:preIndex] - } - - if !containsOnly(patchStr, numbers) { - return Version{}, fmt.Errorf("Invalid character(s) found in patch number %q", patchStr) - } - if hasLeadingZeroes(patchStr) { - return Version{}, fmt.Errorf("Patch number must not contain leading zeroes %q", patchStr) - } - patch, err := strconv.ParseUint(patchStr, 10, 64) - if err != nil { - return Version{}, err - } - - v.Patch = patch - - // Prerelease - for _, prstr := range prerelease { - parsedPR, err := NewPRVersion(prstr) - if err != nil { - return Version{}, err - } - v.Pre = append(v.Pre, parsedPR) - } - - // Build meta data - for _, str := range build { - if len(str) == 0 { - return Version{}, errors.New("Build meta data is empty") - } - if !containsOnly(str, alphanum) { - return Version{}, fmt.Errorf("Invalid character(s) found in build meta data %q", str) - } - v.Build = append(v.Build, str) - } - - return v, nil -} - -// MustParse is like Parse but panics if the version cannot be parsed. -func MustParse(s string) Version { - v, err := Parse(s) - if err != nil { - panic(`semver: Parse(` + s + `): ` + err.Error()) - } - return v -} - -// PRVersion represents a PreRelease Version -type PRVersion struct { - VersionStr string - VersionNum uint64 - IsNum bool -} - -// NewPRVersion creates a new valid prerelease version -func NewPRVersion(s string) (PRVersion, error) { - if len(s) == 0 { - return PRVersion{}, errors.New("Prerelease is empty") - } - v := PRVersion{} - if containsOnly(s, numbers) { - if hasLeadingZeroes(s) { - return PRVersion{}, fmt.Errorf("Numeric PreRelease version must not contain leading zeroes %q", s) - } - num, err := strconv.ParseUint(s, 10, 64) - - // Might never be hit, but just in case - if err != nil { - return PRVersion{}, err - } - v.VersionNum = num - v.IsNum = true - } else if containsOnly(s, alphanum) { - v.VersionStr = s - v.IsNum = false - } else { - return PRVersion{}, fmt.Errorf("Invalid character(s) found in prerelease %q", s) - } - return v, nil -} - -// IsNumeric checks if prerelease-version is numeric -func (v PRVersion) IsNumeric() bool { - return v.IsNum -} - -// Compare compares two PreRelease Versions v and o: -// -1 == v is less than o -// 0 == v is equal to o -// 1 == v is greater than o -func (v PRVersion) Compare(o PRVersion) int { - if v.IsNum && !o.IsNum { - return -1 - } else if !v.IsNum && o.IsNum { - return 1 - } else if v.IsNum && o.IsNum { - if v.VersionNum == o.VersionNum { - return 0 - } else if v.VersionNum > o.VersionNum { - return 1 - } else { - return -1 - } - } else { // both are Alphas - if v.VersionStr == o.VersionStr { - return 0 - } else if v.VersionStr > o.VersionStr { - return 1 - } else { - return -1 - } - } -} - -// PreRelease version to string -func (v PRVersion) String() string { - if v.IsNum { - return strconv.FormatUint(v.VersionNum, 10) - } - return v.VersionStr -} - -func containsOnly(s string, set string) bool { - return strings.IndexFunc(s, func(r rune) bool { - return !strings.ContainsRune(set, r) - }) == -1 -} - -func hasLeadingZeroes(s string) bool { - return len(s) > 1 && s[0] == '0' -} - -// NewBuildVersion creates a new valid build version -func NewBuildVersion(s string) (string, error) { - if len(s) == 0 { - return "", errors.New("Buildversion is empty") - } - if !containsOnly(s, alphanum) { - return "", fmt.Errorf("Invalid character(s) found in build meta data %q", s) - } - return s, nil -} diff --git a/vendor/github.com/blang/semver/sort.go b/vendor/github.com/blang/semver/sort.go deleted file mode 100644 index e18f88082..000000000 --- a/vendor/github.com/blang/semver/sort.go +++ /dev/null @@ -1,28 +0,0 @@ -package semver - -import ( - "sort" -) - -// Versions represents multiple versions. -type Versions []Version - -// Len returns length of version collection -func (s Versions) Len() int { - return len(s) -} - -// Swap swaps two versions inside the collection by its indices -func (s Versions) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -// Less checks if version at index i is less than version at index j -func (s Versions) Less(i, j int) bool { - return s[i].LT(s[j]) -} - -// Sort sorts a slice of versions -func Sort(versions []Version) { - sort.Sort(Versions(versions)) -} diff --git a/vendor/github.com/blang/semver/sql.go b/vendor/github.com/blang/semver/sql.go deleted file mode 100644 index eb4d80266..000000000 --- a/vendor/github.com/blang/semver/sql.go +++ /dev/null @@ -1,30 +0,0 @@ -package semver - -import ( - "database/sql/driver" - "fmt" -) - -// Scan implements the database/sql.Scanner interface. -func (v *Version) Scan(src interface{}) (err error) { - var str string - switch src := src.(type) { - case string: - str = src - case []byte: - str = string(src) - default: - return fmt.Errorf("Version.Scan: cannot convert %T to string.", src) - } - - if t, err := Parse(str); err == nil { - *v = t - } - - return -} - -// Value implements the database/sql/driver.Valuer interface. -func (v Version) Value() (driver.Value, error) { - return v.String(), nil -} diff --git a/vendor/github.com/bmatcuk/doublestar/.travis.yml b/vendor/github.com/bmatcuk/doublestar/.travis.yml deleted file mode 100644 index ec4fee889..000000000 --- a/vendor/github.com/bmatcuk/doublestar/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go - -go: - - 1.11 - - 1.12 - -before_install: - - go get -t -v ./... - -script: - - go test -race -coverprofile=coverage.txt -covermode=atomic - -after_success: - - bash <(curl -s https://codecov.io/bash) - diff --git a/vendor/github.com/bmatcuk/doublestar/LICENSE b/vendor/github.com/bmatcuk/doublestar/LICENSE deleted file mode 100644 index 309c9d1d1..000000000 --- a/vendor/github.com/bmatcuk/doublestar/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Bob Matcuk - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/vendor/github.com/bmatcuk/doublestar/README.md b/vendor/github.com/bmatcuk/doublestar/README.md deleted file mode 100644 index 8e365c5e3..000000000 --- a/vendor/github.com/bmatcuk/doublestar/README.md +++ /dev/null @@ -1,109 +0,0 @@ -![Release](https://img.shields.io/github/release/bmatcuk/doublestar.svg?branch=master) -[![Build Status](https://travis-ci.org/bmatcuk/doublestar.svg?branch=master)](https://travis-ci.org/bmatcuk/doublestar) -[![codecov.io](https://img.shields.io/codecov/c/github/bmatcuk/doublestar.svg?branch=master)](https://codecov.io/github/bmatcuk/doublestar?branch=master) - -# doublestar - -**doublestar** is a [golang](http://golang.org/) implementation of path pattern -matching and globbing with support for "doublestar" (aka globstar: `**`) -patterns. - -doublestar patterns match files and directories recursively. For example, if -you had the following directory structure: - -``` -grandparent -`-- parent - |-- child1 - `-- child2 -``` - -You could find the children with patterns such as: `**/child*`, -`grandparent/**/child?`, `**/parent/*`, or even just `**` by itself (which will -return all files and directories recursively). - -Bash's globstar is doublestar's inspiration and, as such, works similarly. -Note that the doublestar must appear as a path component by itself. A pattern -such as `/path**` is invalid and will be treated the same as `/path*`, but -`/path*/**` should achieve the desired result. Additionally, `/path/**` will -match all directories and files under the path directory, but `/path/**/` will -only match directories. - -## Installation - -**doublestar** can be installed via `go get`: - -```bash -go get github.com/bmatcuk/doublestar -``` - -To use it in your code, you must import it: - -```go -import "github.com/bmatcuk/doublestar" -``` - -## Functions - -### Match -```go -func Match(pattern, name string) (bool, error) -``` - -Match returns true if `name` matches the file name `pattern` -([see below](#patterns)). `name` and `pattern` are split on forward slash (`/`) -characters and may be relative or absolute. - -Note: `Match()` is meant to be a drop-in replacement for `path.Match()`. As -such, it always uses `/` as the path separator. If you are writing code that -will run on systems where `/` is not the path separator (such as Windows), you -want to use `PathMatch()` (below) instead. - - -### PathMatch -```go -func PathMatch(pattern, name string) (bool, error) -``` - -PathMatch returns true if `name` matches the file name `pattern` -([see below](#patterns)). The difference between Match and PathMatch is that -PathMatch will automatically use your system's path separator to split `name` -and `pattern`. - -`PathMatch()` is meant to be a drop-in replacement for `filepath.Match()`. - -### Glob -```go -func Glob(pattern string) ([]string, error) -``` - -Glob finds all files and directories in the filesystem that match `pattern` -([see below](#patterns)). `pattern` may be relative (to the current working -directory), or absolute. - -`Glob()` is meant to be a drop-in replacement for `filepath.Glob()`. - -## Patterns - -**doublestar** supports the following special terms in the patterns: - -Special Terms | Meaning -------------- | ------- -`*` | matches any sequence of non-path-separators -`**` | matches any sequence of characters, including path separators -`?` | matches any single non-path-separator character -`[class]` | matches any single non-path-separator character against a class of characters ([see below](#character-classes)) -`{alt1,...}` | matches a sequence of characters if one of the comma-separated alternatives matches - -Any character with a special meaning can be escaped with a backslash (`\`). - -### Character Classes - -Character classes support the following: - -Class | Meaning ----------- | ------- -`[abc]` | matches any single character within the set -`[a-z]` | matches any single character in the range -`[^class]` | matches any single character which does *not* match the class - diff --git a/vendor/github.com/bmatcuk/doublestar/doublestar.go b/vendor/github.com/bmatcuk/doublestar/doublestar.go deleted file mode 100644 index 0044dfa83..000000000 --- a/vendor/github.com/bmatcuk/doublestar/doublestar.go +++ /dev/null @@ -1,476 +0,0 @@ -package doublestar - -import ( - "fmt" - "os" - "path" - "path/filepath" - "strings" - "unicode/utf8" -) - -// ErrBadPattern indicates a pattern was malformed. -var ErrBadPattern = path.ErrBadPattern - -// Split a path on the given separator, respecting escaping. -func splitPathOnSeparator(path string, separator rune) (ret []string) { - idx := 0 - if separator == '\\' { - // if the separator is '\\', then we can just split... - ret = strings.Split(path, string(separator)) - idx = len(ret) - } else { - // otherwise, we need to be careful of situations where the separator was escaped - cnt := strings.Count(path, string(separator)) - if cnt == 0 { - return []string{path} - } - - ret = make([]string, cnt+1) - pathlen := len(path) - separatorLen := utf8.RuneLen(separator) - emptyEnd := false - for start := 0; start < pathlen; { - end := indexRuneWithEscaping(path[start:], separator) - if end == -1 { - emptyEnd = false - end = pathlen - } else { - emptyEnd = true - end += start - } - ret[idx] = path[start:end] - start = end + separatorLen - idx++ - } - - // If the last rune is a path separator, we need to append an empty string to - // represent the last, empty path component. By default, the strings from - // make([]string, ...) will be empty, so we just need to icrement the count - if emptyEnd { - idx++ - } - } - - return ret[:idx] -} - -// Find the first index of a rune in a string, -// ignoring any times the rune is escaped using "\". -func indexRuneWithEscaping(s string, r rune) int { - end := strings.IndexRune(s, r) - if end == -1 { - return -1 - } - if end > 0 && s[end-1] == '\\' { - start := end + utf8.RuneLen(r) - end = indexRuneWithEscaping(s[start:], r) - if end != -1 { - end += start - } - } - return end -} - -// Match returns true if name matches the shell file name pattern. -// The pattern syntax is: -// -// pattern: -// { term } -// term: -// '*' matches any sequence of non-path-separators -// '**' matches any sequence of characters, including -// path separators. -// '?' matches any single non-path-separator character -// '[' [ '^' ] { character-range } ']' -// character class (must be non-empty) -// '{' { term } [ ',' { term } ... ] '}' -// c matches character c (c != '*', '?', '\\', '[') -// '\\' c matches character c -// -// character-range: -// c matches character c (c != '\\', '-', ']') -// '\\' c matches character c -// lo '-' hi matches character c for lo <= c <= hi -// -// Match requires pattern to match all of name, not just a substring. -// The path-separator defaults to the '/' character. The only possible -// returned error is ErrBadPattern, when pattern is malformed. -// -// Note: this is meant as a drop-in replacement for path.Match() which -// always uses '/' as the path separator. If you want to support systems -// which use a different path separator (such as Windows), what you want -// is the PathMatch() function below. -// -func Match(pattern, name string) (bool, error) { - return matchWithSeparator(pattern, name, '/') -} - -// PathMatch is like Match except that it uses your system's path separator. -// For most systems, this will be '/'. However, for Windows, it would be '\\'. -// Note that for systems where the path separator is '\\', escaping is -// disabled. -// -// Note: this is meant as a drop-in replacement for filepath.Match(). -// -func PathMatch(pattern, name string) (bool, error) { - return matchWithSeparator(pattern, name, os.PathSeparator) -} - -// Match returns true if name matches the shell file name pattern. -// The pattern syntax is: -// -// pattern: -// { term } -// term: -// '*' matches any sequence of non-path-separators -// '**' matches any sequence of characters, including -// path separators. -// '?' matches any single non-path-separator character -// '[' [ '^' ] { character-range } ']' -// character class (must be non-empty) -// '{' { term } [ ',' { term } ... ] '}' -// c matches character c (c != '*', '?', '\\', '[') -// '\\' c matches character c -// -// character-range: -// c matches character c (c != '\\', '-', ']') -// '\\' c matches character c, unless separator is '\\' -// lo '-' hi matches character c for lo <= c <= hi -// -// Match requires pattern to match all of name, not just a substring. -// The only possible returned error is ErrBadPattern, when pattern -// is malformed. -// -func matchWithSeparator(pattern, name string, separator rune) (bool, error) { - patternComponents := splitPathOnSeparator(pattern, separator) - nameComponents := splitPathOnSeparator(name, separator) - return doMatching(patternComponents, nameComponents) -} - -func doMatching(patternComponents, nameComponents []string) (matched bool, err error) { - // check for some base-cases - patternLen, nameLen := len(patternComponents), len(nameComponents) - if patternLen == 0 && nameLen == 0 { - return true, nil - } - if patternLen == 0 || nameLen == 0 { - return false, nil - } - - patIdx, nameIdx := 0, 0 - for patIdx < patternLen && nameIdx < nameLen { - if patternComponents[patIdx] == "**" { - // if our last pattern component is a doublestar, we're done - - // doublestar will match any remaining name components, if any. - if patIdx++; patIdx >= patternLen { - return true, nil - } - - // otherwise, try matching remaining components - for ; nameIdx < nameLen; nameIdx++ { - if m, _ := doMatching(patternComponents[patIdx:], nameComponents[nameIdx:]); m { - return true, nil - } - } - return false, nil - } - - // try matching components - matched, err = matchComponent(patternComponents[patIdx], nameComponents[nameIdx]) - if !matched || err != nil { - return - } - - patIdx++ - nameIdx++ - } - return patIdx >= patternLen && nameIdx >= nameLen, nil -} - -// Glob returns the names of all files matching pattern or nil -// if there is no matching file. The syntax of pattern is the same -// as in Match. The pattern may describe hierarchical names such as -// /usr/*/bin/ed (assuming the Separator is '/'). -// -// Glob ignores file system errors such as I/O errors reading directories. -// The only possible returned error is ErrBadPattern, when pattern -// is malformed. -// -// Your system path separator is automatically used. This means on -// systems where the separator is '\\' (Windows), escaping will be -// disabled. -// -// Note: this is meant as a drop-in replacement for filepath.Glob(). -// -func Glob(pattern string) (matches []string, err error) { - patternComponents := splitPathOnSeparator(filepath.ToSlash(pattern), '/') - if len(patternComponents) == 0 { - return nil, nil - } - - // On Windows systems, this will return the drive name ('C:') for filesystem - // paths, or \\\ for UNC paths. On other systems, it will - // return an empty string. Since absolute paths on non-Windows systems start - // with a slash, patternComponent[0] == volumeName will return true for both - // absolute Windows paths and absolute non-Windows paths, but we need a - // separate check for UNC paths. - volumeName := filepath.VolumeName(pattern) - isWindowsUNC := strings.HasPrefix(pattern, `\\`) - if isWindowsUNC || patternComponents[0] == volumeName { - startComponentIndex := 1 - if isWindowsUNC { - startComponentIndex = 4 - } - return doGlob(fmt.Sprintf("%s%s", volumeName, string(os.PathSeparator)), patternComponents[startComponentIndex:], matches) - } - - // otherwise, it's a relative pattern - return doGlob(".", patternComponents, matches) -} - -// Perform a glob -func doGlob(basedir string, components, matches []string) (m []string, e error) { - m = matches - e = nil - - // figure out how many components we don't need to glob because they're - // just names without patterns - we'll use os.Lstat below to check if that - // path actually exists - patLen := len(components) - patIdx := 0 - for ; patIdx < patLen; patIdx++ { - if strings.IndexAny(components[patIdx], "*?[{\\") >= 0 { - break - } - } - if patIdx > 0 { - basedir = filepath.Join(basedir, filepath.Join(components[0:patIdx]...)) - } - - // Lstat will return an error if the file/directory doesn't exist - fi, err := os.Lstat(basedir) - if err != nil { - return - } - - // if there are no more components, we've found a match - if patIdx >= patLen { - m = append(m, basedir) - return - } - - // otherwise, we need to check each item in the directory... - // first, if basedir is a symlink, follow it... - if (fi.Mode() & os.ModeSymlink) != 0 { - fi, err = os.Stat(basedir) - if err != nil { - return - } - } - - // confirm it's a directory... - if !fi.IsDir() { - return - } - - // read directory - dir, err := os.Open(basedir) - if err != nil { - return - } - defer dir.Close() - - files, _ := dir.Readdir(-1) - lastComponent := (patIdx + 1) >= patLen - if components[patIdx] == "**" { - // if the current component is a doublestar, we'll try depth-first - for _, file := range files { - // if symlink, we may want to follow - if (file.Mode() & os.ModeSymlink) != 0 { - file, err = os.Stat(filepath.Join(basedir, file.Name())) - if err != nil { - continue - } - } - - if file.IsDir() { - // recurse into directories - if lastComponent { - m = append(m, filepath.Join(basedir, file.Name())) - } - m, e = doGlob(filepath.Join(basedir, file.Name()), components[patIdx:], m) - } else if lastComponent { - // if the pattern's last component is a doublestar, we match filenames, too - m = append(m, filepath.Join(basedir, file.Name())) - } - } - if lastComponent { - return // we're done - } - patIdx++ - lastComponent = (patIdx + 1) >= patLen - } - - // check items in current directory and recurse - var match bool - for _, file := range files { - match, e = matchComponent(components[patIdx], file.Name()) - if e != nil { - return - } - if match { - if lastComponent { - m = append(m, filepath.Join(basedir, file.Name())) - } else { - m, e = doGlob(filepath.Join(basedir, file.Name()), components[patIdx+1:], m) - } - } - } - return -} - -// Attempt to match a single pattern component with a path component -func matchComponent(pattern, name string) (bool, error) { - // check some base cases - patternLen, nameLen := len(pattern), len(name) - if patternLen == 0 && nameLen == 0 { - return true, nil - } - if patternLen == 0 { - return false, nil - } - if nameLen == 0 && pattern != "*" { - return false, nil - } - - // check for matches one rune at a time - patIdx, nameIdx := 0, 0 - for patIdx < patternLen && nameIdx < nameLen { - patRune, patAdj := utf8.DecodeRuneInString(pattern[patIdx:]) - nameRune, nameAdj := utf8.DecodeRuneInString(name[nameIdx:]) - if patRune == '\\' { - // handle escaped runes - patIdx += patAdj - patRune, patAdj = utf8.DecodeRuneInString(pattern[patIdx:]) - if patRune == utf8.RuneError { - return false, ErrBadPattern - } else if patRune == nameRune { - patIdx += patAdj - nameIdx += nameAdj - } else { - return false, nil - } - } else if patRune == '*' { - // handle stars - if patIdx += patAdj; patIdx >= patternLen { - // a star at the end of a pattern will always - // match the rest of the path - return true, nil - } - - // check if we can make any matches - for ; nameIdx < nameLen; nameIdx += nameAdj { - if m, _ := matchComponent(pattern[patIdx:], name[nameIdx:]); m { - return true, nil - } - } - return false, nil - } else if patRune == '[' { - // handle character sets - patIdx += patAdj - endClass := indexRuneWithEscaping(pattern[patIdx:], ']') - if endClass == -1 { - return false, ErrBadPattern - } - endClass += patIdx - classRunes := []rune(pattern[patIdx:endClass]) - classRunesLen := len(classRunes) - if classRunesLen > 0 { - classIdx := 0 - matchClass := false - if classRunes[0] == '^' { - classIdx++ - } - for classIdx < classRunesLen { - low := classRunes[classIdx] - if low == '-' { - return false, ErrBadPattern - } - classIdx++ - if low == '\\' { - if classIdx < classRunesLen { - low = classRunes[classIdx] - classIdx++ - } else { - return false, ErrBadPattern - } - } - high := low - if classIdx < classRunesLen && classRunes[classIdx] == '-' { - // we have a range of runes - if classIdx++; classIdx >= classRunesLen { - return false, ErrBadPattern - } - high = classRunes[classIdx] - if high == '-' { - return false, ErrBadPattern - } - classIdx++ - if high == '\\' { - if classIdx < classRunesLen { - high = classRunes[classIdx] - classIdx++ - } else { - return false, ErrBadPattern - } - } - } - if low <= nameRune && nameRune <= high { - matchClass = true - } - } - if matchClass == (classRunes[0] == '^') { - return false, nil - } - } else { - return false, ErrBadPattern - } - patIdx = endClass + 1 - nameIdx += nameAdj - } else if patRune == '{' { - // handle alternatives such as {alt1,alt2,...} - patIdx += patAdj - endOptions := indexRuneWithEscaping(pattern[patIdx:], '}') - if endOptions == -1 { - return false, ErrBadPattern - } - endOptions += patIdx - options := splitPathOnSeparator(pattern[patIdx:endOptions], ',') - patIdx = endOptions + 1 - for _, o := range options { - m, e := matchComponent(o+pattern[patIdx:], name[nameIdx:]) - if e != nil { - return false, e - } - if m { - return true, nil - } - } - return false, nil - } else if patRune == '?' || patRune == nameRune { - // handle single-rune wildcard - patIdx += patAdj - nameIdx += nameAdj - } else { - return false, nil - } - } - if patIdx >= patternLen && nameIdx >= nameLen { - return true, nil - } - if nameIdx >= nameLen && pattern[patIdx:] == "*" || pattern[patIdx:] == "**" { - return true, nil - } - return false, nil -} diff --git a/vendor/github.com/bmatcuk/doublestar/go.mod b/vendor/github.com/bmatcuk/doublestar/go.mod deleted file mode 100644 index ce1688f73..000000000 --- a/vendor/github.com/bmatcuk/doublestar/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/bmatcuk/doublestar - -go 1.12 diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go b/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go index 24fbae6e3..938f646f0 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go @@ -19,7 +19,7 @@ func SortKeys(vs []reflect.Value) []reflect.Value { } // Sort the map keys. - sort.SliceStable(vs, func(i, j int) bool { return isLess(vs[i], vs[j]) }) + sort.Slice(vs, func(i, j int) bool { return isLess(vs[i], vs[j]) }) // Deduplicate keys (fails for NaNs). vs2 := vs[:1] @@ -42,8 +42,6 @@ func isLess(x, y reflect.Value) bool { case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: return x.Uint() < y.Uint() case reflect.Float32, reflect.Float64: - // NOTE: This does not sort -0 as less than +0 - // since Go maps treat -0 and +0 as equal keys. fx, fy := x.Float(), y.Float() return fx < fy || math.IsNaN(fx) && !math.IsNaN(fy) case reflect.Complex64, reflect.Complex128: diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go b/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go index 06a8ffd03..d13a12ccf 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go @@ -4,10 +4,7 @@ package value -import ( - "math" - "reflect" -) +import "reflect" // IsZero reports whether v is the zero value. // This does not rely on Interface and so can be used on unexported fields. @@ -20,9 +17,9 @@ func IsZero(v reflect.Value) bool { case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: return v.Uint() == 0 case reflect.Float32, reflect.Float64: - return math.Float64bits(v.Float()) == 0 + return v.Float() == 0 case reflect.Complex64, reflect.Complex128: - return math.Float64bits(real(v.Complex())) == 0 && math.Float64bits(imag(v.Complex())) == 0 + return v.Complex() == 0 case reflect.String: return v.String() == "" case reflect.UnsafePointer: diff --git a/vendor/github.com/google/go-cmp/cmp/report_compare.go b/vendor/github.com/google/go-cmp/cmp/report_compare.go index 17a05eede..05efb992c 100644 --- a/vendor/github.com/google/go-cmp/cmp/report_compare.go +++ b/vendor/github.com/google/go-cmp/cmp/report_compare.go @@ -168,7 +168,7 @@ func (opts formatOptions) formatDiffList(recs []reportRecord, k reflect.Kind) te var isZero bool switch opts.DiffMode { case diffIdentical: - isZero = value.IsZero(r.Value.ValueX) || value.IsZero(r.Value.ValueY) + isZero = value.IsZero(r.Value.ValueX) || value.IsZero(r.Value.ValueX) case diffRemoved: isZero = value.IsZero(r.Value.ValueX) case diffInserted: diff --git a/vendor/github.com/google/go-cmp/cmp/report_reflect.go b/vendor/github.com/google/go-cmp/cmp/report_reflect.go index 2761b6289..5521c604c 100644 --- a/vendor/github.com/google/go-cmp/cmp/report_reflect.go +++ b/vendor/github.com/google/go-cmp/cmp/report_reflect.go @@ -208,6 +208,7 @@ func (opts formatOptions) FormatValue(v reflect.Value, m visitedPointers) (out t func formatMapKey(v reflect.Value) string { var opts formatOptions opts.TypeMode = elideType + opts.AvoidStringer = true opts.ShallowPointers = true s := opts.FormatValue(v, visitedPointers{}).String() return strings.TrimSpace(s) diff --git a/vendor/github.com/google/go-cmp/cmp/report_slices.go b/vendor/github.com/google/go-cmp/cmp/report_slices.go index eafcf2e4c..8cb3265e7 100644 --- a/vendor/github.com/google/go-cmp/cmp/report_slices.go +++ b/vendor/github.com/google/go-cmp/cmp/report_slices.go @@ -90,7 +90,7 @@ func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode { } if r == '\n' { if maxLineLen < i-lastLineIdx { - maxLineLen = i - lastLineIdx + lastLineIdx = i - lastLineIdx } lastLineIdx = i + 1 numLines++ @@ -322,7 +322,7 @@ func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStat hadX, hadY := prev.NumRemoved > 0, prev.NumInserted > 0 hasX, hasY := next.NumRemoved > 0, next.NumInserted > 0 if ((hadX || hasX) && (hadY || hasY)) && curr.NumIdentical <= windowSize { - *prev = prev.Append(*curr).Append(*next) + *prev = (*prev).Append(*curr).Append(*next) groups = groups[:len(groups)-1] // Truncate off equal group continue } diff --git a/vendor/github.com/google/go-cmp/cmp/report_text.go b/vendor/github.com/google/go-cmp/cmp/report_text.go index 8b8fcab7b..80605d0e4 100644 --- a/vendor/github.com/google/go-cmp/cmp/report_text.go +++ b/vendor/github.com/google/go-cmp/cmp/report_text.go @@ -19,11 +19,6 @@ var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0 type indentMode int func (n indentMode) appendIndent(b []byte, d diffMode) []byte { - // The output of Diff is documented as being unstable to provide future - // flexibility in changing the output for more humanly readable reports. - // This logic intentionally introduces instability to the exact output - // so that users can detect accidental reliance on stability early on, - // rather than much later when an actual change to the format occurs. if flags.Deterministic || randBool { // Use regular spaces (U+0020). switch d { @@ -365,7 +360,7 @@ func (s diffStats) String() string { // Pluralize the name (adjusting for some obscure English grammar rules). name := s.Name if sum > 1 { - name += "s" + name = name + "s" if strings.HasSuffix(name, "ys") { name = name[:len(name)-2] + "ies" // e.g., "entrys" => "entries" } diff --git a/vendor/github.com/hashicorp/go-hclog/README.md b/vendor/github.com/hashicorp/go-hclog/README.md index 1153e2853..9b6845e98 100644 --- a/vendor/github.com/hashicorp/go-hclog/README.md +++ b/vendor/github.com/hashicorp/go-hclog/README.md @@ -128,6 +128,21 @@ stdLogger.Printf("[DEBUG] %+v", stdLogger) ... [DEBUG] my-app: &{mu:{state:0 sema:0} prefix: flag:0 out:0xc42000a0a0 buf:[]} ``` +Alternatively, you may configure the system-wide logger: + +```go +// log the standard logger from 'import "log"' +log.SetOutput(appLogger.Writer(&hclog.StandardLoggerOptions{InferLevels: true})) +log.SetPrefix("") +log.SetFlags(0) + +log.Printf("[DEBUG] %d", 42) +``` + +```text +... [DEBUG] my-app: 42 +``` + Notice that if `appLogger` is initialized with the `INFO` log level _and_ you specify `InferLevels: true`, you will not see any output here. You must change `appLogger` to `DEBUG` to see output. See the docs for more information. diff --git a/vendor/github.com/hashicorp/go-hclog/context.go b/vendor/github.com/hashicorp/go-hclog/context.go new file mode 100644 index 000000000..7815f5019 --- /dev/null +++ b/vendor/github.com/hashicorp/go-hclog/context.go @@ -0,0 +1,38 @@ +package hclog + +import ( + "context" +) + +// WithContext inserts a logger into the context and is retrievable +// with FromContext. The optional args can be set with the same syntax as +// Logger.With to set fields on the inserted logger. This will not modify +// the logger argument in-place. +func WithContext(ctx context.Context, logger Logger, args ...interface{}) context.Context { + // While we could call logger.With even with zero args, we have this + // check to avoid unnecessary allocations around creating a copy of a + // logger. + if len(args) > 0 { + logger = logger.With(args...) + } + + return context.WithValue(ctx, contextKey, logger) +} + +// FromContext returns a logger from the context. This will return L() +// (the default logger) if no logger is found in the context. Therefore, +// this will never return a nil value. +func FromContext(ctx context.Context) Logger { + logger, _ := ctx.Value(contextKey).(Logger) + if logger == nil { + return L() + } + + return logger +} + +// Unexported new type so that our context key never collides with another. +type contextKeyType struct{} + +// contextKey is the key used for the context to store the logger. +var contextKey = contextKeyType{} diff --git a/vendor/github.com/hashicorp/go-hclog/global.go b/vendor/github.com/hashicorp/go-hclog/global.go index 55ce43960..3efc54c12 100644 --- a/vendor/github.com/hashicorp/go-hclog/global.go +++ b/vendor/github.com/hashicorp/go-hclog/global.go @@ -8,27 +8,41 @@ var ( protect sync.Once def Logger - // The options used to create the Default logger. These are - // read only when the Default logger is created, so set them - // as soon as the process starts. + // DefaultOptions is used to create the Default logger. These are read + // only when the Default logger is created, so set them as soon as the + // process starts. DefaultOptions = &LoggerOptions{ Level: DefaultLevel, Output: DefaultOutput, } ) -// Return a logger that is held globally. This can be a good starting +// Default returns a globally held logger. This can be a good starting // place, and then you can use .With() and .Name() to create sub-loggers // to be used in more specific contexts. func Default() Logger { protect.Do(func() { - def = New(DefaultOptions) + // If SetDefault was used before Default() was called, we need to + // detect that here. + if def == nil { + def = New(DefaultOptions) + } }) return def } -// A short alias for Default() +// L is a short alias for Default(). func L() Logger { return Default() } + +// SetDefault changes the logger to be returned by Default()and L() +// to the one given. This allows packages to use the default logger +// and have higher level packages change it to match the execution +// environment. It returns any old default if there is one. +func SetDefault(log Logger) Logger { + old := def + def = log + return old +} diff --git a/vendor/github.com/hashicorp/go-hclog/int.go b/vendor/github.com/hashicorp/go-hclog/intlogger.go similarity index 62% rename from vendor/github.com/hashicorp/go-hclog/int.go rename to vendor/github.com/hashicorp/go-hclog/intlogger.go index 2aaa1f895..219656c4c 100644 --- a/vendor/github.com/hashicorp/go-hclog/int.go +++ b/vendor/github.com/hashicorp/go-hclog/intlogger.go @@ -1,13 +1,12 @@ package hclog import ( - "bufio" "bytes" "encoding" "encoding/json" "fmt" + "io" "log" - "os" "reflect" "runtime" "sort" @@ -18,6 +17,13 @@ import ( "time" ) +// TimeFormat to use for logging. This is a version of RFC3339 that contains +// contains millisecond precision +const TimeFormat = "2006-01-02T15:04:05.000Z0700" + +// errJsonUnsupportedTypeMsg is included in log json entries, if an arg cannot be serialized to json +const errJsonUnsupportedTypeMsg = "logging contained values that don't serialize to json" + var ( _levelToBracket = map[Level]string{ Debug: "[DEBUG]", @@ -28,7 +34,27 @@ var ( } ) -// Given the options (nil for defaults), create a new Logger +// Make sure that intLogger is a Logger +var _ Logger = &intLogger{} + +// intLogger is an internal logger implementation. Internal in that it is +// defined entirely by this package. +type intLogger struct { + json bool + caller bool + name string + timeFormat string + + // This is a pointer so that it's shared by any derived loggers, since + // those derived loggers share the bufio.Writer as well. + mutex *sync.Mutex + writer *writer + level *int32 + + implied []interface{} +} + +// New returns a configured logger. func New(opts *LoggerOptions) Logger { if opts == nil { opts = &LoggerOptions{} @@ -36,7 +62,7 @@ func New(opts *LoggerOptions) Logger { output := opts.Output if output == nil { - output = os.Stderr + output = DefaultOutput } level := opts.Level @@ -44,70 +70,49 @@ func New(opts *LoggerOptions) Logger { level = DefaultLevel } - mtx := opts.Mutex - if mtx == nil { - mtx = new(sync.Mutex) + mutex := opts.Mutex + if mutex == nil { + mutex = new(sync.Mutex) } - ret := &intLogger{ - m: mtx, + l := &intLogger{ json: opts.JSONFormat, caller: opts.IncludeLocation, name: opts.Name, timeFormat: TimeFormat, - w: bufio.NewWriter(output), + mutex: mutex, + writer: newWriter(output), level: new(int32), } + if opts.TimeFormat != "" { - ret.timeFormat = opts.TimeFormat + l.timeFormat = opts.TimeFormat } - atomic.StoreInt32(ret.level, int32(level)) - return ret -} -// The internal logger implementation. Internal in that it is defined entirely -// by this package. -type intLogger struct { - json bool - caller bool - name string - timeFormat string + atomic.StoreInt32(l.level, int32(level)) - // this is a pointer so that it's shared by any derived loggers, since - // those derived loggers share the bufio.Writer as well. - m *sync.Mutex - w *bufio.Writer - level *int32 - - implied []interface{} + return l } -// Make sure that intLogger is a Logger -var _ Logger = &intLogger{} - -// The time format to use for logging. This is a version of RFC3339 that -// contains millisecond precision -const TimeFormat = "2006-01-02T15:04:05.000Z0700" - // Log a message and a set of key/value pairs if the given level is at // or more severe that the threshold configured in the Logger. -func (z *intLogger) Log(level Level, msg string, args ...interface{}) { - if level < Level(atomic.LoadInt32(z.level)) { +func (l *intLogger) Log(level Level, msg string, args ...interface{}) { + if level < Level(atomic.LoadInt32(l.level)) { return } t := time.Now() - z.m.Lock() - defer z.m.Unlock() + l.mutex.Lock() + defer l.mutex.Unlock() - if z.json { - z.logJson(t, level, msg, args...) + if l.json { + l.logJSON(t, level, msg, args...) } else { - z.log(t, level, msg, args...) + l.log(t, level, msg, args...) } - z.w.Flush() + l.writer.Flush(level) } // Cleanup a path by returning the last 2 segments of the path only. @@ -123,10 +128,8 @@ func trimCallerPath(path string) string { // and https://github.com/golang/go/issues/18151 // // for discussion on the issue on Go side. - // // Find the last separator. - // idx := strings.LastIndexByte(path, '/') if idx == -1 { return path @@ -142,37 +145,37 @@ func trimCallerPath(path string) string { } // Non-JSON logging format function -func (z *intLogger) log(t time.Time, level Level, msg string, args ...interface{}) { - z.w.WriteString(t.Format(z.timeFormat)) - z.w.WriteByte(' ') +func (l *intLogger) log(t time.Time, level Level, msg string, args ...interface{}) { + l.writer.WriteString(t.Format(l.timeFormat)) + l.writer.WriteByte(' ') s, ok := _levelToBracket[level] if ok { - z.w.WriteString(s) + l.writer.WriteString(s) } else { - z.w.WriteString("[?????]") + l.writer.WriteString("[?????]") } - if z.caller { + if l.caller { if _, file, line, ok := runtime.Caller(3); ok { - z.w.WriteByte(' ') - z.w.WriteString(trimCallerPath(file)) - z.w.WriteByte(':') - z.w.WriteString(strconv.Itoa(line)) - z.w.WriteByte(':') + l.writer.WriteByte(' ') + l.writer.WriteString(trimCallerPath(file)) + l.writer.WriteByte(':') + l.writer.WriteString(strconv.Itoa(line)) + l.writer.WriteByte(':') } } - z.w.WriteByte(' ') + l.writer.WriteByte(' ') - if z.name != "" { - z.w.WriteString(z.name) - z.w.WriteString(": ") + if l.name != "" { + l.writer.WriteString(l.name) + l.writer.WriteString(": ") } - z.w.WriteString(msg) + l.writer.WriteString(msg) - args = append(z.implied, args...) + args = append(l.implied, args...) var stacktrace CapturedStacktrace @@ -187,7 +190,7 @@ func (z *intLogger) log(t time.Time, level Level, msg string, args ...interface{ } } - z.w.WriteByte(':') + l.writer.WriteByte(':') FOR: for i := 0; i < len(args); i = i + 2 { @@ -227,35 +230,35 @@ func (z *intLogger) log(t time.Time, level Level, msg string, args ...interface{ default: v := reflect.ValueOf(st) if v.Kind() == reflect.Slice { - val = z.renderSlice(v) + val = l.renderSlice(v) raw = true } else { val = fmt.Sprintf("%v", st) } } - z.w.WriteByte(' ') - z.w.WriteString(args[i].(string)) - z.w.WriteByte('=') + l.writer.WriteByte(' ') + l.writer.WriteString(args[i].(string)) + l.writer.WriteByte('=') if !raw && strings.ContainsAny(val, " \t\n\r") { - z.w.WriteByte('"') - z.w.WriteString(val) - z.w.WriteByte('"') + l.writer.WriteByte('"') + l.writer.WriteString(val) + l.writer.WriteByte('"') } else { - z.w.WriteString(val) + l.writer.WriteString(val) } } } - z.w.WriteString("\n") + l.writer.WriteString("\n") if stacktrace != "" { - z.w.WriteString(string(stacktrace)) + l.writer.WriteString(string(stacktrace)) } } -func (z *intLogger) renderSlice(v reflect.Value) string { +func (l *intLogger) renderSlice(v reflect.Value) string { var buf bytes.Buffer buf.WriteRune('[') @@ -295,41 +298,9 @@ func (z *intLogger) renderSlice(v reflect.Value) string { } // JSON logging function -func (z *intLogger) logJson(t time.Time, level Level, msg string, args ...interface{}) { - vals := map[string]interface{}{ - "@message": msg, - "@timestamp": t.Format("2006-01-02T15:04:05.000000Z07:00"), - } - - var levelStr string - switch level { - case Error: - levelStr = "error" - case Warn: - levelStr = "warn" - case Info: - levelStr = "info" - case Debug: - levelStr = "debug" - case Trace: - levelStr = "trace" - default: - levelStr = "all" - } - - vals["@level"] = levelStr - - if z.name != "" { - vals["@module"] = z.name - } - - if z.caller { - if _, file, line, ok := runtime.Caller(3); ok { - vals["@caller"] = fmt.Sprintf("%s:%d", file, line) - } - } - - args = append(z.implied, args...) +func (l *intLogger) logJSON(t time.Time, level Level, msg string, args ...interface{}) { + vals := l.jsonMapEntry(t, level, msg) + args = append(l.implied, args...) if args != nil && len(args) > 0 { if len(args)%2 != 0 { @@ -367,80 +338,121 @@ func (z *intLogger) logJson(t time.Time, level Level, msg string, args ...interf } } - err := json.NewEncoder(z.w).Encode(vals) + err := json.NewEncoder(l.writer).Encode(vals) if err != nil { - panic(err) + if _, ok := err.(*json.UnsupportedTypeError); ok { + plainVal := l.jsonMapEntry(t, level, msg) + plainVal["@warn"] = errJsonUnsupportedTypeMsg + + json.NewEncoder(l.writer).Encode(plainVal) + } + } +} + +func (l intLogger) jsonMapEntry(t time.Time, level Level, msg string) map[string]interface{} { + vals := map[string]interface{}{ + "@message": msg, + "@timestamp": t.Format("2006-01-02T15:04:05.000000Z07:00"), + } + + var levelStr string + switch level { + case Error: + levelStr = "error" + case Warn: + levelStr = "warn" + case Info: + levelStr = "info" + case Debug: + levelStr = "debug" + case Trace: + levelStr = "trace" + default: + levelStr = "all" + } + + vals["@level"] = levelStr + + if l.name != "" { + vals["@module"] = l.name + } + + if l.caller { + if _, file, line, ok := runtime.Caller(4); ok { + vals["@caller"] = fmt.Sprintf("%s:%d", file, line) + } } + return vals } // Emit the message and args at DEBUG level -func (z *intLogger) Debug(msg string, args ...interface{}) { - z.Log(Debug, msg, args...) +func (l *intLogger) Debug(msg string, args ...interface{}) { + l.Log(Debug, msg, args...) } // Emit the message and args at TRACE level -func (z *intLogger) Trace(msg string, args ...interface{}) { - z.Log(Trace, msg, args...) +func (l *intLogger) Trace(msg string, args ...interface{}) { + l.Log(Trace, msg, args...) } // Emit the message and args at INFO level -func (z *intLogger) Info(msg string, args ...interface{}) { - z.Log(Info, msg, args...) +func (l *intLogger) Info(msg string, args ...interface{}) { + l.Log(Info, msg, args...) } // Emit the message and args at WARN level -func (z *intLogger) Warn(msg string, args ...interface{}) { - z.Log(Warn, msg, args...) +func (l *intLogger) Warn(msg string, args ...interface{}) { + l.Log(Warn, msg, args...) } // Emit the message and args at ERROR level -func (z *intLogger) Error(msg string, args ...interface{}) { - z.Log(Error, msg, args...) +func (l *intLogger) Error(msg string, args ...interface{}) { + l.Log(Error, msg, args...) } // Indicate that the logger would emit TRACE level logs -func (z *intLogger) IsTrace() bool { - return Level(atomic.LoadInt32(z.level)) == Trace +func (l *intLogger) IsTrace() bool { + return Level(atomic.LoadInt32(l.level)) == Trace } // Indicate that the logger would emit DEBUG level logs -func (z *intLogger) IsDebug() bool { - return Level(atomic.LoadInt32(z.level)) <= Debug +func (l *intLogger) IsDebug() bool { + return Level(atomic.LoadInt32(l.level)) <= Debug } // Indicate that the logger would emit INFO level logs -func (z *intLogger) IsInfo() bool { - return Level(atomic.LoadInt32(z.level)) <= Info +func (l *intLogger) IsInfo() bool { + return Level(atomic.LoadInt32(l.level)) <= Info } // Indicate that the logger would emit WARN level logs -func (z *intLogger) IsWarn() bool { - return Level(atomic.LoadInt32(z.level)) <= Warn +func (l *intLogger) IsWarn() bool { + return Level(atomic.LoadInt32(l.level)) <= Warn } // Indicate that the logger would emit ERROR level logs -func (z *intLogger) IsError() bool { - return Level(atomic.LoadInt32(z.level)) <= Error +func (l *intLogger) IsError() bool { + return Level(atomic.LoadInt32(l.level)) <= Error } // Return a sub-Logger for which every emitted log message will contain // the given key/value pairs. This is used to create a context specific // Logger. -func (z *intLogger) With(args ...interface{}) Logger { +func (l *intLogger) With(args ...interface{}) Logger { if len(args)%2 != 0 { panic("With() call requires paired arguments") } - var nz intLogger = *z + sl := *l - result := make(map[string]interface{}, len(z.implied)+len(args)) - keys := make([]string, 0, len(z.implied)+len(args)) + result := make(map[string]interface{}, len(l.implied)+len(args)) + keys := make([]string, 0, len(l.implied)+len(args)) // Read existing args, store map and key for consistent sorting - for i := 0; i < len(z.implied); i += 2 { - key := z.implied[i].(string) + for i := 0; i < len(l.implied); i += 2 { + key := l.implied[i].(string) keys = append(keys, key) - result[key] = z.implied[i+1] + result[key] = l.implied[i+1] } // Read new args, store map and key for consistent sorting for i := 0; i < len(args); i += 2 { @@ -455,53 +467,61 @@ func (z *intLogger) With(args ...interface{}) Logger { // Sort keys to be consistent sort.Strings(keys) - nz.implied = make([]interface{}, 0, len(z.implied)+len(args)) + sl.implied = make([]interface{}, 0, len(l.implied)+len(args)) for _, k := range keys { - nz.implied = append(nz.implied, k) - nz.implied = append(nz.implied, result[k]) + sl.implied = append(sl.implied, k) + sl.implied = append(sl.implied, result[k]) } - return &nz + return &sl } // Create a new sub-Logger that a name decending from the current name. // This is used to create a subsystem specific Logger. -func (z *intLogger) Named(name string) Logger { - var nz intLogger = *z +func (l *intLogger) Named(name string) Logger { + sl := *l - if nz.name != "" { - nz.name = nz.name + "." + name + if sl.name != "" { + sl.name = sl.name + "." + name } else { - nz.name = name + sl.name = name } - return &nz + return &sl } // Create a new sub-Logger with an explicit name. This ignores the current // name. This is used to create a standalone logger that doesn't fall // within the normal hierarchy. -func (z *intLogger) ResetNamed(name string) Logger { - var nz intLogger = *z +func (l *intLogger) ResetNamed(name string) Logger { + sl := *l - nz.name = name + sl.name = name - return &nz + return &sl } // Update the logging level on-the-fly. This will affect all subloggers as // well. -func (z *intLogger) SetLevel(level Level) { - atomic.StoreInt32(z.level, int32(level)) +func (l *intLogger) SetLevel(level Level) { + atomic.StoreInt32(l.level, int32(level)) } // Create a *log.Logger that will send it's data through this Logger. This // allows packages that expect to be using the standard library log to actually // use this logger. -func (z *intLogger) StandardLogger(opts *StandardLoggerOptions) *log.Logger { +func (l *intLogger) StandardLogger(opts *StandardLoggerOptions) *log.Logger { if opts == nil { opts = &StandardLoggerOptions{} } - return log.New(&stdlogAdapter{z, opts.InferLevels}, "", 0) + return log.New(l.StandardWriter(opts), "", 0) +} + +func (l *intLogger) StandardWriter(opts *StandardLoggerOptions) io.Writer { + return &stdlogAdapter{ + log: l, + inferLevels: opts.InferLevels, + forceLevel: opts.ForceLevel, + } } diff --git a/vendor/github.com/hashicorp/go-hclog/log.go b/vendor/github.com/hashicorp/go-hclog/logger.go similarity index 73% rename from vendor/github.com/hashicorp/go-hclog/log.go rename to vendor/github.com/hashicorp/go-hclog/logger.go index d98714e0a..080ed7999 100644 --- a/vendor/github.com/hashicorp/go-hclog/log.go +++ b/vendor/github.com/hashicorp/go-hclog/logger.go @@ -9,38 +9,42 @@ import ( ) var ( - DefaultOutput = os.Stderr - DefaultLevel = Info + //DefaultOutput is used as the default log output. + DefaultOutput io.Writer = os.Stderr + + // DefaultLevel is used as the default log level. + DefaultLevel = Info ) +// Level represents a log level. type Level int32 const ( - // This is a special level used to indicate that no level has been + // NoLevel is a special level used to indicate that no level has been // set and allow for a default to be used. NoLevel Level = 0 - // The most verbose level. Intended to be used for the tracing of actions - // in code, such as function enters/exits, etc. + // Trace is the most verbose level. Intended to be used for the tracing + // of actions in code, such as function enters/exits, etc. Trace Level = 1 - // For programmer lowlevel analysis. + // Debug information for programmer lowlevel analysis. Debug Level = 2 - // For information about steady state operations. + // Info information about steady state operations. Info Level = 3 - // For information about rare but handled events. + // Warn information about rare but handled events. Warn Level = 4 - // For information about unrecoverable events. + // Error information about unrecoverable events. Error Level = 5 ) -// When processing a value of this type, the logger automatically treats the first -// argument as a Printf formatting string and passes the rest as the values to be -// formatted. For example: L.Info(Fmt{"%d beans/day", beans}). This is a simple -// convience type for when formatting is required. +// Format is a simple convience type for when formatting is required. When +// processing a value of this type, the logger automatically treats the first +// argument as a Printf formatting string and passes the rest as the values +// to be formatted. For example: L.Info(Fmt{"%d beans/day", beans}). type Format []interface{} // Fmt returns a Format type. This is a convience function for creating a Format @@ -53,7 +57,7 @@ func Fmt(str string, args ...interface{}) Format { // the level string is invalid. This facilitates setting the log level via // config or environment variable by name in a predictable way. func LevelFromString(levelStr string) Level { - // We don't care about case. Accept "INFO" or "info" + // We don't care about case. Accept both "INFO" and "info". levelStr = strings.ToLower(strings.TrimSpace(levelStr)) switch levelStr { case "trace": @@ -71,7 +75,7 @@ func LevelFromString(levelStr string) Level { } } -// The main Logger interface. All code should code against this interface only. +// Logger describes the interface that must be implemeted by all loggers. type Logger interface { // Args are alternating key, val pairs // keys must be strings @@ -127,16 +131,27 @@ type Logger interface { // Return a value that conforms to the stdlib log.Logger interface StandardLogger(opts *StandardLoggerOptions) *log.Logger + + // Return a value that conforms to io.Writer, which can be passed into log.SetOutput() + StandardWriter(opts *StandardLoggerOptions) io.Writer } +// StandardLoggerOptions can be used to configure a new standard logger. type StandardLoggerOptions struct { // Indicate that some minimal parsing should be done on strings to try // and detect their level and re-emit them. // This supports the strings like [ERROR], [ERR] [TRACE], [WARN], [INFO], // [DEBUG] and strip it off before reapplying it. InferLevels bool + + // ForceLevel is used to force all output from the standard logger to be at + // the specified level. Similar to InferLevels, this will strip any level + // prefix contained in the logged string before applying the forced level. + // If set, this override InferLevels. + ForceLevel Level } +// LoggerOptions can be used to configure a new logger. type LoggerOptions struct { // Name of the subsystem to prefix logs with Name string diff --git a/vendor/github.com/hashicorp/go-hclog/nulllogger.go b/vendor/github.com/hashicorp/go-hclog/nulllogger.go index 0942361a5..7ad6b351e 100644 --- a/vendor/github.com/hashicorp/go-hclog/nulllogger.go +++ b/vendor/github.com/hashicorp/go-hclog/nulllogger.go @@ -1,6 +1,7 @@ package hclog import ( + "io" "io/ioutil" "log" ) @@ -43,5 +44,9 @@ func (l *nullLogger) ResetNamed(name string) Logger { return l } func (l *nullLogger) SetLevel(level Level) {} func (l *nullLogger) StandardLogger(opts *StandardLoggerOptions) *log.Logger { - return log.New(ioutil.Discard, "", log.LstdFlags) + return log.New(l.StandardWriter(opts), "", log.LstdFlags) +} + +func (l *nullLogger) StandardWriter(opts *StandardLoggerOptions) io.Writer { + return ioutil.Discard } diff --git a/vendor/github.com/hashicorp/go-hclog/stacktrace.go b/vendor/github.com/hashicorp/go-hclog/stacktrace.go index 8af1a3be4..9b27bd3d3 100644 --- a/vendor/github.com/hashicorp/go-hclog/stacktrace.go +++ b/vendor/github.com/hashicorp/go-hclog/stacktrace.go @@ -40,12 +40,13 @@ var ( } ) -// A stacktrace gathered by a previous call to log.Stacktrace. If passed -// to a logging function, the stacktrace will be appended. +// CapturedStacktrace represents a stacktrace captured by a previous call +// to log.Stacktrace. If passed to a logging function, the stacktrace +// will be appended. type CapturedStacktrace string -// Gather a stacktrace of the current goroutine and return it to be passed -// to a logging function. +// Stacktrace captures a stacktrace of the current goroutine and returns +// it to be passed to a logging function. func Stacktrace() CapturedStacktrace { return CapturedStacktrace(takeStacktrace()) } diff --git a/vendor/github.com/hashicorp/go-hclog/stdlog.go b/vendor/github.com/hashicorp/go-hclog/stdlog.go index 2bb927fc9..044a46960 100644 --- a/vendor/github.com/hashicorp/go-hclog/stdlog.go +++ b/vendor/github.com/hashicorp/go-hclog/stdlog.go @@ -9,39 +9,60 @@ import ( // and back into our Logger. This is basically the only way to // build upon *log.Logger. type stdlogAdapter struct { - hl Logger + log Logger inferLevels bool + forceLevel Level } // Take the data, infer the levels if configured, and send it through -// a regular Logger +// a regular Logger. func (s *stdlogAdapter) Write(data []byte) (int, error) { str := string(bytes.TrimRight(data, " \t\n")) - if s.inferLevels { + if s.forceLevel != NoLevel { + // Use pickLevel to strip log levels included in the line since we are + // forcing the level + _, str := s.pickLevel(str) + + // Log at the forced level + switch s.forceLevel { + case Trace: + s.log.Trace(str) + case Debug: + s.log.Debug(str) + case Info: + s.log.Info(str) + case Warn: + s.log.Warn(str) + case Error: + s.log.Error(str) + default: + s.log.Info(str) + } + } else if s.inferLevels { level, str := s.pickLevel(str) switch level { case Trace: - s.hl.Trace(str) + s.log.Trace(str) case Debug: - s.hl.Debug(str) + s.log.Debug(str) case Info: - s.hl.Info(str) + s.log.Info(str) case Warn: - s.hl.Warn(str) + s.log.Warn(str) case Error: - s.hl.Error(str) + s.log.Error(str) default: - s.hl.Info(str) + s.log.Info(str) } } else { - s.hl.Info(str) + s.log.Info(str) } return len(data), nil } -// Detect, based on conventions, what log level this is +// Detect, based on conventions, what log level this is. func (s *stdlogAdapter) pickLevel(str string) (Level, string) { switch { case strings.HasPrefix(str, "[DEBUG]"): diff --git a/vendor/github.com/hashicorp/go-hclog/writer.go b/vendor/github.com/hashicorp/go-hclog/writer.go new file mode 100644 index 000000000..7e8ec729d --- /dev/null +++ b/vendor/github.com/hashicorp/go-hclog/writer.go @@ -0,0 +1,74 @@ +package hclog + +import ( + "bytes" + "io" +) + +type writer struct { + b bytes.Buffer + w io.Writer +} + +func newWriter(w io.Writer) *writer { + return &writer{w: w} +} + +func (w *writer) Flush(level Level) (err error) { + if lw, ok := w.w.(LevelWriter); ok { + _, err = lw.LevelWrite(level, w.b.Bytes()) + } else { + _, err = w.w.Write(w.b.Bytes()) + } + w.b.Reset() + return err +} + +func (w *writer) Write(p []byte) (int, error) { + return w.b.Write(p) +} + +func (w *writer) WriteByte(c byte) error { + return w.b.WriteByte(c) +} + +func (w *writer) WriteString(s string) (int, error) { + return w.b.WriteString(s) +} + +// LevelWriter is the interface that wraps the LevelWrite method. +type LevelWriter interface { + LevelWrite(level Level, p []byte) (n int, err error) +} + +// LeveledWriter writes all log messages to the standard writer, +// except for log levels that are defined in the overrides map. +type LeveledWriter struct { + standard io.Writer + overrides map[Level]io.Writer +} + +// NewLeveledWriter returns an initialized LeveledWriter. +// +// standard will be used as the default writer for all log levels, +// except for log levels that are defined in the overrides map. +func NewLeveledWriter(standard io.Writer, overrides map[Level]io.Writer) *LeveledWriter { + return &LeveledWriter{ + standard: standard, + overrides: overrides, + } +} + +// Write implements io.Writer. +func (lw *LeveledWriter) Write(p []byte) (int, error) { + return lw.standard.Write(p) +} + +// LevelWrite implements LevelWriter. +func (lw *LeveledWriter) LevelWrite(level Level, p []byte) (int, error) { + w, ok := lw.overrides[level] + if !ok { + w = lw.standard + } + return w.Write(p) +} diff --git a/vendor/github.com/hashicorp/go-plugin/.gitignore b/vendor/github.com/hashicorp/go-plugin/.gitignore index e43b0f988..4befed30a 100644 --- a/vendor/github.com/hashicorp/go-plugin/.gitignore +++ b/vendor/github.com/hashicorp/go-plugin/.gitignore @@ -1 +1,2 @@ .DS_Store +.idea diff --git a/vendor/github.com/hashicorp/go-plugin/grpc_client.go b/vendor/github.com/hashicorp/go-plugin/grpc_client.go index 294518ed9..d0d0d8e20 100644 --- a/vendor/github.com/hashicorp/go-plugin/grpc_client.go +++ b/vendor/github.com/hashicorp/go-plugin/grpc_client.go @@ -3,6 +3,7 @@ package plugin import ( "crypto/tls" "fmt" + "math" "net" "time" @@ -32,6 +33,11 @@ func dialGRPCConn(tls *tls.Config, dialer func(string, time.Duration) (net.Conn, credentials.NewTLS(tls))) } + opts = append(opts, + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxInt32)), + grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(math.MaxInt32))) + + // Connect. Note the first parameter is unused because we use a custom // dialer that has the state to see the address. conn, err := grpc.Dial("unused", opts...) diff --git a/vendor/github.com/hashicorp/hcl/.travis.yml b/vendor/github.com/hashicorp/hcl/.travis.yml index 3f83d9023..cb63a3216 100644 --- a/vendor/github.com/hashicorp/hcl/.travis.yml +++ b/vendor/github.com/hashicorp/hcl/.travis.yml @@ -3,7 +3,8 @@ sudo: false language: go go: - - 1.8 + - 1.x + - tip branches: only: diff --git a/vendor/github.com/hashicorp/hcl/decoder.go b/vendor/github.com/hashicorp/hcl/decoder.go index 0b39c1b95..bed9ebbe1 100644 --- a/vendor/github.com/hashicorp/hcl/decoder.go +++ b/vendor/github.com/hashicorp/hcl/decoder.go @@ -89,7 +89,7 @@ func (d *decoder) decode(name string, node ast.Node, result reflect.Value) error switch k.Kind() { case reflect.Bool: return d.decodeBool(name, node, result) - case reflect.Float64: + case reflect.Float32, reflect.Float64: return d.decodeFloat(name, node, result) case reflect.Int, reflect.Int32, reflect.Int64: return d.decodeInt(name, node, result) @@ -137,13 +137,13 @@ func (d *decoder) decodeBool(name string, node ast.Node, result reflect.Value) e func (d *decoder) decodeFloat(name string, node ast.Node, result reflect.Value) error { switch n := node.(type) { case *ast.LiteralType: - if n.Token.Type == token.FLOAT { + if n.Token.Type == token.FLOAT || n.Token.Type == token.NUMBER { v, err := strconv.ParseFloat(n.Token.Text, 64) if err != nil { return err } - result.Set(reflect.ValueOf(v)) + result.Set(reflect.ValueOf(v).Convert(result.Type())) return nil } } @@ -573,7 +573,11 @@ func (d *decoder) decodeStruct(name string, node ast.Node, result reflect.Value) // Compile the list of all the fields that we're going to be decoding // from all the structs. - fields := make(map[*reflect.StructField]reflect.Value) + type field struct { + field reflect.StructField + val reflect.Value + } + fields := []field{} for len(structs) > 0 { structVal := structs[0] structs = structs[1:] @@ -616,7 +620,7 @@ func (d *decoder) decodeStruct(name string, node ast.Node, result reflect.Value) } // Normal struct field, store it away - fields[&fieldType] = structVal.Field(i) + fields = append(fields, field{fieldType, structVal.Field(i)}) } } @@ -624,26 +628,27 @@ func (d *decoder) decodeStruct(name string, node ast.Node, result reflect.Value) decodedFields := make([]string, 0, len(fields)) decodedFieldsVal := make([]reflect.Value, 0) unusedKeysVal := make([]reflect.Value, 0) - for fieldType, field := range fields { - if !field.IsValid() { + for _, f := range fields { + field, fieldValue := f.field, f.val + if !fieldValue.IsValid() { // This should never happen panic("field is not valid") } // If we can't set the field, then it is unexported or something, // and we just continue onwards. - if !field.CanSet() { + if !fieldValue.CanSet() { continue } - fieldName := fieldType.Name + fieldName := field.Name - tagValue := fieldType.Tag.Get(tagName) + tagValue := field.Tag.Get(tagName) tagParts := strings.SplitN(tagValue, ",", 2) if len(tagParts) >= 2 { switch tagParts[1] { case "decodedFields": - decodedFieldsVal = append(decodedFieldsVal, field) + decodedFieldsVal = append(decodedFieldsVal, fieldValue) continue case "key": if item == nil { @@ -654,10 +659,10 @@ func (d *decoder) decodeStruct(name string, node ast.Node, result reflect.Value) } } - field.SetString(item.Keys[0].Token.Value().(string)) + fieldValue.SetString(item.Keys[0].Token.Value().(string)) continue case "unusedKeys": - unusedKeysVal = append(unusedKeysVal, field) + unusedKeysVal = append(unusedKeysVal, fieldValue) continue } } @@ -684,7 +689,7 @@ func (d *decoder) decodeStruct(name string, node ast.Node, result reflect.Value) // because we actually want the value. fieldName = fmt.Sprintf("%s.%s", name, fieldName) if len(prefixMatches.Items) > 0 { - if err := d.decode(fieldName, prefixMatches, field); err != nil { + if err := d.decode(fieldName, prefixMatches, fieldValue); err != nil { return err } } @@ -694,12 +699,12 @@ func (d *decoder) decodeStruct(name string, node ast.Node, result reflect.Value) decodeNode = &ast.ObjectList{Items: ot.List.Items} } - if err := d.decode(fieldName, decodeNode, field); err != nil { + if err := d.decode(fieldName, decodeNode, fieldValue); err != nil { return err } } - decodedFields = append(decodedFields, fieldType.Name) + decodedFields = append(decodedFields, field.Name) } if len(decodedFieldsVal) > 0 { diff --git a/vendor/github.com/hashicorp/hcl/go.mod b/vendor/github.com/hashicorp/hcl/go.mod new file mode 100644 index 000000000..4debbbe35 --- /dev/null +++ b/vendor/github.com/hashicorp/hcl/go.mod @@ -0,0 +1,3 @@ +module github.com/hashicorp/hcl + +require github.com/davecgh/go-spew v1.1.1 diff --git a/vendor/github.com/hashicorp/hcl/go.sum b/vendor/github.com/hashicorp/hcl/go.sum new file mode 100644 index 000000000..b5e2922e8 --- /dev/null +++ b/vendor/github.com/hashicorp/hcl/go.sum @@ -0,0 +1,2 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go b/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go index b4881806e..64c83bcfb 100644 --- a/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go +++ b/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go @@ -197,9 +197,18 @@ func (p *Parser) objectItem() (*ast.ObjectItem, error) { keyStr = append(keyStr, k.Token.Text) } - return nil, fmt.Errorf( - "key '%s' expected start of object ('{') or assignment ('=')", - strings.Join(keyStr, " ")) + return nil, &PosError{ + Pos: p.tok.Pos, + Err: fmt.Errorf( + "key '%s' expected start of object ('{') or assignment ('=')", + strings.Join(keyStr, " ")), + } + } + + // key=#comment + // val + if p.lineComment != nil { + o.LineComment, p.lineComment = p.lineComment, nil } // do a look-ahead for line comment @@ -319,7 +328,10 @@ func (p *Parser) objectType() (*ast.ObjectType, error) { // No error, scan and expect the ending to be a brace if tok := p.scan(); tok.Type != token.RBRACE { - return nil, fmt.Errorf("object expected closing RBRACE got: %s", tok.Type) + return nil, &PosError{ + Pos: tok.Pos, + Err: fmt.Errorf("object expected closing RBRACE got: %s", tok.Type), + } } o.List = l diff --git a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go b/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go index 69662367f..624a18fe3 100644 --- a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go +++ b/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go @@ -74,14 +74,6 @@ func (s *Scanner) next() rune { return eof } - if ch == utf8.RuneError && size == 1 { - s.srcPos.Column++ - s.srcPos.Offset += size - s.lastCharLen = size - s.err("illegal UTF-8 encoding") - return ch - } - // remember last position s.prevPos = s.srcPos @@ -89,18 +81,27 @@ func (s *Scanner) next() rune { s.lastCharLen = size s.srcPos.Offset += size + if ch == utf8.RuneError && size == 1 { + s.err("illegal UTF-8 encoding") + return ch + } + if ch == '\n' { s.srcPos.Line++ s.lastLineLen = s.srcPos.Column s.srcPos.Column = 0 } - // If we see a null character with data left, then that is an error - if ch == '\x00' && s.buf.Len() > 0 { + if ch == '\x00' { s.err("unexpected null character (0x00)") return eof } + if ch == '\uE123' { + s.err("unicode code point U+E123 reserved for internal use") + return utf8.RuneError + } + // debug // fmt.Printf("ch: %q, offset:column: %d:%d\n", ch, s.srcPos.Offset, s.srcPos.Column) return ch @@ -351,7 +352,7 @@ func (s *Scanner) scanNumber(ch rune) token.Type { return token.NUMBER } -// scanMantissa scans the mantissa begining from the rune. It returns the next +// scanMantissa scans the mantissa beginning from the rune. It returns the next // non decimal rune. It's used to determine wheter it's a fraction or exponent. func (s *Scanner) scanMantissa(ch rune) rune { scanned := false @@ -432,16 +433,16 @@ func (s *Scanner) scanHeredoc() { // Read the identifier identBytes := s.src[offs : s.srcPos.Offset-s.lastCharLen] - if len(identBytes) == 0 { + if len(identBytes) == 0 || (len(identBytes) == 1 && identBytes[0] == '-') { s.err("zero-length heredoc anchor") return } var identRegexp *regexp.Regexp if identBytes[0] == '-' { - identRegexp = regexp.MustCompile(fmt.Sprintf(`[[:space:]]*%s\z`, identBytes[1:])) + identRegexp = regexp.MustCompile(fmt.Sprintf(`^[[:space:]]*%s\r*\z`, identBytes[1:])) } else { - identRegexp = regexp.MustCompile(fmt.Sprintf(`[[:space:]]*%s\z`, identBytes)) + identRegexp = regexp.MustCompile(fmt.Sprintf(`^[[:space:]]*%s\r*\z`, identBytes)) } // Read the actual string value @@ -551,7 +552,7 @@ func (s *Scanner) scanDigits(ch rune, base, n int) rune { s.err("illegal char escape") } - if n != start { + if n != start && ch != eof { // we scanned all digits, put the last non digit char back, // only if we read anything at all s.unread() diff --git a/vendor/github.com/hashicorp/hcl/json/scanner/scanner.go b/vendor/github.com/hashicorp/hcl/json/scanner/scanner.go index dd5c72bb3..fe3f0f095 100644 --- a/vendor/github.com/hashicorp/hcl/json/scanner/scanner.go +++ b/vendor/github.com/hashicorp/hcl/json/scanner/scanner.go @@ -246,7 +246,7 @@ func (s *Scanner) scanNumber(ch rune) token.Type { return token.NUMBER } -// scanMantissa scans the mantissa begining from the rune. It returns the next +// scanMantissa scans the mantissa beginning from the rune. It returns the next // non decimal rune. It's used to determine wheter it's a fraction or exponent. func (s *Scanner) scanMantissa(ch rune) rune { scanned := false diff --git a/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md b/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md deleted file mode 100644 index ccb46bbd8..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -# HCL Changelog - -## v2.0.0 (Oct 2, 2019) - -Initial release of HCL 2, which is a new implementating combining the HCL 1 -language with the HIL expression language to produce a single language -supporting both nested configuration structures and arbitrary expressions. - -HCL 2 has an entirely new Go library API and so is _not_ a drop-in upgrade -relative to HCL 1. It's possible to import both versions of HCL into a single -program using Go's _semantic import versioning_ mechanism: - -``` -import ( - hcl1 "github.com/hashicorp/hcl" - hcl2 "github.com/hashicorp/hcl/v2" -) -``` - ---- - -Prior to v2.0.0 there was not a curated changelog. Consult the git history -from the latest v1.x.x tag for information on the changes to HCL 1. diff --git a/vendor/github.com/hashicorp/hcl/v2/README.md b/vendor/github.com/hashicorp/hcl/v2/README.md deleted file mode 100644 index d807a4245..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/README.md +++ /dev/null @@ -1,204 +0,0 @@ -# HCL - -HCL is a toolkit for creating structured configuration languages that are -both human- and machine-friendly, for use with command-line tools. -Although intended to be generally useful, it is primarily targeted -towards devops tools, servers, etc. - -> **NOTE:** This is major version 2 of HCL, whose Go API is incompatible with -> major version 1. Both versions are available for selection in Go Modules -> projects. HCL 2 _cannot_ be imported from Go projects that are not using Go Modules. For more information, see -> [our version selection guide](https://github.com/golang/go/wiki/Version-Selection). - -HCL has both a _native syntax_, intended to be pleasant to read and write for -humans, and a JSON-based variant that is easier for machines to generate -and parse. - -The HCL native syntax is inspired by [libucl](https://github.com/vstakhov/libucl), -[nginx configuration](http://nginx.org/en/docs/beginners_guide.html#conf_structure), -and others. - -It includes an expression syntax that allows basic inline computation and, -with support from the calling application, use of variables and functions -for more dynamic configuration languages. - -HCL provides a set of constructs that can be used by a calling application to -construct a configuration language. The application defines which attribute -names and nested block types are expected, and HCL parses the configuration -file, verifies that it conforms to the expected structure, and returns -high-level objects that the application can use for further processing. - -```go -package main - -import ( - "log" - "github.com/hashicorp/hcl/v2/hclsimple" -) - -type Config struct { - LogLevel string `hcl:"log_level"` -} - -func main() { - var config Config - err := hclsimple.DecodeFile("config.hcl", nil, &config) - if err != nil { - log.Fatalf("Failed to load configuration: %s", err) - } - log.Printf("Configuration is %#v", config) -} -``` - -A lower-level API is available for applications that need more control over -the parsing, decoding, and evaluation of configuration. - -## Why? - -Newcomers to HCL often ask: why not JSON, YAML, etc? - -Whereas JSON and YAML are formats for serializing data structures, HCL is -a syntax and API specifically designed for building structured configuration -formats. - -HCL attempts to strike a compromise between generic serialization formats -such as JSON and configuration formats built around full programming languages -such as Ruby. HCL syntax is designed to be easily read and written by humans, -and allows _declarative_ logic to permit its use in more complex applications. - -HCL is intended as a base syntax for configuration formats built -around key-value pairs and hierarchical blocks whose structure is well-defined -by the calling application, and this definition of the configuration structure -allows for better error messages and more convenient definition within the -calling application. - -It can't be denied that JSON is very convenient as a _lingua franca_ -for interoperability between different pieces of software. Because of this, -HCL defines a common configuration model that can be parsed from either its -native syntax or from a well-defined equivalent JSON structure. This allows -configuration to be provided as a mixture of human-authored configuration -files in the native syntax and machine-generated files in JSON. - -## Information Model and Syntax - -HCL is built around two primary concepts: _attributes_ and _blocks_. In -native syntax, a configuration file for a hypothetical application might look -something like this: - -```hcl -io_mode = "async" - -service "http" "web_proxy" { - listen_addr = "127.0.0.1:8080" - - process "main" { - command = ["/usr/local/bin/awesome-app", "server"] - } - - process "mgmt" { - command = ["/usr/local/bin/awesome-app", "mgmt"] - } -} -``` - -The JSON equivalent of this configuration is the following: - -```json -{ - "io_mode": "async", - "service": { - "http": { - "web_proxy": { - "listen_addr": "127.0.0.1:8080", - "process": { - "main": { - "command": ["/usr/local/bin/awesome-app", "server"] - }, - "mgmt": { - "command": ["/usr/local/bin/awesome-app", "mgmt"] - }, - } - } - } - } -} -``` - -Regardless of which syntax is used, the API within the calling application -is the same. It can either work directly with the low-level attributes and -blocks, for more advanced use-cases, or it can use one of the _decoder_ -packages to declaratively extract into either Go structs or dynamic value -structures. - -Attribute values can be expressions as well as just literal values: - -```hcl -# Arithmetic with literals and application-provided variables -sum = 1 + addend - -# String interpolation and templates -message = "Hello, ${name}!" - -# Application-provided functions -shouty_message = upper(message) -``` - -Although JSON syntax doesn't permit direct use of expressions, the interpolation -syntax allows use of arbitrary expressions within JSON strings: - -```json -{ - "sum": "${1 + addend}", - "message": "Hello, ${name}!", - "shouty_message": "${upper(message)}" -} -``` - -For more information, see the detailed specifications: - -* [Syntax-agnostic Information Model](hcl/spec.md) -* [HCL Native Syntax](hcl/hclsyntax/spec.md) -* [JSON Representation](hcl/json/spec.md) - -## Changes in 2.0 - -Version 2.0 of HCL combines the features of HCL 1.0 with those of the -interpolation language HIL to produce a single configuration language that -supports arbitrary expressions. - -This new version has a completely new parser and Go API, with no direct -migration path. Although the syntax is similar, the implementation takes some -very different approaches to improve on some "rough edges" that existed with -the original implementation and to allow for more robust error handling. - -It's possible to import both HCL 1 and HCL 2 into the same program using Go's -_semantic import versioning_ mechanism: - -```go -import ( - hcl1 "github.com/hashicorp/hcl" - hcl2 "github.com/hashicorp/hcl/v2" -) -``` - -## Acknowledgements - -HCL was heavily inspired by [libucl](https://github.com/vstakhov/libucl), -by [Vsevolod Stakhov](https://github.com/vstakhov). - -HCL and HIL originate in [HashiCorp Terraform](https://terraform.io/), -with the original parsers for each written by -[Mitchell Hashimoto](https://github.com/mitchellh). - -The original HCL parser was ported to pure Go (from yacc) by -[Fatih Arslan](https://github.com/fatih). The structure-related portions of -the new native syntax parser build on that work. - -The original HIL parser was ported to pure Go (from yacc) by -[Martin Atkins](https://github.com/apparentlymart). The expression-related -portions of the new native syntax parser build on that work. - -HCL 2, which merged the original HCL and HIL languages into this single new -language, builds on design and prototyping work by -[Martin Atkins](https://github.com/apparentlymart) in -[zcl](https://github.com/zclconf/go-zcl). diff --git a/vendor/github.com/hashicorp/hcl/v2/diagnostic.go b/vendor/github.com/hashicorp/hcl/v2/diagnostic.go deleted file mode 100644 index c320961e1..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/diagnostic.go +++ /dev/null @@ -1,143 +0,0 @@ -package hcl - -import ( - "fmt" -) - -// DiagnosticSeverity represents the severity of a diagnostic. -type DiagnosticSeverity int - -const ( - // DiagInvalid is the invalid zero value of DiagnosticSeverity - DiagInvalid DiagnosticSeverity = iota - - // DiagError indicates that the problem reported by a diagnostic prevents - // further progress in parsing and/or evaluating the subject. - DiagError - - // DiagWarning indicates that the problem reported by a diagnostic warrants - // user attention but does not prevent further progress. It is most - // commonly used for showing deprecation notices. - DiagWarning -) - -// Diagnostic represents information to be presented to a user about an -// error or anomoly in parsing or evaluating configuration. -type Diagnostic struct { - Severity DiagnosticSeverity - - // Summary and Detail contain the English-language description of the - // problem. Summary is a terse description of the general problem and - // detail is a more elaborate, often-multi-sentence description of - // the probem and what might be done to solve it. - Summary string - Detail string - - // Subject and Context are both source ranges relating to the diagnostic. - // - // Subject is a tight range referring to exactly the construct that - // is problematic, while Context is an optional broader range (which should - // fully contain Subject) that ought to be shown around Subject when - // generating isolated source-code snippets in diagnostic messages. - // If Context is nil, the Subject is also the Context. - // - // Some diagnostics have no source ranges at all. If Context is set then - // Subject should always also be set. - Subject *Range - Context *Range - - // For diagnostics that occur when evaluating an expression, Expression - // may refer to that expression and EvalContext may point to the - // EvalContext that was active when evaluating it. This may allow for the - // inclusion of additional useful information when rendering a diagnostic - // message to the user. - // - // It is not always possible to select a single EvalContext for a - // diagnostic, and so in some cases this field may be nil even when an - // expression causes a problem. - // - // EvalContexts form a tree, so the given EvalContext may refer to a parent - // which in turn refers to another parent, etc. For a full picture of all - // of the active variables and functions the caller must walk up this - // chain, preferring definitions that are "closer" to the expression in - // case of colliding names. - Expression Expression - EvalContext *EvalContext -} - -// Diagnostics is a list of Diagnostic instances. -type Diagnostics []*Diagnostic - -// error implementation, so that diagnostics can be returned via APIs -// that normally deal in vanilla Go errors. -// -// This presents only minimal context about the error, for compatibility -// with usual expectations about how errors will present as strings. -func (d *Diagnostic) Error() string { - return fmt.Sprintf("%s: %s; %s", d.Subject, d.Summary, d.Detail) -} - -// error implementation, so that sets of diagnostics can be returned via -// APIs that normally deal in vanilla Go errors. -func (d Diagnostics) Error() string { - count := len(d) - switch { - case count == 0: - return "no diagnostics" - case count == 1: - return d[0].Error() - default: - return fmt.Sprintf("%s, and %d other diagnostic(s)", d[0].Error(), count-1) - } -} - -// Append appends a new error to a Diagnostics and return the whole Diagnostics. -// -// This is provided as a convenience for returning from a function that -// collects and then returns a set of diagnostics: -// -// return nil, diags.Append(&hcl.Diagnostic{ ... }) -// -// Note that this modifies the array underlying the diagnostics slice, so -// must be used carefully within a single codepath. It is incorrect (and rude) -// to extend a diagnostics created by a different subsystem. -func (d Diagnostics) Append(diag *Diagnostic) Diagnostics { - return append(d, diag) -} - -// Extend concatenates the given Diagnostics with the receiver and returns -// the whole new Diagnostics. -// -// This is similar to Append but accepts multiple diagnostics to add. It has -// all the same caveats and constraints. -func (d Diagnostics) Extend(diags Diagnostics) Diagnostics { - return append(d, diags...) -} - -// HasErrors returns true if the receiver contains any diagnostics of -// severity DiagError. -func (d Diagnostics) HasErrors() bool { - for _, diag := range d { - if diag.Severity == DiagError { - return true - } - } - return false -} - -func (d Diagnostics) Errs() []error { - var errs []error - for _, diag := range d { - if diag.Severity == DiagError { - errs = append(errs, diag) - } - } - - return errs -} - -// A DiagnosticWriter emits diagnostics somehow. -type DiagnosticWriter interface { - WriteDiagnostic(*Diagnostic) error - WriteDiagnostics(Diagnostics) error -} diff --git a/vendor/github.com/hashicorp/hcl/v2/diagnostic_text.go b/vendor/github.com/hashicorp/hcl/v2/diagnostic_text.go deleted file mode 100644 index 0b4a2629b..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/diagnostic_text.go +++ /dev/null @@ -1,311 +0,0 @@ -package hcl - -import ( - "bufio" - "bytes" - "errors" - "fmt" - "io" - "sort" - - wordwrap "github.com/mitchellh/go-wordwrap" - "github.com/zclconf/go-cty/cty" -) - -type diagnosticTextWriter struct { - files map[string]*File - wr io.Writer - width uint - color bool -} - -// NewDiagnosticTextWriter creates a DiagnosticWriter that writes diagnostics -// to the given writer as formatted text. -// -// It is designed to produce text appropriate to print in a monospaced font -// in a terminal of a particular width, or optionally with no width limit. -// -// The given width may be zero to disable word-wrapping of the detail text -// and truncation of source code snippets. -// -// If color is set to true, the output will include VT100 escape sequences to -// color-code the severity indicators. It is suggested to turn this off if -// the target writer is not a terminal. -func NewDiagnosticTextWriter(wr io.Writer, files map[string]*File, width uint, color bool) DiagnosticWriter { - return &diagnosticTextWriter{ - files: files, - wr: wr, - width: width, - color: color, - } -} - -func (w *diagnosticTextWriter) WriteDiagnostic(diag *Diagnostic) error { - if diag == nil { - return errors.New("nil diagnostic") - } - - var colorCode, highlightCode, resetCode string - if w.color { - switch diag.Severity { - case DiagError: - colorCode = "\x1b[31m" - case DiagWarning: - colorCode = "\x1b[33m" - } - resetCode = "\x1b[0m" - highlightCode = "\x1b[1;4m" - } - - var severityStr string - switch diag.Severity { - case DiagError: - severityStr = "Error" - case DiagWarning: - severityStr = "Warning" - default: - // should never happen - severityStr = "???????" - } - - fmt.Fprintf(w.wr, "%s%s%s: %s\n\n", colorCode, severityStr, resetCode, diag.Summary) - - if diag.Subject != nil { - snipRange := *diag.Subject - highlightRange := snipRange - if diag.Context != nil { - // Show enough of the source code to include both the subject - // and context ranges, which overlap in all reasonable - // situations. - snipRange = RangeOver(snipRange, *diag.Context) - } - // We can't illustrate an empty range, so we'll turn such ranges into - // single-character ranges, which might not be totally valid (may point - // off the end of a line, or off the end of the file) but are good - // enough for the bounds checks we do below. - if snipRange.Empty() { - snipRange.End.Byte++ - snipRange.End.Column++ - } - if highlightRange.Empty() { - highlightRange.End.Byte++ - highlightRange.End.Column++ - } - - file := w.files[diag.Subject.Filename] - if file == nil || file.Bytes == nil { - fmt.Fprintf(w.wr, " on %s line %d:\n (source code not available)\n\n", diag.Subject.Filename, diag.Subject.Start.Line) - } else { - - var contextLine string - if diag.Subject != nil { - contextLine = contextString(file, diag.Subject.Start.Byte) - if contextLine != "" { - contextLine = ", in " + contextLine - } - } - - fmt.Fprintf(w.wr, " on %s line %d%s:\n", diag.Subject.Filename, diag.Subject.Start.Line, contextLine) - - src := file.Bytes - sc := NewRangeScanner(src, diag.Subject.Filename, bufio.ScanLines) - - for sc.Scan() { - lineRange := sc.Range() - if !lineRange.Overlaps(snipRange) { - continue - } - - beforeRange, highlightedRange, afterRange := lineRange.PartitionAround(highlightRange) - if highlightedRange.Empty() { - fmt.Fprintf(w.wr, "%4d: %s\n", lineRange.Start.Line, sc.Bytes()) - } else { - before := beforeRange.SliceBytes(src) - highlighted := highlightedRange.SliceBytes(src) - after := afterRange.SliceBytes(src) - fmt.Fprintf( - w.wr, "%4d: %s%s%s%s%s\n", - lineRange.Start.Line, - before, - highlightCode, highlighted, resetCode, - after, - ) - } - - } - - w.wr.Write([]byte{'\n'}) - } - - if diag.Expression != nil && diag.EvalContext != nil { - // We will attempt to render the values for any variables - // referenced in the given expression as additional context, for - // situations where the same expression is evaluated multiple - // times in different scopes. - expr := diag.Expression - ctx := diag.EvalContext - - vars := expr.Variables() - stmts := make([]string, 0, len(vars)) - seen := make(map[string]struct{}, len(vars)) - for _, traversal := range vars { - val, diags := traversal.TraverseAbs(ctx) - if diags.HasErrors() { - // Skip anything that generates errors, since we probably - // already have the same error in our diagnostics set - // already. - continue - } - - traversalStr := w.traversalStr(traversal) - if _, exists := seen[traversalStr]; exists { - continue // don't show duplicates when the same variable is referenced multiple times - } - switch { - case !val.IsKnown(): - // Can't say anything about this yet, then. - continue - case val.IsNull(): - stmts = append(stmts, fmt.Sprintf("%s set to null", traversalStr)) - default: - stmts = append(stmts, fmt.Sprintf("%s as %s", traversalStr, w.valueStr(val))) - } - seen[traversalStr] = struct{}{} - } - - sort.Strings(stmts) // FIXME: Should maybe use a traversal-aware sort that can sort numeric indexes properly? - last := len(stmts) - 1 - - for i, stmt := range stmts { - switch i { - case 0: - w.wr.Write([]byte{'w', 'i', 't', 'h', ' '}) - default: - w.wr.Write([]byte{' ', ' ', ' ', ' ', ' '}) - } - w.wr.Write([]byte(stmt)) - switch i { - case last: - w.wr.Write([]byte{'.', '\n', '\n'}) - default: - w.wr.Write([]byte{',', '\n'}) - } - } - } - } - - if diag.Detail != "" { - detail := diag.Detail - if w.width != 0 { - detail = wordwrap.WrapString(detail, w.width) - } - fmt.Fprintf(w.wr, "%s\n\n", detail) - } - - return nil -} - -func (w *diagnosticTextWriter) WriteDiagnostics(diags Diagnostics) error { - for _, diag := range diags { - err := w.WriteDiagnostic(diag) - if err != nil { - return err - } - } - return nil -} - -func (w *diagnosticTextWriter) traversalStr(traversal Traversal) string { - // This is a specialized subset of traversal rendering tailored to - // producing helpful contextual messages in diagnostics. It is not - // comprehensive nor intended to be used for other purposes. - - var buf bytes.Buffer - for _, step := range traversal { - switch tStep := step.(type) { - case TraverseRoot: - buf.WriteString(tStep.Name) - case TraverseAttr: - buf.WriteByte('.') - buf.WriteString(tStep.Name) - case TraverseIndex: - buf.WriteByte('[') - if keyTy := tStep.Key.Type(); keyTy.IsPrimitiveType() { - buf.WriteString(w.valueStr(tStep.Key)) - } else { - // We'll just use a placeholder for more complex values, - // since otherwise our result could grow ridiculously long. - buf.WriteString("...") - } - buf.WriteByte(']') - } - } - return buf.String() -} - -func (w *diagnosticTextWriter) valueStr(val cty.Value) string { - // This is a specialized subset of value rendering tailored to producing - // helpful but concise messages in diagnostics. It is not comprehensive - // nor intended to be used for other purposes. - - ty := val.Type() - switch { - case val.IsNull(): - return "null" - case !val.IsKnown(): - // Should never happen here because we should filter before we get - // in here, but we'll do something reasonable rather than panic. - return "(not yet known)" - case ty == cty.Bool: - if val.True() { - return "true" - } - return "false" - case ty == cty.Number: - bf := val.AsBigFloat() - return bf.Text('g', 10) - case ty == cty.String: - // Go string syntax is not exactly the same as HCL native string syntax, - // but we'll accept the minor edge-cases where this is different here - // for now, just to get something reasonable here. - return fmt.Sprintf("%q", val.AsString()) - case ty.IsCollectionType() || ty.IsTupleType(): - l := val.LengthInt() - switch l { - case 0: - return "empty " + ty.FriendlyName() - case 1: - return ty.FriendlyName() + " with 1 element" - default: - return fmt.Sprintf("%s with %d elements", ty.FriendlyName(), l) - } - case ty.IsObjectType(): - atys := ty.AttributeTypes() - l := len(atys) - switch l { - case 0: - return "object with no attributes" - case 1: - var name string - for k := range atys { - name = k - } - return fmt.Sprintf("object with 1 attribute %q", name) - default: - return fmt.Sprintf("object with %d attributes", l) - } - default: - return ty.FriendlyName() - } -} - -func contextString(file *File, offset int) string { - type contextStringer interface { - ContextString(offset int) string - } - - if cser, ok := file.Nav.(contextStringer); ok { - return cser.ContextString(offset) - } - return "" -} diff --git a/vendor/github.com/hashicorp/hcl/v2/didyoumean.go b/vendor/github.com/hashicorp/hcl/v2/didyoumean.go deleted file mode 100644 index c12833440..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/didyoumean.go +++ /dev/null @@ -1,24 +0,0 @@ -package hcl - -import ( - "github.com/agext/levenshtein" -) - -// nameSuggestion tries to find a name from the given slice of suggested names -// that is close to the given name and returns it if found. If no suggestion -// is close enough, returns the empty string. -// -// The suggestions are tried in order, so earlier suggestions take precedence -// if the given string is similar to two or more suggestions. -// -// This function is intended to be used with a relatively-small number of -// suggestions. It's not optimized for hundreds or thousands of them. -func nameSuggestion(given string, suggestions []string) string { - for _, suggestion := range suggestions { - dist := levenshtein.Distance(given, suggestion, nil) - if dist < 3 { // threshold determined experimentally - return suggestion - } - } - return "" -} diff --git a/vendor/github.com/hashicorp/hcl/v2/doc.go b/vendor/github.com/hashicorp/hcl/v2/doc.go deleted file mode 100644 index 0d43fb2c7..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/doc.go +++ /dev/null @@ -1,34 +0,0 @@ -// Package hcl contains the main modelling types and general utility functions -// for HCL. -// -// For a simple entry point into HCL, see the package in the subdirectory -// "hclsimple", which has an opinionated function Decode that can decode HCL -// configurations in either native HCL syntax or JSON syntax into a Go struct -// type: -// -// package main -// -// import ( -// "log" -// "github.com/hashicorp/hcl/v2/hclsimple" -// ) -// -// type Config struct { -// LogLevel string `hcl:"log_level"` -// } -// -// func main() { -// var config Config -// err := hclsimple.DecodeFile("config.hcl", nil, &config) -// if err != nil { -// log.Fatalf("Failed to load configuration: %s", err) -// } -// log.Printf("Configuration is %#v", config) -// } -// -// If your application needs more control over the evaluation of the -// configuration, you can use the functions in the subdirectories hclparse, -// gohcl, hcldec, etc. Splitting the handling of configuration into multiple -// phases allows for advanced patterns such as allowing expressions in one -// part of the configuration to refer to data defined in another part. -package hcl diff --git a/vendor/github.com/hashicorp/hcl/v2/eval_context.go b/vendor/github.com/hashicorp/hcl/v2/eval_context.go deleted file mode 100644 index 915910ad8..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/eval_context.go +++ /dev/null @@ -1,25 +0,0 @@ -package hcl - -import ( - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/function" -) - -// An EvalContext provides the variables and functions that should be used -// to evaluate an expression. -type EvalContext struct { - Variables map[string]cty.Value - Functions map[string]function.Function - parent *EvalContext -} - -// NewChild returns a new EvalContext that is a child of the receiver. -func (ctx *EvalContext) NewChild() *EvalContext { - return &EvalContext{parent: ctx} -} - -// Parent returns the parent of the receiver, or nil if the receiver has -// no parent. -func (ctx *EvalContext) Parent() *EvalContext { - return ctx.parent -} diff --git a/vendor/github.com/hashicorp/hcl/v2/expr_call.go b/vendor/github.com/hashicorp/hcl/v2/expr_call.go deleted file mode 100644 index 6963fbae3..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/expr_call.go +++ /dev/null @@ -1,46 +0,0 @@ -package hcl - -// ExprCall tests if the given expression is a function call and, -// if so, extracts the function name and the expressions that represent -// the arguments. If the given expression is not statically a function call, -// error diagnostics are returned. -// -// A particular Expression implementation can support this function by -// offering a method called ExprCall that takes no arguments and returns -// *StaticCall. This method should return nil if a static call cannot -// be extracted. Alternatively, an implementation can support -// UnwrapExpression to delegate handling of this function to a wrapped -// Expression object. -func ExprCall(expr Expression) (*StaticCall, Diagnostics) { - type exprCall interface { - ExprCall() *StaticCall - } - - physExpr := UnwrapExpressionUntil(expr, func(expr Expression) bool { - _, supported := expr.(exprCall) - return supported - }) - - if exC, supported := physExpr.(exprCall); supported { - if call := exC.ExprCall(); call != nil { - return call, nil - } - } - return nil, Diagnostics{ - &Diagnostic{ - Severity: DiagError, - Summary: "Invalid expression", - Detail: "A static function call is required.", - Subject: expr.StartRange().Ptr(), - }, - } -} - -// StaticCall represents a function call that was extracted statically from -// an expression using ExprCall. -type StaticCall struct { - Name string - NameRange Range - Arguments []Expression - ArgsRange Range -} diff --git a/vendor/github.com/hashicorp/hcl/v2/expr_list.go b/vendor/github.com/hashicorp/hcl/v2/expr_list.go deleted file mode 100644 index d05cca0b9..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/expr_list.go +++ /dev/null @@ -1,37 +0,0 @@ -package hcl - -// ExprList tests if the given expression is a static list construct and, -// if so, extracts the expressions that represent the list elements. -// If the given expression is not a static list, error diagnostics are -// returned. -// -// A particular Expression implementation can support this function by -// offering a method called ExprList that takes no arguments and returns -// []Expression. This method should return nil if a static list cannot -// be extracted. Alternatively, an implementation can support -// UnwrapExpression to delegate handling of this function to a wrapped -// Expression object. -func ExprList(expr Expression) ([]Expression, Diagnostics) { - type exprList interface { - ExprList() []Expression - } - - physExpr := UnwrapExpressionUntil(expr, func(expr Expression) bool { - _, supported := expr.(exprList) - return supported - }) - - if exL, supported := physExpr.(exprList); supported { - if list := exL.ExprList(); list != nil { - return list, nil - } - } - return nil, Diagnostics{ - &Diagnostic{ - Severity: DiagError, - Summary: "Invalid expression", - Detail: "A static list expression is required.", - Subject: expr.StartRange().Ptr(), - }, - } -} diff --git a/vendor/github.com/hashicorp/hcl/v2/expr_map.go b/vendor/github.com/hashicorp/hcl/v2/expr_map.go deleted file mode 100644 index 96d1ce4bf..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/expr_map.go +++ /dev/null @@ -1,44 +0,0 @@ -package hcl - -// ExprMap tests if the given expression is a static map construct and, -// if so, extracts the expressions that represent the map elements. -// If the given expression is not a static map, error diagnostics are -// returned. -// -// A particular Expression implementation can support this function by -// offering a method called ExprMap that takes no arguments and returns -// []KeyValuePair. This method should return nil if a static map cannot -// be extracted. Alternatively, an implementation can support -// UnwrapExpression to delegate handling of this function to a wrapped -// Expression object. -func ExprMap(expr Expression) ([]KeyValuePair, Diagnostics) { - type exprMap interface { - ExprMap() []KeyValuePair - } - - physExpr := UnwrapExpressionUntil(expr, func(expr Expression) bool { - _, supported := expr.(exprMap) - return supported - }) - - if exM, supported := physExpr.(exprMap); supported { - if pairs := exM.ExprMap(); pairs != nil { - return pairs, nil - } - } - return nil, Diagnostics{ - &Diagnostic{ - Severity: DiagError, - Summary: "Invalid expression", - Detail: "A static map expression is required.", - Subject: expr.StartRange().Ptr(), - }, - } -} - -// KeyValuePair represents a pair of expressions that serve as a single item -// within a map or object definition construct. -type KeyValuePair struct { - Key Expression - Value Expression -} diff --git a/vendor/github.com/hashicorp/hcl/v2/expr_unwrap.go b/vendor/github.com/hashicorp/hcl/v2/expr_unwrap.go deleted file mode 100644 index 6d5d205c4..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/expr_unwrap.go +++ /dev/null @@ -1,68 +0,0 @@ -package hcl - -type unwrapExpression interface { - UnwrapExpression() Expression -} - -// UnwrapExpression removes any "wrapper" expressions from the given expression, -// to recover the representation of the physical expression given in source -// code. -// -// Sometimes wrapping expressions are used to modify expression behavior, e.g. -// in extensions that need to make some local variables available to certain -// sub-trees of the configuration. This can make it difficult to reliably -// type-assert on the physical AST types used by the underlying syntax. -// -// Unwrapping an expression may modify its behavior by stripping away any -// additional constraints or capabilities being applied to the Value and -// Variables methods, so this function should generally only be used prior -// to operations that concern themselves with the static syntax of the input -// configuration, and not with the effective value of the expression. -// -// Wrapper expression types must support unwrapping by implementing a method -// called UnwrapExpression that takes no arguments and returns the embedded -// Expression. Implementations of this method should peel away only one level -// of wrapping, if multiple are present. This method may return nil to -// indicate _dynamically_ that no wrapped expression is available, for -// expression types that might only behave as wrappers in certain cases. -func UnwrapExpression(expr Expression) Expression { - for { - unwrap, wrapped := expr.(unwrapExpression) - if !wrapped { - return expr - } - innerExpr := unwrap.UnwrapExpression() - if innerExpr == nil { - return expr - } - expr = innerExpr - } -} - -// UnwrapExpressionUntil is similar to UnwrapExpression except it gives the -// caller an opportunity to test each level of unwrapping to see each a -// particular expression is accepted. -// -// This could be used, for example, to unwrap until a particular other -// interface is satisfied, regardless of wrap wrapping level it is satisfied -// at. -// -// The given callback function must return false to continue wrapping, or -// true to accept and return the proposed expression given. If the callback -// function rejects even the final, physical expression then the result of -// this function is nil. -func UnwrapExpressionUntil(expr Expression, until func(Expression) bool) Expression { - for { - if until(expr) { - return expr - } - unwrap, wrapped := expr.(unwrapExpression) - if !wrapped { - return nil - } - expr = unwrap.UnwrapExpression() - if expr == nil { - return nil - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/v2/go.mod b/vendor/github.com/hashicorp/hcl/v2/go.mod deleted file mode 100644 index c152e6016..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/go.mod +++ /dev/null @@ -1,21 +0,0 @@ -module github.com/hashicorp/hcl/v2 - -require ( - github.com/agext/levenshtein v1.2.1 - github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 - github.com/apparentlymart/go-textseg v1.0.0 - github.com/davecgh/go-spew v1.1.1 - github.com/go-test/deep v1.0.3 - github.com/google/go-cmp v0.2.0 - github.com/kr/pretty v0.1.0 - github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 - github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/sergi/go-diff v1.0.0 - github.com/spf13/pflag v1.0.2 - github.com/stretchr/testify v1.2.2 // indirect - github.com/zclconf/go-cty v1.1.0 - golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 - golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 // indirect - golang.org/x/text v0.3.2 // indirect -) diff --git a/vendor/github.com/hashicorp/hcl/v2/go.sum b/vendor/github.com/hashicorp/hcl/v2/go.sum deleted file mode 100644 index b3b95415f..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/go.sum +++ /dev/null @@ -1,51 +0,0 @@ -github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= -github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 h1:ZSTrOEhiM5J5RFxEaFvMZVEAM1KvT1YzbEOwB2EAGjA= -github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= -github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= -github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= -github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= -github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc= -github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/zclconf/go-cty v1.1.0 h1:uJwc9HiBOCpoKIObTQaLR+tsEXx1HBHnOsOOpcdhZgw= -github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 h1:vsphBvatvfbhlb4PO1BYSr9dzugGxJ/SQHoNufZJq1w= -golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/vendor/github.com/hashicorp/hcl/v2/gohcl/decode.go b/vendor/github.com/hashicorp/hcl/v2/gohcl/decode.go deleted file mode 100644 index 7ba08eee0..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/gohcl/decode.go +++ /dev/null @@ -1,304 +0,0 @@ -package gohcl - -import ( - "fmt" - "reflect" - - "github.com/zclconf/go-cty/cty" - - "github.com/hashicorp/hcl/v2" - "github.com/zclconf/go-cty/cty/convert" - "github.com/zclconf/go-cty/cty/gocty" -) - -// DecodeBody extracts the configuration within the given body into the given -// value. This value must be a non-nil pointer to either a struct or -// a map, where in the former case the configuration will be decoded using -// struct tags and in the latter case only attributes are allowed and their -// values are decoded into the map. -// -// The given EvalContext is used to resolve any variables or functions in -// expressions encountered while decoding. This may be nil to require only -// constant values, for simple applications that do not support variables or -// functions. -// -// The returned diagnostics should be inspected with its HasErrors method to -// determine if the populated value is valid and complete. If error diagnostics -// are returned then the given value may have been partially-populated but -// may still be accessed by a careful caller for static analysis and editor -// integration use-cases. -func DecodeBody(body hcl.Body, ctx *hcl.EvalContext, val interface{}) hcl.Diagnostics { - rv := reflect.ValueOf(val) - if rv.Kind() != reflect.Ptr { - panic(fmt.Sprintf("target value must be a pointer, not %s", rv.Type().String())) - } - - return decodeBodyToValue(body, ctx, rv.Elem()) -} - -func decodeBodyToValue(body hcl.Body, ctx *hcl.EvalContext, val reflect.Value) hcl.Diagnostics { - et := val.Type() - switch et.Kind() { - case reflect.Struct: - return decodeBodyToStruct(body, ctx, val) - case reflect.Map: - return decodeBodyToMap(body, ctx, val) - default: - panic(fmt.Sprintf("target value must be pointer to struct or map, not %s", et.String())) - } -} - -func decodeBodyToStruct(body hcl.Body, ctx *hcl.EvalContext, val reflect.Value) hcl.Diagnostics { - schema, partial := ImpliedBodySchema(val.Interface()) - - var content *hcl.BodyContent - var leftovers hcl.Body - var diags hcl.Diagnostics - if partial { - content, leftovers, diags = body.PartialContent(schema) - } else { - content, diags = body.Content(schema) - } - if content == nil { - return diags - } - - tags := getFieldTags(val.Type()) - - if tags.Remain != nil { - fieldIdx := *tags.Remain - field := val.Type().Field(fieldIdx) - fieldV := val.Field(fieldIdx) - switch { - case bodyType.AssignableTo(field.Type): - fieldV.Set(reflect.ValueOf(leftovers)) - case attrsType.AssignableTo(field.Type): - attrs, attrsDiags := leftovers.JustAttributes() - if len(attrsDiags) > 0 { - diags = append(diags, attrsDiags...) - } - fieldV.Set(reflect.ValueOf(attrs)) - default: - diags = append(diags, decodeBodyToValue(leftovers, ctx, fieldV)...) - } - } - - for name, fieldIdx := range tags.Attributes { - attr := content.Attributes[name] - field := val.Type().Field(fieldIdx) - fieldV := val.Field(fieldIdx) - - if attr == nil { - if !exprType.AssignableTo(field.Type) { - continue - } - - // As a special case, if the target is of type hcl.Expression then - // we'll assign an actual expression that evalues to a cty null, - // so the caller can deal with it within the cty realm rather - // than within the Go realm. - synthExpr := hcl.StaticExpr(cty.NullVal(cty.DynamicPseudoType), body.MissingItemRange()) - fieldV.Set(reflect.ValueOf(synthExpr)) - continue - } - - switch { - case attrType.AssignableTo(field.Type): - fieldV.Set(reflect.ValueOf(attr)) - case exprType.AssignableTo(field.Type): - fieldV.Set(reflect.ValueOf(attr.Expr)) - default: - diags = append(diags, DecodeExpression( - attr.Expr, ctx, fieldV.Addr().Interface(), - )...) - } - } - - blocksByType := content.Blocks.ByType() - - for typeName, fieldIdx := range tags.Blocks { - blocks := blocksByType[typeName] - field := val.Type().Field(fieldIdx) - - ty := field.Type - isSlice := false - isPtr := false - if ty.Kind() == reflect.Slice { - isSlice = true - ty = ty.Elem() - } - if ty.Kind() == reflect.Ptr { - isPtr = true - ty = ty.Elem() - } - - if len(blocks) > 1 && !isSlice { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Duplicate %s block", typeName), - Detail: fmt.Sprintf( - "Only one %s block is allowed. Another was defined at %s.", - typeName, blocks[0].DefRange.String(), - ), - Subject: &blocks[1].DefRange, - }) - continue - } - - if len(blocks) == 0 { - if isSlice || isPtr { - val.Field(fieldIdx).Set(reflect.Zero(field.Type)) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Missing %s block", typeName), - Detail: fmt.Sprintf("A %s block is required.", typeName), - Subject: body.MissingItemRange().Ptr(), - }) - } - continue - } - - switch { - - case isSlice: - elemType := ty - if isPtr { - elemType = reflect.PtrTo(ty) - } - sli := reflect.MakeSlice(reflect.SliceOf(elemType), len(blocks), len(blocks)) - - for i, block := range blocks { - if isPtr { - v := reflect.New(ty) - diags = append(diags, decodeBlockToValue(block, ctx, v.Elem())...) - sli.Index(i).Set(v) - } else { - diags = append(diags, decodeBlockToValue(block, ctx, sli.Index(i))...) - } - } - - val.Field(fieldIdx).Set(sli) - - default: - block := blocks[0] - if isPtr { - v := reflect.New(ty) - diags = append(diags, decodeBlockToValue(block, ctx, v.Elem())...) - val.Field(fieldIdx).Set(v) - } else { - diags = append(diags, decodeBlockToValue(block, ctx, val.Field(fieldIdx))...) - } - - } - - } - - return diags -} - -func decodeBodyToMap(body hcl.Body, ctx *hcl.EvalContext, v reflect.Value) hcl.Diagnostics { - attrs, diags := body.JustAttributes() - if attrs == nil { - return diags - } - - mv := reflect.MakeMap(v.Type()) - - for k, attr := range attrs { - switch { - case attrType.AssignableTo(v.Type().Elem()): - mv.SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(attr)) - case exprType.AssignableTo(v.Type().Elem()): - mv.SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(attr.Expr)) - default: - ev := reflect.New(v.Type().Elem()) - diags = append(diags, DecodeExpression(attr.Expr, ctx, ev.Interface())...) - mv.SetMapIndex(reflect.ValueOf(k), ev.Elem()) - } - } - - v.Set(mv) - - return diags -} - -func decodeBlockToValue(block *hcl.Block, ctx *hcl.EvalContext, v reflect.Value) hcl.Diagnostics { - var diags hcl.Diagnostics - - ty := v.Type() - - switch { - case blockType.AssignableTo(ty): - v.Elem().Set(reflect.ValueOf(block)) - case bodyType.AssignableTo(ty): - v.Elem().Set(reflect.ValueOf(block.Body)) - case attrsType.AssignableTo(ty): - attrs, attrsDiags := block.Body.JustAttributes() - if len(attrsDiags) > 0 { - diags = append(diags, attrsDiags...) - } - v.Elem().Set(reflect.ValueOf(attrs)) - default: - diags = append(diags, decodeBodyToValue(block.Body, ctx, v)...) - - if len(block.Labels) > 0 { - blockTags := getFieldTags(ty) - for li, lv := range block.Labels { - lfieldIdx := blockTags.Labels[li].FieldIndex - v.Field(lfieldIdx).Set(reflect.ValueOf(lv)) - } - } - - } - - return diags -} - -// DecodeExpression extracts the value of the given expression into the given -// value. This value must be something that gocty is able to decode into, -// since the final decoding is delegated to that package. -// -// The given EvalContext is used to resolve any variables or functions in -// expressions encountered while decoding. This may be nil to require only -// constant values, for simple applications that do not support variables or -// functions. -// -// The returned diagnostics should be inspected with its HasErrors method to -// determine if the populated value is valid and complete. If error diagnostics -// are returned then the given value may have been partially-populated but -// may still be accessed by a careful caller for static analysis and editor -// integration use-cases. -func DecodeExpression(expr hcl.Expression, ctx *hcl.EvalContext, val interface{}) hcl.Diagnostics { - srcVal, diags := expr.Value(ctx) - - convTy, err := gocty.ImpliedType(val) - if err != nil { - panic(fmt.Sprintf("unsuitable DecodeExpression target: %s", err)) - } - - srcVal, err = convert.Convert(srcVal, convTy) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsuitable value type", - Detail: fmt.Sprintf("Unsuitable value: %s", err.Error()), - Subject: expr.StartRange().Ptr(), - Context: expr.Range().Ptr(), - }) - return diags - } - - err = gocty.FromCtyValue(srcVal, val) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsuitable value type", - Detail: fmt.Sprintf("Unsuitable value: %s", err.Error()), - Subject: expr.StartRange().Ptr(), - Context: expr.Range().Ptr(), - }) - } - - return diags -} diff --git a/vendor/github.com/hashicorp/hcl/v2/gohcl/doc.go b/vendor/github.com/hashicorp/hcl/v2/gohcl/doc.go deleted file mode 100644 index aa3c6ea9e..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/gohcl/doc.go +++ /dev/null @@ -1,53 +0,0 @@ -// Package gohcl allows decoding HCL configurations into Go data structures. -// -// It provides a convenient and concise way of describing the schema for -// configuration and then accessing the resulting data via native Go -// types. -// -// A struct field tag scheme is used, similar to other decoding and -// unmarshalling libraries. The tags are formatted as in the following example: -// -// ThingType string `hcl:"thing_type,attr"` -// -// Within each tag there are two comma-separated tokens. The first is the -// name of the corresponding construct in configuration, while the second -// is a keyword giving the kind of construct expected. The following -// kind keywords are supported: -// -// attr (the default) indicates that the value is to be populated from an attribute -// block indicates that the value is to populated from a block -// label indicates that the value is to populated from a block label -// remain indicates that the value is to be populated from the remaining body after populating other fields -// -// "attr" fields may either be of type *hcl.Expression, in which case the raw -// expression is assigned, or of any type accepted by gocty, in which case -// gocty will be used to assign the value to a native Go type. -// -// "block" fields may be of type *hcl.Block or hcl.Body, in which case the -// corresponding raw value is assigned, or may be a struct that recursively -// uses the same tags. Block fields may also be slices of any of these types, -// in which case multiple blocks of the corresponding type are decoded into -// the slice. -// -// "label" fields are considered only in a struct used as the type of a field -// marked as "block", and are used sequentially to capture the labels of -// the blocks being decoded. In this case, the name token is used only as -// an identifier for the label in diagnostic messages. -// -// "remain" can be placed on a single field that may be either of type -// hcl.Body or hcl.Attributes, in which case any remaining body content is -// placed into this field for delayed processing. If no "remain" field is -// present then any attributes or blocks not matched by another valid tag -// will cause an error diagnostic. -// -// Only a subset of this tagging/typing vocabulary is supported for the -// "Encode" family of functions. See the EncodeIntoBody docs for full details -// on the constraints there. -// -// Broadly-speaking this package deals with two types of error. The first is -// errors in the configuration itself, which are returned as diagnostics -// written with the configuration author as the target audience. The second -// is bugs in the calling program, such as invalid struct tags, which are -// surfaced via panics since there can be no useful runtime handling of such -// errors and they should certainly not be returned to the user as diagnostics. -package gohcl diff --git a/vendor/github.com/hashicorp/hcl/v2/gohcl/encode.go b/vendor/github.com/hashicorp/hcl/v2/gohcl/encode.go deleted file mode 100644 index d612e09c9..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/gohcl/encode.go +++ /dev/null @@ -1,191 +0,0 @@ -package gohcl - -import ( - "fmt" - "reflect" - "sort" - - "github.com/hashicorp/hcl/v2/hclwrite" - "github.com/zclconf/go-cty/cty/gocty" -) - -// EncodeIntoBody replaces the contents of the given hclwrite Body with -// attributes and blocks derived from the given value, which must be a -// struct value or a pointer to a struct value with the struct tags defined -// in this package. -// -// This function can work only with fully-decoded data. It will ignore any -// fields tagged as "remain", any fields that decode attributes into either -// hcl.Attribute or hcl.Expression values, and any fields that decode blocks -// into hcl.Attributes values. This function does not have enough information -// to complete the decoding of these types. -// -// Any fields tagged as "label" are ignored by this function. Use EncodeAsBlock -// to produce a whole hclwrite.Block including block labels. -// -// As long as a suitable value is given to encode and the destination body -// is non-nil, this function will always complete. It will panic in case of -// any errors in the calling program, such as passing an inappropriate type -// or a nil body. -// -// The layout of the resulting HCL source is derived from the ordering of -// the struct fields, with blank lines around nested blocks of different types. -// Fields representing attributes should usually precede those representing -// blocks so that the attributes can group togather in the result. For more -// control, use the hclwrite API directly. -func EncodeIntoBody(val interface{}, dst *hclwrite.Body) { - rv := reflect.ValueOf(val) - ty := rv.Type() - if ty.Kind() == reflect.Ptr { - rv = rv.Elem() - ty = rv.Type() - } - if ty.Kind() != reflect.Struct { - panic(fmt.Sprintf("value is %s, not struct", ty.Kind())) - } - - tags := getFieldTags(ty) - populateBody(rv, ty, tags, dst) -} - -// EncodeAsBlock creates a new hclwrite.Block populated with the data from -// the given value, which must be a struct or pointer to struct with the -// struct tags defined in this package. -// -// If the given struct type has fields tagged with "label" tags then they -// will be used in order to annotate the created block with labels. -// -// This function has the same constraints as EncodeIntoBody and will panic -// if they are violated. -func EncodeAsBlock(val interface{}, blockType string) *hclwrite.Block { - rv := reflect.ValueOf(val) - ty := rv.Type() - if ty.Kind() == reflect.Ptr { - rv = rv.Elem() - ty = rv.Type() - } - if ty.Kind() != reflect.Struct { - panic(fmt.Sprintf("value is %s, not struct", ty.Kind())) - } - - tags := getFieldTags(ty) - labels := make([]string, len(tags.Labels)) - for i, lf := range tags.Labels { - lv := rv.Field(lf.FieldIndex) - // We just stringify whatever we find. It should always be a string - // but if not then we'll still do something reasonable. - labels[i] = fmt.Sprintf("%s", lv.Interface()) - } - - block := hclwrite.NewBlock(blockType, labels) - populateBody(rv, ty, tags, block.Body()) - return block -} - -func populateBody(rv reflect.Value, ty reflect.Type, tags *fieldTags, dst *hclwrite.Body) { - nameIdxs := make(map[string]int, len(tags.Attributes)+len(tags.Blocks)) - namesOrder := make([]string, 0, len(tags.Attributes)+len(tags.Blocks)) - for n, i := range tags.Attributes { - nameIdxs[n] = i - namesOrder = append(namesOrder, n) - } - for n, i := range tags.Blocks { - nameIdxs[n] = i - namesOrder = append(namesOrder, n) - } - sort.SliceStable(namesOrder, func(i, j int) bool { - ni, nj := namesOrder[i], namesOrder[j] - return nameIdxs[ni] < nameIdxs[nj] - }) - - dst.Clear() - - prevWasBlock := false - for _, name := range namesOrder { - fieldIdx := nameIdxs[name] - field := ty.Field(fieldIdx) - fieldTy := field.Type - fieldVal := rv.Field(fieldIdx) - - if fieldTy.Kind() == reflect.Ptr { - fieldTy = fieldTy.Elem() - fieldVal = fieldVal.Elem() - } - - if _, isAttr := tags.Attributes[name]; isAttr { - - if exprType.AssignableTo(fieldTy) || attrType.AssignableTo(fieldTy) { - continue // ignore undecoded fields - } - if !fieldVal.IsValid() { - continue // ignore (field value is nil pointer) - } - if fieldTy.Kind() == reflect.Ptr && fieldVal.IsNil() { - continue // ignore - } - if prevWasBlock { - dst.AppendNewline() - prevWasBlock = false - } - - valTy, err := gocty.ImpliedType(fieldVal.Interface()) - if err != nil { - panic(fmt.Sprintf("cannot encode %T as HCL expression: %s", fieldVal.Interface(), err)) - } - - val, err := gocty.ToCtyValue(fieldVal.Interface(), valTy) - if err != nil { - // This should never happen, since we should always be able - // to decode into the implied type. - panic(fmt.Sprintf("failed to encode %T as %#v: %s", fieldVal.Interface(), valTy, err)) - } - - dst.SetAttributeValue(name, val) - - } else { // must be a block, then - elemTy := fieldTy - isSeq := false - if elemTy.Kind() == reflect.Slice || elemTy.Kind() == reflect.Array { - isSeq = true - elemTy = elemTy.Elem() - } - - if bodyType.AssignableTo(elemTy) || attrsType.AssignableTo(elemTy) { - continue // ignore undecoded fields - } - prevWasBlock = false - - if isSeq { - l := fieldVal.Len() - for i := 0; i < l; i++ { - elemVal := fieldVal.Index(i) - if !elemVal.IsValid() { - continue // ignore (elem value is nil pointer) - } - if elemTy.Kind() == reflect.Ptr && elemVal.IsNil() { - continue // ignore - } - block := EncodeAsBlock(elemVal.Interface(), name) - if !prevWasBlock { - dst.AppendNewline() - prevWasBlock = true - } - dst.AppendBlock(block) - } - } else { - if !fieldVal.IsValid() { - continue // ignore (field value is nil pointer) - } - if elemTy.Kind() == reflect.Ptr && fieldVal.IsNil() { - continue // ignore - } - block := EncodeAsBlock(fieldVal.Interface(), name) - if !prevWasBlock { - dst.AppendNewline() - prevWasBlock = true - } - dst.AppendBlock(block) - } - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/v2/gohcl/schema.go b/vendor/github.com/hashicorp/hcl/v2/gohcl/schema.go deleted file mode 100644 index ecf6ddbac..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/gohcl/schema.go +++ /dev/null @@ -1,174 +0,0 @@ -package gohcl - -import ( - "fmt" - "reflect" - "sort" - "strings" - - "github.com/hashicorp/hcl/v2" -) - -// ImpliedBodySchema produces a hcl.BodySchema derived from the type of the -// given value, which must be a struct value or a pointer to one. If an -// inappropriate value is passed, this function will panic. -// -// The second return argument indicates whether the given struct includes -// a "remain" field, and thus the returned schema is non-exhaustive. -// -// This uses the tags on the fields of the struct to discover how each -// field's value should be expressed within configuration. If an invalid -// mapping is attempted, this function will panic. -func ImpliedBodySchema(val interface{}) (schema *hcl.BodySchema, partial bool) { - ty := reflect.TypeOf(val) - - if ty.Kind() == reflect.Ptr { - ty = ty.Elem() - } - - if ty.Kind() != reflect.Struct { - panic(fmt.Sprintf("given value must be struct, not %T", val)) - } - - var attrSchemas []hcl.AttributeSchema - var blockSchemas []hcl.BlockHeaderSchema - - tags := getFieldTags(ty) - - attrNames := make([]string, 0, len(tags.Attributes)) - for n := range tags.Attributes { - attrNames = append(attrNames, n) - } - sort.Strings(attrNames) - for _, n := range attrNames { - idx := tags.Attributes[n] - optional := tags.Optional[n] - field := ty.Field(idx) - - var required bool - - switch { - case field.Type.AssignableTo(exprType): - // If we're decoding to hcl.Expression then absense can be - // indicated via a null value, so we don't specify that - // the field is required during decoding. - required = false - case field.Type.Kind() != reflect.Ptr && !optional: - required = true - default: - required = false - } - - attrSchemas = append(attrSchemas, hcl.AttributeSchema{ - Name: n, - Required: required, - }) - } - - blockNames := make([]string, 0, len(tags.Blocks)) - for n := range tags.Blocks { - blockNames = append(blockNames, n) - } - sort.Strings(blockNames) - for _, n := range blockNames { - idx := tags.Blocks[n] - field := ty.Field(idx) - fty := field.Type - if fty.Kind() == reflect.Slice { - fty = fty.Elem() - } - if fty.Kind() == reflect.Ptr { - fty = fty.Elem() - } - if fty.Kind() != reflect.Struct { - panic(fmt.Sprintf( - "hcl 'block' tag kind cannot be applied to %s field %s: struct required", field.Type.String(), field.Name, - )) - } - ftags := getFieldTags(fty) - var labelNames []string - if len(ftags.Labels) > 0 { - labelNames = make([]string, len(ftags.Labels)) - for i, l := range ftags.Labels { - labelNames[i] = l.Name - } - } - - blockSchemas = append(blockSchemas, hcl.BlockHeaderSchema{ - Type: n, - LabelNames: labelNames, - }) - } - - partial = tags.Remain != nil - schema = &hcl.BodySchema{ - Attributes: attrSchemas, - Blocks: blockSchemas, - } - return schema, partial -} - -type fieldTags struct { - Attributes map[string]int - Blocks map[string]int - Labels []labelField - Remain *int - Optional map[string]bool -} - -type labelField struct { - FieldIndex int - Name string -} - -func getFieldTags(ty reflect.Type) *fieldTags { - ret := &fieldTags{ - Attributes: map[string]int{}, - Blocks: map[string]int{}, - Optional: map[string]bool{}, - } - - ct := ty.NumField() - for i := 0; i < ct; i++ { - field := ty.Field(i) - tag := field.Tag.Get("hcl") - if tag == "" { - continue - } - - comma := strings.Index(tag, ",") - var name, kind string - if comma != -1 { - name = tag[:comma] - kind = tag[comma+1:] - } else { - name = tag - kind = "attr" - } - - switch kind { - case "attr": - ret.Attributes[name] = i - case "block": - ret.Blocks[name] = i - case "label": - ret.Labels = append(ret.Labels, labelField{ - FieldIndex: i, - Name: name, - }) - case "remain": - if ret.Remain != nil { - panic("only one 'remain' tag is permitted") - } - idx := i // copy, because this loop will continue assigning to i - ret.Remain = &idx - case "optional": - ret.Attributes[name] = i - ret.Optional[name] = true - default: - panic(fmt.Sprintf("invalid hcl field tag kind %q on %s %q", kind, field.Type.String(), field.Name)) - } - } - - return ret -} diff --git a/vendor/github.com/hashicorp/hcl/v2/gohcl/types.go b/vendor/github.com/hashicorp/hcl/v2/gohcl/types.go deleted file mode 100644 index a8d00f8ff..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/gohcl/types.go +++ /dev/null @@ -1,16 +0,0 @@ -package gohcl - -import ( - "reflect" - - "github.com/hashicorp/hcl/v2" -) - -var victimExpr hcl.Expression -var victimBody hcl.Body - -var exprType = reflect.TypeOf(&victimExpr).Elem() -var bodyType = reflect.TypeOf(&victimBody).Elem() -var blockType = reflect.TypeOf((*hcl.Block)(nil)) -var attrType = reflect.TypeOf((*hcl.Attribute)(nil)) -var attrsType = reflect.TypeOf(hcl.Attributes(nil)) diff --git a/vendor/github.com/hashicorp/hcl/v2/hclparse/parser.go b/vendor/github.com/hashicorp/hcl/v2/hclparse/parser.go deleted file mode 100644 index 1dc2eccd8..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclparse/parser.go +++ /dev/null @@ -1,135 +0,0 @@ -// Package hclparse has the main API entry point for parsing both HCL native -// syntax and HCL JSON. -// -// The main HCL package also includes SimpleParse and SimpleParseFile which -// can be a simpler interface for the common case where an application just -// needs to parse a single file. The gohcl package simplifies that further -// in its SimpleDecode function, which combines hcl.SimpleParse with decoding -// into Go struct values -// -// Package hclparse, then, is useful for applications that require more fine -// control over parsing or which need to load many separate files and keep -// track of them for possible error reporting or other analysis. -package hclparse - -import ( - "fmt" - "io/ioutil" - - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" - "github.com/hashicorp/hcl/v2/json" -) - -// NOTE: This is the public interface for parsing. The actual parsers are -// in other packages alongside this one, with this package just wrapping them -// to provide a unified interface for the caller across all supported formats. - -// Parser is the main interface for parsing configuration files. As well as -// parsing files, a parser also retains a registry of all of the files it -// has parsed so that multiple attempts to parse the same file will return -// the same object and so the collected files can be used when printing -// diagnostics. -// -// Any diagnostics for parsing a file are only returned once on the first -// call to parse that file. Callers are expected to collect up diagnostics -// and present them together, so returning diagnostics for the same file -// multiple times would create a confusing result. -type Parser struct { - files map[string]*hcl.File -} - -// NewParser creates a new parser, ready to parse configuration files. -func NewParser() *Parser { - return &Parser{ - files: map[string]*hcl.File{}, - } -} - -// ParseHCL parses the given buffer (which is assumed to have been loaded from -// the given filename) as a native-syntax configuration file and returns the -// hcl.File object representing it. -func (p *Parser) ParseHCL(src []byte, filename string) (*hcl.File, hcl.Diagnostics) { - if existing := p.files[filename]; existing != nil { - return existing, nil - } - - file, diags := hclsyntax.ParseConfig(src, filename, hcl.Pos{Byte: 0, Line: 1, Column: 1}) - p.files[filename] = file - return file, diags -} - -// ParseHCLFile reads the given filename and parses it as a native-syntax HCL -// configuration file. An error diagnostic is returned if the given file -// cannot be read. -func (p *Parser) ParseHCLFile(filename string) (*hcl.File, hcl.Diagnostics) { - if existing := p.files[filename]; existing != nil { - return existing, nil - } - - src, err := ioutil.ReadFile(filename) - if err != nil { - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Failed to read file", - Detail: fmt.Sprintf("The configuration file %q could not be read.", filename), - }, - } - } - - return p.ParseHCL(src, filename) -} - -// ParseJSON parses the given JSON buffer (which is assumed to have been loaded -// from the given filename) and returns the hcl.File object representing it. -func (p *Parser) ParseJSON(src []byte, filename string) (*hcl.File, hcl.Diagnostics) { - if existing := p.files[filename]; existing != nil { - return existing, nil - } - - file, diags := json.Parse(src, filename) - p.files[filename] = file - return file, diags -} - -// ParseJSONFile reads the given filename and parses it as JSON, similarly to -// ParseJSON. An error diagnostic is returned if the given file cannot be read. -func (p *Parser) ParseJSONFile(filename string) (*hcl.File, hcl.Diagnostics) { - if existing := p.files[filename]; existing != nil { - return existing, nil - } - - file, diags := json.ParseFile(filename) - p.files[filename] = file - return file, diags -} - -// AddFile allows a caller to record in a parser a file that was parsed some -// other way, thus allowing it to be included in the registry of sources. -func (p *Parser) AddFile(filename string, file *hcl.File) { - p.files[filename] = file -} - -// Sources returns a map from filenames to the raw source code that was -// read from them. This is intended to be used, for example, to print -// diagnostics with contextual information. -// -// The arrays underlying the returned slices should not be modified. -func (p *Parser) Sources() map[string][]byte { - ret := make(map[string][]byte) - for fn, f := range p.files { - ret[fn] = f.Bytes - } - return ret -} - -// Files returns a map from filenames to the File objects produced from them. -// This is intended to be used, for example, to print diagnostics with -// contextual information. -// -// The returned map and all of the objects it refers to directly or indirectly -// must not be modified. -func (p *Parser) Files() map[string]*hcl.File { - return p.files -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/diagnostics.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/diagnostics.go deleted file mode 100644 index 8c20286b2..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/diagnostics.go +++ /dev/null @@ -1,23 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl/v2" -) - -// setDiagEvalContext is an internal helper that will impose a particular -// EvalContext on a set of diagnostics in-place, for any diagnostic that -// does not already have an EvalContext set. -// -// We generally expect diagnostics to be immutable, but this is safe to use -// on any Diagnostics where none of the contained Diagnostic objects have yet -// been seen by a caller. Its purpose is to apply additional context to a -// set of diagnostics produced by a "deeper" component as the stack unwinds -// during expression evaluation. -func setDiagEvalContext(diags hcl.Diagnostics, expr hcl.Expression, ctx *hcl.EvalContext) { - for _, diag := range diags { - if diag.Expression == nil { - diag.Expression = expr - diag.EvalContext = ctx - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/didyoumean.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/didyoumean.go deleted file mode 100644 index ccc1c0ae2..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/didyoumean.go +++ /dev/null @@ -1,24 +0,0 @@ -package hclsyntax - -import ( - "github.com/agext/levenshtein" -) - -// nameSuggestion tries to find a name from the given slice of suggested names -// that is close to the given name and returns it if found. If no suggestion -// is close enough, returns the empty string. -// -// The suggestions are tried in order, so earlier suggestions take precedence -// if the given string is similar to two or more suggestions. -// -// This function is intended to be used with a relatively-small number of -// suggestions. It's not optimized for hundreds or thousands of them. -func nameSuggestion(given string, suggestions []string) string { - for _, suggestion := range suggestions { - dist := levenshtein.Distance(given, suggestion, nil) - if dist < 3 { // threshold determined experimentally - return suggestion - } - } - return "" -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/doc.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/doc.go deleted file mode 100644 index 617bc29dc..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// Package hclsyntax contains the parser, AST, etc for HCL's native language, -// as opposed to the JSON variant. -// -// In normal use applications should rarely depend on this package directly, -// instead preferring the higher-level interface of the main hcl package and -// its companion package hclparse. -package hclsyntax diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go deleted file mode 100644 index 963ed7752..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go +++ /dev/null @@ -1,1477 +0,0 @@ -package hclsyntax - -import ( - "fmt" - "sync" - - "github.com/hashicorp/hcl/v2" - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" - "github.com/zclconf/go-cty/cty/function" -) - -// Expression is the abstract type for nodes that behave as HCL expressions. -type Expression interface { - Node - - // The hcl.Expression methods are duplicated here, rather than simply - // embedded, because both Node and hcl.Expression have a Range method - // and so they conflict. - - Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) - Variables() []hcl.Traversal - StartRange() hcl.Range -} - -// Assert that Expression implements hcl.Expression -var assertExprImplExpr hcl.Expression = Expression(nil) - -// LiteralValueExpr is an expression that just always returns a given value. -type LiteralValueExpr struct { - Val cty.Value - SrcRange hcl.Range -} - -func (e *LiteralValueExpr) walkChildNodes(w internalWalkFunc) { - // Literal values have no child nodes -} - -func (e *LiteralValueExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - return e.Val, nil -} - -func (e *LiteralValueExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *LiteralValueExpr) StartRange() hcl.Range { - return e.SrcRange -} - -// Implementation for hcl.AbsTraversalForExpr. -func (e *LiteralValueExpr) AsTraversal() hcl.Traversal { - // This one's a little weird: the contract for AsTraversal is to interpret - // an expression as if it were traversal syntax, and traversal syntax - // doesn't have the special keywords "null", "true", and "false" so these - // are expected to be treated like variables in that case. - // Since our parser already turned them into LiteralValueExpr by the time - // we get here, we need to undo this and infer the name that would've - // originally led to our value. - // We don't do anything for any other values, since they don't overlap - // with traversal roots. - - if e.Val.IsNull() { - // In practice the parser only generates null values of the dynamic - // pseudo-type for literals, so we can safely assume that any null - // was orignally the keyword "null". - return hcl.Traversal{ - hcl.TraverseRoot{ - Name: "null", - SrcRange: e.SrcRange, - }, - } - } - - switch e.Val { - case cty.True: - return hcl.Traversal{ - hcl.TraverseRoot{ - Name: "true", - SrcRange: e.SrcRange, - }, - } - case cty.False: - return hcl.Traversal{ - hcl.TraverseRoot{ - Name: "false", - SrcRange: e.SrcRange, - }, - } - default: - // No traversal is possible for any other value. - return nil - } -} - -// ScopeTraversalExpr is an Expression that retrieves a value from the scope -// using a traversal. -type ScopeTraversalExpr struct { - Traversal hcl.Traversal - SrcRange hcl.Range -} - -func (e *ScopeTraversalExpr) walkChildNodes(w internalWalkFunc) { - // Scope traversals have no child nodes -} - -func (e *ScopeTraversalExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - val, diags := e.Traversal.TraverseAbs(ctx) - setDiagEvalContext(diags, e, ctx) - return val, diags -} - -func (e *ScopeTraversalExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *ScopeTraversalExpr) StartRange() hcl.Range { - return e.SrcRange -} - -// Implementation for hcl.AbsTraversalForExpr. -func (e *ScopeTraversalExpr) AsTraversal() hcl.Traversal { - return e.Traversal -} - -// RelativeTraversalExpr is an Expression that retrieves a value from another -// value using a _relative_ traversal. -type RelativeTraversalExpr struct { - Source Expression - Traversal hcl.Traversal - SrcRange hcl.Range -} - -func (e *RelativeTraversalExpr) walkChildNodes(w internalWalkFunc) { - w(e.Source) -} - -func (e *RelativeTraversalExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - src, diags := e.Source.Value(ctx) - ret, travDiags := e.Traversal.TraverseRel(src) - setDiagEvalContext(travDiags, e, ctx) - diags = append(diags, travDiags...) - return ret, diags -} - -func (e *RelativeTraversalExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *RelativeTraversalExpr) StartRange() hcl.Range { - return e.SrcRange -} - -// Implementation for hcl.AbsTraversalForExpr. -func (e *RelativeTraversalExpr) AsTraversal() hcl.Traversal { - // We can produce a traversal only if our source can. - st, diags := hcl.AbsTraversalForExpr(e.Source) - if diags.HasErrors() { - return nil - } - - ret := make(hcl.Traversal, len(st)+len(e.Traversal)) - copy(ret, st) - copy(ret[len(st):], e.Traversal) - return ret -} - -// FunctionCallExpr is an Expression that calls a function from the EvalContext -// and returns its result. -type FunctionCallExpr struct { - Name string - Args []Expression - - // If true, the final argument should be a tuple, list or set which will - // expand to be one argument per element. - ExpandFinal bool - - NameRange hcl.Range - OpenParenRange hcl.Range - CloseParenRange hcl.Range -} - -func (e *FunctionCallExpr) walkChildNodes(w internalWalkFunc) { - for _, arg := range e.Args { - w(arg) - } -} - -func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var diags hcl.Diagnostics - - var f function.Function - exists := false - hasNonNilMap := false - thisCtx := ctx - for thisCtx != nil { - if thisCtx.Functions == nil { - thisCtx = thisCtx.Parent() - continue - } - hasNonNilMap = true - f, exists = thisCtx.Functions[e.Name] - if exists { - break - } - thisCtx = thisCtx.Parent() - } - - if !exists { - if !hasNonNilMap { - return cty.DynamicVal, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Function calls not allowed", - Detail: "Functions may not be called here.", - Subject: e.Range().Ptr(), - Expression: e, - EvalContext: ctx, - }, - } - } - - avail := make([]string, 0, len(ctx.Functions)) - for name := range ctx.Functions { - avail = append(avail, name) - } - suggestion := nameSuggestion(e.Name, avail) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } - - return cty.DynamicVal, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Call to unknown function", - Detail: fmt.Sprintf("There is no function named %q.%s", e.Name, suggestion), - Subject: &e.NameRange, - Context: e.Range().Ptr(), - Expression: e, - EvalContext: ctx, - }, - } - } - - params := f.Params() - varParam := f.VarParam() - - args := e.Args - if e.ExpandFinal { - if len(args) < 1 { - // should never happen if the parser is behaving - panic("ExpandFinal set on function call with no arguments") - } - expandExpr := args[len(args)-1] - expandVal, expandDiags := expandExpr.Value(ctx) - diags = append(diags, expandDiags...) - if expandDiags.HasErrors() { - return cty.DynamicVal, diags - } - - switch { - case expandVal.Type().IsTupleType() || expandVal.Type().IsListType() || expandVal.Type().IsSetType(): - if expandVal.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid expanding argument value", - Detail: "The expanding argument (indicated by ...) must not be null.", - Subject: expandExpr.Range().Ptr(), - Context: e.Range().Ptr(), - Expression: expandExpr, - EvalContext: ctx, - }) - return cty.DynamicVal, diags - } - if !expandVal.IsKnown() { - return cty.DynamicVal, diags - } - - newArgs := make([]Expression, 0, (len(args)-1)+expandVal.LengthInt()) - newArgs = append(newArgs, args[:len(args)-1]...) - it := expandVal.ElementIterator() - for it.Next() { - _, val := it.Element() - newArgs = append(newArgs, &LiteralValueExpr{ - Val: val, - SrcRange: expandExpr.Range(), - }) - } - args = newArgs - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid expanding argument value", - Detail: "The expanding argument (indicated by ...) must be of a tuple, list, or set type.", - Subject: expandExpr.Range().Ptr(), - Context: e.Range().Ptr(), - Expression: expandExpr, - EvalContext: ctx, - }) - return cty.DynamicVal, diags - } - } - - if len(args) < len(params) { - missing := params[len(args)] - qual := "" - if varParam != nil { - qual = " at least" - } - return cty.DynamicVal, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Not enough function arguments", - Detail: fmt.Sprintf( - "Function %q expects%s %d argument(s). Missing value for %q.", - e.Name, qual, len(params), missing.Name, - ), - Subject: &e.CloseParenRange, - Context: e.Range().Ptr(), - Expression: e, - EvalContext: ctx, - }, - } - } - - if varParam == nil && len(args) > len(params) { - return cty.DynamicVal, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Too many function arguments", - Detail: fmt.Sprintf( - "Function %q expects only %d argument(s).", - e.Name, len(params), - ), - Subject: args[len(params)].StartRange().Ptr(), - Context: e.Range().Ptr(), - Expression: e, - EvalContext: ctx, - }, - } - } - - argVals := make([]cty.Value, len(args)) - - for i, argExpr := range args { - var param *function.Parameter - if i < len(params) { - param = ¶ms[i] - } else { - param = varParam - } - - val, argDiags := argExpr.Value(ctx) - if len(argDiags) > 0 { - diags = append(diags, argDiags...) - } - - // Try to convert our value to the parameter type - val, err := convert.Convert(val, param.Type) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid function argument", - Detail: fmt.Sprintf( - "Invalid value for %q parameter: %s.", - param.Name, err, - ), - Subject: argExpr.StartRange().Ptr(), - Context: e.Range().Ptr(), - Expression: argExpr, - EvalContext: ctx, - }) - } - - argVals[i] = val - } - - if diags.HasErrors() { - // Don't try to execute the function if we already have errors with - // the arguments, because the result will probably be a confusing - // error message. - return cty.DynamicVal, diags - } - - resultVal, err := f.Call(argVals) - if err != nil { - switch terr := err.(type) { - case function.ArgError: - i := terr.Index - var param *function.Parameter - if i < len(params) { - param = ¶ms[i] - } else { - param = varParam - } - argExpr := e.Args[i] - - // TODO: we should also unpick a PathError here and show the - // path to the deep value where the error was detected. - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid function argument", - Detail: fmt.Sprintf( - "Invalid value for %q parameter: %s.", - param.Name, err, - ), - Subject: argExpr.StartRange().Ptr(), - Context: e.Range().Ptr(), - Expression: argExpr, - EvalContext: ctx, - }) - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Error in function call", - Detail: fmt.Sprintf( - "Call to function %q failed: %s.", - e.Name, err, - ), - Subject: e.StartRange().Ptr(), - Context: e.Range().Ptr(), - Expression: e, - EvalContext: ctx, - }) - } - - return cty.DynamicVal, diags - } - - return resultVal, diags -} - -func (e *FunctionCallExpr) Range() hcl.Range { - return hcl.RangeBetween(e.NameRange, e.CloseParenRange) -} - -func (e *FunctionCallExpr) StartRange() hcl.Range { - return hcl.RangeBetween(e.NameRange, e.OpenParenRange) -} - -// Implementation for hcl.ExprCall. -func (e *FunctionCallExpr) ExprCall() *hcl.StaticCall { - ret := &hcl.StaticCall{ - Name: e.Name, - NameRange: e.NameRange, - Arguments: make([]hcl.Expression, len(e.Args)), - ArgsRange: hcl.RangeBetween(e.OpenParenRange, e.CloseParenRange), - } - // Need to convert our own Expression objects into hcl.Expression. - for i, arg := range e.Args { - ret.Arguments[i] = arg - } - return ret -} - -type ConditionalExpr struct { - Condition Expression - TrueResult Expression - FalseResult Expression - - SrcRange hcl.Range -} - -func (e *ConditionalExpr) walkChildNodes(w internalWalkFunc) { - w(e.Condition) - w(e.TrueResult) - w(e.FalseResult) -} - -func (e *ConditionalExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - trueResult, trueDiags := e.TrueResult.Value(ctx) - falseResult, falseDiags := e.FalseResult.Value(ctx) - var diags hcl.Diagnostics - - resultType := cty.DynamicPseudoType - convs := make([]convert.Conversion, 2) - - switch { - // If either case is a dynamic null value (which would result from a - // literal null in the config), we know that it can convert to the expected - // type of the opposite case, and we don't need to speculatively reduce the - // final result type to DynamicPseudoType. - - // If we know that either Type is a DynamicPseudoType, we can be certain - // that the other value can convert since it's a pass-through, and we don't - // need to unify the types. If the final evaluation results in the dynamic - // value being returned, there's no conversion we can do, so we return the - // value directly. - case trueResult.RawEquals(cty.NullVal(cty.DynamicPseudoType)): - resultType = falseResult.Type() - convs[0] = convert.GetConversionUnsafe(cty.DynamicPseudoType, resultType) - case falseResult.RawEquals(cty.NullVal(cty.DynamicPseudoType)): - resultType = trueResult.Type() - convs[1] = convert.GetConversionUnsafe(cty.DynamicPseudoType, resultType) - case trueResult.Type() == cty.DynamicPseudoType, falseResult.Type() == cty.DynamicPseudoType: - // the final resultType type is still unknown - // we don't need to get the conversion, because both are a noop. - - default: - // Try to find a type that both results can be converted to. - resultType, convs = convert.UnifyUnsafe([]cty.Type{trueResult.Type(), falseResult.Type()}) - } - - if resultType == cty.NilType { - return cty.DynamicVal, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Inconsistent conditional result types", - Detail: fmt.Sprintf( - // FIXME: Need a helper function for showing natural-language type diffs, - // since this will generate some useless messages in some cases, like - // "These expressions are object and object respectively" if the - // object types don't exactly match. - "The true and false result expressions must have consistent types. The given expressions are %s and %s, respectively.", - trueResult.Type().FriendlyName(), falseResult.Type().FriendlyName(), - ), - Subject: hcl.RangeBetween(e.TrueResult.Range(), e.FalseResult.Range()).Ptr(), - Context: &e.SrcRange, - Expression: e, - EvalContext: ctx, - }, - } - } - - condResult, condDiags := e.Condition.Value(ctx) - diags = append(diags, condDiags...) - if condResult.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Null condition", - Detail: "The condition value is null. Conditions must either be true or false.", - Subject: e.Condition.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.Condition, - EvalContext: ctx, - }) - return cty.UnknownVal(resultType), diags - } - if !condResult.IsKnown() { - return cty.UnknownVal(resultType), diags - } - condResult, err := convert.Convert(condResult, cty.Bool) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect condition type", - Detail: fmt.Sprintf("The condition expression must be of type bool."), - Subject: e.Condition.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.Condition, - EvalContext: ctx, - }) - return cty.UnknownVal(resultType), diags - } - - if condResult.True() { - diags = append(diags, trueDiags...) - if convs[0] != nil { - var err error - trueResult, err = convs[0](trueResult) - if err != nil { - // Unsafe conversion failed with the concrete result value - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Inconsistent conditional result types", - Detail: fmt.Sprintf( - "The true result value has the wrong type: %s.", - err.Error(), - ), - Subject: e.TrueResult.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.TrueResult, - EvalContext: ctx, - }) - trueResult = cty.UnknownVal(resultType) - } - } - return trueResult, diags - } else { - diags = append(diags, falseDiags...) - if convs[1] != nil { - var err error - falseResult, err = convs[1](falseResult) - if err != nil { - // Unsafe conversion failed with the concrete result value - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Inconsistent conditional result types", - Detail: fmt.Sprintf( - "The false result value has the wrong type: %s.", - err.Error(), - ), - Subject: e.FalseResult.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.FalseResult, - EvalContext: ctx, - }) - falseResult = cty.UnknownVal(resultType) - } - } - return falseResult, diags - } -} - -func (e *ConditionalExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *ConditionalExpr) StartRange() hcl.Range { - return e.Condition.StartRange() -} - -type IndexExpr struct { - Collection Expression - Key Expression - - SrcRange hcl.Range - OpenRange hcl.Range -} - -func (e *IndexExpr) walkChildNodes(w internalWalkFunc) { - w(e.Collection) - w(e.Key) -} - -func (e *IndexExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var diags hcl.Diagnostics - coll, collDiags := e.Collection.Value(ctx) - key, keyDiags := e.Key.Value(ctx) - diags = append(diags, collDiags...) - diags = append(diags, keyDiags...) - - val, indexDiags := hcl.Index(coll, key, &e.SrcRange) - setDiagEvalContext(indexDiags, e, ctx) - diags = append(diags, indexDiags...) - return val, diags -} - -func (e *IndexExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *IndexExpr) StartRange() hcl.Range { - return e.OpenRange -} - -type TupleConsExpr struct { - Exprs []Expression - - SrcRange hcl.Range - OpenRange hcl.Range -} - -func (e *TupleConsExpr) walkChildNodes(w internalWalkFunc) { - for _, expr := range e.Exprs { - w(expr) - } -} - -func (e *TupleConsExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var vals []cty.Value - var diags hcl.Diagnostics - - vals = make([]cty.Value, len(e.Exprs)) - for i, expr := range e.Exprs { - val, valDiags := expr.Value(ctx) - vals[i] = val - diags = append(diags, valDiags...) - } - - return cty.TupleVal(vals), diags -} - -func (e *TupleConsExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *TupleConsExpr) StartRange() hcl.Range { - return e.OpenRange -} - -// Implementation for hcl.ExprList -func (e *TupleConsExpr) ExprList() []hcl.Expression { - ret := make([]hcl.Expression, len(e.Exprs)) - for i, expr := range e.Exprs { - ret[i] = expr - } - return ret -} - -type ObjectConsExpr struct { - Items []ObjectConsItem - - SrcRange hcl.Range - OpenRange hcl.Range -} - -type ObjectConsItem struct { - KeyExpr Expression - ValueExpr Expression -} - -func (e *ObjectConsExpr) walkChildNodes(w internalWalkFunc) { - for _, item := range e.Items { - w(item.KeyExpr) - w(item.ValueExpr) - } -} - -func (e *ObjectConsExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var vals map[string]cty.Value - var diags hcl.Diagnostics - - // This will get set to true if we fail to produce any of our keys, - // either because they are actually unknown or if the evaluation produces - // errors. In all of these case we must return DynamicPseudoType because - // we're unable to know the full set of keys our object has, and thus - // we can't produce a complete value of the intended type. - // - // We still evaluate all of the item keys and values to make sure that we - // get as complete as possible a set of diagnostics. - known := true - - vals = make(map[string]cty.Value, len(e.Items)) - for _, item := range e.Items { - key, keyDiags := item.KeyExpr.Value(ctx) - diags = append(diags, keyDiags...) - - val, valDiags := item.ValueExpr.Value(ctx) - diags = append(diags, valDiags...) - - if keyDiags.HasErrors() { - known = false - continue - } - - if key.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Null value as key", - Detail: "Can't use a null value as a key.", - Subject: item.ValueExpr.Range().Ptr(), - Expression: item.KeyExpr, - EvalContext: ctx, - }) - known = false - continue - } - - var err error - key, err = convert.Convert(key, cty.String) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect key type", - Detail: fmt.Sprintf("Can't use this value as a key: %s.", err.Error()), - Subject: item.KeyExpr.Range().Ptr(), - Expression: item.KeyExpr, - EvalContext: ctx, - }) - known = false - continue - } - - if !key.IsKnown() { - known = false - continue - } - - keyStr := key.AsString() - - vals[keyStr] = val - } - - if !known { - return cty.DynamicVal, diags - } - - return cty.ObjectVal(vals), diags -} - -func (e *ObjectConsExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *ObjectConsExpr) StartRange() hcl.Range { - return e.OpenRange -} - -// Implementation for hcl.ExprMap -func (e *ObjectConsExpr) ExprMap() []hcl.KeyValuePair { - ret := make([]hcl.KeyValuePair, len(e.Items)) - for i, item := range e.Items { - ret[i] = hcl.KeyValuePair{ - Key: item.KeyExpr, - Value: item.ValueExpr, - } - } - return ret -} - -// ObjectConsKeyExpr is a special wrapper used only for ObjectConsExpr keys, -// which deals with the special case that a naked identifier in that position -// must be interpreted as a literal string rather than evaluated directly. -type ObjectConsKeyExpr struct { - Wrapped Expression - ForceNonLiteral bool -} - -func (e *ObjectConsKeyExpr) literalName() string { - // This is our logic for deciding whether to behave like a literal string. - // We lean on our AbsTraversalForExpr implementation here, which already - // deals with some awkward cases like the expression being the result - // of the keywords "null", "true" and "false" which we'd want to interpret - // as keys here too. - return hcl.ExprAsKeyword(e.Wrapped) -} - -func (e *ObjectConsKeyExpr) walkChildNodes(w internalWalkFunc) { - // We only treat our wrapped expression as a real expression if we're - // not going to interpret it as a literal. - if e.literalName() == "" { - w(e.Wrapped) - } -} - -func (e *ObjectConsKeyExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - // Because we accept a naked identifier as a literal key rather than a - // reference, it's confusing to accept a traversal containing periods - // here since we can't tell if the user intends to create a key with - // periods or actually reference something. To avoid confusing downstream - // errors we'll just prohibit a naked multi-step traversal here and - // require the user to state their intent more clearly. - // (This is handled at evaluation time rather than parse time because - // an application using static analysis _can_ accept a naked multi-step - // traversal here, if desired.) - if !e.ForceNonLiteral { - if travExpr, isTraversal := e.Wrapped.(*ScopeTraversalExpr); isTraversal && len(travExpr.Traversal) > 1 { - var diags hcl.Diagnostics - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Ambiguous attribute key", - Detail: "If this expression is intended to be a reference, wrap it in parentheses. If it's instead intended as a literal name containing periods, wrap it in quotes to create a string literal.", - Subject: e.Range().Ptr(), - }) - return cty.DynamicVal, diags - } - - if ln := e.literalName(); ln != "" { - return cty.StringVal(ln), nil - } - } - return e.Wrapped.Value(ctx) -} - -func (e *ObjectConsKeyExpr) Range() hcl.Range { - return e.Wrapped.Range() -} - -func (e *ObjectConsKeyExpr) StartRange() hcl.Range { - return e.Wrapped.StartRange() -} - -// Implementation for hcl.AbsTraversalForExpr. -func (e *ObjectConsKeyExpr) AsTraversal() hcl.Traversal { - // If we're forcing a non-literal then we can never be interpreted - // as a traversal. - if e.ForceNonLiteral { - return nil - } - - // We can produce a traversal only if our wrappee can. - st, diags := hcl.AbsTraversalForExpr(e.Wrapped) - if diags.HasErrors() { - return nil - } - - return st -} - -func (e *ObjectConsKeyExpr) UnwrapExpression() Expression { - return e.Wrapped -} - -// ForExpr represents iteration constructs: -// -// tuple = [for i, v in list: upper(v) if i > 2] -// object = {for k, v in map: k => upper(v)} -// object_of_tuples = {for v in list: v.key: v...} -type ForExpr struct { - KeyVar string // empty if ignoring the key - ValVar string - - CollExpr Expression - - KeyExpr Expression // nil when producing a tuple - ValExpr Expression - CondExpr Expression // null if no "if" clause is present - - Group bool // set if the ellipsis is used on the value in an object for - - SrcRange hcl.Range - OpenRange hcl.Range - CloseRange hcl.Range -} - -func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var diags hcl.Diagnostics - - collVal, collDiags := e.CollExpr.Value(ctx) - diags = append(diags, collDiags...) - - if collVal.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Iteration over null value", - Detail: "A null value cannot be used as the collection in a 'for' expression.", - Subject: e.CollExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.CollExpr, - EvalContext: ctx, - }) - return cty.DynamicVal, diags - } - if collVal.Type() == cty.DynamicPseudoType { - return cty.DynamicVal, diags - } - if !collVal.CanIterateElements() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Iteration over non-iterable value", - Detail: fmt.Sprintf( - "A value of type %s cannot be used as the collection in a 'for' expression.", - collVal.Type().FriendlyName(), - ), - Subject: e.CollExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.CollExpr, - EvalContext: ctx, - }) - return cty.DynamicVal, diags - } - if !collVal.IsKnown() { - return cty.DynamicVal, diags - } - - // Before we start we'll do an early check to see if any CondExpr we've - // been given is of the wrong type. This isn't 100% reliable (it may - // be DynamicVal until real values are given) but it should catch some - // straightforward cases and prevent a barrage of repeated errors. - if e.CondExpr != nil { - childCtx := ctx.NewChild() - childCtx.Variables = map[string]cty.Value{} - if e.KeyVar != "" { - childCtx.Variables[e.KeyVar] = cty.DynamicVal - } - childCtx.Variables[e.ValVar] = cty.DynamicVal - - result, condDiags := e.CondExpr.Value(childCtx) - diags = append(diags, condDiags...) - if result.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Condition is null", - Detail: "The value of the 'if' clause must not be null.", - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.CondExpr, - EvalContext: ctx, - }) - return cty.DynamicVal, diags - } - _, err := convert.Convert(result, cty.Bool) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' condition", - Detail: fmt.Sprintf("The 'if' clause value is invalid: %s.", err.Error()), - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.CondExpr, - EvalContext: ctx, - }) - return cty.DynamicVal, diags - } - if condDiags.HasErrors() { - return cty.DynamicVal, diags - } - } - - if e.KeyExpr != nil { - // Producing an object - var vals map[string]cty.Value - var groupVals map[string][]cty.Value - if e.Group { - groupVals = map[string][]cty.Value{} - } else { - vals = map[string]cty.Value{} - } - - it := collVal.ElementIterator() - - known := true - for it.Next() { - k, v := it.Element() - childCtx := ctx.NewChild() - childCtx.Variables = map[string]cty.Value{} - if e.KeyVar != "" { - childCtx.Variables[e.KeyVar] = k - } - childCtx.Variables[e.ValVar] = v - - if e.CondExpr != nil { - includeRaw, condDiags := e.CondExpr.Value(childCtx) - diags = append(diags, condDiags...) - if includeRaw.IsNull() { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' condition", - Detail: "The value of the 'if' clause must not be null.", - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.CondExpr, - EvalContext: childCtx, - }) - } - known = false - continue - } - include, err := convert.Convert(includeRaw, cty.Bool) - if err != nil { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' condition", - Detail: fmt.Sprintf("The 'if' clause value is invalid: %s.", err.Error()), - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.CondExpr, - EvalContext: childCtx, - }) - } - known = false - continue - } - if !include.IsKnown() { - known = false - continue - } - - if include.False() { - // Skip this element - continue - } - } - - keyRaw, keyDiags := e.KeyExpr.Value(childCtx) - diags = append(diags, keyDiags...) - if keyRaw.IsNull() { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid object key", - Detail: "Key expression in 'for' expression must not produce a null value.", - Subject: e.KeyExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.KeyExpr, - EvalContext: childCtx, - }) - } - known = false - continue - } - if !keyRaw.IsKnown() { - known = false - continue - } - - key, err := convert.Convert(keyRaw, cty.String) - if err != nil { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid object key", - Detail: fmt.Sprintf("The key expression produced an invalid result: %s.", err.Error()), - Subject: e.KeyExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.KeyExpr, - EvalContext: childCtx, - }) - } - known = false - continue - } - - val, valDiags := e.ValExpr.Value(childCtx) - diags = append(diags, valDiags...) - - if e.Group { - k := key.AsString() - groupVals[k] = append(groupVals[k], val) - } else { - k := key.AsString() - if _, exists := vals[k]; exists { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Duplicate object key", - Detail: fmt.Sprintf( - "Two different items produced the key %q in this 'for' expression. If duplicates are expected, use the ellipsis (...) after the value expression to enable grouping by key.", - k, - ), - Subject: e.KeyExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.KeyExpr, - EvalContext: childCtx, - }) - } else { - vals[key.AsString()] = val - } - } - } - - if !known { - return cty.DynamicVal, diags - } - - if e.Group { - vals = map[string]cty.Value{} - for k, gvs := range groupVals { - vals[k] = cty.TupleVal(gvs) - } - } - - return cty.ObjectVal(vals), diags - - } else { - // Producing a tuple - vals := []cty.Value{} - - it := collVal.ElementIterator() - - known := true - for it.Next() { - k, v := it.Element() - childCtx := ctx.NewChild() - childCtx.Variables = map[string]cty.Value{} - if e.KeyVar != "" { - childCtx.Variables[e.KeyVar] = k - } - childCtx.Variables[e.ValVar] = v - - if e.CondExpr != nil { - includeRaw, condDiags := e.CondExpr.Value(childCtx) - diags = append(diags, condDiags...) - if includeRaw.IsNull() { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' condition", - Detail: "The value of the 'if' clause must not be null.", - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.CondExpr, - EvalContext: childCtx, - }) - } - known = false - continue - } - if !includeRaw.IsKnown() { - // We will eventually return DynamicVal, but we'll continue - // iterating in case there are other diagnostics to gather - // for later elements. - known = false - continue - } - - include, err := convert.Convert(includeRaw, cty.Bool) - if err != nil { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' condition", - Detail: fmt.Sprintf("The 'if' clause value is invalid: %s.", err.Error()), - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.CondExpr, - EvalContext: childCtx, - }) - } - known = false - continue - } - - if include.False() { - // Skip this element - continue - } - } - - val, valDiags := e.ValExpr.Value(childCtx) - diags = append(diags, valDiags...) - vals = append(vals, val) - } - - if !known { - return cty.DynamicVal, diags - } - - return cty.TupleVal(vals), diags - } -} - -func (e *ForExpr) walkChildNodes(w internalWalkFunc) { - w(e.CollExpr) - - scopeNames := map[string]struct{}{} - if e.KeyVar != "" { - scopeNames[e.KeyVar] = struct{}{} - } - if e.ValVar != "" { - scopeNames[e.ValVar] = struct{}{} - } - - if e.KeyExpr != nil { - w(ChildScope{ - LocalNames: scopeNames, - Expr: e.KeyExpr, - }) - } - w(ChildScope{ - LocalNames: scopeNames, - Expr: e.ValExpr, - }) - if e.CondExpr != nil { - w(ChildScope{ - LocalNames: scopeNames, - Expr: e.CondExpr, - }) - } -} - -func (e *ForExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *ForExpr) StartRange() hcl.Range { - return e.OpenRange -} - -type SplatExpr struct { - Source Expression - Each Expression - Item *AnonSymbolExpr - - SrcRange hcl.Range - MarkerRange hcl.Range -} - -func (e *SplatExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - sourceVal, diags := e.Source.Value(ctx) - if diags.HasErrors() { - // We'll evaluate our "Each" expression here just to see if it - // produces any more diagnostics we can report. Since we're not - // assigning a value to our AnonSymbolExpr here it will return - // DynamicVal, which should short-circuit any use of it. - _, itemDiags := e.Item.Value(ctx) - diags = append(diags, itemDiags...) - return cty.DynamicVal, diags - } - - sourceTy := sourceVal.Type() - if sourceTy == cty.DynamicPseudoType { - // If we don't even know the _type_ of our source value yet then - // we'll need to defer all processing, since we can't decide our - // result type either. - return cty.DynamicVal, diags - } - - // A "special power" of splat expressions is that they can be applied - // both to tuples/lists and to other values, and in the latter case - // the value will be treated as an implicit single-item tuple, or as - // an empty tuple if the value is null. - autoUpgrade := !(sourceTy.IsTupleType() || sourceTy.IsListType() || sourceTy.IsSetType()) - - if sourceVal.IsNull() { - if autoUpgrade { - return cty.EmptyTupleVal, diags - } - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Splat of null value", - Detail: "Splat expressions (with the * symbol) cannot be applied to null sequences.", - Subject: e.Source.Range().Ptr(), - Context: hcl.RangeBetween(e.Source.Range(), e.MarkerRange).Ptr(), - Expression: e.Source, - EvalContext: ctx, - }) - return cty.DynamicVal, diags - } - - if autoUpgrade { - sourceVal = cty.TupleVal([]cty.Value{sourceVal}) - sourceTy = sourceVal.Type() - } - - // We'll compute our result type lazily if we need it. In the normal case - // it's inferred automatically from the value we construct. - resultTy := func() (cty.Type, hcl.Diagnostics) { - chiCtx := ctx.NewChild() - var diags hcl.Diagnostics - switch { - case sourceTy.IsListType() || sourceTy.IsSetType(): - ety := sourceTy.ElementType() - e.Item.setValue(chiCtx, cty.UnknownVal(ety)) - val, itemDiags := e.Each.Value(chiCtx) - diags = append(diags, itemDiags...) - e.Item.clearValue(chiCtx) // clean up our temporary value - return cty.List(val.Type()), diags - case sourceTy.IsTupleType(): - etys := sourceTy.TupleElementTypes() - resultTys := make([]cty.Type, 0, len(etys)) - for _, ety := range etys { - e.Item.setValue(chiCtx, cty.UnknownVal(ety)) - val, itemDiags := e.Each.Value(chiCtx) - diags = append(diags, itemDiags...) - e.Item.clearValue(chiCtx) // clean up our temporary value - resultTys = append(resultTys, val.Type()) - } - return cty.Tuple(resultTys), diags - default: - // Should never happen because of our promotion to list above. - return cty.DynamicPseudoType, diags - } - } - - if !sourceVal.IsKnown() { - // We can't produce a known result in this case, but we'll still - // indicate what the result type would be, allowing any downstream type - // checking to proceed. - ty, tyDiags := resultTy() - diags = append(diags, tyDiags...) - return cty.UnknownVal(ty), diags - } - - vals := make([]cty.Value, 0, sourceVal.LengthInt()) - it := sourceVal.ElementIterator() - if ctx == nil { - // we need a context to use our AnonSymbolExpr, so we'll just - // make an empty one here to use as a placeholder. - ctx = ctx.NewChild() - } - isKnown := true - for it.Next() { - _, sourceItem := it.Element() - e.Item.setValue(ctx, sourceItem) - newItem, itemDiags := e.Each.Value(ctx) - diags = append(diags, itemDiags...) - if itemDiags.HasErrors() { - isKnown = false - } - vals = append(vals, newItem) - } - e.Item.clearValue(ctx) // clean up our temporary value - - if !isKnown { - // We'll ingore the resultTy diagnostics in this case since they - // will just be the same errors we saw while iterating above. - ty, _ := resultTy() - return cty.UnknownVal(ty), diags - } - - switch { - case sourceTy.IsListType() || sourceTy.IsSetType(): - if len(vals) == 0 { - ty, tyDiags := resultTy() - diags = append(diags, tyDiags...) - return cty.ListValEmpty(ty.ElementType()), diags - } - return cty.ListVal(vals), diags - default: - return cty.TupleVal(vals), diags - } -} - -func (e *SplatExpr) walkChildNodes(w internalWalkFunc) { - w(e.Source) - w(e.Each) -} - -func (e *SplatExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *SplatExpr) StartRange() hcl.Range { - return e.MarkerRange -} - -// AnonSymbolExpr is used as a placeholder for a value in an expression that -// can be applied dynamically to any value at runtime. -// -// This is a rather odd, synthetic expression. It is used as part of the -// representation of splat expressions as a placeholder for the current item -// being visited in the splat evaluation. -// -// AnonSymbolExpr cannot be evaluated in isolation. If its Value is called -// directly then cty.DynamicVal will be returned. Instead, it is evaluated -// in terms of another node (i.e. a splat expression) which temporarily -// assigns it a value. -type AnonSymbolExpr struct { - SrcRange hcl.Range - - // values and its associated lock are used to isolate concurrent - // evaluations of a symbol from one another. It is the calling application's - // responsibility to ensure that the same splat expression is not evalauted - // concurrently within the _same_ EvalContext, but it is fine and safe to - // do cuncurrent evaluations with distinct EvalContexts. - values map[*hcl.EvalContext]cty.Value - valuesLock sync.RWMutex -} - -func (e *AnonSymbolExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - if ctx == nil { - return cty.DynamicVal, nil - } - - e.valuesLock.RLock() - defer e.valuesLock.RUnlock() - - val, exists := e.values[ctx] - if !exists { - return cty.DynamicVal, nil - } - return val, nil -} - -// setValue sets a temporary local value for the expression when evaluated -// in the given context, which must be non-nil. -func (e *AnonSymbolExpr) setValue(ctx *hcl.EvalContext, val cty.Value) { - e.valuesLock.Lock() - defer e.valuesLock.Unlock() - - if e.values == nil { - e.values = make(map[*hcl.EvalContext]cty.Value) - } - if ctx == nil { - panic("can't setValue for a nil EvalContext") - } - e.values[ctx] = val -} - -func (e *AnonSymbolExpr) clearValue(ctx *hcl.EvalContext) { - e.valuesLock.Lock() - defer e.valuesLock.Unlock() - - if e.values == nil { - return - } - if ctx == nil { - panic("can't clearValue for a nil EvalContext") - } - delete(e.values, ctx) -} - -func (e *AnonSymbolExpr) walkChildNodes(w internalWalkFunc) { - // AnonSymbolExpr is a leaf node in the tree -} - -func (e *AnonSymbolExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *AnonSymbolExpr) StartRange() hcl.Range { - return e.SrcRange -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_ops.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_ops.go deleted file mode 100644 index c1db0cecc..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_ops.go +++ /dev/null @@ -1,268 +0,0 @@ -package hclsyntax - -import ( - "fmt" - - "github.com/hashicorp/hcl/v2" - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" - "github.com/zclconf/go-cty/cty/function" - "github.com/zclconf/go-cty/cty/function/stdlib" -) - -type Operation struct { - Impl function.Function - Type cty.Type -} - -var ( - OpLogicalOr = &Operation{ - Impl: stdlib.OrFunc, - Type: cty.Bool, - } - OpLogicalAnd = &Operation{ - Impl: stdlib.AndFunc, - Type: cty.Bool, - } - OpLogicalNot = &Operation{ - Impl: stdlib.NotFunc, - Type: cty.Bool, - } - - OpEqual = &Operation{ - Impl: stdlib.EqualFunc, - Type: cty.Bool, - } - OpNotEqual = &Operation{ - Impl: stdlib.NotEqualFunc, - Type: cty.Bool, - } - - OpGreaterThan = &Operation{ - Impl: stdlib.GreaterThanFunc, - Type: cty.Bool, - } - OpGreaterThanOrEqual = &Operation{ - Impl: stdlib.GreaterThanOrEqualToFunc, - Type: cty.Bool, - } - OpLessThan = &Operation{ - Impl: stdlib.LessThanFunc, - Type: cty.Bool, - } - OpLessThanOrEqual = &Operation{ - Impl: stdlib.LessThanOrEqualToFunc, - Type: cty.Bool, - } - - OpAdd = &Operation{ - Impl: stdlib.AddFunc, - Type: cty.Number, - } - OpSubtract = &Operation{ - Impl: stdlib.SubtractFunc, - Type: cty.Number, - } - OpMultiply = &Operation{ - Impl: stdlib.MultiplyFunc, - Type: cty.Number, - } - OpDivide = &Operation{ - Impl: stdlib.DivideFunc, - Type: cty.Number, - } - OpModulo = &Operation{ - Impl: stdlib.ModuloFunc, - Type: cty.Number, - } - OpNegate = &Operation{ - Impl: stdlib.NegateFunc, - Type: cty.Number, - } -) - -var binaryOps []map[TokenType]*Operation - -func init() { - // This operation table maps from the operator's token type - // to the AST operation type. All expressions produced from - // binary operators are BinaryOp nodes. - // - // Binary operator groups are listed in order of precedence, with - // the *lowest* precedence first. Operators within the same group - // have left-to-right associativity. - binaryOps = []map[TokenType]*Operation{ - { - TokenOr: OpLogicalOr, - }, - { - TokenAnd: OpLogicalAnd, - }, - { - TokenEqualOp: OpEqual, - TokenNotEqual: OpNotEqual, - }, - { - TokenGreaterThan: OpGreaterThan, - TokenGreaterThanEq: OpGreaterThanOrEqual, - TokenLessThan: OpLessThan, - TokenLessThanEq: OpLessThanOrEqual, - }, - { - TokenPlus: OpAdd, - TokenMinus: OpSubtract, - }, - { - TokenStar: OpMultiply, - TokenSlash: OpDivide, - TokenPercent: OpModulo, - }, - } -} - -type BinaryOpExpr struct { - LHS Expression - Op *Operation - RHS Expression - - SrcRange hcl.Range -} - -func (e *BinaryOpExpr) walkChildNodes(w internalWalkFunc) { - w(e.LHS) - w(e.RHS) -} - -func (e *BinaryOpExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - impl := e.Op.Impl // assumed to be a function taking exactly two arguments - params := impl.Params() - lhsParam := params[0] - rhsParam := params[1] - - var diags hcl.Diagnostics - - givenLHSVal, lhsDiags := e.LHS.Value(ctx) - givenRHSVal, rhsDiags := e.RHS.Value(ctx) - diags = append(diags, lhsDiags...) - diags = append(diags, rhsDiags...) - - lhsVal, err := convert.Convert(givenLHSVal, lhsParam.Type) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid operand", - Detail: fmt.Sprintf("Unsuitable value for left operand: %s.", err), - Subject: e.LHS.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.LHS, - EvalContext: ctx, - }) - } - rhsVal, err := convert.Convert(givenRHSVal, rhsParam.Type) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid operand", - Detail: fmt.Sprintf("Unsuitable value for right operand: %s.", err), - Subject: e.RHS.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.RHS, - EvalContext: ctx, - }) - } - - if diags.HasErrors() { - // Don't actually try the call if we have errors already, since the - // this will probably just produce a confusing duplicative diagnostic. - return cty.UnknownVal(e.Op.Type), diags - } - - args := []cty.Value{lhsVal, rhsVal} - result, err := impl.Call(args) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - // FIXME: This diagnostic is useless. - Severity: hcl.DiagError, - Summary: "Operation failed", - Detail: fmt.Sprintf("Error during operation: %s.", err), - Subject: &e.SrcRange, - Expression: e, - EvalContext: ctx, - }) - return cty.UnknownVal(e.Op.Type), diags - } - - return result, diags -} - -func (e *BinaryOpExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *BinaryOpExpr) StartRange() hcl.Range { - return e.LHS.StartRange() -} - -type UnaryOpExpr struct { - Op *Operation - Val Expression - - SrcRange hcl.Range - SymbolRange hcl.Range -} - -func (e *UnaryOpExpr) walkChildNodes(w internalWalkFunc) { - w(e.Val) -} - -func (e *UnaryOpExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - impl := e.Op.Impl // assumed to be a function taking exactly one argument - params := impl.Params() - param := params[0] - - givenVal, diags := e.Val.Value(ctx) - - val, err := convert.Convert(givenVal, param.Type) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid operand", - Detail: fmt.Sprintf("Unsuitable value for unary operand: %s.", err), - Subject: e.Val.Range().Ptr(), - Context: &e.SrcRange, - Expression: e.Val, - EvalContext: ctx, - }) - } - - if diags.HasErrors() { - // Don't actually try the call if we have errors already, since the - // this will probably just produce a confusing duplicative diagnostic. - return cty.UnknownVal(e.Op.Type), diags - } - - args := []cty.Value{val} - result, err := impl.Call(args) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - // FIXME: This diagnostic is useless. - Severity: hcl.DiagError, - Summary: "Operation failed", - Detail: fmt.Sprintf("Error during operation: %s.", err), - Subject: &e.SrcRange, - Expression: e, - EvalContext: ctx, - }) - return cty.UnknownVal(e.Op.Type), diags - } - - return result, diags -} - -func (e *UnaryOpExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *UnaryOpExpr) StartRange() hcl.Range { - return e.SymbolRange -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_template.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_template.go deleted file mode 100644 index 9d425115f..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_template.go +++ /dev/null @@ -1,220 +0,0 @@ -package hclsyntax - -import ( - "bytes" - "fmt" - - "github.com/hashicorp/hcl/v2" - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" -) - -type TemplateExpr struct { - Parts []Expression - - SrcRange hcl.Range -} - -func (e *TemplateExpr) walkChildNodes(w internalWalkFunc) { - for _, part := range e.Parts { - w(part) - } -} - -func (e *TemplateExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - buf := &bytes.Buffer{} - var diags hcl.Diagnostics - isKnown := true - - for _, part := range e.Parts { - partVal, partDiags := part.Value(ctx) - diags = append(diags, partDiags...) - - if partVal.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template interpolation value", - Detail: fmt.Sprintf( - "The expression result is null. Cannot include a null value in a string template.", - ), - Subject: part.Range().Ptr(), - Context: &e.SrcRange, - Expression: part, - EvalContext: ctx, - }) - continue - } - - if !partVal.IsKnown() { - // If any part is unknown then the result as a whole must be - // unknown too. We'll keep on processing the rest of the parts - // anyway, because we want to still emit any diagnostics resulting - // from evaluating those. - isKnown = false - continue - } - - strVal, err := convert.Convert(partVal, cty.String) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template interpolation value", - Detail: fmt.Sprintf( - "Cannot include the given value in a string template: %s.", - err.Error(), - ), - Subject: part.Range().Ptr(), - Context: &e.SrcRange, - Expression: part, - EvalContext: ctx, - }) - continue - } - - buf.WriteString(strVal.AsString()) - } - - if !isKnown { - return cty.UnknownVal(cty.String), diags - } - - return cty.StringVal(buf.String()), diags -} - -func (e *TemplateExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *TemplateExpr) StartRange() hcl.Range { - return e.Parts[0].StartRange() -} - -// IsStringLiteral returns true if and only if the template consists only of -// single string literal, as would be created for a simple quoted string like -// "foo". -// -// If this function returns true, then calling Value on the same expression -// with a nil EvalContext will return the literal value. -// -// Note that "${"foo"}", "${1}", etc aren't considered literal values for the -// purposes of this method, because the intent of this method is to identify -// situations where the user seems to be explicitly intending literal string -// interpretation, not situations that result in literals as a technicality -// of the template expression unwrapping behavior. -func (e *TemplateExpr) IsStringLiteral() bool { - if len(e.Parts) != 1 { - return false - } - _, ok := e.Parts[0].(*LiteralValueExpr) - return ok -} - -// TemplateJoinExpr is used to convert tuples of strings produced by template -// constructs (i.e. for loops) into flat strings, by converting the values -// tos strings and joining them. This AST node is not used directly; it's -// produced as part of the AST of a "for" loop in a template. -type TemplateJoinExpr struct { - Tuple Expression -} - -func (e *TemplateJoinExpr) walkChildNodes(w internalWalkFunc) { - w(e.Tuple) -} - -func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - tuple, diags := e.Tuple.Value(ctx) - - if tuple.IsNull() { - // This indicates a bug in the code that constructed the AST. - panic("TemplateJoinExpr got null tuple") - } - if tuple.Type() == cty.DynamicPseudoType { - return cty.UnknownVal(cty.String), diags - } - if !tuple.Type().IsTupleType() { - // This indicates a bug in the code that constructed the AST. - panic("TemplateJoinExpr got non-tuple tuple") - } - if !tuple.IsKnown() { - return cty.UnknownVal(cty.String), diags - } - - buf := &bytes.Buffer{} - it := tuple.ElementIterator() - for it.Next() { - _, val := it.Element() - - if val.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template interpolation value", - Detail: fmt.Sprintf( - "An iteration result is null. Cannot include a null value in a string template.", - ), - Subject: e.Range().Ptr(), - Expression: e, - EvalContext: ctx, - }) - continue - } - if val.Type() == cty.DynamicPseudoType { - return cty.UnknownVal(cty.String), diags - } - strVal, err := convert.Convert(val, cty.String) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template interpolation value", - Detail: fmt.Sprintf( - "Cannot include one of the interpolation results into the string template: %s.", - err.Error(), - ), - Subject: e.Range().Ptr(), - Expression: e, - EvalContext: ctx, - }) - continue - } - if !val.IsKnown() { - return cty.UnknownVal(cty.String), diags - } - - buf.WriteString(strVal.AsString()) - } - - return cty.StringVal(buf.String()), diags -} - -func (e *TemplateJoinExpr) Range() hcl.Range { - return e.Tuple.Range() -} - -func (e *TemplateJoinExpr) StartRange() hcl.Range { - return e.Tuple.StartRange() -} - -// TemplateWrapExpr is used instead of a TemplateExpr when a template -// consists _only_ of a single interpolation sequence. In that case, the -// template's result is the single interpolation's result, verbatim with -// no type conversions. -type TemplateWrapExpr struct { - Wrapped Expression - - SrcRange hcl.Range -} - -func (e *TemplateWrapExpr) walkChildNodes(w internalWalkFunc) { - w(e.Wrapped) -} - -func (e *TemplateWrapExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - return e.Wrapped.Value(ctx) -} - -func (e *TemplateWrapExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *TemplateWrapExpr) StartRange() hcl.Range { - return e.SrcRange -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_vars.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_vars.go deleted file mode 100644 index a82bf790e..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_vars.go +++ /dev/null @@ -1,76 +0,0 @@ -package hclsyntax - -// Generated by expression_vars_get.go. DO NOT EDIT. -// Run 'go generate' on this package to update the set of functions here. - -import ( - "github.com/hashicorp/hcl/v2" -) - -func (e *AnonSymbolExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *BinaryOpExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *ConditionalExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *ForExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *FunctionCallExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *IndexExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *LiteralValueExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *ObjectConsExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *ObjectConsKeyExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *RelativeTraversalExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *ScopeTraversalExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *SplatExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *TemplateExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *TemplateJoinExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *TemplateWrapExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *TupleConsExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *UnaryOpExpr) Variables() []hcl.Traversal { - return Variables(e) -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/file.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/file.go deleted file mode 100644 index f55e9ce2c..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/file.go +++ /dev/null @@ -1,20 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl/v2" -) - -// File is the top-level object resulting from parsing a configuration file. -type File struct { - Body *Body - Bytes []byte -} - -func (f *File) AsHCLFile() *hcl.File { - return &hcl.File{ - Body: f.Body, - Bytes: f.Bytes, - - // TODO: The Nav object, once we have an implementation of it - } -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/generate.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/generate.go deleted file mode 100644 index 841656a6a..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/generate.go +++ /dev/null @@ -1,9 +0,0 @@ -package hclsyntax - -//go:generate go run expression_vars_gen.go -//go:generate ruby unicode2ragel.rb --url=http://www.unicode.org/Public/9.0.0/ucd/DerivedCoreProperties.txt -m UnicodeDerived -p ID_Start,ID_Continue -o unicode_derived.rl -//go:generate ragel -Z scan_tokens.rl -//go:generate gofmt -w scan_tokens.go -//go:generate ragel -Z scan_string_lit.rl -//go:generate gofmt -w scan_string_lit.go -//go:generate stringer -type TokenType -output token_type_string.go diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/keywords.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/keywords.go deleted file mode 100644 index eef8b9626..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/keywords.go +++ /dev/null @@ -1,21 +0,0 @@ -package hclsyntax - -import ( - "bytes" -) - -type Keyword []byte - -var forKeyword = Keyword([]byte{'f', 'o', 'r'}) -var inKeyword = Keyword([]byte{'i', 'n'}) -var ifKeyword = Keyword([]byte{'i', 'f'}) -var elseKeyword = Keyword([]byte{'e', 'l', 's', 'e'}) -var endifKeyword = Keyword([]byte{'e', 'n', 'd', 'i', 'f'}) -var endforKeyword = Keyword([]byte{'e', 'n', 'd', 'f', 'o', 'r'}) - -func (kw Keyword) TokenMatches(token Token) bool { - if token.Type != TokenIdent { - return false - } - return bytes.Equal([]byte(kw), token.Bytes) -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/navigation.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/navigation.go deleted file mode 100644 index af98ef045..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/navigation.go +++ /dev/null @@ -1,59 +0,0 @@ -package hclsyntax - -import ( - "bytes" - "fmt" - - "github.com/hashicorp/hcl/v2" -) - -type navigation struct { - root *Body -} - -// Implementation of hcled.ContextString -func (n navigation) ContextString(offset int) string { - // We will walk our top-level blocks until we find one that contains - // the given offset, and then construct a representation of the header - // of the block. - - var block *Block - for _, candidate := range n.root.Blocks { - if candidate.Range().ContainsOffset(offset) { - block = candidate - break - } - } - - if block == nil { - return "" - } - - if len(block.Labels) == 0 { - // Easy case! - return block.Type - } - - buf := &bytes.Buffer{} - buf.WriteString(block.Type) - for _, label := range block.Labels { - fmt.Fprintf(buf, " %q", label) - } - return buf.String() -} - -func (n navigation) ContextDefRange(offset int) hcl.Range { - var block *Block - for _, candidate := range n.root.Blocks { - if candidate.Range().ContainsOffset(offset) { - block = candidate - break - } - } - - if block == nil { - return hcl.Range{} - } - - return block.DefRange() -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/node.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/node.go deleted file mode 100644 index 41b35e53f..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/node.go +++ /dev/null @@ -1,22 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl/v2" -) - -// Node is the abstract type that every AST node implements. -// -// This is a closed interface, so it cannot be implemented from outside of -// this package. -type Node interface { - // This is the mechanism by which the public-facing walk functions - // are implemented. Implementations should call the given function - // for each child node and then replace that node with its return value. - // The return value might just be the same node, for non-transforming - // walks. - walkChildNodes(w internalWalkFunc) - - Range() hcl.Range -} - -type internalWalkFunc func(Node) diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser.go deleted file mode 100644 index 6fb284a8f..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser.go +++ /dev/null @@ -1,2054 +0,0 @@ -package hclsyntax - -import ( - "bytes" - "fmt" - "strconv" - "unicode/utf8" - - "github.com/apparentlymart/go-textseg/textseg" - "github.com/hashicorp/hcl/v2" - "github.com/zclconf/go-cty/cty" -) - -type parser struct { - *peeker - - // set to true if any recovery is attempted. The parser can use this - // to attempt to reduce error noise by suppressing "bad token" errors - // in recovery mode, assuming that the recovery heuristics have failed - // in this case and left the peeker in a wrong place. - recovery bool -} - -func (p *parser) ParseBody(end TokenType) (*Body, hcl.Diagnostics) { - attrs := Attributes{} - blocks := Blocks{} - var diags hcl.Diagnostics - - startRange := p.PrevRange() - var endRange hcl.Range - -Token: - for { - next := p.Peek() - if next.Type == end { - endRange = p.NextRange() - p.Read() - break Token - } - - switch next.Type { - case TokenNewline: - p.Read() - continue - case TokenIdent: - item, itemDiags := p.ParseBodyItem() - diags = append(diags, itemDiags...) - switch titem := item.(type) { - case *Block: - blocks = append(blocks, titem) - case *Attribute: - if existing, exists := attrs[titem.Name]; exists { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Attribute redefined", - Detail: fmt.Sprintf( - "The argument %q was already set at %s. Each argument may be set only once.", - titem.Name, existing.NameRange.String(), - ), - Subject: &titem.NameRange, - }) - } else { - attrs[titem.Name] = titem - } - default: - // This should never happen for valid input, but may if a - // syntax error was detected in ParseBodyItem that prevented - // it from even producing a partially-broken item. In that - // case, it would've left at least one error in the diagnostics - // slice we already dealt with above. - // - // We'll assume ParseBodyItem attempted recovery to leave - // us in a reasonable position to try parsing the next item. - continue - } - default: - bad := p.Read() - if !p.recovery { - if bad.Type == TokenOQuote { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid argument name", - Detail: "Argument names must not be quoted.", - Subject: &bad.Range, - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Argument or block definition required", - Detail: "An argument or block definition is required here.", - Subject: &bad.Range, - }) - } - } - endRange = p.PrevRange() // arbitrary, but somewhere inside the body means better diagnostics - - p.recover(end) // attempt to recover to the token after the end of this body - break Token - } - } - - return &Body{ - Attributes: attrs, - Blocks: blocks, - - SrcRange: hcl.RangeBetween(startRange, endRange), - EndRange: hcl.Range{ - Filename: endRange.Filename, - Start: endRange.End, - End: endRange.End, - }, - }, diags -} - -func (p *parser) ParseBodyItem() (Node, hcl.Diagnostics) { - ident := p.Read() - if ident.Type != TokenIdent { - p.recoverAfterBodyItem() - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Argument or block definition required", - Detail: "An argument or block definition is required here.", - Subject: &ident.Range, - }, - } - } - - next := p.Peek() - - switch next.Type { - case TokenEqual: - return p.finishParsingBodyAttribute(ident, false) - case TokenOQuote, TokenOBrace, TokenIdent: - return p.finishParsingBodyBlock(ident) - default: - p.recoverAfterBodyItem() - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Argument or block definition required", - Detail: "An argument or block definition is required here. To set an argument, use the equals sign \"=\" to introduce the argument value.", - Subject: &ident.Range, - }, - } - } - - return nil, nil -} - -// parseSingleAttrBody is a weird variant of ParseBody that deals with the -// body of a nested block containing only one attribute value all on a single -// line, like foo { bar = baz } . It expects to find a single attribute item -// immediately followed by the end token type with no intervening newlines. -func (p *parser) parseSingleAttrBody(end TokenType) (*Body, hcl.Diagnostics) { - ident := p.Read() - if ident.Type != TokenIdent { - p.recoverAfterBodyItem() - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Argument or block definition required", - Detail: "An argument or block definition is required here.", - Subject: &ident.Range, - }, - } - } - - var attr *Attribute - var diags hcl.Diagnostics - - next := p.Peek() - - switch next.Type { - case TokenEqual: - node, attrDiags := p.finishParsingBodyAttribute(ident, true) - diags = append(diags, attrDiags...) - attr = node.(*Attribute) - case TokenOQuote, TokenOBrace, TokenIdent: - p.recoverAfterBodyItem() - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Argument definition required", - Detail: fmt.Sprintf("A single-line block definition can contain only a single argument. If you meant to define argument %q, use an equals sign to assign it a value. To define a nested block, place it on a line of its own within its parent block.", ident.Bytes), - Subject: hcl.RangeBetween(ident.Range, next.Range).Ptr(), - }, - } - default: - p.recoverAfterBodyItem() - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Argument or block definition required", - Detail: "An argument or block definition is required here. To set an argument, use the equals sign \"=\" to introduce the argument value.", - Subject: &ident.Range, - }, - } - } - - return &Body{ - Attributes: Attributes{ - string(ident.Bytes): attr, - }, - - SrcRange: attr.SrcRange, - EndRange: hcl.Range{ - Filename: attr.SrcRange.Filename, - Start: attr.SrcRange.End, - End: attr.SrcRange.End, - }, - }, diags - -} - -func (p *parser) finishParsingBodyAttribute(ident Token, singleLine bool) (Node, hcl.Diagnostics) { - eqTok := p.Read() // eat equals token - if eqTok.Type != TokenEqual { - // should never happen if caller behaves - panic("finishParsingBodyAttribute called with next not equals") - } - - var endRange hcl.Range - - expr, diags := p.ParseExpression() - if p.recovery && diags.HasErrors() { - // recovery within expressions tends to be tricky, so we've probably - // landed somewhere weird. We'll try to reset to the start of a body - // item so parsing can continue. - endRange = p.PrevRange() - p.recoverAfterBodyItem() - } else { - endRange = p.PrevRange() - if !singleLine { - end := p.Peek() - if end.Type != TokenNewline && end.Type != TokenEOF { - if !p.recovery { - summary := "Missing newline after argument" - detail := "An argument definition must end with a newline." - - if end.Type == TokenComma { - summary = "Unexpected comma after argument" - detail = "Argument definitions must be separated by newlines, not commas. " + detail - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: summary, - Detail: detail, - Subject: &end.Range, - Context: hcl.RangeBetween(ident.Range, end.Range).Ptr(), - }) - } - endRange = p.PrevRange() - p.recoverAfterBodyItem() - } else { - endRange = p.PrevRange() - p.Read() // eat newline - } - } - } - - return &Attribute{ - Name: string(ident.Bytes), - Expr: expr, - - SrcRange: hcl.RangeBetween(ident.Range, endRange), - NameRange: ident.Range, - EqualsRange: eqTok.Range, - }, diags -} - -func (p *parser) finishParsingBodyBlock(ident Token) (Node, hcl.Diagnostics) { - var blockType = string(ident.Bytes) - var diags hcl.Diagnostics - var labels []string - var labelRanges []hcl.Range - - var oBrace Token - -Token: - for { - tok := p.Peek() - - switch tok.Type { - - case TokenOBrace: - oBrace = p.Read() - break Token - - case TokenOQuote: - label, labelRange, labelDiags := p.parseQuotedStringLiteral() - diags = append(diags, labelDiags...) - labels = append(labels, label) - labelRanges = append(labelRanges, labelRange) - // parseQuoteStringLiteral recovers up to the closing quote - // if it encounters problems, so we can continue looking for - // more labels and eventually the block body even. - - case TokenIdent: - tok = p.Read() // eat token - label, labelRange := string(tok.Bytes), tok.Range - labels = append(labels, label) - labelRanges = append(labelRanges, labelRange) - - default: - switch tok.Type { - case TokenEqual: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid block definition", - Detail: "The equals sign \"=\" indicates an argument definition, and must not be used when defining a block.", - Subject: &tok.Range, - Context: hcl.RangeBetween(ident.Range, tok.Range).Ptr(), - }) - case TokenNewline: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid block definition", - Detail: "A block definition must have block content delimited by \"{\" and \"}\", starting on the same line as the block header.", - Subject: &tok.Range, - Context: hcl.RangeBetween(ident.Range, tok.Range).Ptr(), - }) - default: - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid block definition", - Detail: "Either a quoted string block label or an opening brace (\"{\") is expected here.", - Subject: &tok.Range, - Context: hcl.RangeBetween(ident.Range, tok.Range).Ptr(), - }) - } - } - - p.recoverAfterBodyItem() - - return &Block{ - Type: blockType, - Labels: labels, - Body: &Body{ - SrcRange: ident.Range, - EndRange: ident.Range, - }, - - TypeRange: ident.Range, - LabelRanges: labelRanges, - OpenBraceRange: ident.Range, // placeholder - CloseBraceRange: ident.Range, // placeholder - }, diags - } - } - - // Once we fall out here, the peeker is pointed just after our opening - // brace, so we can begin our nested body parsing. - var body *Body - var bodyDiags hcl.Diagnostics - switch p.Peek().Type { - case TokenNewline, TokenEOF, TokenCBrace: - body, bodyDiags = p.ParseBody(TokenCBrace) - default: - // Special one-line, single-attribute block parsing mode. - body, bodyDiags = p.parseSingleAttrBody(TokenCBrace) - switch p.Peek().Type { - case TokenCBrace: - p.Read() // the happy path - just consume the closing brace - case TokenComma: - // User seems to be trying to use the object-constructor - // comma-separated style, which isn't permitted for blocks. - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid single-argument block definition", - Detail: "Single-line block syntax can include only one argument definition. To define multiple arguments, use the multi-line block syntax with one argument definition per line.", - Subject: p.Peek().Range.Ptr(), - }) - p.recover(TokenCBrace) - case TokenNewline: - // We don't allow weird mixtures of single and multi-line syntax. - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid single-argument block definition", - Detail: "An argument definition on the same line as its containing block creates a single-line block definition, which must also be closed on the same line. Place the block's closing brace immediately after the argument definition.", - Subject: p.Peek().Range.Ptr(), - }) - p.recover(TokenCBrace) - default: - // Some other weird thing is going on. Since we can't guess a likely - // user intent for this one, we'll skip it if we're already in - // recovery mode. - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid single-argument block definition", - Detail: "A single-line block definition must end with a closing brace immediately after its single argument definition.", - Subject: p.Peek().Range.Ptr(), - }) - } - p.recover(TokenCBrace) - } - } - diags = append(diags, bodyDiags...) - cBraceRange := p.PrevRange() - - eol := p.Peek() - if eol.Type == TokenNewline || eol.Type == TokenEOF { - p.Read() // eat newline - } else { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing newline after block definition", - Detail: "A block definition must end with a newline.", - Subject: &eol.Range, - Context: hcl.RangeBetween(ident.Range, eol.Range).Ptr(), - }) - } - p.recoverAfterBodyItem() - } - - // We must never produce a nil body, since the caller may attempt to - // do analysis of a partial result when there's an error, so we'll - // insert a placeholder if we otherwise failed to produce a valid - // body due to one of the syntax error paths above. - if body == nil && diags.HasErrors() { - body = &Body{ - SrcRange: hcl.RangeBetween(oBrace.Range, cBraceRange), - EndRange: cBraceRange, - } - } - - return &Block{ - Type: blockType, - Labels: labels, - Body: body, - - TypeRange: ident.Range, - LabelRanges: labelRanges, - OpenBraceRange: oBrace.Range, - CloseBraceRange: cBraceRange, - }, diags -} - -func (p *parser) ParseExpression() (Expression, hcl.Diagnostics) { - return p.parseTernaryConditional() -} - -func (p *parser) parseTernaryConditional() (Expression, hcl.Diagnostics) { - // The ternary conditional operator (.. ? .. : ..) behaves somewhat - // like a binary operator except that the "symbol" is itself - // an expression enclosed in two punctuation characters. - // The middle expression is parsed as if the ? and : symbols - // were parentheses. The "rhs" (the "false expression") is then - // treated right-associatively so it behaves similarly to the - // middle in terms of precedence. - - startRange := p.NextRange() - var condExpr, trueExpr, falseExpr Expression - var diags hcl.Diagnostics - - condExpr, condDiags := p.parseBinaryOps(binaryOps) - diags = append(diags, condDiags...) - if p.recovery && condDiags.HasErrors() { - return condExpr, diags - } - - questionMark := p.Peek() - if questionMark.Type != TokenQuestion { - return condExpr, diags - } - - p.Read() // eat question mark - - trueExpr, trueDiags := p.ParseExpression() - diags = append(diags, trueDiags...) - if p.recovery && trueDiags.HasErrors() { - return condExpr, diags - } - - colon := p.Peek() - if colon.Type != TokenColon { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing false expression in conditional", - Detail: "The conditional operator (...?...:...) requires a false expression, delimited by a colon.", - Subject: &colon.Range, - Context: hcl.RangeBetween(startRange, colon.Range).Ptr(), - }) - return condExpr, diags - } - - p.Read() // eat colon - - falseExpr, falseDiags := p.ParseExpression() - diags = append(diags, falseDiags...) - if p.recovery && falseDiags.HasErrors() { - return condExpr, diags - } - - return &ConditionalExpr{ - Condition: condExpr, - TrueResult: trueExpr, - FalseResult: falseExpr, - - SrcRange: hcl.RangeBetween(startRange, falseExpr.Range()), - }, diags -} - -// parseBinaryOps calls itself recursively to work through all of the -// operator precedence groups, and then eventually calls parseExpressionTerm -// for each operand. -func (p *parser) parseBinaryOps(ops []map[TokenType]*Operation) (Expression, hcl.Diagnostics) { - if len(ops) == 0 { - // We've run out of operators, so now we'll just try to parse a term. - return p.parseExpressionWithTraversals() - } - - thisLevel := ops[0] - remaining := ops[1:] - - var lhs, rhs Expression - var operation *Operation - var diags hcl.Diagnostics - - // Parse a term that might be the first operand of a binary - // operation or it might just be a standalone term. - // We won't know until we've parsed it and can look ahead - // to see if there's an operator token for this level. - lhs, lhsDiags := p.parseBinaryOps(remaining) - diags = append(diags, lhsDiags...) - if p.recovery && lhsDiags.HasErrors() { - return lhs, diags - } - - // We'll keep eating up operators until we run out, so that operators - // with the same precedence will combine in a left-associative manner: - // a+b+c => (a+b)+c, not a+(b+c) - // - // Should we later want to have right-associative operators, a way - // to achieve that would be to call back up to ParseExpression here - // instead of iteratively parsing only the remaining operators. - for { - next := p.Peek() - var newOp *Operation - var ok bool - if newOp, ok = thisLevel[next.Type]; !ok { - break - } - - // Are we extending an expression started on the previous iteration? - if operation != nil { - lhs = &BinaryOpExpr{ - LHS: lhs, - Op: operation, - RHS: rhs, - - SrcRange: hcl.RangeBetween(lhs.Range(), rhs.Range()), - } - } - - operation = newOp - p.Read() // eat operator token - var rhsDiags hcl.Diagnostics - rhs, rhsDiags = p.parseBinaryOps(remaining) - diags = append(diags, rhsDiags...) - if p.recovery && rhsDiags.HasErrors() { - return lhs, diags - } - } - - if operation == nil { - return lhs, diags - } - - return &BinaryOpExpr{ - LHS: lhs, - Op: operation, - RHS: rhs, - - SrcRange: hcl.RangeBetween(lhs.Range(), rhs.Range()), - }, diags -} - -func (p *parser) parseExpressionWithTraversals() (Expression, hcl.Diagnostics) { - term, diags := p.parseExpressionTerm() - ret, moreDiags := p.parseExpressionTraversals(term) - diags = append(diags, moreDiags...) - return ret, diags -} - -func (p *parser) parseExpressionTraversals(from Expression) (Expression, hcl.Diagnostics) { - var diags hcl.Diagnostics - ret := from - -Traversal: - for { - next := p.Peek() - - switch next.Type { - case TokenDot: - // Attribute access or splat - dot := p.Read() - attrTok := p.Peek() - - switch attrTok.Type { - case TokenIdent: - attrTok = p.Read() // eat token - name := string(attrTok.Bytes) - rng := hcl.RangeBetween(dot.Range, attrTok.Range) - step := hcl.TraverseAttr{ - Name: name, - SrcRange: rng, - } - - ret = makeRelativeTraversal(ret, step, rng) - - case TokenNumberLit: - // This is a weird form we inherited from HIL, allowing numbers - // to be used as attributes as a weird way of writing [n]. - // This was never actually a first-class thing in HIL, but - // HIL tolerated sequences like .0. in its variable names and - // calling applications like Terraform exploited that to - // introduce indexing syntax where none existed. - numTok := p.Read() // eat token - attrTok = numTok - - // This syntax is ambiguous if multiple indices are used in - // succession, like foo.0.1.baz: that actually parses as - // a fractional number 0.1. Since we're only supporting this - // syntax for compatibility with legacy Terraform - // configurations, and Terraform does not tend to have lists - // of lists, we'll choose to reject that here with a helpful - // error message, rather than failing later because the index - // isn't a whole number. - if dotIdx := bytes.IndexByte(numTok.Bytes, '.'); dotIdx >= 0 { - first := numTok.Bytes[:dotIdx] - second := numTok.Bytes[dotIdx+1:] - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid legacy index syntax", - Detail: fmt.Sprintf("When using the legacy index syntax, chaining two indexes together is not permitted. Use the proper index syntax instead, like [%s][%s].", first, second), - Subject: &attrTok.Range, - }) - rng := hcl.RangeBetween(dot.Range, numTok.Range) - step := hcl.TraverseIndex{ - Key: cty.DynamicVal, - SrcRange: rng, - } - ret = makeRelativeTraversal(ret, step, rng) - break - } - - numVal, numDiags := p.numberLitValue(numTok) - diags = append(diags, numDiags...) - - rng := hcl.RangeBetween(dot.Range, numTok.Range) - step := hcl.TraverseIndex{ - Key: numVal, - SrcRange: rng, - } - - ret = makeRelativeTraversal(ret, step, rng) - - case TokenStar: - // "Attribute-only" splat expression. - // (This is a kinda weird construct inherited from HIL, which - // behaves a bit like a [*] splat except that it is only able - // to do attribute traversals into each of its elements, - // whereas foo[*] can support _any_ traversal. - marker := p.Read() // eat star - trav := make(hcl.Traversal, 0, 1) - var firstRange, lastRange hcl.Range - firstRange = p.NextRange() - for p.Peek().Type == TokenDot { - dot := p.Read() - - if p.Peek().Type == TokenNumberLit { - // Continuing the "weird stuff inherited from HIL" - // theme, we also allow numbers as attribute names - // inside splats and interpret them as indexing - // into a list, for expressions like: - // foo.bar.*.baz.0.foo - numTok := p.Read() - - // Weird special case if the user writes something - // like foo.bar.*.baz.0.0.foo, where 0.0 parses - // as a number. - if dotIdx := bytes.IndexByte(numTok.Bytes, '.'); dotIdx >= 0 { - first := numTok.Bytes[:dotIdx] - second := numTok.Bytes[dotIdx+1:] - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid legacy index syntax", - Detail: fmt.Sprintf("When using the legacy index syntax, chaining two indexes together is not permitted. Use the proper index syntax with a full splat expression [*] instead, like [%s][%s].", first, second), - Subject: &attrTok.Range, - }) - trav = append(trav, hcl.TraverseIndex{ - Key: cty.DynamicVal, - SrcRange: hcl.RangeBetween(dot.Range, numTok.Range), - }) - lastRange = numTok.Range - continue - } - - numVal, numDiags := p.numberLitValue(numTok) - diags = append(diags, numDiags...) - trav = append(trav, hcl.TraverseIndex{ - Key: numVal, - SrcRange: hcl.RangeBetween(dot.Range, numTok.Range), - }) - lastRange = numTok.Range - continue - } - - if p.Peek().Type != TokenIdent { - if !p.recovery { - if p.Peek().Type == TokenStar { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Nested splat expression not allowed", - Detail: "A splat expression (*) cannot be used inside another attribute-only splat expression.", - Subject: p.Peek().Range.Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid attribute name", - Detail: "An attribute name is required after a dot.", - Subject: &attrTok.Range, - }) - } - } - p.setRecovery() - continue Traversal - } - - attrTok := p.Read() - trav = append(trav, hcl.TraverseAttr{ - Name: string(attrTok.Bytes), - SrcRange: hcl.RangeBetween(dot.Range, attrTok.Range), - }) - lastRange = attrTok.Range - } - - itemExpr := &AnonSymbolExpr{ - SrcRange: hcl.RangeBetween(dot.Range, marker.Range), - } - var travExpr Expression - if len(trav) == 0 { - travExpr = itemExpr - } else { - travExpr = &RelativeTraversalExpr{ - Source: itemExpr, - Traversal: trav, - SrcRange: hcl.RangeBetween(firstRange, lastRange), - } - } - - ret = &SplatExpr{ - Source: ret, - Each: travExpr, - Item: itemExpr, - - SrcRange: hcl.RangeBetween(dot.Range, lastRange), - MarkerRange: hcl.RangeBetween(dot.Range, marker.Range), - } - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid attribute name", - Detail: "An attribute name is required after a dot.", - Subject: &attrTok.Range, - }) - // This leaves the peeker in a bad place, so following items - // will probably be misparsed until we hit something that - // allows us to re-sync. - // - // We will probably need to do something better here eventually - // in order to support autocomplete triggered by typing a - // period. - p.setRecovery() - } - - case TokenOBrack: - // Indexing of a collection. - // This may or may not be a hcl.Traverser, depending on whether - // the key value is something constant. - - open := p.Read() - switch p.Peek().Type { - case TokenStar: - // This is a full splat expression, like foo[*], which consumes - // the rest of the traversal steps after it using a recursive - // call to this function. - p.Read() // consume star - close := p.Read() - if close.Type != TokenCBrack && !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing close bracket on splat index", - Detail: "The star for a full splat operator must be immediately followed by a closing bracket (\"]\").", - Subject: &close.Range, - }) - close = p.recover(TokenCBrack) - } - // Splat expressions use a special "anonymous symbol" as a - // placeholder in an expression to be evaluated once for each - // item in the source expression. - itemExpr := &AnonSymbolExpr{ - SrcRange: hcl.RangeBetween(open.Range, close.Range), - } - // Now we'll recursively call this same function to eat any - // remaining traversal steps against the anonymous symbol. - travExpr, nestedDiags := p.parseExpressionTraversals(itemExpr) - diags = append(diags, nestedDiags...) - - ret = &SplatExpr{ - Source: ret, - Each: travExpr, - Item: itemExpr, - - SrcRange: hcl.RangeBetween(open.Range, travExpr.Range()), - MarkerRange: hcl.RangeBetween(open.Range, close.Range), - } - - default: - - var close Token - p.PushIncludeNewlines(false) // arbitrary newlines allowed in brackets - keyExpr, keyDiags := p.ParseExpression() - diags = append(diags, keyDiags...) - if p.recovery && keyDiags.HasErrors() { - close = p.recover(TokenCBrack) - } else { - close = p.Read() - if close.Type != TokenCBrack && !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing close bracket on index", - Detail: "The index operator must end with a closing bracket (\"]\").", - Subject: &close.Range, - }) - close = p.recover(TokenCBrack) - } - } - p.PopIncludeNewlines() - - if lit, isLit := keyExpr.(*LiteralValueExpr); isLit { - litKey, _ := lit.Value(nil) - rng := hcl.RangeBetween(open.Range, close.Range) - step := hcl.TraverseIndex{ - Key: litKey, - SrcRange: rng, - } - ret = makeRelativeTraversal(ret, step, rng) - } else if tmpl, isTmpl := keyExpr.(*TemplateExpr); isTmpl && tmpl.IsStringLiteral() { - litKey, _ := tmpl.Value(nil) - rng := hcl.RangeBetween(open.Range, close.Range) - step := hcl.TraverseIndex{ - Key: litKey, - SrcRange: rng, - } - ret = makeRelativeTraversal(ret, step, rng) - } else { - rng := hcl.RangeBetween(open.Range, close.Range) - ret = &IndexExpr{ - Collection: ret, - Key: keyExpr, - - SrcRange: rng, - OpenRange: open.Range, - } - } - } - - default: - break Traversal - } - } - - return ret, diags -} - -// makeRelativeTraversal takes an expression and a traverser and returns -// a traversal expression that combines the two. If the given expression -// is already a traversal, it is extended in place (mutating it) and -// returned. If it isn't, a new RelativeTraversalExpr is created and returned. -func makeRelativeTraversal(expr Expression, next hcl.Traverser, rng hcl.Range) Expression { - switch texpr := expr.(type) { - case *ScopeTraversalExpr: - texpr.Traversal = append(texpr.Traversal, next) - texpr.SrcRange = hcl.RangeBetween(texpr.SrcRange, rng) - return texpr - case *RelativeTraversalExpr: - texpr.Traversal = append(texpr.Traversal, next) - texpr.SrcRange = hcl.RangeBetween(texpr.SrcRange, rng) - return texpr - default: - return &RelativeTraversalExpr{ - Source: expr, - Traversal: hcl.Traversal{next}, - SrcRange: rng, - } - } -} - -func (p *parser) parseExpressionTerm() (Expression, hcl.Diagnostics) { - start := p.Peek() - - switch start.Type { - case TokenOParen: - p.Read() // eat open paren - - p.PushIncludeNewlines(false) - - expr, diags := p.ParseExpression() - if diags.HasErrors() { - // attempt to place the peeker after our closing paren - // before we return, so that the next parser has some - // chance of finding a valid expression. - p.recover(TokenCParen) - p.PopIncludeNewlines() - return expr, diags - } - - close := p.Peek() - if close.Type != TokenCParen { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unbalanced parentheses", - Detail: "Expected a closing parenthesis to terminate the expression.", - Subject: &close.Range, - Context: hcl.RangeBetween(start.Range, close.Range).Ptr(), - }) - p.setRecovery() - } - - p.Read() // eat closing paren - p.PopIncludeNewlines() - - return expr, diags - - case TokenNumberLit: - tok := p.Read() // eat number token - - numVal, diags := p.numberLitValue(tok) - return &LiteralValueExpr{ - Val: numVal, - SrcRange: tok.Range, - }, diags - - case TokenIdent: - tok := p.Read() // eat identifier token - - if p.Peek().Type == TokenOParen { - return p.finishParsingFunctionCall(tok) - } - - name := string(tok.Bytes) - switch name { - case "true": - return &LiteralValueExpr{ - Val: cty.True, - SrcRange: tok.Range, - }, nil - case "false": - return &LiteralValueExpr{ - Val: cty.False, - SrcRange: tok.Range, - }, nil - case "null": - return &LiteralValueExpr{ - Val: cty.NullVal(cty.DynamicPseudoType), - SrcRange: tok.Range, - }, nil - default: - return &ScopeTraversalExpr{ - Traversal: hcl.Traversal{ - hcl.TraverseRoot{ - Name: name, - SrcRange: tok.Range, - }, - }, - SrcRange: tok.Range, - }, nil - } - - case TokenOQuote, TokenOHeredoc: - open := p.Read() // eat opening marker - closer := p.oppositeBracket(open.Type) - exprs, passthru, _, diags := p.parseTemplateInner(closer, tokenOpensFlushHeredoc(open)) - - closeRange := p.PrevRange() - - if passthru { - if len(exprs) != 1 { - panic("passthru set with len(exprs) != 1") - } - return &TemplateWrapExpr{ - Wrapped: exprs[0], - SrcRange: hcl.RangeBetween(open.Range, closeRange), - }, diags - } - - return &TemplateExpr{ - Parts: exprs, - SrcRange: hcl.RangeBetween(open.Range, closeRange), - }, diags - - case TokenMinus: - tok := p.Read() // eat minus token - - // Important to use parseExpressionWithTraversals rather than parseExpression - // here, otherwise we can capture a following binary expression into - // our negation. - // e.g. -46+5 should parse as (-46)+5, not -(46+5) - operand, diags := p.parseExpressionWithTraversals() - return &UnaryOpExpr{ - Op: OpNegate, - Val: operand, - - SrcRange: hcl.RangeBetween(tok.Range, operand.Range()), - SymbolRange: tok.Range, - }, diags - - case TokenBang: - tok := p.Read() // eat bang token - - // Important to use parseExpressionWithTraversals rather than parseExpression - // here, otherwise we can capture a following binary expression into - // our negation. - operand, diags := p.parseExpressionWithTraversals() - return &UnaryOpExpr{ - Op: OpLogicalNot, - Val: operand, - - SrcRange: hcl.RangeBetween(tok.Range, operand.Range()), - SymbolRange: tok.Range, - }, diags - - case TokenOBrack: - return p.parseTupleCons() - - case TokenOBrace: - return p.parseObjectCons() - - default: - var diags hcl.Diagnostics - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid expression", - Detail: "Expected the start of an expression, but found an invalid expression token.", - Subject: &start.Range, - }) - } - p.setRecovery() - - // Return a placeholder so that the AST is still structurally sound - // even in the presence of parse errors. - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: start.Range, - }, diags - } -} - -func (p *parser) numberLitValue(tok Token) (cty.Value, hcl.Diagnostics) { - // The cty.ParseNumberVal is always the same behavior as converting a - // string to a number, ensuring we always interpret decimal numbers in - // the same way. - numVal, err := cty.ParseNumberVal(string(tok.Bytes)) - if err != nil { - ret := cty.UnknownVal(cty.Number) - return ret, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Invalid number literal", - // FIXME: not a very good error message, but convert only - // gives us "a number is required", so not much help either. - Detail: "Failed to recognize the value of this number literal.", - Subject: &tok.Range, - }, - } - } - return numVal, nil -} - -// finishParsingFunctionCall parses a function call assuming that the function -// name was already read, and so the peeker should be pointing at the opening -// parenthesis after the name. -func (p *parser) finishParsingFunctionCall(name Token) (Expression, hcl.Diagnostics) { - openTok := p.Read() - if openTok.Type != TokenOParen { - // should never happen if callers behave - panic("finishParsingFunctionCall called with non-parenthesis as next token") - } - - var args []Expression - var diags hcl.Diagnostics - var expandFinal bool - var closeTok Token - - // Arbitrary newlines are allowed inside the function call parentheses. - p.PushIncludeNewlines(false) - -Token: - for { - tok := p.Peek() - - if tok.Type == TokenCParen { - closeTok = p.Read() // eat closing paren - break Token - } - - arg, argDiags := p.ParseExpression() - args = append(args, arg) - diags = append(diags, argDiags...) - if p.recovery && argDiags.HasErrors() { - // if there was a parse error in the argument then we've - // probably been left in a weird place in the token stream, - // so we'll bail out with a partial argument list. - p.recover(TokenCParen) - break Token - } - - sep := p.Read() - if sep.Type == TokenCParen { - closeTok = sep - break Token - } - - if sep.Type == TokenEllipsis { - expandFinal = true - - if p.Peek().Type != TokenCParen { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing closing parenthesis", - Detail: "An expanded function argument (with ...) must be immediately followed by closing parentheses.", - Subject: &sep.Range, - Context: hcl.RangeBetween(name.Range, sep.Range).Ptr(), - }) - } - closeTok = p.recover(TokenCParen) - } else { - closeTok = p.Read() // eat closing paren - } - break Token - } - - if sep.Type != TokenComma { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing argument separator", - Detail: "A comma is required to separate each function argument from the next.", - Subject: &sep.Range, - Context: hcl.RangeBetween(name.Range, sep.Range).Ptr(), - }) - closeTok = p.recover(TokenCParen) - break Token - } - - if p.Peek().Type == TokenCParen { - // A trailing comma after the last argument gets us in here. - closeTok = p.Read() // eat closing paren - break Token - } - - } - - p.PopIncludeNewlines() - - return &FunctionCallExpr{ - Name: string(name.Bytes), - Args: args, - - ExpandFinal: expandFinal, - - NameRange: name.Range, - OpenParenRange: openTok.Range, - CloseParenRange: closeTok.Range, - }, diags -} - -func (p *parser) parseTupleCons() (Expression, hcl.Diagnostics) { - open := p.Read() - if open.Type != TokenOBrack { - // Should never happen if callers are behaving - panic("parseTupleCons called without peeker pointing to open bracket") - } - - p.PushIncludeNewlines(false) - defer p.PopIncludeNewlines() - - if forKeyword.TokenMatches(p.Peek()) { - return p.finishParsingForExpr(open) - } - - var close Token - - var diags hcl.Diagnostics - var exprs []Expression - - for { - next := p.Peek() - if next.Type == TokenCBrack { - close = p.Read() // eat closer - break - } - - expr, exprDiags := p.ParseExpression() - exprs = append(exprs, expr) - diags = append(diags, exprDiags...) - - if p.recovery && exprDiags.HasErrors() { - // If expression parsing failed then we are probably in a strange - // place in the token stream, so we'll bail out and try to reset - // to after our closing bracket to allow parsing to continue. - close = p.recover(TokenCBrack) - break - } - - next = p.Peek() - if next.Type == TokenCBrack { - close = p.Read() // eat closer - break - } - - if next.Type != TokenComma { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing item separator", - Detail: "Expected a comma to mark the beginning of the next item.", - Subject: &next.Range, - Context: hcl.RangeBetween(open.Range, next.Range).Ptr(), - }) - } - close = p.recover(TokenCBrack) - break - } - - p.Read() // eat comma - - } - - return &TupleConsExpr{ - Exprs: exprs, - - SrcRange: hcl.RangeBetween(open.Range, close.Range), - OpenRange: open.Range, - }, diags -} - -func (p *parser) parseObjectCons() (Expression, hcl.Diagnostics) { - open := p.Read() - if open.Type != TokenOBrace { - // Should never happen if callers are behaving - panic("parseObjectCons called without peeker pointing to open brace") - } - - // We must temporarily stop looking at newlines here while we check for - // a "for" keyword, since for expressions are _not_ newline-sensitive, - // even though object constructors are. - p.PushIncludeNewlines(false) - isFor := forKeyword.TokenMatches(p.Peek()) - p.PopIncludeNewlines() - if isFor { - return p.finishParsingForExpr(open) - } - - p.PushIncludeNewlines(true) - defer p.PopIncludeNewlines() - - var close Token - - var diags hcl.Diagnostics - var items []ObjectConsItem - - for { - next := p.Peek() - if next.Type == TokenNewline { - p.Read() // eat newline - continue - } - - if next.Type == TokenCBrace { - close = p.Read() // eat closer - break - } - - // Wrapping parens are not explicitly represented in the AST, but - // we want to use them here to disambiguate intepreting a mapping - // key as a full expression rather than just a name, and so - // we'll remember this was present and use it to force the - // behavior of our final ObjectConsKeyExpr. - forceNonLiteral := (p.Peek().Type == TokenOParen) - - var key Expression - var keyDiags hcl.Diagnostics - key, keyDiags = p.ParseExpression() - diags = append(diags, keyDiags...) - - if p.recovery && keyDiags.HasErrors() { - // If expression parsing failed then we are probably in a strange - // place in the token stream, so we'll bail out and try to reset - // to after our closing brace to allow parsing to continue. - close = p.recover(TokenCBrace) - break - } - - // We wrap up the key expression in a special wrapper that deals - // with our special case that naked identifiers as object keys - // are interpreted as literal strings. - key = &ObjectConsKeyExpr{ - Wrapped: key, - ForceNonLiteral: forceNonLiteral, - } - - next = p.Peek() - if next.Type != TokenEqual && next.Type != TokenColon { - if !p.recovery { - switch next.Type { - case TokenNewline, TokenComma: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing attribute value", - Detail: "Expected an attribute value, introduced by an equals sign (\"=\").", - Subject: &next.Range, - Context: hcl.RangeBetween(open.Range, next.Range).Ptr(), - }) - case TokenIdent: - // Although this might just be a plain old missing equals - // sign before a reference, one way to get here is to try - // to write an attribute name containing a period followed - // by a digit, which was valid in HCL1, like this: - // foo1.2_bar = "baz" - // We can't know exactly what the user intended here, but - // we'll augment our message with an extra hint in this case - // in case it is helpful. - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing key/value separator", - Detail: "Expected an equals sign (\"=\") to mark the beginning of the attribute value. If you intended to given an attribute name containing periods or spaces, write the name in quotes to create a string literal.", - Subject: &next.Range, - Context: hcl.RangeBetween(open.Range, next.Range).Ptr(), - }) - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing key/value separator", - Detail: "Expected an equals sign (\"=\") to mark the beginning of the attribute value.", - Subject: &next.Range, - Context: hcl.RangeBetween(open.Range, next.Range).Ptr(), - }) - } - } - close = p.recover(TokenCBrace) - break - } - - p.Read() // eat equals sign or colon - - value, valueDiags := p.ParseExpression() - diags = append(diags, valueDiags...) - - if p.recovery && valueDiags.HasErrors() { - // If expression parsing failed then we are probably in a strange - // place in the token stream, so we'll bail out and try to reset - // to after our closing brace to allow parsing to continue. - close = p.recover(TokenCBrace) - break - } - - items = append(items, ObjectConsItem{ - KeyExpr: key, - ValueExpr: value, - }) - - next = p.Peek() - if next.Type == TokenCBrace { - close = p.Read() // eat closer - break - } - - if next.Type != TokenComma && next.Type != TokenNewline { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing attribute separator", - Detail: "Expected a newline or comma to mark the beginning of the next attribute.", - Subject: &next.Range, - Context: hcl.RangeBetween(open.Range, next.Range).Ptr(), - }) - } - close = p.recover(TokenCBrace) - break - } - - p.Read() // eat comma or newline - - } - - return &ObjectConsExpr{ - Items: items, - - SrcRange: hcl.RangeBetween(open.Range, close.Range), - OpenRange: open.Range, - }, diags -} - -func (p *parser) finishParsingForExpr(open Token) (Expression, hcl.Diagnostics) { - p.PushIncludeNewlines(false) - defer p.PopIncludeNewlines() - introducer := p.Read() - if !forKeyword.TokenMatches(introducer) { - // Should never happen if callers are behaving - panic("finishParsingForExpr called without peeker pointing to 'for' identifier") - } - - var makeObj bool - var closeType TokenType - switch open.Type { - case TokenOBrace: - makeObj = true - closeType = TokenCBrace - case TokenOBrack: - makeObj = false // making a tuple - closeType = TokenCBrack - default: - // Should never happen if callers are behaving - panic("finishParsingForExpr called with invalid open token") - } - - var diags hcl.Diagnostics - var keyName, valName string - - if p.Peek().Type != TokenIdent { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "For expression requires variable name after 'for'.", - Subject: p.Peek().Range.Ptr(), - Context: hcl.RangeBetween(open.Range, p.Peek().Range).Ptr(), - }) - } - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - - valName = string(p.Read().Bytes) - - if p.Peek().Type == TokenComma { - // What we just read was actually the key, then. - keyName = valName - p.Read() // eat comma - - if p.Peek().Type != TokenIdent { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "For expression requires value variable name after comma.", - Subject: p.Peek().Range.Ptr(), - Context: hcl.RangeBetween(open.Range, p.Peek().Range).Ptr(), - }) - } - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - - valName = string(p.Read().Bytes) - } - - if !inKeyword.TokenMatches(p.Peek()) { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "For expression requires the 'in' keyword after its name declarations.", - Subject: p.Peek().Range.Ptr(), - Context: hcl.RangeBetween(open.Range, p.Peek().Range).Ptr(), - }) - } - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - p.Read() // eat 'in' keyword - - collExpr, collDiags := p.ParseExpression() - diags = append(diags, collDiags...) - if p.recovery && collDiags.HasErrors() { - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - - if p.Peek().Type != TokenColon { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "For expression requires a colon after the collection expression.", - Subject: p.Peek().Range.Ptr(), - Context: hcl.RangeBetween(open.Range, p.Peek().Range).Ptr(), - }) - } - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - p.Read() // eat colon - - var keyExpr, valExpr Expression - var keyDiags, valDiags hcl.Diagnostics - valExpr, valDiags = p.ParseExpression() - if p.Peek().Type == TokenFatArrow { - // What we just parsed was actually keyExpr - p.Read() // eat the fat arrow - keyExpr, keyDiags = valExpr, valDiags - - valExpr, valDiags = p.ParseExpression() - } - diags = append(diags, keyDiags...) - diags = append(diags, valDiags...) - if p.recovery && (keyDiags.HasErrors() || valDiags.HasErrors()) { - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - - group := false - var ellipsis Token - if p.Peek().Type == TokenEllipsis { - ellipsis = p.Read() - group = true - } - - var condExpr Expression - var condDiags hcl.Diagnostics - if ifKeyword.TokenMatches(p.Peek()) { - p.Read() // eat "if" - condExpr, condDiags = p.ParseExpression() - diags = append(diags, condDiags...) - if p.recovery && condDiags.HasErrors() { - close := p.recover(p.oppositeBracket(open.Type)) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - } - - var close Token - if p.Peek().Type == closeType { - close = p.Read() - } else { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "Extra characters after the end of the 'for' expression.", - Subject: p.Peek().Range.Ptr(), - Context: hcl.RangeBetween(open.Range, p.Peek().Range).Ptr(), - }) - } - close = p.recover(closeType) - } - - if !makeObj { - if keyExpr != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "Key expression is not valid when building a tuple.", - Subject: keyExpr.Range().Ptr(), - Context: hcl.RangeBetween(open.Range, close.Range).Ptr(), - }) - } - - if group { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "Grouping ellipsis (...) cannot be used when building a tuple.", - Subject: &ellipsis.Range, - Context: hcl.RangeBetween(open.Range, close.Range).Ptr(), - }) - } - } else { - if keyExpr == nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "Key expression is required when building an object.", - Subject: valExpr.Range().Ptr(), - Context: hcl.RangeBetween(open.Range, close.Range).Ptr(), - }) - } - } - - return &ForExpr{ - KeyVar: keyName, - ValVar: valName, - CollExpr: collExpr, - KeyExpr: keyExpr, - ValExpr: valExpr, - CondExpr: condExpr, - Group: group, - - SrcRange: hcl.RangeBetween(open.Range, close.Range), - OpenRange: open.Range, - CloseRange: close.Range, - }, diags -} - -// parseQuotedStringLiteral is a helper for parsing quoted strings that -// aren't allowed to contain any interpolations, such as block labels. -func (p *parser) parseQuotedStringLiteral() (string, hcl.Range, hcl.Diagnostics) { - oQuote := p.Read() - if oQuote.Type != TokenOQuote { - return "", oQuote.Range, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Invalid string literal", - Detail: "A quoted string is required here.", - Subject: &oQuote.Range, - }, - } - } - - var diags hcl.Diagnostics - ret := &bytes.Buffer{} - var cQuote Token - -Token: - for { - tok := p.Read() - switch tok.Type { - - case TokenCQuote: - cQuote = tok - break Token - - case TokenQuotedLit: - s, sDiags := ParseStringLiteralToken(tok) - diags = append(diags, sDiags...) - ret.WriteString(s) - - case TokenTemplateControl, TokenTemplateInterp: - which := "$" - if tok.Type == TokenTemplateControl { - which = "%" - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid string literal", - Detail: fmt.Sprintf( - "Template sequences are not allowed in this string. To include a literal %q, double it (as \"%s%s\") to escape it.", - which, which, which, - ), - Subject: &tok.Range, - Context: hcl.RangeBetween(oQuote.Range, tok.Range).Ptr(), - }) - - // Now that we're returning an error callers won't attempt to use - // the result for any real operations, but they might try to use - // the partial AST for other analyses, so we'll leave a marker - // to indicate that there was something invalid in the string to - // help avoid misinterpretation of the partial result - ret.WriteString(which) - ret.WriteString("{ ... }") - - p.recover(TokenTemplateSeqEnd) // we'll try to keep parsing after the sequence ends - - case TokenEOF: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unterminated string literal", - Detail: "Unable to find the closing quote mark before the end of the file.", - Subject: &tok.Range, - Context: hcl.RangeBetween(oQuote.Range, tok.Range).Ptr(), - }) - break Token - - default: - // Should never happen, as long as the scanner is behaving itself - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid string literal", - Detail: "This item is not valid in a string literal.", - Subject: &tok.Range, - Context: hcl.RangeBetween(oQuote.Range, tok.Range).Ptr(), - }) - p.recover(TokenCQuote) - break Token - - } - - } - - return ret.String(), hcl.RangeBetween(oQuote.Range, cQuote.Range), diags -} - -// ParseStringLiteralToken processes the given token, which must be either a -// TokenQuotedLit or a TokenStringLit, returning the string resulting from -// resolving any escape sequences. -// -// If any error diagnostics are returned, the returned string may be incomplete -// or otherwise invalid. -func ParseStringLiteralToken(tok Token) (string, hcl.Diagnostics) { - var quoted bool - switch tok.Type { - case TokenQuotedLit: - quoted = true - case TokenStringLit: - quoted = false - default: - panic("ParseStringLiteralToken can only be used with TokenStringLit and TokenQuotedLit tokens") - } - var diags hcl.Diagnostics - - ret := make([]byte, 0, len(tok.Bytes)) - slices := scanStringLit(tok.Bytes, quoted) - - // We will mutate rng constantly as we walk through our token slices below. - // Any diagnostics must take a copy of this rng rather than simply pointing - // to it, e.g. by using rng.Ptr() rather than &rng. - rng := tok.Range - rng.End = rng.Start - -Slices: - for _, slice := range slices { - if len(slice) == 0 { - continue - } - - // Advance the start of our range to where the previous token ended - rng.Start = rng.End - - // Advance the end of our range to after our token. - b := slice - for len(b) > 0 { - adv, ch, _ := textseg.ScanGraphemeClusters(b, true) - rng.End.Byte += adv - switch ch[0] { - case '\r', '\n': - rng.End.Line++ - rng.End.Column = 1 - default: - rng.End.Column++ - } - b = b[adv:] - } - - TokenType: - switch slice[0] { - case '\\': - if !quoted { - // If we're not in quoted mode then just treat this token as - // normal. (Slices can still start with backslash even if we're - // not specifically looking for backslash sequences.) - break TokenType - } - if len(slice) < 2 { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid escape sequence", - Detail: "Backslash must be followed by an escape sequence selector character.", - Subject: rng.Ptr(), - }) - break TokenType - } - - switch slice[1] { - - case 'n': - ret = append(ret, '\n') - continue Slices - case 'r': - ret = append(ret, '\r') - continue Slices - case 't': - ret = append(ret, '\t') - continue Slices - case '"': - ret = append(ret, '"') - continue Slices - case '\\': - ret = append(ret, '\\') - continue Slices - case 'u', 'U': - if slice[1] == 'u' && len(slice) != 6 { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid escape sequence", - Detail: "The \\u escape sequence must be followed by four hexadecimal digits.", - Subject: rng.Ptr(), - }) - break TokenType - } else if slice[1] == 'U' && len(slice) != 10 { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid escape sequence", - Detail: "The \\U escape sequence must be followed by eight hexadecimal digits.", - Subject: rng.Ptr(), - }) - break TokenType - } - - numHex := string(slice[2:]) - num, err := strconv.ParseUint(numHex, 16, 32) - if err != nil { - // Should never happen because the scanner won't match - // a sequence of digits that isn't valid. - panic(err) - } - - r := rune(num) - l := utf8.RuneLen(r) - if l == -1 { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid escape sequence", - Detail: fmt.Sprintf("Cannot encode character U+%04x in UTF-8.", num), - Subject: rng.Ptr(), - }) - break TokenType - } - for i := 0; i < l; i++ { - ret = append(ret, 0) - } - rb := ret[len(ret)-l:] - utf8.EncodeRune(rb, r) - - continue Slices - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid escape sequence", - Detail: fmt.Sprintf("The symbol %q is not a valid escape sequence selector.", slice[1:]), - Subject: rng.Ptr(), - }) - ret = append(ret, slice[1:]...) - continue Slices - } - - case '$', '%': - if len(slice) != 3 { - // Not long enough to be our escape sequence, so it's literal. - break TokenType - } - - if slice[1] == slice[0] && slice[2] == '{' { - ret = append(ret, slice[0]) - ret = append(ret, '{') - continue Slices - } - - break TokenType - } - - // If we fall out here or break out of here from the switch above - // then this slice is just a literal. - ret = append(ret, slice...) - } - - return string(ret), diags -} - -// setRecovery turns on recovery mode without actually doing any recovery. -// This can be used when a parser knowingly leaves the peeker in a useless -// place and wants to suppress errors that might result from that decision. -func (p *parser) setRecovery() { - p.recovery = true -} - -// recover seeks forward in the token stream until it finds TokenType "end", -// then returns with the peeker pointed at the following token. -// -// If the given token type is a bracketer, this function will additionally -// count nested instances of the brackets to try to leave the peeker at -// the end of the _current_ instance of that bracketer, skipping over any -// nested instances. This is a best-effort operation and may have -// unpredictable results on input with bad bracketer nesting. -func (p *parser) recover(end TokenType) Token { - start := p.oppositeBracket(end) - p.recovery = true - - nest := 0 - for { - tok := p.Read() - ty := tok.Type - if end == TokenTemplateSeqEnd && ty == TokenTemplateControl { - // normalize so that our matching behavior can work, since - // TokenTemplateControl/TokenTemplateInterp are asymmetrical - // with TokenTemplateSeqEnd and thus we need to count both - // openers if that's the closer we're looking for. - ty = TokenTemplateInterp - } - - switch ty { - case start: - nest++ - case end: - if nest < 1 { - return tok - } - - nest-- - case TokenEOF: - return tok - } - } -} - -// recoverOver seeks forward in the token stream until it finds a block -// starting with TokenType "start", then finds the corresponding end token, -// leaving the peeker pointed at the token after that end token. -// -// The given token type _must_ be a bracketer. For example, if the given -// start token is TokenOBrace then the parser will be left at the _end_ of -// the next brace-delimited block encountered, or at EOF if no such block -// is found or it is unclosed. -func (p *parser) recoverOver(start TokenType) { - end := p.oppositeBracket(start) - - // find the opening bracket first -Token: - for { - tok := p.Read() - switch tok.Type { - case start, TokenEOF: - break Token - } - } - - // Now use our existing recover function to locate the _end_ of the - // container we've found. - p.recover(end) -} - -func (p *parser) recoverAfterBodyItem() { - p.recovery = true - var open []TokenType - -Token: - for { - tok := p.Read() - - switch tok.Type { - - case TokenNewline: - if len(open) == 0 { - break Token - } - - case TokenEOF: - break Token - - case TokenOBrace, TokenOBrack, TokenOParen, TokenOQuote, TokenOHeredoc, TokenTemplateInterp, TokenTemplateControl: - open = append(open, tok.Type) - - case TokenCBrace, TokenCBrack, TokenCParen, TokenCQuote, TokenCHeredoc: - opener := p.oppositeBracket(tok.Type) - for len(open) > 0 && open[len(open)-1] != opener { - open = open[:len(open)-1] - } - if len(open) > 0 { - open = open[:len(open)-1] - } - - case TokenTemplateSeqEnd: - for len(open) > 0 && open[len(open)-1] != TokenTemplateInterp && open[len(open)-1] != TokenTemplateControl { - open = open[:len(open)-1] - } - if len(open) > 0 { - open = open[:len(open)-1] - } - - } - } -} - -// oppositeBracket finds the bracket that opposes the given bracketer, or -// NilToken if the given token isn't a bracketer. -// -// "Bracketer", for the sake of this function, is one end of a matching -// open/close set of tokens that establish a bracketing context. -func (p *parser) oppositeBracket(ty TokenType) TokenType { - switch ty { - - case TokenOBrace: - return TokenCBrace - case TokenOBrack: - return TokenCBrack - case TokenOParen: - return TokenCParen - case TokenOQuote: - return TokenCQuote - case TokenOHeredoc: - return TokenCHeredoc - - case TokenCBrace: - return TokenOBrace - case TokenCBrack: - return TokenOBrack - case TokenCParen: - return TokenOParen - case TokenCQuote: - return TokenOQuote - case TokenCHeredoc: - return TokenOHeredoc - - case TokenTemplateControl: - return TokenTemplateSeqEnd - case TokenTemplateInterp: - return TokenTemplateSeqEnd - case TokenTemplateSeqEnd: - // This is ambigous, but we return Interp here because that's - // what's assumed by the "recover" method. - return TokenTemplateInterp - - default: - return TokenNil - } -} - -func errPlaceholderExpr(rng hcl.Range) Expression { - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: rng, - } -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_template.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_template.go deleted file mode 100644 index eb8f7ea38..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_template.go +++ /dev/null @@ -1,799 +0,0 @@ -package hclsyntax - -import ( - "fmt" - "strings" - "unicode" - - "github.com/apparentlymart/go-textseg/textseg" - "github.com/hashicorp/hcl/v2" - "github.com/zclconf/go-cty/cty" -) - -func (p *parser) ParseTemplate() (Expression, hcl.Diagnostics) { - return p.parseTemplate(TokenEOF, false) -} - -func (p *parser) parseTemplate(end TokenType, flushHeredoc bool) (Expression, hcl.Diagnostics) { - exprs, passthru, rng, diags := p.parseTemplateInner(end, flushHeredoc) - - if passthru { - if len(exprs) != 1 { - panic("passthru set with len(exprs) != 1") - } - return &TemplateWrapExpr{ - Wrapped: exprs[0], - SrcRange: rng, - }, diags - } - - return &TemplateExpr{ - Parts: exprs, - SrcRange: rng, - }, diags -} - -func (p *parser) parseTemplateInner(end TokenType, flushHeredoc bool) ([]Expression, bool, hcl.Range, hcl.Diagnostics) { - parts, diags := p.parseTemplateParts(end) - if flushHeredoc { - flushHeredocTemplateParts(parts) // Trim off leading spaces on lines per the flush heredoc spec - } - tp := templateParser{ - Tokens: parts.Tokens, - SrcRange: parts.SrcRange, - } - exprs, exprsDiags := tp.parseRoot() - diags = append(diags, exprsDiags...) - - passthru := false - if len(parts.Tokens) == 2 { // one real token and one synthetic "end" token - if _, isInterp := parts.Tokens[0].(*templateInterpToken); isInterp { - passthru = true - } - } - - return exprs, passthru, parts.SrcRange, diags -} - -type templateParser struct { - Tokens []templateToken - SrcRange hcl.Range - - pos int -} - -func (p *templateParser) parseRoot() ([]Expression, hcl.Diagnostics) { - var exprs []Expression - var diags hcl.Diagnostics - - for { - next := p.Peek() - if _, isEnd := next.(*templateEndToken); isEnd { - break - } - - expr, exprDiags := p.parseExpr() - diags = append(diags, exprDiags...) - exprs = append(exprs, expr) - } - - return exprs, diags -} - -func (p *templateParser) parseExpr() (Expression, hcl.Diagnostics) { - next := p.Peek() - switch tok := next.(type) { - - case *templateLiteralToken: - p.Read() // eat literal - return &LiteralValueExpr{ - Val: cty.StringVal(tok.Val), - SrcRange: tok.SrcRange, - }, nil - - case *templateInterpToken: - p.Read() // eat interp - return tok.Expr, nil - - case *templateIfToken: - return p.parseIf() - - case *templateForToken: - return p.parseFor() - - case *templateEndToken: - p.Read() // eat erroneous token - return errPlaceholderExpr(tok.SrcRange), hcl.Diagnostics{ - { - // This is a particularly unhelpful diagnostic, so callers - // should attempt to pre-empt it and produce a more helpful - // diagnostic that is context-aware. - Severity: hcl.DiagError, - Summary: "Unexpected end of template", - Detail: "The control directives within this template are unbalanced.", - Subject: &tok.SrcRange, - }, - } - - case *templateEndCtrlToken: - p.Read() // eat erroneous token - return errPlaceholderExpr(tok.SrcRange), hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Unexpected %s directive", tok.Name()), - Detail: "The control directives within this template are unbalanced.", - Subject: &tok.SrcRange, - }, - } - - default: - // should never happen, because above should be exhaustive - panic(fmt.Sprintf("unhandled template token type %T", next)) - } -} - -func (p *templateParser) parseIf() (Expression, hcl.Diagnostics) { - open := p.Read() - openIf, isIf := open.(*templateIfToken) - if !isIf { - // should never happen if caller is behaving - panic("parseIf called with peeker not pointing at if token") - } - - var ifExprs, elseExprs []Expression - var diags hcl.Diagnostics - var endifRange hcl.Range - - currentExprs := &ifExprs -Token: - for { - next := p.Peek() - if end, isEnd := next.(*templateEndToken); isEnd { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unexpected end of template", - Detail: fmt.Sprintf( - "The if directive at %s is missing its corresponding endif directive.", - openIf.SrcRange, - ), - Subject: &end.SrcRange, - }) - return errPlaceholderExpr(end.SrcRange), diags - } - if end, isCtrlEnd := next.(*templateEndCtrlToken); isCtrlEnd { - p.Read() // eat end directive - - switch end.Type { - - case templateElse: - if currentExprs == &ifExprs { - currentExprs = &elseExprs - continue Token - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unexpected else directive", - Detail: fmt.Sprintf( - "Already in the else clause for the if started at %s.", - openIf.SrcRange, - ), - Subject: &end.SrcRange, - }) - - case templateEndIf: - endifRange = end.SrcRange - break Token - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Unexpected %s directive", end.Name()), - Detail: fmt.Sprintf( - "Expecting an endif directive for the if started at %s.", - openIf.SrcRange, - ), - Subject: &end.SrcRange, - }) - } - - return errPlaceholderExpr(end.SrcRange), diags - } - - expr, exprDiags := p.parseExpr() - diags = append(diags, exprDiags...) - *currentExprs = append(*currentExprs, expr) - } - - if len(ifExprs) == 0 { - ifExprs = append(ifExprs, &LiteralValueExpr{ - Val: cty.StringVal(""), - SrcRange: hcl.Range{ - Filename: openIf.SrcRange.Filename, - Start: openIf.SrcRange.End, - End: openIf.SrcRange.End, - }, - }) - } - if len(elseExprs) == 0 { - elseExprs = append(elseExprs, &LiteralValueExpr{ - Val: cty.StringVal(""), - SrcRange: hcl.Range{ - Filename: endifRange.Filename, - Start: endifRange.Start, - End: endifRange.Start, - }, - }) - } - - trueExpr := &TemplateExpr{ - Parts: ifExprs, - SrcRange: hcl.RangeBetween(ifExprs[0].Range(), ifExprs[len(ifExprs)-1].Range()), - } - falseExpr := &TemplateExpr{ - Parts: elseExprs, - SrcRange: hcl.RangeBetween(elseExprs[0].Range(), elseExprs[len(elseExprs)-1].Range()), - } - - return &ConditionalExpr{ - Condition: openIf.CondExpr, - TrueResult: trueExpr, - FalseResult: falseExpr, - - SrcRange: hcl.RangeBetween(openIf.SrcRange, endifRange), - }, diags -} - -func (p *templateParser) parseFor() (Expression, hcl.Diagnostics) { - open := p.Read() - openFor, isFor := open.(*templateForToken) - if !isFor { - // should never happen if caller is behaving - panic("parseFor called with peeker not pointing at for token") - } - - var contentExprs []Expression - var diags hcl.Diagnostics - var endforRange hcl.Range - -Token: - for { - next := p.Peek() - if end, isEnd := next.(*templateEndToken); isEnd { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unexpected end of template", - Detail: fmt.Sprintf( - "The for directive at %s is missing its corresponding endfor directive.", - openFor.SrcRange, - ), - Subject: &end.SrcRange, - }) - return errPlaceholderExpr(end.SrcRange), diags - } - if end, isCtrlEnd := next.(*templateEndCtrlToken); isCtrlEnd { - p.Read() // eat end directive - - switch end.Type { - - case templateElse: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unexpected else directive", - Detail: "An else clause is not expected for a for directive.", - Subject: &end.SrcRange, - }) - - case templateEndFor: - endforRange = end.SrcRange - break Token - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Unexpected %s directive", end.Name()), - Detail: fmt.Sprintf( - "Expecting an endfor directive corresponding to the for directive at %s.", - openFor.SrcRange, - ), - Subject: &end.SrcRange, - }) - } - - return errPlaceholderExpr(end.SrcRange), diags - } - - expr, exprDiags := p.parseExpr() - diags = append(diags, exprDiags...) - contentExprs = append(contentExprs, expr) - } - - if len(contentExprs) == 0 { - contentExprs = append(contentExprs, &LiteralValueExpr{ - Val: cty.StringVal(""), - SrcRange: hcl.Range{ - Filename: openFor.SrcRange.Filename, - Start: openFor.SrcRange.End, - End: openFor.SrcRange.End, - }, - }) - } - - contentExpr := &TemplateExpr{ - Parts: contentExprs, - SrcRange: hcl.RangeBetween(contentExprs[0].Range(), contentExprs[len(contentExprs)-1].Range()), - } - - forExpr := &ForExpr{ - KeyVar: openFor.KeyVar, - ValVar: openFor.ValVar, - - CollExpr: openFor.CollExpr, - ValExpr: contentExpr, - - SrcRange: hcl.RangeBetween(openFor.SrcRange, endforRange), - OpenRange: openFor.SrcRange, - CloseRange: endforRange, - } - - return &TemplateJoinExpr{ - Tuple: forExpr, - }, diags -} - -func (p *templateParser) Peek() templateToken { - return p.Tokens[p.pos] -} - -func (p *templateParser) Read() templateToken { - ret := p.Peek() - if _, end := ret.(*templateEndToken); !end { - p.pos++ - } - return ret -} - -// parseTemplateParts produces a flat sequence of "template tokens", which are -// either literal values (with any "trimming" already applied), interpolation -// sequences, or control flow markers. -// -// A further pass is required on the result to turn it into an AST. -func (p *parser) parseTemplateParts(end TokenType) (*templateParts, hcl.Diagnostics) { - var parts []templateToken - var diags hcl.Diagnostics - - startRange := p.NextRange() - ltrimNext := false - nextCanTrimPrev := false - var endRange hcl.Range - -Token: - for { - next := p.Read() - if next.Type == end { - // all done! - endRange = next.Range - break - } - - ltrim := ltrimNext - ltrimNext = false - canTrimPrev := nextCanTrimPrev - nextCanTrimPrev = false - - switch next.Type { - case TokenStringLit, TokenQuotedLit: - str, strDiags := ParseStringLiteralToken(next) - diags = append(diags, strDiags...) - - if ltrim { - str = strings.TrimLeftFunc(str, unicode.IsSpace) - } - - parts = append(parts, &templateLiteralToken{ - Val: str, - SrcRange: next.Range, - }) - nextCanTrimPrev = true - - case TokenTemplateInterp: - // if the opener is ${~ then we want to eat any trailing whitespace - // in the preceding literal token, assuming it is indeed a literal - // token. - if canTrimPrev && len(next.Bytes) == 3 && next.Bytes[2] == '~' && len(parts) > 0 { - prevExpr := parts[len(parts)-1] - if lexpr, ok := prevExpr.(*templateLiteralToken); ok { - lexpr.Val = strings.TrimRightFunc(lexpr.Val, unicode.IsSpace) - } - } - - p.PushIncludeNewlines(false) - expr, exprDiags := p.ParseExpression() - diags = append(diags, exprDiags...) - close := p.Peek() - if close.Type != TokenTemplateSeqEnd { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Extra characters after interpolation expression", - Detail: "Expected a closing brace to end the interpolation expression, but found extra characters.", - Subject: &close.Range, - Context: hcl.RangeBetween(startRange, close.Range).Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - } else { - p.Read() // eat closing brace - - // If the closer is ~} then we want to eat any leading - // whitespace on the next token, if it turns out to be a - // literal token. - if len(close.Bytes) == 2 && close.Bytes[0] == '~' { - ltrimNext = true - } - } - p.PopIncludeNewlines() - parts = append(parts, &templateInterpToken{ - Expr: expr, - SrcRange: hcl.RangeBetween(next.Range, close.Range), - }) - - case TokenTemplateControl: - // if the opener is %{~ then we want to eat any trailing whitespace - // in the preceding literal token, assuming it is indeed a literal - // token. - if canTrimPrev && len(next.Bytes) == 3 && next.Bytes[2] == '~' && len(parts) > 0 { - prevExpr := parts[len(parts)-1] - if lexpr, ok := prevExpr.(*templateLiteralToken); ok { - lexpr.Val = strings.TrimRightFunc(lexpr.Val, unicode.IsSpace) - } - } - p.PushIncludeNewlines(false) - - kw := p.Peek() - if kw.Type != TokenIdent { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template directive", - Detail: "A template directive keyword (\"if\", \"for\", etc) is expected at the beginning of a %{ sequence.", - Subject: &kw.Range, - Context: hcl.RangeBetween(next.Range, kw.Range).Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - p.PopIncludeNewlines() - continue Token - } - p.Read() // eat keyword token - - switch { - - case ifKeyword.TokenMatches(kw): - condExpr, exprDiags := p.ParseExpression() - diags = append(diags, exprDiags...) - parts = append(parts, &templateIfToken{ - CondExpr: condExpr, - SrcRange: hcl.RangeBetween(next.Range, p.NextRange()), - }) - - case elseKeyword.TokenMatches(kw): - parts = append(parts, &templateEndCtrlToken{ - Type: templateElse, - SrcRange: hcl.RangeBetween(next.Range, p.NextRange()), - }) - - case endifKeyword.TokenMatches(kw): - parts = append(parts, &templateEndCtrlToken{ - Type: templateEndIf, - SrcRange: hcl.RangeBetween(next.Range, p.NextRange()), - }) - - case forKeyword.TokenMatches(kw): - var keyName, valName string - if p.Peek().Type != TokenIdent { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' directive", - Detail: "For directive requires variable name after 'for'.", - Subject: p.Peek().Range.Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - p.PopIncludeNewlines() - continue Token - } - - valName = string(p.Read().Bytes) - - if p.Peek().Type == TokenComma { - // What we just read was actually the key, then. - keyName = valName - p.Read() // eat comma - - if p.Peek().Type != TokenIdent { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' directive", - Detail: "For directive requires value variable name after comma.", - Subject: p.Peek().Range.Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - p.PopIncludeNewlines() - continue Token - } - - valName = string(p.Read().Bytes) - } - - if !inKeyword.TokenMatches(p.Peek()) { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' directive", - Detail: "For directive requires 'in' keyword after names.", - Subject: p.Peek().Range.Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - p.PopIncludeNewlines() - continue Token - } - p.Read() // eat 'in' keyword - - collExpr, collDiags := p.ParseExpression() - diags = append(diags, collDiags...) - parts = append(parts, &templateForToken{ - KeyVar: keyName, - ValVar: valName, - CollExpr: collExpr, - - SrcRange: hcl.RangeBetween(next.Range, p.NextRange()), - }) - - case endforKeyword.TokenMatches(kw): - parts = append(parts, &templateEndCtrlToken{ - Type: templateEndFor, - SrcRange: hcl.RangeBetween(next.Range, p.NextRange()), - }) - - default: - if !p.recovery { - suggestions := []string{"if", "for", "else", "endif", "endfor"} - given := string(kw.Bytes) - suggestion := nameSuggestion(given, suggestions) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template control keyword", - Detail: fmt.Sprintf("%q is not a valid template control keyword.%s", given, suggestion), - Subject: &kw.Range, - Context: hcl.RangeBetween(next.Range, kw.Range).Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - p.PopIncludeNewlines() - continue Token - - } - - close := p.Peek() - if close.Type != TokenTemplateSeqEnd { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Extra characters in %s marker", kw.Bytes), - Detail: "Expected a closing brace to end the sequence, but found extra characters.", - Subject: &close.Range, - Context: hcl.RangeBetween(startRange, close.Range).Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - } else { - p.Read() // eat closing brace - - // If the closer is ~} then we want to eat any leading - // whitespace on the next token, if it turns out to be a - // literal token. - if len(close.Bytes) == 2 && close.Bytes[0] == '~' { - ltrimNext = true - } - } - p.PopIncludeNewlines() - - default: - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unterminated template string", - Detail: "No closing marker was found for the string.", - Subject: &next.Range, - Context: hcl.RangeBetween(startRange, next.Range).Ptr(), - }) - } - final := p.recover(end) - endRange = final.Range - break Token - } - } - - if len(parts) == 0 { - // If a sequence has no content, we'll treat it as if it had an - // empty string in it because that's what the user probably means - // if they write "" in configuration. - parts = append(parts, &templateLiteralToken{ - Val: "", - SrcRange: hcl.Range{ - // Range is the zero-character span immediately after the - // opening quote. - Filename: startRange.Filename, - Start: startRange.End, - End: startRange.End, - }, - }) - } - - // Always end with an end token, so the parser can produce diagnostics - // about unclosed items with proper position information. - parts = append(parts, &templateEndToken{ - SrcRange: endRange, - }) - - ret := &templateParts{ - Tokens: parts, - SrcRange: hcl.RangeBetween(startRange, endRange), - } - - return ret, diags -} - -// flushHeredocTemplateParts modifies in-place the line-leading literal strings -// to apply the flush heredoc processing rule: find the line with the smallest -// number of whitespace characters as prefix and then trim that number of -// characters from all of the lines. -// -// This rule is applied to static tokens rather than to the rendered result, -// so interpolating a string with leading whitespace cannot affect the chosen -// prefix length. -func flushHeredocTemplateParts(parts *templateParts) { - if len(parts.Tokens) == 0 { - // Nothing to do - return - } - - const maxInt = int((^uint(0)) >> 1) - - minSpaces := maxInt - newline := true - var adjust []*templateLiteralToken - for _, ttok := range parts.Tokens { - if newline { - newline = false - var spaces int - if lit, ok := ttok.(*templateLiteralToken); ok { - orig := lit.Val - trimmed := strings.TrimLeftFunc(orig, unicode.IsSpace) - // If a token is entirely spaces and ends with a newline - // then it's a "blank line" and thus not considered for - // space-prefix-counting purposes. - if len(trimmed) == 0 && strings.HasSuffix(orig, "\n") { - spaces = maxInt - } else { - spaceBytes := len(lit.Val) - len(trimmed) - spaces, _ = textseg.TokenCount([]byte(orig[:spaceBytes]), textseg.ScanGraphemeClusters) - adjust = append(adjust, lit) - } - } else if _, ok := ttok.(*templateEndToken); ok { - break // don't process the end token since it never has spaces before it - } - if spaces < minSpaces { - minSpaces = spaces - } - } - if lit, ok := ttok.(*templateLiteralToken); ok { - if strings.HasSuffix(lit.Val, "\n") { - newline = true // The following token, if any, begins a new line - } - } - } - - for _, lit := range adjust { - // Since we want to count space _characters_ rather than space _bytes_, - // we can't just do a straightforward slice operation here and instead - // need to hunt for the split point with a scanner. - valBytes := []byte(lit.Val) - spaceByteCount := 0 - for i := 0; i < minSpaces; i++ { - adv, _, _ := textseg.ScanGraphemeClusters(valBytes, true) - spaceByteCount += adv - valBytes = valBytes[adv:] - } - lit.Val = lit.Val[spaceByteCount:] - lit.SrcRange.Start.Column += minSpaces - lit.SrcRange.Start.Byte += spaceByteCount - } -} - -type templateParts struct { - Tokens []templateToken - SrcRange hcl.Range -} - -// templateToken is a higher-level token that represents a single atom within -// the template language. Our template parsing first raises the raw token -// stream to a sequence of templateToken, and then transforms the result into -// an expression tree. -type templateToken interface { - templateToken() templateToken -} - -type templateLiteralToken struct { - Val string - SrcRange hcl.Range - isTemplateToken -} - -type templateInterpToken struct { - Expr Expression - SrcRange hcl.Range - isTemplateToken -} - -type templateIfToken struct { - CondExpr Expression - SrcRange hcl.Range - isTemplateToken -} - -type templateForToken struct { - KeyVar string // empty if ignoring key - ValVar string - CollExpr Expression - SrcRange hcl.Range - isTemplateToken -} - -type templateEndCtrlType int - -const ( - templateEndIf templateEndCtrlType = iota - templateElse - templateEndFor -) - -type templateEndCtrlToken struct { - Type templateEndCtrlType - SrcRange hcl.Range - isTemplateToken -} - -func (t *templateEndCtrlToken) Name() string { - switch t.Type { - case templateEndIf: - return "endif" - case templateElse: - return "else" - case templateEndFor: - return "endfor" - default: - // should never happen - panic("invalid templateEndCtrlType") - } -} - -type templateEndToken struct { - SrcRange hcl.Range - isTemplateToken -} - -type isTemplateToken [0]int - -func (t isTemplateToken) templateToken() templateToken { - return t -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_traversal.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_traversal.go deleted file mode 100644 index 7dcb0fd34..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_traversal.go +++ /dev/null @@ -1,159 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl/v2" - "github.com/zclconf/go-cty/cty" -) - -// ParseTraversalAbs parses an absolute traversal that is assumed to consume -// all of the remaining tokens in the peeker. The usual parser recovery -// behavior is not supported here because traversals are not expected to -// be parsed as part of a larger program. -func (p *parser) ParseTraversalAbs() (hcl.Traversal, hcl.Diagnostics) { - var ret hcl.Traversal - var diags hcl.Diagnostics - - // Absolute traversal must always begin with a variable name - varTok := p.Read() - if varTok.Type != TokenIdent { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Variable name required", - Detail: "Must begin with a variable name.", - Subject: &varTok.Range, - }) - return ret, diags - } - - varName := string(varTok.Bytes) - ret = append(ret, hcl.TraverseRoot{ - Name: varName, - SrcRange: varTok.Range, - }) - - for { - next := p.Peek() - - if next.Type == TokenEOF { - return ret, diags - } - - switch next.Type { - case TokenDot: - // Attribute access - dot := p.Read() // eat dot - nameTok := p.Read() - if nameTok.Type != TokenIdent { - if nameTok.Type == TokenStar { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Attribute name required", - Detail: "Splat expressions (.*) may not be used here.", - Subject: &nameTok.Range, - Context: hcl.RangeBetween(varTok.Range, nameTok.Range).Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Attribute name required", - Detail: "Dot must be followed by attribute name.", - Subject: &nameTok.Range, - Context: hcl.RangeBetween(varTok.Range, nameTok.Range).Ptr(), - }) - } - return ret, diags - } - - attrName := string(nameTok.Bytes) - ret = append(ret, hcl.TraverseAttr{ - Name: attrName, - SrcRange: hcl.RangeBetween(dot.Range, nameTok.Range), - }) - case TokenOBrack: - // Index - open := p.Read() // eat open bracket - next := p.Peek() - - switch next.Type { - case TokenNumberLit: - tok := p.Read() // eat number - numVal, numDiags := p.numberLitValue(tok) - diags = append(diags, numDiags...) - - close := p.Read() - if close.Type != TokenCBrack { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unclosed index brackets", - Detail: "Index key must be followed by a closing bracket.", - Subject: &close.Range, - Context: hcl.RangeBetween(open.Range, close.Range).Ptr(), - }) - } - - ret = append(ret, hcl.TraverseIndex{ - Key: numVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }) - - if diags.HasErrors() { - return ret, diags - } - - case TokenOQuote: - str, _, strDiags := p.parseQuotedStringLiteral() - diags = append(diags, strDiags...) - - close := p.Read() - if close.Type != TokenCBrack { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unclosed index brackets", - Detail: "Index key must be followed by a closing bracket.", - Subject: &close.Range, - Context: hcl.RangeBetween(open.Range, close.Range).Ptr(), - }) - } - - ret = append(ret, hcl.TraverseIndex{ - Key: cty.StringVal(str), - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }) - - if diags.HasErrors() { - return ret, diags - } - - default: - if next.Type == TokenStar { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Attribute name required", - Detail: "Splat expressions ([*]) may not be used here.", - Subject: &next.Range, - Context: hcl.RangeBetween(varTok.Range, next.Range).Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Index value required", - Detail: "Index brackets must contain either a literal number or a literal string.", - Subject: &next.Range, - Context: hcl.RangeBetween(varTok.Range, next.Range).Ptr(), - }) - } - return ret, diags - } - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid character", - Detail: "Expected an attribute access or an index operator.", - Subject: &next.Range, - Context: hcl.RangeBetween(varTok.Range, next.Range).Ptr(), - }) - return ret, diags - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/peeker.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/peeker.go deleted file mode 100644 index f056f906e..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/peeker.go +++ /dev/null @@ -1,212 +0,0 @@ -package hclsyntax - -import ( - "bytes" - "fmt" - "path/filepath" - "runtime" - "strings" - - "github.com/hashicorp/hcl/v2" -) - -// This is set to true at init() time in tests, to enable more useful output -// if a stack discipline error is detected. It should not be enabled in -// normal mode since there is a performance penalty from accessing the -// runtime stack to produce the traces, but could be temporarily set to -// true for debugging if desired. -var tracePeekerNewlinesStack = false - -type peeker struct { - Tokens Tokens - NextIndex int - - IncludeComments bool - IncludeNewlinesStack []bool - - // used only when tracePeekerNewlinesStack is set - newlineStackChanges []peekerNewlineStackChange -} - -// for use in debugging the stack usage only -type peekerNewlineStackChange struct { - Pushing bool // if false, then popping - Frame runtime.Frame - Include bool -} - -func newPeeker(tokens Tokens, includeComments bool) *peeker { - return &peeker{ - Tokens: tokens, - IncludeComments: includeComments, - - IncludeNewlinesStack: []bool{true}, - } -} - -func (p *peeker) Peek() Token { - ret, _ := p.nextToken() - return ret -} - -func (p *peeker) Read() Token { - ret, nextIdx := p.nextToken() - p.NextIndex = nextIdx - return ret -} - -func (p *peeker) NextRange() hcl.Range { - return p.Peek().Range -} - -func (p *peeker) PrevRange() hcl.Range { - if p.NextIndex == 0 { - return p.NextRange() - } - - return p.Tokens[p.NextIndex-1].Range -} - -func (p *peeker) nextToken() (Token, int) { - for i := p.NextIndex; i < len(p.Tokens); i++ { - tok := p.Tokens[i] - switch tok.Type { - case TokenComment: - if !p.IncludeComments { - // Single-line comment tokens, starting with # or //, absorb - // the trailing newline that terminates them as part of their - // bytes. When we're filtering out comments, we must as a - // special case transform these to newline tokens in order - // to properly parse newline-terminated block items. - - if p.includingNewlines() { - if len(tok.Bytes) > 0 && tok.Bytes[len(tok.Bytes)-1] == '\n' { - fakeNewline := Token{ - Type: TokenNewline, - Bytes: tok.Bytes[len(tok.Bytes)-1 : len(tok.Bytes)], - - // We use the whole token range as the newline - // range, even though that's a little... weird, - // because otherwise we'd need to go count - // characters again in order to figure out the - // column of the newline, and that complexity - // isn't justified when ranges of newlines are - // so rarely printed anyway. - Range: tok.Range, - } - return fakeNewline, i + 1 - } - } - - continue - } - case TokenNewline: - if !p.includingNewlines() { - continue - } - } - - return tok, i + 1 - } - - // if we fall out here then we'll return the EOF token, and leave - // our index pointed off the end of the array so we'll keep - // returning EOF in future too. - return p.Tokens[len(p.Tokens)-1], len(p.Tokens) -} - -func (p *peeker) includingNewlines() bool { - return p.IncludeNewlinesStack[len(p.IncludeNewlinesStack)-1] -} - -func (p *peeker) PushIncludeNewlines(include bool) { - if tracePeekerNewlinesStack { - // Record who called us so that we can more easily track down any - // mismanagement of the stack in the parser. - callers := []uintptr{0} - runtime.Callers(2, callers) - frames := runtime.CallersFrames(callers) - frame, _ := frames.Next() - p.newlineStackChanges = append(p.newlineStackChanges, peekerNewlineStackChange{ - true, frame, include, - }) - } - - p.IncludeNewlinesStack = append(p.IncludeNewlinesStack, include) -} - -func (p *peeker) PopIncludeNewlines() bool { - stack := p.IncludeNewlinesStack - remain, ret := stack[:len(stack)-1], stack[len(stack)-1] - p.IncludeNewlinesStack = remain - - if tracePeekerNewlinesStack { - // Record who called us so that we can more easily track down any - // mismanagement of the stack in the parser. - callers := []uintptr{0} - runtime.Callers(2, callers) - frames := runtime.CallersFrames(callers) - frame, _ := frames.Next() - p.newlineStackChanges = append(p.newlineStackChanges, peekerNewlineStackChange{ - false, frame, ret, - }) - } - - return ret -} - -// AssertEmptyNewlinesStack checks if the IncludeNewlinesStack is empty, doing -// panicking if it is not. This can be used to catch stack mismanagement that -// might otherwise just cause confusing downstream errors. -// -// This function is a no-op if the stack is empty when called. -// -// If newlines stack tracing is enabled by setting the global variable -// tracePeekerNewlinesStack at init time, a full log of all of the push/pop -// calls will be produced to help identify which caller in the parser is -// misbehaving. -func (p *peeker) AssertEmptyIncludeNewlinesStack() { - if len(p.IncludeNewlinesStack) != 1 { - // Should never happen; indicates mismanagement of the stack inside - // the parser. - if p.newlineStackChanges != nil { // only if traceNewlinesStack is enabled above - panic(fmt.Errorf( - "non-empty IncludeNewlinesStack after parse with %d calls unaccounted for:\n%s", - len(p.IncludeNewlinesStack)-1, - formatPeekerNewlineStackChanges(p.newlineStackChanges), - )) - } else { - panic(fmt.Errorf("non-empty IncludeNewlinesStack after parse: %#v", p.IncludeNewlinesStack)) - } - } -} - -func formatPeekerNewlineStackChanges(changes []peekerNewlineStackChange) string { - indent := 0 - var buf bytes.Buffer - for _, change := range changes { - funcName := change.Frame.Function - if idx := strings.LastIndexByte(funcName, '.'); idx != -1 { - funcName = funcName[idx+1:] - } - filename := change.Frame.File - if idx := strings.LastIndexByte(filename, filepath.Separator); idx != -1 { - filename = filename[idx+1:] - } - - switch change.Pushing { - - case true: - buf.WriteString(strings.Repeat(" ", indent)) - fmt.Fprintf(&buf, "PUSH %#v (%s at %s:%d)\n", change.Include, funcName, filename, change.Frame.Line) - indent++ - - case false: - indent-- - buf.WriteString(strings.Repeat(" ", indent)) - fmt.Fprintf(&buf, "POP %#v (%s at %s:%d)\n", change.Include, funcName, filename, change.Frame.Line) - - } - } - return buf.String() -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/public.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/public.go deleted file mode 100644 index 0b68efd60..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/public.go +++ /dev/null @@ -1,171 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl/v2" -) - -// ParseConfig parses the given buffer as a whole HCL config file, returning -// a *hcl.File representing its contents. If HasErrors called on the returned -// diagnostics returns true, the returned body is likely to be incomplete -// and should therefore be used with care. -// -// The body in the returned file has dynamic type *hclsyntax.Body, so callers -// may freely type-assert this to get access to the full hclsyntax API in -// situations where detailed access is required. However, most common use-cases -// should be served using the hcl.Body interface to ensure compatibility with -// other configurationg syntaxes, such as JSON. -func ParseConfig(src []byte, filename string, start hcl.Pos) (*hcl.File, hcl.Diagnostics) { - tokens, diags := LexConfig(src, filename, start) - peeker := newPeeker(tokens, false) - parser := &parser{peeker: peeker} - body, parseDiags := parser.ParseBody(TokenEOF) - diags = append(diags, parseDiags...) - - // Panic if the parser uses incorrect stack discipline with the peeker's - // newlines stack, since otherwise it will produce confusing downstream - // errors. - peeker.AssertEmptyIncludeNewlinesStack() - - return &hcl.File{ - Body: body, - Bytes: src, - - Nav: navigation{ - root: body, - }, - }, diags -} - -// ParseExpression parses the given buffer as a standalone HCL expression, -// returning it as an instance of Expression. -func ParseExpression(src []byte, filename string, start hcl.Pos) (Expression, hcl.Diagnostics) { - tokens, diags := LexExpression(src, filename, start) - peeker := newPeeker(tokens, false) - parser := &parser{peeker: peeker} - - // Bare expressions are always parsed in "ignore newlines" mode, as if - // they were wrapped in parentheses. - parser.PushIncludeNewlines(false) - - expr, parseDiags := parser.ParseExpression() - diags = append(diags, parseDiags...) - - next := parser.Peek() - if next.Type != TokenEOF && !parser.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Extra characters after expression", - Detail: "An expression was successfully parsed, but extra characters were found after it.", - Subject: &next.Range, - }) - } - - parser.PopIncludeNewlines() - - // Panic if the parser uses incorrect stack discipline with the peeker's - // newlines stack, since otherwise it will produce confusing downstream - // errors. - peeker.AssertEmptyIncludeNewlinesStack() - - return expr, diags -} - -// ParseTemplate parses the given buffer as a standalone HCL template, -// returning it as an instance of Expression. -func ParseTemplate(src []byte, filename string, start hcl.Pos) (Expression, hcl.Diagnostics) { - tokens, diags := LexTemplate(src, filename, start) - peeker := newPeeker(tokens, false) - parser := &parser{peeker: peeker} - expr, parseDiags := parser.ParseTemplate() - diags = append(diags, parseDiags...) - - // Panic if the parser uses incorrect stack discipline with the peeker's - // newlines stack, since otherwise it will produce confusing downstream - // errors. - peeker.AssertEmptyIncludeNewlinesStack() - - return expr, diags -} - -// ParseTraversalAbs parses the given buffer as a standalone absolute traversal. -// -// Parsing as a traversal is more limited than parsing as an expession since -// it allows only attribute and indexing operations on variables. Traverals -// are useful as a syntax for referring to objects without necessarily -// evaluating them. -func ParseTraversalAbs(src []byte, filename string, start hcl.Pos) (hcl.Traversal, hcl.Diagnostics) { - tokens, diags := LexExpression(src, filename, start) - peeker := newPeeker(tokens, false) - parser := &parser{peeker: peeker} - - // Bare traverals are always parsed in "ignore newlines" mode, as if - // they were wrapped in parentheses. - parser.PushIncludeNewlines(false) - - expr, parseDiags := parser.ParseTraversalAbs() - diags = append(diags, parseDiags...) - - parser.PopIncludeNewlines() - - // Panic if the parser uses incorrect stack discipline with the peeker's - // newlines stack, since otherwise it will produce confusing downstream - // errors. - peeker.AssertEmptyIncludeNewlinesStack() - - return expr, diags -} - -// LexConfig performs lexical analysis on the given buffer, treating it as a -// whole HCL config file, and returns the resulting tokens. -// -// Only minimal validation is done during lexical analysis, so the returned -// diagnostics may include errors about lexical issues such as bad character -// encodings or unrecognized characters, but full parsing is required to -// detect _all_ syntax errors. -func LexConfig(src []byte, filename string, start hcl.Pos) (Tokens, hcl.Diagnostics) { - tokens := scanTokens(src, filename, start, scanNormal) - diags := checkInvalidTokens(tokens) - return tokens, diags -} - -// LexExpression performs lexical analysis on the given buffer, treating it as -// a standalone HCL expression, and returns the resulting tokens. -// -// Only minimal validation is done during lexical analysis, so the returned -// diagnostics may include errors about lexical issues such as bad character -// encodings or unrecognized characters, but full parsing is required to -// detect _all_ syntax errors. -func LexExpression(src []byte, filename string, start hcl.Pos) (Tokens, hcl.Diagnostics) { - // This is actually just the same thing as LexConfig, since configs - // and expressions lex in the same way. - tokens := scanTokens(src, filename, start, scanNormal) - diags := checkInvalidTokens(tokens) - return tokens, diags -} - -// LexTemplate performs lexical analysis on the given buffer, treating it as a -// standalone HCL template, and returns the resulting tokens. -// -// Only minimal validation is done during lexical analysis, so the returned -// diagnostics may include errors about lexical issues such as bad character -// encodings or unrecognized characters, but full parsing is required to -// detect _all_ syntax errors. -func LexTemplate(src []byte, filename string, start hcl.Pos) (Tokens, hcl.Diagnostics) { - tokens := scanTokens(src, filename, start, scanTemplate) - diags := checkInvalidTokens(tokens) - return tokens, diags -} - -// ValidIdentifier tests if the given string could be a valid identifier in -// a native syntax expression. -// -// This is useful when accepting names from the user that will be used as -// variable or attribute names in the scope, to ensure that any name chosen -// will be traversable using the variable or attribute traversal syntax. -func ValidIdentifier(s string) bool { - // This is a kinda-expensive way to do something pretty simple, but it - // is easiest to do with our existing scanner-related infrastructure here - // and nobody should be validating identifiers in a tight loop. - tokens := scanTokens([]byte(s), "", hcl.Pos{}, scanIdentOnly) - return len(tokens) == 2 && tokens[0].Type == TokenIdent && tokens[1].Type == TokenEOF -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_string_lit.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_string_lit.go deleted file mode 100644 index 2895ade75..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_string_lit.go +++ /dev/null @@ -1,301 +0,0 @@ -//line scan_string_lit.rl:1 - -package hclsyntax - -// This file is generated from scan_string_lit.rl. DO NOT EDIT. - -//line scan_string_lit.go:9 -var _hclstrtok_actions []byte = []byte{ - 0, 1, 0, 1, 1, 2, 1, 0, -} - -var _hclstrtok_key_offsets []byte = []byte{ - 0, 0, 2, 4, 6, 10, 14, 18, - 22, 27, 31, 36, 41, 46, 51, 57, - 62, 74, 85, 96, 107, 118, 129, 140, - 151, -} - -var _hclstrtok_trans_keys []byte = []byte{ - 128, 191, 128, 191, 128, 191, 10, 13, - 36, 37, 10, 13, 36, 37, 10, 13, - 36, 37, 10, 13, 36, 37, 10, 13, - 36, 37, 123, 10, 13, 36, 37, 10, - 13, 36, 37, 92, 10, 13, 36, 37, - 92, 10, 13, 36, 37, 92, 10, 13, - 36, 37, 92, 10, 13, 36, 37, 92, - 123, 10, 13, 36, 37, 92, 85, 117, - 128, 191, 192, 223, 224, 239, 240, 247, - 248, 255, 10, 13, 36, 37, 92, 48, - 57, 65, 70, 97, 102, 10, 13, 36, - 37, 92, 48, 57, 65, 70, 97, 102, - 10, 13, 36, 37, 92, 48, 57, 65, - 70, 97, 102, 10, 13, 36, 37, 92, - 48, 57, 65, 70, 97, 102, 10, 13, - 36, 37, 92, 48, 57, 65, 70, 97, - 102, 10, 13, 36, 37, 92, 48, 57, - 65, 70, 97, 102, 10, 13, 36, 37, - 92, 48, 57, 65, 70, 97, 102, 10, - 13, 36, 37, 92, 48, 57, 65, 70, - 97, 102, -} - -var _hclstrtok_single_lengths []byte = []byte{ - 0, 0, 0, 0, 4, 4, 4, 4, - 5, 4, 5, 5, 5, 5, 6, 5, - 2, 5, 5, 5, 5, 5, 5, 5, - 5, -} - -var _hclstrtok_range_lengths []byte = []byte{ - 0, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 5, 3, 3, 3, 3, 3, 3, 3, - 3, -} - -var _hclstrtok_index_offsets []byte = []byte{ - 0, 0, 2, 4, 6, 11, 16, 21, - 26, 32, 37, 43, 49, 55, 61, 68, - 74, 82, 91, 100, 109, 118, 127, 136, - 145, -} - -var _hclstrtok_indicies []byte = []byte{ - 0, 1, 2, 1, 3, 1, 5, 6, - 7, 8, 4, 10, 11, 12, 13, 9, - 14, 11, 12, 13, 9, 10, 11, 15, - 13, 9, 10, 11, 12, 13, 14, 9, - 10, 11, 12, 15, 9, 17, 18, 19, - 20, 21, 16, 23, 24, 25, 26, 27, - 22, 0, 24, 25, 26, 27, 22, 23, - 24, 28, 26, 27, 22, 23, 24, 25, - 26, 27, 0, 22, 23, 24, 25, 28, - 27, 22, 29, 30, 22, 2, 3, 31, - 22, 0, 23, 24, 25, 26, 27, 32, - 32, 32, 22, 23, 24, 25, 26, 27, - 33, 33, 33, 22, 23, 24, 25, 26, - 27, 34, 34, 34, 22, 23, 24, 25, - 26, 27, 30, 30, 30, 22, 23, 24, - 25, 26, 27, 35, 35, 35, 22, 23, - 24, 25, 26, 27, 36, 36, 36, 22, - 23, 24, 25, 26, 27, 37, 37, 37, - 22, 23, 24, 25, 26, 27, 0, 0, - 0, 22, -} - -var _hclstrtok_trans_targs []byte = []byte{ - 11, 0, 1, 2, 4, 5, 6, 7, - 9, 4, 5, 6, 7, 9, 5, 8, - 10, 11, 12, 13, 15, 16, 10, 11, - 12, 13, 15, 16, 14, 17, 21, 3, - 18, 19, 20, 22, 23, 24, -} - -var _hclstrtok_trans_actions []byte = []byte{ - 0, 0, 0, 0, 0, 1, 1, 1, - 1, 3, 5, 5, 5, 5, 0, 0, - 0, 1, 1, 1, 1, 1, 3, 5, - 5, 5, 5, 5, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -} - -var _hclstrtok_eof_actions []byte = []byte{ - 0, 0, 0, 0, 0, 3, 3, 3, - 3, 3, 0, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, -} - -const hclstrtok_start int = 4 -const hclstrtok_first_final int = 4 -const hclstrtok_error int = 0 - -const hclstrtok_en_quoted int = 10 -const hclstrtok_en_unquoted int = 4 - -//line scan_string_lit.rl:10 - -func scanStringLit(data []byte, quoted bool) [][]byte { - var ret [][]byte - -//line scan_string_lit.rl:61 - - // Ragel state - p := 0 // "Pointer" into data - pe := len(data) // End-of-data "pointer" - ts := 0 - te := 0 - eof := pe - - var cs int // current state - switch { - case quoted: - cs = hclstrtok_en_quoted - default: - cs = hclstrtok_en_unquoted - } - - // Make Go compiler happy - _ = ts - _ = eof - - /*token := func () { - ret = append(ret, data[ts:te]) - }*/ - -//line scan_string_lit.go:154 - { - } - -//line scan_string_lit.go:158 - { - var _klen int - var _trans int - var _acts int - var _nacts uint - var _keys int - if p == pe { - goto _test_eof - } - if cs == 0 { - goto _out - } - _resume: - _keys = int(_hclstrtok_key_offsets[cs]) - _trans = int(_hclstrtok_index_offsets[cs]) - - _klen = int(_hclstrtok_single_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + _klen - 1) - for { - if _upper < _lower { - break - } - - _mid = _lower + ((_upper - _lower) >> 1) - switch { - case data[p] < _hclstrtok_trans_keys[_mid]: - _upper = _mid - 1 - case data[p] > _hclstrtok_trans_keys[_mid]: - _lower = _mid + 1 - default: - _trans += int(_mid - int(_keys)) - goto _match - } - } - _keys += _klen - _trans += _klen - } - - _klen = int(_hclstrtok_range_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + (_klen << 1) - 2) - for { - if _upper < _lower { - break - } - - _mid = _lower + (((_upper - _lower) >> 1) & ^1) - switch { - case data[p] < _hclstrtok_trans_keys[_mid]: - _upper = _mid - 2 - case data[p] > _hclstrtok_trans_keys[_mid+1]: - _lower = _mid + 2 - default: - _trans += int((_mid - int(_keys)) >> 1) - goto _match - } - } - _trans += _klen - } - - _match: - _trans = int(_hclstrtok_indicies[_trans]) - cs = int(_hclstrtok_trans_targs[_trans]) - - if _hclstrtok_trans_actions[_trans] == 0 { - goto _again - } - - _acts = int(_hclstrtok_trans_actions[_trans]) - _nacts = uint(_hclstrtok_actions[_acts]) - _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _hclstrtok_actions[_acts-1] { - case 0: -//line scan_string_lit.rl:40 - - // If te is behind p then we've skipped over some literal - // characters which we must now return. - if te < p { - ret = append(ret, data[te:p]) - } - ts = p - - case 1: -//line scan_string_lit.rl:48 - - te = p - ret = append(ret, data[ts:te]) - -//line scan_string_lit.go:253 - } - } - - _again: - if cs == 0 { - goto _out - } - p++ - if p != pe { - goto _resume - } - _test_eof: - { - } - if p == eof { - __acts := _hclstrtok_eof_actions[cs] - __nacts := uint(_hclstrtok_actions[__acts]) - __acts++ - for ; __nacts > 0; __nacts-- { - __acts++ - switch _hclstrtok_actions[__acts-1] { - case 1: -//line scan_string_lit.rl:48 - - te = p - ret = append(ret, data[ts:te]) - -//line scan_string_lit.go:278 - } - } - } - - _out: - { - } - } - -//line scan_string_lit.rl:89 - - if te < p { - // Collect any leftover literal characters at the end of the input - ret = append(ret, data[te:p]) - } - - // If we fall out here without being in a final state then we've - // encountered something that the scanner can't match, which should - // be impossible (the scanner matches all bytes _somehow_) but we'll - // tolerate it and let the caller deal with it. - if cs < hclstrtok_first_final { - ret = append(ret, data[p:len(data)]) - } - - return ret -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_string_lit.rl b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_string_lit.rl deleted file mode 100644 index f8ac11751..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_string_lit.rl +++ /dev/null @@ -1,105 +0,0 @@ - -package hclsyntax - -// This file is generated from scan_string_lit.rl. DO NOT EDIT. -%%{ - # (except you are actually in scan_string_lit.rl here, so edit away!) - - machine hclstrtok; - write data; -}%% - -func scanStringLit(data []byte, quoted bool) [][]byte { - var ret [][]byte - - %%{ - include UnicodeDerived "unicode_derived.rl"; - - UTF8Cont = 0x80 .. 0xBF; - AnyUTF8 = ( - 0x00..0x7F | - 0xC0..0xDF . UTF8Cont | - 0xE0..0xEF . UTF8Cont . UTF8Cont | - 0xF0..0xF7 . UTF8Cont . UTF8Cont . UTF8Cont - ); - BadUTF8 = any - AnyUTF8; - - Hex = ('0'..'9' | 'a'..'f' | 'A'..'F'); - - # Our goal with this patterns is to capture user intent as best as - # possible, even if the input is invalid. The caller will then verify - # whether each token is valid and generate suitable error messages - # if not. - UnicodeEscapeShort = "\\u" . Hex{0,4}; - UnicodeEscapeLong = "\\U" . Hex{0,8}; - UnicodeEscape = (UnicodeEscapeShort | UnicodeEscapeLong); - SimpleEscape = "\\" . (AnyUTF8 - ('U'|'u'))?; - TemplateEscape = ("$" . ("$" . ("{"?))?) | ("%" . ("%" . ("{"?))?); - Newline = ("\r\n" | "\r" | "\n"); - - action Begin { - // If te is behind p then we've skipped over some literal - // characters which we must now return. - if te < p { - ret = append(ret, data[te:p]) - } - ts = p; - } - action End { - te = p; - ret = append(ret, data[ts:te]); - } - - QuotedToken = (UnicodeEscape | SimpleEscape | TemplateEscape | Newline) >Begin %End; - UnquotedToken = (TemplateEscape | Newline) >Begin %End; - QuotedLiteral = (any - ("\\" | "$" | "%" | "\r" | "\n")); - UnquotedLiteral = (any - ("$" | "%" | "\r" | "\n")); - - quoted := (QuotedToken | QuotedLiteral)**; - unquoted := (UnquotedToken | UnquotedLiteral)**; - - }%% - - // Ragel state - p := 0 // "Pointer" into data - pe := len(data) // End-of-data "pointer" - ts := 0 - te := 0 - eof := pe - - var cs int // current state - switch { - case quoted: - cs = hclstrtok_en_quoted - default: - cs = hclstrtok_en_unquoted - } - - // Make Go compiler happy - _ = ts - _ = eof - - /*token := func () { - ret = append(ret, data[ts:te]) - }*/ - - %%{ - write init nocs; - write exec; - }%% - - if te < p { - // Collect any leftover literal characters at the end of the input - ret = append(ret, data[te:p]) - } - - // If we fall out here without being in a final state then we've - // encountered something that the scanner can't match, which should - // be impossible (the scanner matches all bytes _somehow_) but we'll - // tolerate it and let the caller deal with it. - if cs < hclstrtok_first_final { - ret = append(ret, data[p:len(data)]) - } - - return ret -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_tokens.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_tokens.go deleted file mode 100644 index 794123a85..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_tokens.go +++ /dev/null @@ -1,5265 +0,0 @@ -//line scan_tokens.rl:1 - -package hclsyntax - -import ( - "bytes" - - "github.com/hashicorp/hcl/v2" -) - -// This file is generated from scan_tokens.rl. DO NOT EDIT. - -//line scan_tokens.go:15 -var _hcltok_actions []byte = []byte{ - 0, 1, 0, 1, 1, 1, 3, 1, 4, - 1, 7, 1, 8, 1, 9, 1, 10, - 1, 11, 1, 12, 1, 13, 1, 14, - 1, 15, 1, 16, 1, 17, 1, 18, - 1, 19, 1, 20, 1, 23, 1, 24, - 1, 25, 1, 26, 1, 27, 1, 28, - 1, 29, 1, 30, 1, 31, 1, 32, - 1, 35, 1, 36, 1, 37, 1, 38, - 1, 39, 1, 40, 1, 41, 1, 42, - 1, 43, 1, 44, 1, 47, 1, 48, - 1, 49, 1, 50, 1, 51, 1, 52, - 1, 53, 1, 56, 1, 57, 1, 58, - 1, 59, 1, 60, 1, 61, 1, 62, - 1, 63, 1, 64, 1, 65, 1, 66, - 1, 67, 1, 68, 1, 69, 1, 70, - 1, 71, 1, 72, 1, 73, 1, 74, - 1, 75, 1, 76, 1, 77, 1, 78, - 1, 79, 1, 80, 1, 81, 1, 82, - 1, 83, 1, 84, 1, 85, 2, 0, - 14, 2, 0, 25, 2, 0, 29, 2, - 0, 37, 2, 0, 41, 2, 1, 2, - 2, 4, 5, 2, 4, 6, 2, 4, - 21, 2, 4, 22, 2, 4, 33, 2, - 4, 34, 2, 4, 45, 2, 4, 46, - 2, 4, 54, 2, 4, 55, -} - -var _hcltok_key_offsets []int16 = []int16{ - 0, 0, 1, 2, 4, 9, 13, 15, - 57, 98, 144, 145, 149, 155, 155, 157, - 159, 168, 174, 181, 182, 185, 186, 190, - 195, 204, 208, 212, 220, 222, 224, 226, - 229, 261, 263, 265, 269, 273, 276, 287, - 300, 319, 332, 348, 360, 376, 391, 412, - 422, 434, 445, 459, 474, 484, 496, 505, - 517, 519, 523, 544, 553, 563, 569, 575, - 576, 625, 627, 631, 633, 639, 646, 654, - 661, 664, 670, 674, 678, 680, 684, 688, - 692, 698, 706, 714, 720, 722, 726, 728, - 734, 738, 742, 746, 750, 755, 762, 768, - 770, 772, 776, 778, 784, 788, 792, 802, - 807, 821, 836, 838, 846, 848, 853, 867, - 872, 874, 878, 879, 883, 889, 895, 905, - 915, 926, 934, 937, 940, 944, 948, 950, - 953, 953, 956, 958, 988, 990, 992, 996, - 1001, 1005, 1010, 1012, 1014, 1016, 1025, 1029, - 1033, 1039, 1041, 1049, 1057, 1069, 1072, 1078, - 1082, 1084, 1088, 1108, 1110, 1112, 1123, 1129, - 1131, 1133, 1135, 1139, 1145, 1151, 1153, 1158, - 1162, 1164, 1172, 1190, 1230, 1240, 1244, 1246, - 1248, 1249, 1253, 1257, 1261, 1265, 1269, 1274, - 1278, 1282, 1286, 1288, 1290, 1294, 1304, 1308, - 1310, 1314, 1318, 1322, 1335, 1337, 1339, 1343, - 1345, 1349, 1351, 1353, 1383, 1387, 1391, 1395, - 1398, 1405, 1410, 1421, 1425, 1441, 1455, 1459, - 1464, 1468, 1472, 1478, 1480, 1486, 1488, 1492, - 1494, 1500, 1505, 1510, 1520, 1522, 1524, 1528, - 1532, 1534, 1547, 1549, 1553, 1557, 1565, 1567, - 1571, 1573, 1574, 1577, 1582, 1584, 1586, 1590, - 1592, 1596, 1602, 1622, 1628, 1634, 1636, 1637, - 1647, 1648, 1656, 1663, 1665, 1668, 1670, 1672, - 1674, 1679, 1683, 1687, 1692, 1702, 1712, 1716, - 1720, 1734, 1760, 1770, 1772, 1774, 1777, 1779, - 1782, 1784, 1788, 1790, 1791, 1795, 1797, 1800, - 1807, 1815, 1817, 1819, 1823, 1825, 1831, 1842, - 1845, 1847, 1851, 1856, 1886, 1891, 1893, 1896, - 1901, 1915, 1922, 1936, 1941, 1954, 1958, 1971, - 1976, 1994, 1995, 2004, 2008, 2020, 2025, 2032, - 2039, 2046, 2048, 2052, 2074, 2079, 2080, 2084, - 2086, 2136, 2139, 2150, 2154, 2156, 2162, 2168, - 2170, 2175, 2177, 2181, 2183, 2184, 2186, 2188, - 2194, 2196, 2198, 2202, 2208, 2221, 2223, 2229, - 2233, 2241, 2252, 2260, 2263, 2293, 2299, 2302, - 2307, 2309, 2313, 2317, 2321, 2323, 2330, 2332, - 2341, 2348, 2356, 2358, 2378, 2390, 2394, 2396, - 2414, 2453, 2455, 2459, 2461, 2468, 2472, 2500, - 2502, 2504, 2506, 2508, 2511, 2513, 2517, 2521, - 2523, 2526, 2528, 2530, 2533, 2535, 2537, 2538, - 2540, 2542, 2546, 2550, 2553, 2566, 2568, 2574, - 2578, 2580, 2584, 2588, 2602, 2605, 2614, 2616, - 2620, 2626, 2626, 2628, 2630, 2639, 2645, 2652, - 2653, 2656, 2657, 2661, 2666, 2675, 2679, 2683, - 2691, 2693, 2695, 2697, 2700, 2732, 2734, 2736, - 2740, 2744, 2747, 2758, 2771, 2790, 2803, 2819, - 2831, 2847, 2862, 2883, 2893, 2905, 2916, 2930, - 2945, 2955, 2967, 2976, 2988, 2990, 2994, 3015, - 3024, 3034, 3040, 3046, 3047, 3096, 3098, 3102, - 3104, 3110, 3117, 3125, 3132, 3135, 3141, 3145, - 3149, 3151, 3155, 3159, 3163, 3169, 3177, 3185, - 3191, 3193, 3197, 3199, 3205, 3209, 3213, 3217, - 3221, 3226, 3233, 3239, 3241, 3243, 3247, 3249, - 3255, 3259, 3263, 3273, 3278, 3292, 3307, 3309, - 3317, 3319, 3324, 3338, 3343, 3345, 3349, 3350, - 3354, 3360, 3366, 3376, 3386, 3397, 3405, 3408, - 3411, 3415, 3419, 3421, 3424, 3424, 3427, 3429, - 3459, 3461, 3463, 3467, 3472, 3476, 3481, 3483, - 3485, 3487, 3496, 3500, 3504, 3510, 3512, 3520, - 3528, 3540, 3543, 3549, 3553, 3555, 3559, 3579, - 3581, 3583, 3594, 3600, 3602, 3604, 3606, 3610, - 3616, 3622, 3624, 3629, 3633, 3635, 3643, 3661, - 3701, 3711, 3715, 3717, 3719, 3720, 3724, 3728, - 3732, 3736, 3740, 3745, 3749, 3753, 3757, 3759, - 3761, 3765, 3775, 3779, 3781, 3785, 3789, 3793, - 3806, 3808, 3810, 3814, 3816, 3820, 3822, 3824, - 3854, 3858, 3862, 3866, 3869, 3876, 3881, 3892, - 3896, 3912, 3926, 3930, 3935, 3939, 3943, 3949, - 3951, 3957, 3959, 3963, 3965, 3971, 3976, 3981, - 3991, 3993, 3995, 3999, 4003, 4005, 4018, 4020, - 4024, 4028, 4036, 4038, 4042, 4044, 4045, 4048, - 4053, 4055, 4057, 4061, 4063, 4067, 4073, 4093, - 4099, 4105, 4107, 4108, 4118, 4119, 4127, 4134, - 4136, 4139, 4141, 4143, 4145, 4150, 4154, 4158, - 4163, 4173, 4183, 4187, 4191, 4205, 4231, 4241, - 4243, 4245, 4248, 4250, 4253, 4255, 4259, 4261, - 4262, 4266, 4268, 4270, 4277, 4281, 4288, 4295, - 4304, 4320, 4332, 4350, 4361, 4373, 4381, 4399, - 4407, 4437, 4440, 4450, 4460, 4472, 4483, 4492, - 4505, 4517, 4521, 4527, 4554, 4563, 4566, 4571, - 4577, 4582, 4603, 4607, 4613, 4613, 4620, 4629, - 4637, 4640, 4644, 4650, 4656, 4659, 4663, 4670, - 4676, 4685, 4694, 4698, 4702, 4706, 4710, 4717, - 4721, 4725, 4735, 4741, 4745, 4751, 4755, 4758, - 4764, 4770, 4782, 4786, 4790, 4800, 4804, 4815, - 4817, 4819, 4823, 4835, 4840, 4864, 4868, 4874, - 4896, 4905, 4909, 4912, 4913, 4921, 4929, 4935, - 4945, 4952, 4970, 4973, 4976, 4984, 4990, 4994, - 4998, 5002, 5008, 5016, 5021, 5027, 5031, 5039, - 5046, 5050, 5057, 5063, 5071, 5079, 5085, 5091, - 5102, 5106, 5118, 5127, 5144, 5161, 5164, 5168, - 5170, 5176, 5178, 5182, 5197, 5201, 5205, 5209, - 5213, 5217, 5219, 5225, 5230, 5234, 5240, 5247, - 5250, 5268, 5270, 5315, 5321, 5327, 5331, 5335, - 5341, 5345, 5351, 5357, 5364, 5366, 5372, 5378, - 5382, 5386, 5394, 5407, 5413, 5420, 5428, 5434, - 5443, 5449, 5453, 5458, 5462, 5470, 5474, 5478, - 5508, 5514, 5520, 5526, 5532, 5539, 5545, 5552, - 5557, 5567, 5571, 5578, 5584, 5588, 5595, 5599, - 5605, 5608, 5612, 5616, 5620, 5624, 5629, 5634, - 5638, 5649, 5653, 5657, 5663, 5671, 5675, 5692, - 5696, 5702, 5712, 5718, 5724, 5727, 5732, 5741, - 5745, 5749, 5755, 5759, 5765, 5773, 5791, 5792, - 5802, 5803, 5812, 5820, 5822, 5825, 5827, 5829, - 5831, 5836, 5849, 5853, 5868, 5897, 5908, 5910, - 5914, 5918, 5923, 5927, 5929, 5936, 5940, 5948, - 5952, 5964, 5966, 5968, 5970, 5972, 5974, 5975, - 5977, 5979, 5981, 5983, 5985, 5986, 5988, 5990, - 5992, 5994, 5996, 6000, 6006, 6006, 6008, 6010, - 6019, 6025, 6032, 6033, 6036, 6037, 6041, 6046, - 6055, 6059, 6063, 6071, 6073, 6075, 6077, 6080, - 6112, 6114, 6116, 6120, 6124, 6127, 6138, 6151, - 6170, 6183, 6199, 6211, 6227, 6242, 6263, 6273, - 6285, 6296, 6310, 6325, 6335, 6347, 6356, 6368, - 6370, 6374, 6395, 6404, 6414, 6420, 6426, 6427, - 6476, 6478, 6482, 6484, 6490, 6497, 6505, 6512, - 6515, 6521, 6525, 6529, 6531, 6535, 6539, 6543, - 6549, 6557, 6565, 6571, 6573, 6577, 6579, 6585, - 6589, 6593, 6597, 6601, 6606, 6613, 6619, 6621, - 6623, 6627, 6629, 6635, 6639, 6643, 6653, 6658, - 6672, 6687, 6689, 6697, 6699, 6704, 6718, 6723, - 6725, 6729, 6730, 6734, 6740, 6746, 6756, 6766, - 6777, 6785, 6788, 6791, 6795, 6799, 6801, 6804, - 6804, 6807, 6809, 6839, 6841, 6843, 6847, 6852, - 6856, 6861, 6863, 6865, 6867, 6876, 6880, 6884, - 6890, 6892, 6900, 6908, 6920, 6923, 6929, 6933, - 6935, 6939, 6959, 6961, 6963, 6974, 6980, 6982, - 6984, 6986, 6990, 6996, 7002, 7004, 7009, 7013, - 7015, 7023, 7041, 7081, 7091, 7095, 7097, 7099, - 7100, 7104, 7108, 7112, 7116, 7120, 7125, 7129, - 7133, 7137, 7139, 7141, 7145, 7155, 7159, 7161, - 7165, 7169, 7173, 7186, 7188, 7190, 7194, 7196, - 7200, 7202, 7204, 7234, 7238, 7242, 7246, 7249, - 7256, 7261, 7272, 7276, 7292, 7306, 7310, 7315, - 7319, 7323, 7329, 7331, 7337, 7339, 7343, 7345, - 7351, 7356, 7361, 7371, 7373, 7375, 7379, 7383, - 7385, 7398, 7400, 7404, 7408, 7416, 7418, 7422, - 7424, 7425, 7428, 7433, 7435, 7437, 7441, 7443, - 7447, 7453, 7473, 7479, 7485, 7487, 7488, 7498, - 7499, 7507, 7514, 7516, 7519, 7521, 7523, 7525, - 7530, 7534, 7538, 7543, 7553, 7563, 7567, 7571, - 7585, 7611, 7621, 7623, 7625, 7628, 7630, 7633, - 7635, 7639, 7641, 7642, 7646, 7648, 7650, 7657, - 7661, 7668, 7675, 7684, 7700, 7712, 7730, 7741, - 7753, 7761, 7779, 7787, 7817, 7820, 7830, 7840, - 7852, 7863, 7872, 7885, 7897, 7901, 7907, 7934, - 7943, 7946, 7951, 7957, 7962, 7983, 7987, 7993, - 7993, 8000, 8009, 8017, 8020, 8024, 8030, 8036, - 8039, 8043, 8050, 8056, 8065, 8074, 8078, 8082, - 8086, 8090, 8097, 8101, 8105, 8115, 8121, 8125, - 8131, 8135, 8138, 8144, 8150, 8162, 8166, 8170, - 8180, 8184, 8195, 8197, 8199, 8203, 8215, 8220, - 8244, 8248, 8254, 8276, 8285, 8289, 8292, 8293, - 8301, 8309, 8315, 8325, 8332, 8350, 8353, 8356, - 8364, 8370, 8374, 8378, 8382, 8388, 8396, 8401, - 8407, 8411, 8419, 8426, 8430, 8437, 8443, 8451, - 8459, 8465, 8471, 8482, 8486, 8498, 8507, 8524, - 8541, 8544, 8548, 8550, 8556, 8558, 8562, 8577, - 8581, 8585, 8589, 8593, 8597, 8599, 8605, 8610, - 8614, 8620, 8627, 8630, 8648, 8650, 8695, 8701, - 8707, 8711, 8715, 8721, 8725, 8731, 8737, 8744, - 8746, 8752, 8758, 8762, 8766, 8774, 8787, 8793, - 8800, 8808, 8814, 8823, 8829, 8833, 8838, 8842, - 8850, 8854, 8858, 8888, 8894, 8900, 8906, 8912, - 8919, 8925, 8932, 8937, 8947, 8951, 8958, 8964, - 8968, 8975, 8979, 8985, 8988, 8992, 8996, 9000, - 9004, 9009, 9014, 9018, 9029, 9033, 9037, 9043, - 9051, 9055, 9072, 9076, 9082, 9092, 9098, 9104, - 9107, 9112, 9121, 9125, 9129, 9135, 9139, 9145, - 9153, 9171, 9172, 9182, 9183, 9192, 9200, 9202, - 9205, 9207, 9209, 9211, 9216, 9229, 9233, 9248, - 9277, 9288, 9290, 9294, 9298, 9303, 9307, 9309, - 9316, 9320, 9328, 9332, 9407, 9409, 9410, 9411, - 9412, 9413, 9414, 9416, 9421, 9423, 9425, 9426, - 9470, 9471, 9472, 9474, 9479, 9483, 9483, 9485, - 9487, 9498, 9508, 9516, 9517, 9519, 9520, 9524, - 9528, 9538, 9542, 9549, 9560, 9567, 9571, 9577, - 9588, 9620, 9669, 9684, 9699, 9704, 9706, 9711, - 9743, 9751, 9753, 9775, 9797, 9799, 9815, 9831, - 9833, 9835, 9835, 9836, 9837, 9838, 9840, 9841, - 9853, 9855, 9857, 9859, 9873, 9887, 9889, 9892, - 9895, 9897, 9898, 9899, 9901, 9903, 9905, 9919, - 9933, 9935, 9938, 9941, 9943, 9944, 9945, 9947, - 9949, 9951, 10000, 10044, 10046, 10051, 10055, 10055, - 10057, 10059, 10070, 10080, 10088, 10089, 10091, 10092, - 10096, 10100, 10110, 10114, 10121, 10132, 10139, 10143, - 10149, 10160, 10192, 10241, 10256, 10271, 10276, 10278, - 10283, 10315, 10323, 10325, 10347, 10369, -} - -var _hcltok_trans_keys []byte = []byte{ - 46, 42, 42, 47, 46, 69, 101, 48, - 57, 43, 45, 48, 57, 48, 57, 45, - 95, 194, 195, 198, 199, 203, 205, 206, - 207, 210, 212, 213, 214, 215, 216, 217, - 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 233, 234, 237, 239, 240, 65, - 90, 97, 122, 196, 202, 208, 218, 229, - 236, 95, 194, 195, 198, 199, 203, 205, - 206, 207, 210, 212, 213, 214, 215, 216, - 217, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 228, 233, 234, 237, 239, 240, - 65, 90, 97, 122, 196, 202, 208, 218, - 229, 236, 10, 13, 45, 95, 194, 195, - 198, 199, 203, 204, 205, 206, 207, 210, - 212, 213, 214, 215, 216, 217, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, - 233, 234, 237, 239, 240, 243, 48, 57, - 65, 90, 97, 122, 196, 218, 229, 236, - 10, 170, 181, 183, 186, 128, 150, 152, - 182, 184, 255, 192, 255, 128, 255, 173, - 130, 133, 146, 159, 165, 171, 175, 255, - 181, 190, 184, 185, 192, 255, 140, 134, - 138, 142, 161, 163, 255, 182, 130, 136, - 137, 176, 151, 152, 154, 160, 190, 136, - 144, 192, 255, 135, 129, 130, 132, 133, - 144, 170, 176, 178, 144, 154, 160, 191, - 128, 169, 174, 255, 148, 169, 157, 158, - 189, 190, 192, 255, 144, 255, 139, 140, - 178, 255, 186, 128, 181, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 128, 173, 128, - 155, 160, 180, 182, 189, 148, 161, 163, - 255, 176, 164, 165, 132, 169, 177, 141, - 142, 145, 146, 179, 181, 186, 187, 158, - 133, 134, 137, 138, 143, 150, 152, 155, - 164, 165, 178, 255, 188, 129, 131, 133, - 138, 143, 144, 147, 168, 170, 176, 178, - 179, 181, 182, 184, 185, 190, 255, 157, - 131, 134, 137, 138, 142, 144, 146, 152, - 159, 165, 182, 255, 129, 131, 133, 141, - 143, 145, 147, 168, 170, 176, 178, 179, - 181, 185, 188, 255, 134, 138, 142, 143, - 145, 159, 164, 165, 176, 184, 186, 255, - 129, 131, 133, 140, 143, 144, 147, 168, - 170, 176, 178, 179, 181, 185, 188, 191, - 177, 128, 132, 135, 136, 139, 141, 150, - 151, 156, 157, 159, 163, 166, 175, 156, - 130, 131, 133, 138, 142, 144, 146, 149, - 153, 154, 158, 159, 163, 164, 168, 170, - 174, 185, 190, 191, 144, 151, 128, 130, - 134, 136, 138, 141, 166, 175, 128, 131, - 133, 140, 142, 144, 146, 168, 170, 185, - 189, 255, 133, 137, 151, 142, 148, 155, - 159, 164, 165, 176, 255, 128, 131, 133, - 140, 142, 144, 146, 168, 170, 179, 181, - 185, 188, 191, 158, 128, 132, 134, 136, - 138, 141, 149, 150, 160, 163, 166, 175, - 177, 178, 129, 131, 133, 140, 142, 144, - 146, 186, 189, 255, 133, 137, 143, 147, - 152, 158, 164, 165, 176, 185, 192, 255, - 189, 130, 131, 133, 150, 154, 177, 179, - 187, 138, 150, 128, 134, 143, 148, 152, - 159, 166, 175, 178, 179, 129, 186, 128, - 142, 144, 153, 132, 138, 141, 165, 167, - 129, 130, 135, 136, 148, 151, 153, 159, - 161, 163, 170, 171, 173, 185, 187, 189, - 134, 128, 132, 136, 141, 144, 153, 156, - 159, 128, 181, 183, 185, 152, 153, 160, - 169, 190, 191, 128, 135, 137, 172, 177, - 191, 128, 132, 134, 151, 153, 188, 134, - 128, 129, 130, 131, 137, 138, 139, 140, - 141, 142, 143, 144, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 173, 175, - 176, 177, 178, 179, 181, 182, 183, 188, - 189, 190, 191, 132, 152, 172, 184, 185, - 187, 128, 191, 128, 137, 144, 255, 158, - 159, 134, 187, 136, 140, 142, 143, 137, - 151, 153, 142, 143, 158, 159, 137, 177, - 142, 143, 182, 183, 191, 255, 128, 130, - 133, 136, 150, 152, 255, 145, 150, 151, - 155, 156, 160, 168, 178, 255, 128, 143, - 160, 255, 182, 183, 190, 255, 129, 255, - 173, 174, 192, 255, 129, 154, 160, 255, - 171, 173, 185, 255, 128, 140, 142, 148, - 160, 180, 128, 147, 160, 172, 174, 176, - 178, 179, 148, 150, 152, 155, 158, 159, - 170, 255, 139, 141, 144, 153, 160, 255, - 184, 255, 128, 170, 176, 255, 182, 255, - 128, 158, 160, 171, 176, 187, 134, 173, - 176, 180, 128, 171, 176, 255, 138, 143, - 155, 255, 128, 155, 160, 255, 159, 189, - 190, 192, 255, 167, 128, 137, 144, 153, - 176, 189, 140, 143, 154, 170, 180, 255, - 180, 255, 128, 183, 128, 137, 141, 189, - 128, 136, 144, 146, 148, 182, 184, 185, - 128, 181, 187, 191, 150, 151, 158, 159, - 152, 154, 156, 158, 134, 135, 142, 143, - 190, 255, 190, 128, 180, 182, 188, 130, - 132, 134, 140, 144, 147, 150, 155, 160, - 172, 178, 180, 182, 188, 128, 129, 130, - 131, 132, 133, 134, 176, 177, 178, 179, - 180, 181, 182, 183, 191, 255, 129, 147, - 149, 176, 178, 190, 192, 255, 144, 156, - 161, 144, 156, 165, 176, 130, 135, 149, - 164, 166, 168, 138, 147, 152, 157, 170, - 185, 188, 191, 142, 133, 137, 160, 255, - 137, 255, 128, 174, 176, 255, 159, 165, - 170, 180, 255, 167, 173, 128, 165, 176, - 255, 168, 174, 176, 190, 192, 255, 128, - 150, 160, 166, 168, 174, 176, 182, 184, - 190, 128, 134, 136, 142, 144, 150, 152, - 158, 160, 191, 128, 129, 130, 131, 132, - 133, 134, 135, 144, 145, 255, 133, 135, - 161, 175, 177, 181, 184, 188, 160, 151, - 152, 187, 192, 255, 133, 173, 177, 255, - 143, 159, 187, 255, 176, 191, 182, 183, - 184, 191, 192, 255, 150, 255, 128, 146, - 147, 148, 152, 153, 154, 155, 156, 158, - 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 129, 255, 141, 255, 144, 189, - 141, 143, 172, 255, 191, 128, 175, 180, - 189, 151, 159, 162, 255, 175, 137, 138, - 184, 255, 183, 255, 168, 255, 128, 179, - 188, 134, 143, 154, 159, 184, 186, 190, - 255, 128, 173, 176, 255, 148, 159, 189, - 255, 129, 142, 154, 159, 191, 255, 128, - 182, 128, 141, 144, 153, 160, 182, 186, - 255, 128, 130, 155, 157, 160, 175, 178, - 182, 129, 134, 137, 142, 145, 150, 160, - 166, 168, 174, 176, 255, 155, 166, 175, - 128, 170, 172, 173, 176, 185, 158, 159, - 160, 255, 164, 175, 135, 138, 188, 255, - 164, 169, 171, 172, 173, 174, 175, 180, - 181, 182, 183, 184, 185, 187, 188, 189, - 190, 191, 165, 186, 174, 175, 154, 255, - 190, 128, 134, 147, 151, 157, 168, 170, - 182, 184, 188, 128, 129, 131, 132, 134, - 255, 147, 255, 190, 255, 144, 145, 136, - 175, 188, 255, 128, 143, 160, 175, 179, - 180, 141, 143, 176, 180, 182, 255, 189, - 255, 191, 144, 153, 161, 186, 129, 154, - 166, 255, 191, 255, 130, 135, 138, 143, - 146, 151, 154, 156, 144, 145, 146, 147, - 148, 150, 151, 152, 155, 157, 158, 160, - 170, 171, 172, 175, 161, 169, 128, 129, - 130, 131, 133, 135, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, - 152, 156, 157, 160, 161, 162, 163, 164, - 166, 168, 169, 170, 171, 172, 173, 174, - 176, 177, 153, 155, 178, 179, 128, 139, - 141, 166, 168, 186, 188, 189, 191, 255, - 142, 143, 158, 255, 187, 255, 128, 180, - 189, 128, 156, 160, 255, 145, 159, 161, - 255, 128, 159, 176, 255, 139, 143, 187, - 255, 128, 157, 160, 255, 144, 132, 135, - 150, 255, 158, 159, 170, 175, 148, 151, - 188, 255, 128, 167, 176, 255, 164, 255, - 183, 255, 128, 149, 160, 167, 136, 188, - 128, 133, 138, 181, 183, 184, 191, 255, - 150, 159, 183, 255, 128, 158, 160, 178, - 180, 181, 128, 149, 160, 185, 128, 183, - 190, 191, 191, 128, 131, 133, 134, 140, - 147, 149, 151, 153, 179, 184, 186, 160, - 188, 128, 156, 128, 135, 137, 166, 128, - 181, 128, 149, 160, 178, 128, 145, 128, - 178, 129, 130, 131, 132, 133, 135, 136, - 138, 139, 140, 141, 144, 145, 146, 147, - 150, 151, 152, 153, 154, 155, 156, 162, - 163, 171, 176, 177, 178, 128, 134, 135, - 165, 176, 190, 144, 168, 176, 185, 128, - 180, 182, 191, 182, 144, 179, 155, 133, - 137, 141, 143, 157, 255, 190, 128, 145, - 147, 183, 136, 128, 134, 138, 141, 143, - 157, 159, 168, 176, 255, 171, 175, 186, - 255, 128, 131, 133, 140, 143, 144, 147, - 168, 170, 176, 178, 179, 181, 185, 188, - 191, 144, 151, 128, 132, 135, 136, 139, - 141, 157, 163, 166, 172, 176, 180, 128, - 138, 144, 153, 134, 136, 143, 154, 255, - 128, 181, 184, 255, 129, 151, 158, 255, - 129, 131, 133, 143, 154, 255, 128, 137, - 128, 153, 157, 171, 176, 185, 160, 255, - 170, 190, 192, 255, 128, 184, 128, 136, - 138, 182, 184, 191, 128, 144, 153, 178, - 255, 168, 144, 145, 183, 255, 128, 142, - 145, 149, 129, 141, 144, 146, 147, 148, - 175, 255, 132, 255, 128, 144, 129, 143, - 144, 153, 145, 152, 135, 255, 160, 168, - 169, 171, 172, 173, 174, 188, 189, 190, - 191, 161, 167, 185, 255, 128, 158, 160, - 169, 144, 173, 176, 180, 128, 131, 144, - 153, 163, 183, 189, 255, 144, 255, 133, - 143, 191, 255, 143, 159, 160, 128, 129, - 255, 159, 160, 171, 172, 255, 173, 255, - 179, 255, 128, 176, 177, 178, 128, 129, - 171, 175, 189, 255, 128, 136, 144, 153, - 157, 158, 133, 134, 137, 144, 145, 146, - 147, 148, 149, 154, 155, 156, 157, 158, - 159, 168, 169, 170, 150, 153, 165, 169, - 173, 178, 187, 255, 131, 132, 140, 169, - 174, 255, 130, 132, 149, 157, 173, 186, - 188, 160, 161, 163, 164, 167, 168, 132, - 134, 149, 157, 186, 139, 140, 191, 255, - 134, 128, 132, 138, 144, 146, 255, 166, - 167, 129, 155, 187, 149, 181, 143, 175, - 137, 169, 131, 140, 141, 192, 255, 128, - 182, 187, 255, 173, 180, 182, 255, 132, - 155, 159, 161, 175, 128, 160, 163, 164, - 165, 184, 185, 186, 161, 162, 128, 134, - 136, 152, 155, 161, 163, 164, 166, 170, - 133, 143, 151, 255, 139, 143, 154, 255, - 164, 167, 185, 187, 128, 131, 133, 159, - 161, 162, 169, 178, 180, 183, 130, 135, - 137, 139, 148, 151, 153, 155, 157, 159, - 164, 190, 141, 143, 145, 146, 161, 162, - 167, 170, 172, 178, 180, 183, 185, 188, - 128, 137, 139, 155, 161, 163, 165, 169, - 171, 187, 155, 156, 151, 255, 156, 157, - 160, 181, 255, 186, 187, 255, 162, 255, - 160, 168, 161, 167, 158, 255, 160, 132, - 135, 133, 134, 176, 255, 170, 181, 186, - 191, 176, 180, 182, 183, 186, 189, 134, - 140, 136, 138, 142, 161, 163, 255, 130, - 137, 136, 255, 144, 170, 176, 178, 160, - 191, 128, 138, 174, 175, 177, 255, 148, - 150, 164, 167, 173, 176, 185, 189, 190, - 192, 255, 144, 146, 175, 141, 255, 166, - 176, 178, 255, 186, 138, 170, 180, 181, - 160, 161, 162, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 184, 186, - 187, 188, 189, 190, 183, 185, 154, 164, - 168, 128, 149, 128, 152, 189, 132, 185, - 144, 152, 161, 177, 255, 169, 177, 129, - 132, 141, 142, 145, 146, 179, 181, 186, - 188, 190, 255, 142, 156, 157, 159, 161, - 176, 177, 133, 138, 143, 144, 147, 168, - 170, 176, 178, 179, 181, 182, 184, 185, - 158, 153, 156, 178, 180, 189, 133, 141, - 143, 145, 147, 168, 170, 176, 178, 179, - 181, 185, 144, 185, 160, 161, 189, 133, - 140, 143, 144, 147, 168, 170, 176, 178, - 179, 181, 185, 177, 156, 157, 159, 161, - 131, 156, 133, 138, 142, 144, 146, 149, - 153, 154, 158, 159, 163, 164, 168, 170, - 174, 185, 144, 189, 133, 140, 142, 144, - 146, 168, 170, 185, 152, 154, 160, 161, - 128, 189, 133, 140, 142, 144, 146, 168, - 170, 179, 181, 185, 158, 160, 161, 177, - 178, 189, 133, 140, 142, 144, 146, 186, - 142, 148, 150, 159, 161, 186, 191, 189, - 133, 150, 154, 177, 179, 187, 128, 134, - 129, 176, 178, 179, 132, 138, 141, 165, - 167, 189, 129, 130, 135, 136, 148, 151, - 153, 159, 161, 163, 170, 171, 173, 176, - 178, 179, 134, 128, 132, 156, 159, 128, - 128, 135, 137, 172, 136, 140, 128, 129, - 130, 131, 137, 138, 139, 140, 141, 142, - 143, 144, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 184, - 188, 189, 190, 191, 132, 152, 185, 187, - 191, 128, 170, 161, 144, 149, 154, 157, - 165, 166, 174, 176, 181, 255, 130, 141, - 143, 159, 155, 255, 128, 140, 142, 145, - 160, 177, 128, 145, 160, 172, 174, 176, - 151, 156, 170, 128, 168, 176, 255, 138, - 255, 128, 150, 160, 255, 149, 255, 167, - 133, 179, 133, 139, 131, 160, 174, 175, - 186, 255, 166, 255, 128, 163, 141, 143, - 154, 189, 169, 172, 174, 177, 181, 182, - 129, 130, 132, 133, 134, 176, 177, 178, - 179, 180, 181, 182, 183, 177, 191, 165, - 170, 175, 177, 180, 255, 168, 174, 176, - 255, 128, 134, 136, 142, 144, 150, 152, - 158, 128, 129, 130, 131, 132, 133, 134, - 135, 144, 145, 255, 133, 135, 161, 169, - 177, 181, 184, 188, 160, 151, 154, 128, - 146, 147, 148, 152, 153, 154, 155, 156, - 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 129, 255, 141, 143, 160, - 169, 172, 255, 191, 128, 174, 130, 134, - 139, 163, 255, 130, 179, 187, 189, 178, - 183, 138, 165, 176, 255, 135, 159, 189, - 255, 132, 178, 143, 160, 164, 166, 175, - 186, 190, 128, 168, 186, 128, 130, 132, - 139, 160, 182, 190, 255, 176, 178, 180, - 183, 184, 190, 255, 128, 130, 155, 157, - 160, 170, 178, 180, 128, 162, 164, 169, - 171, 172, 173, 174, 175, 180, 181, 182, - 183, 185, 186, 187, 188, 189, 190, 191, - 165, 179, 157, 190, 128, 134, 147, 151, - 159, 168, 170, 182, 184, 188, 176, 180, - 182, 255, 161, 186, 144, 145, 146, 147, - 148, 150, 151, 152, 155, 157, 158, 160, - 170, 171, 172, 175, 161, 169, 128, 129, - 130, 131, 133, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 152, - 156, 157, 160, 161, 162, 163, 164, 166, - 168, 169, 170, 171, 172, 173, 174, 176, - 177, 153, 155, 178, 179, 145, 255, 139, - 143, 182, 255, 158, 175, 128, 144, 147, - 149, 151, 153, 179, 128, 135, 137, 164, - 128, 130, 131, 132, 133, 134, 135, 136, - 138, 139, 140, 141, 144, 145, 146, 147, - 150, 151, 152, 153, 154, 156, 162, 163, - 171, 176, 177, 178, 131, 183, 131, 175, - 144, 168, 131, 166, 182, 144, 178, 131, - 178, 154, 156, 129, 132, 128, 145, 147, - 171, 159, 255, 144, 157, 161, 135, 138, - 128, 175, 135, 132, 133, 128, 174, 152, - 155, 132, 128, 170, 128, 153, 160, 190, - 192, 255, 128, 136, 138, 174, 128, 178, - 255, 160, 168, 169, 171, 172, 173, 174, - 188, 189, 190, 191, 161, 167, 144, 173, - 128, 131, 163, 183, 189, 255, 133, 143, - 145, 255, 147, 159, 128, 176, 177, 178, - 128, 136, 144, 153, 144, 145, 146, 147, - 148, 149, 154, 155, 156, 157, 158, 159, - 150, 153, 131, 140, 255, 160, 163, 164, - 165, 184, 185, 186, 161, 162, 133, 255, - 170, 181, 183, 186, 128, 150, 152, 182, - 184, 255, 192, 255, 128, 255, 173, 130, - 133, 146, 159, 165, 171, 175, 255, 181, - 190, 184, 185, 192, 255, 140, 134, 138, - 142, 161, 163, 255, 182, 130, 136, 137, - 176, 151, 152, 154, 160, 190, 136, 144, - 192, 255, 135, 129, 130, 132, 133, 144, - 170, 176, 178, 144, 154, 160, 191, 128, - 169, 174, 255, 148, 169, 157, 158, 189, - 190, 192, 255, 144, 255, 139, 140, 178, - 255, 186, 128, 181, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 128, 173, 128, 155, - 160, 180, 182, 189, 148, 161, 163, 255, - 176, 164, 165, 132, 169, 177, 141, 142, - 145, 146, 179, 181, 186, 187, 158, 133, - 134, 137, 138, 143, 150, 152, 155, 164, - 165, 178, 255, 188, 129, 131, 133, 138, - 143, 144, 147, 168, 170, 176, 178, 179, - 181, 182, 184, 185, 190, 255, 157, 131, - 134, 137, 138, 142, 144, 146, 152, 159, - 165, 182, 255, 129, 131, 133, 141, 143, - 145, 147, 168, 170, 176, 178, 179, 181, - 185, 188, 255, 134, 138, 142, 143, 145, - 159, 164, 165, 176, 184, 186, 255, 129, - 131, 133, 140, 143, 144, 147, 168, 170, - 176, 178, 179, 181, 185, 188, 191, 177, - 128, 132, 135, 136, 139, 141, 150, 151, - 156, 157, 159, 163, 166, 175, 156, 130, - 131, 133, 138, 142, 144, 146, 149, 153, - 154, 158, 159, 163, 164, 168, 170, 174, - 185, 190, 191, 144, 151, 128, 130, 134, - 136, 138, 141, 166, 175, 128, 131, 133, - 140, 142, 144, 146, 168, 170, 185, 189, - 255, 133, 137, 151, 142, 148, 155, 159, - 164, 165, 176, 255, 128, 131, 133, 140, - 142, 144, 146, 168, 170, 179, 181, 185, - 188, 191, 158, 128, 132, 134, 136, 138, - 141, 149, 150, 160, 163, 166, 175, 177, - 178, 129, 131, 133, 140, 142, 144, 146, - 186, 189, 255, 133, 137, 143, 147, 152, - 158, 164, 165, 176, 185, 192, 255, 189, - 130, 131, 133, 150, 154, 177, 179, 187, - 138, 150, 128, 134, 143, 148, 152, 159, - 166, 175, 178, 179, 129, 186, 128, 142, - 144, 153, 132, 138, 141, 165, 167, 129, - 130, 135, 136, 148, 151, 153, 159, 161, - 163, 170, 171, 173, 185, 187, 189, 134, - 128, 132, 136, 141, 144, 153, 156, 159, - 128, 181, 183, 185, 152, 153, 160, 169, - 190, 191, 128, 135, 137, 172, 177, 191, - 128, 132, 134, 151, 153, 188, 134, 128, - 129, 130, 131, 137, 138, 139, 140, 141, - 142, 143, 144, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 173, 175, 176, - 177, 178, 179, 181, 182, 183, 188, 189, - 190, 191, 132, 152, 172, 184, 185, 187, - 128, 191, 128, 137, 144, 255, 158, 159, - 134, 187, 136, 140, 142, 143, 137, 151, - 153, 142, 143, 158, 159, 137, 177, 142, - 143, 182, 183, 191, 255, 128, 130, 133, - 136, 150, 152, 255, 145, 150, 151, 155, - 156, 160, 168, 178, 255, 128, 143, 160, - 255, 182, 183, 190, 255, 129, 255, 173, - 174, 192, 255, 129, 154, 160, 255, 171, - 173, 185, 255, 128, 140, 142, 148, 160, - 180, 128, 147, 160, 172, 174, 176, 178, - 179, 148, 150, 152, 155, 158, 159, 170, - 255, 139, 141, 144, 153, 160, 255, 184, - 255, 128, 170, 176, 255, 182, 255, 128, - 158, 160, 171, 176, 187, 134, 173, 176, - 180, 128, 171, 176, 255, 138, 143, 155, - 255, 128, 155, 160, 255, 159, 189, 190, - 192, 255, 167, 128, 137, 144, 153, 176, - 189, 140, 143, 154, 170, 180, 255, 180, - 255, 128, 183, 128, 137, 141, 189, 128, - 136, 144, 146, 148, 182, 184, 185, 128, - 181, 187, 191, 150, 151, 158, 159, 152, - 154, 156, 158, 134, 135, 142, 143, 190, - 255, 190, 128, 180, 182, 188, 130, 132, - 134, 140, 144, 147, 150, 155, 160, 172, - 178, 180, 182, 188, 128, 129, 130, 131, - 132, 133, 134, 176, 177, 178, 179, 180, - 181, 182, 183, 191, 255, 129, 147, 149, - 176, 178, 190, 192, 255, 144, 156, 161, - 144, 156, 165, 176, 130, 135, 149, 164, - 166, 168, 138, 147, 152, 157, 170, 185, - 188, 191, 142, 133, 137, 160, 255, 137, - 255, 128, 174, 176, 255, 159, 165, 170, - 180, 255, 167, 173, 128, 165, 176, 255, - 168, 174, 176, 190, 192, 255, 128, 150, - 160, 166, 168, 174, 176, 182, 184, 190, - 128, 134, 136, 142, 144, 150, 152, 158, - 160, 191, 128, 129, 130, 131, 132, 133, - 134, 135, 144, 145, 255, 133, 135, 161, - 175, 177, 181, 184, 188, 160, 151, 152, - 187, 192, 255, 133, 173, 177, 255, 143, - 159, 187, 255, 176, 191, 182, 183, 184, - 191, 192, 255, 150, 255, 128, 146, 147, - 148, 152, 153, 154, 155, 156, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, - 176, 129, 255, 141, 255, 144, 189, 141, - 143, 172, 255, 191, 128, 175, 180, 189, - 151, 159, 162, 255, 175, 137, 138, 184, - 255, 183, 255, 168, 255, 128, 179, 188, - 134, 143, 154, 159, 184, 186, 190, 255, - 128, 173, 176, 255, 148, 159, 189, 255, - 129, 142, 154, 159, 191, 255, 128, 182, - 128, 141, 144, 153, 160, 182, 186, 255, - 128, 130, 155, 157, 160, 175, 178, 182, - 129, 134, 137, 142, 145, 150, 160, 166, - 168, 174, 176, 255, 155, 166, 175, 128, - 170, 172, 173, 176, 185, 158, 159, 160, - 255, 164, 175, 135, 138, 188, 255, 164, - 169, 171, 172, 173, 174, 175, 180, 181, - 182, 183, 184, 185, 187, 188, 189, 190, - 191, 165, 186, 174, 175, 154, 255, 190, - 128, 134, 147, 151, 157, 168, 170, 182, - 184, 188, 128, 129, 131, 132, 134, 255, - 147, 255, 190, 255, 144, 145, 136, 175, - 188, 255, 128, 143, 160, 175, 179, 180, - 141, 143, 176, 180, 182, 255, 189, 255, - 191, 144, 153, 161, 186, 129, 154, 166, - 255, 191, 255, 130, 135, 138, 143, 146, - 151, 154, 156, 144, 145, 146, 147, 148, - 150, 151, 152, 155, 157, 158, 160, 170, - 171, 172, 175, 161, 169, 128, 129, 130, - 131, 133, 135, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 152, - 156, 157, 160, 161, 162, 163, 164, 166, - 168, 169, 170, 171, 172, 173, 174, 176, - 177, 153, 155, 178, 179, 128, 139, 141, - 166, 168, 186, 188, 189, 191, 255, 142, - 143, 158, 255, 187, 255, 128, 180, 189, - 128, 156, 160, 255, 145, 159, 161, 255, - 128, 159, 176, 255, 139, 143, 187, 255, - 128, 157, 160, 255, 144, 132, 135, 150, - 255, 158, 159, 170, 175, 148, 151, 188, - 255, 128, 167, 176, 255, 164, 255, 183, - 255, 128, 149, 160, 167, 136, 188, 128, - 133, 138, 181, 183, 184, 191, 255, 150, - 159, 183, 255, 128, 158, 160, 178, 180, - 181, 128, 149, 160, 185, 128, 183, 190, - 191, 191, 128, 131, 133, 134, 140, 147, - 149, 151, 153, 179, 184, 186, 160, 188, - 128, 156, 128, 135, 137, 166, 128, 181, - 128, 149, 160, 178, 128, 145, 128, 178, - 129, 130, 131, 132, 133, 135, 136, 138, - 139, 140, 141, 144, 145, 146, 147, 150, - 151, 152, 153, 154, 155, 156, 162, 163, - 171, 176, 177, 178, 128, 134, 135, 165, - 176, 190, 144, 168, 176, 185, 128, 180, - 182, 191, 182, 144, 179, 155, 133, 137, - 141, 143, 157, 255, 190, 128, 145, 147, - 183, 136, 128, 134, 138, 141, 143, 157, - 159, 168, 176, 255, 171, 175, 186, 255, - 128, 131, 133, 140, 143, 144, 147, 168, - 170, 176, 178, 179, 181, 185, 188, 191, - 144, 151, 128, 132, 135, 136, 139, 141, - 157, 163, 166, 172, 176, 180, 128, 138, - 144, 153, 134, 136, 143, 154, 255, 128, - 181, 184, 255, 129, 151, 158, 255, 129, - 131, 133, 143, 154, 255, 128, 137, 128, - 153, 157, 171, 176, 185, 160, 255, 170, - 190, 192, 255, 128, 184, 128, 136, 138, - 182, 184, 191, 128, 144, 153, 178, 255, - 168, 144, 145, 183, 255, 128, 142, 145, - 149, 129, 141, 144, 146, 147, 148, 175, - 255, 132, 255, 128, 144, 129, 143, 144, - 153, 145, 152, 135, 255, 160, 168, 169, - 171, 172, 173, 174, 188, 189, 190, 191, - 161, 167, 185, 255, 128, 158, 160, 169, - 144, 173, 176, 180, 128, 131, 144, 153, - 163, 183, 189, 255, 144, 255, 133, 143, - 191, 255, 143, 159, 160, 128, 129, 255, - 159, 160, 171, 172, 255, 173, 255, 179, - 255, 128, 176, 177, 178, 128, 129, 171, - 175, 189, 255, 128, 136, 144, 153, 157, - 158, 133, 134, 137, 144, 145, 146, 147, - 148, 149, 154, 155, 156, 157, 158, 159, - 168, 169, 170, 150, 153, 165, 169, 173, - 178, 187, 255, 131, 132, 140, 169, 174, - 255, 130, 132, 149, 157, 173, 186, 188, - 160, 161, 163, 164, 167, 168, 132, 134, - 149, 157, 186, 139, 140, 191, 255, 134, - 128, 132, 138, 144, 146, 255, 166, 167, - 129, 155, 187, 149, 181, 143, 175, 137, - 169, 131, 140, 141, 192, 255, 128, 182, - 187, 255, 173, 180, 182, 255, 132, 155, - 159, 161, 175, 128, 160, 163, 164, 165, - 184, 185, 186, 161, 162, 128, 134, 136, - 152, 155, 161, 163, 164, 166, 170, 133, - 143, 151, 255, 139, 143, 154, 255, 164, - 167, 185, 187, 128, 131, 133, 159, 161, - 162, 169, 178, 180, 183, 130, 135, 137, - 139, 148, 151, 153, 155, 157, 159, 164, - 190, 141, 143, 145, 146, 161, 162, 167, - 170, 172, 178, 180, 183, 185, 188, 128, - 137, 139, 155, 161, 163, 165, 169, 171, - 187, 155, 156, 151, 255, 156, 157, 160, - 181, 255, 186, 187, 255, 162, 255, 160, - 168, 161, 167, 158, 255, 160, 132, 135, - 133, 134, 176, 255, 128, 191, 154, 164, - 168, 128, 149, 150, 191, 128, 152, 153, - 191, 181, 128, 159, 160, 189, 190, 191, - 189, 128, 131, 132, 185, 186, 191, 144, - 128, 151, 152, 161, 162, 176, 177, 255, - 169, 177, 129, 132, 141, 142, 145, 146, - 179, 181, 186, 188, 190, 191, 192, 255, - 142, 158, 128, 155, 156, 161, 162, 175, - 176, 177, 178, 191, 169, 177, 180, 183, - 128, 132, 133, 138, 139, 142, 143, 144, - 145, 146, 147, 185, 186, 191, 157, 128, - 152, 153, 158, 159, 177, 178, 180, 181, - 191, 142, 146, 169, 177, 180, 189, 128, - 132, 133, 185, 186, 191, 144, 185, 128, - 159, 160, 161, 162, 191, 169, 177, 180, - 189, 128, 132, 133, 140, 141, 142, 143, - 144, 145, 146, 147, 185, 186, 191, 158, - 177, 128, 155, 156, 161, 162, 191, 131, - 145, 155, 157, 128, 132, 133, 138, 139, - 141, 142, 149, 150, 152, 153, 159, 160, - 162, 163, 164, 165, 167, 168, 170, 171, - 173, 174, 185, 186, 191, 144, 128, 191, - 141, 145, 169, 189, 128, 132, 133, 185, - 186, 191, 128, 151, 152, 154, 155, 159, - 160, 161, 162, 191, 128, 141, 145, 169, - 180, 189, 129, 132, 133, 185, 186, 191, - 158, 128, 159, 160, 161, 162, 176, 177, - 178, 179, 191, 141, 145, 189, 128, 132, - 133, 186, 187, 191, 142, 128, 147, 148, - 150, 151, 158, 159, 161, 162, 185, 186, - 191, 178, 188, 128, 132, 133, 150, 151, - 153, 154, 189, 190, 191, 128, 134, 135, - 191, 128, 177, 129, 179, 180, 191, 128, - 131, 137, 141, 152, 160, 164, 166, 172, - 177, 189, 129, 132, 133, 134, 135, 138, - 139, 147, 148, 167, 168, 169, 170, 179, - 180, 191, 133, 128, 134, 135, 155, 156, - 159, 160, 191, 128, 129, 191, 136, 128, - 172, 173, 191, 128, 135, 136, 140, 141, - 191, 191, 128, 170, 171, 190, 161, 128, - 143, 144, 149, 150, 153, 154, 157, 158, - 164, 165, 166, 167, 173, 174, 176, 177, - 180, 181, 255, 130, 141, 143, 159, 134, - 187, 136, 140, 142, 143, 137, 151, 153, - 142, 143, 158, 159, 137, 177, 191, 142, - 143, 182, 183, 192, 255, 129, 151, 128, - 133, 134, 135, 136, 255, 145, 150, 151, - 155, 191, 192, 255, 128, 143, 144, 159, - 160, 255, 182, 183, 190, 191, 192, 255, - 128, 129, 255, 173, 174, 192, 255, 128, - 129, 154, 155, 159, 160, 255, 171, 173, - 185, 191, 192, 255, 141, 128, 145, 146, - 159, 160, 177, 178, 191, 173, 128, 145, - 146, 159, 160, 176, 177, 191, 128, 179, - 180, 191, 151, 156, 128, 191, 128, 159, - 160, 255, 184, 191, 192, 255, 169, 128, - 170, 171, 175, 176, 255, 182, 191, 192, - 255, 128, 158, 159, 191, 128, 143, 144, - 173, 174, 175, 176, 180, 181, 191, 128, - 171, 172, 175, 176, 255, 138, 191, 192, - 255, 128, 150, 151, 159, 160, 255, 149, - 191, 192, 255, 167, 128, 191, 128, 132, - 133, 179, 180, 191, 128, 132, 133, 139, - 140, 191, 128, 130, 131, 160, 161, 173, - 174, 175, 176, 185, 186, 255, 166, 191, - 192, 255, 128, 163, 164, 191, 128, 140, - 141, 143, 144, 153, 154, 189, 190, 191, - 128, 136, 137, 191, 173, 128, 168, 169, - 177, 178, 180, 181, 182, 183, 191, 0, - 127, 192, 255, 150, 151, 158, 159, 152, - 154, 156, 158, 134, 135, 142, 143, 190, - 191, 192, 255, 181, 189, 191, 128, 190, - 133, 181, 128, 129, 130, 140, 141, 143, - 144, 147, 148, 149, 150, 155, 156, 159, - 160, 172, 173, 177, 178, 188, 189, 191, - 177, 191, 128, 190, 128, 143, 144, 156, - 157, 191, 130, 135, 148, 164, 166, 168, - 128, 137, 138, 149, 150, 151, 152, 157, - 158, 169, 170, 185, 186, 187, 188, 191, - 142, 128, 132, 133, 137, 138, 159, 160, - 255, 137, 191, 192, 255, 175, 128, 255, - 159, 165, 170, 175, 177, 180, 191, 192, - 255, 166, 173, 128, 167, 168, 175, 176, - 255, 168, 174, 176, 191, 192, 255, 167, - 175, 183, 191, 128, 150, 151, 159, 160, - 190, 135, 143, 151, 128, 158, 159, 191, - 128, 132, 133, 135, 136, 160, 161, 169, - 170, 176, 177, 181, 182, 183, 184, 188, - 189, 191, 160, 151, 154, 187, 192, 255, - 128, 132, 133, 173, 174, 176, 177, 255, - 143, 159, 187, 191, 192, 255, 128, 175, - 176, 191, 150, 191, 192, 255, 141, 191, - 192, 255, 128, 143, 144, 189, 190, 191, - 141, 143, 160, 169, 172, 191, 192, 255, - 191, 128, 174, 175, 190, 128, 157, 158, - 159, 160, 255, 176, 191, 192, 255, 128, - 150, 151, 159, 160, 161, 162, 255, 175, - 137, 138, 184, 191, 192, 255, 128, 182, - 183, 255, 130, 134, 139, 163, 191, 192, - 255, 128, 129, 130, 179, 180, 191, 187, - 189, 128, 177, 178, 183, 184, 191, 128, - 137, 138, 165, 166, 175, 176, 255, 135, - 159, 189, 191, 192, 255, 128, 131, 132, - 178, 179, 191, 143, 165, 191, 128, 159, - 160, 175, 176, 185, 186, 190, 128, 168, - 169, 191, 131, 186, 128, 139, 140, 159, - 160, 182, 183, 189, 190, 255, 176, 178, - 180, 183, 184, 190, 191, 192, 255, 129, - 128, 130, 131, 154, 155, 157, 158, 159, - 160, 170, 171, 177, 178, 180, 181, 191, - 128, 167, 175, 129, 134, 135, 136, 137, - 142, 143, 144, 145, 150, 151, 159, 160, - 255, 155, 166, 175, 128, 162, 163, 191, - 164, 175, 135, 138, 188, 191, 192, 255, - 174, 175, 154, 191, 192, 255, 157, 169, - 183, 189, 191, 128, 134, 135, 146, 147, - 151, 152, 158, 159, 190, 130, 133, 128, - 255, 178, 191, 192, 255, 128, 146, 147, - 255, 190, 191, 192, 255, 128, 143, 144, - 255, 144, 145, 136, 175, 188, 191, 192, - 255, 181, 128, 175, 176, 255, 189, 191, - 192, 255, 128, 160, 161, 186, 187, 191, - 128, 129, 154, 155, 165, 166, 255, 191, - 192, 255, 128, 129, 130, 135, 136, 137, - 138, 143, 144, 145, 146, 151, 152, 153, - 154, 156, 157, 191, 128, 191, 128, 129, - 130, 131, 133, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 152, - 156, 157, 160, 161, 162, 163, 164, 166, - 168, 169, 170, 171, 172, 173, 174, 176, - 177, 132, 151, 153, 155, 158, 175, 178, - 179, 180, 191, 140, 167, 187, 190, 128, - 255, 142, 143, 158, 191, 192, 255, 187, - 191, 192, 255, 128, 180, 181, 191, 128, - 156, 157, 159, 160, 255, 145, 191, 192, - 255, 128, 159, 160, 175, 176, 255, 139, - 143, 182, 191, 192, 255, 144, 132, 135, - 150, 191, 192, 255, 158, 175, 148, 151, - 188, 191, 192, 255, 128, 167, 168, 175, - 176, 255, 164, 191, 192, 255, 183, 191, - 192, 255, 128, 149, 150, 159, 160, 167, - 168, 191, 136, 182, 188, 128, 133, 134, - 137, 138, 184, 185, 190, 191, 255, 150, - 159, 183, 191, 192, 255, 179, 128, 159, - 160, 181, 182, 191, 128, 149, 150, 159, - 160, 185, 186, 191, 128, 183, 184, 189, - 190, 191, 128, 148, 152, 129, 143, 144, - 179, 180, 191, 128, 159, 160, 188, 189, - 191, 128, 156, 157, 191, 136, 128, 164, - 165, 191, 128, 181, 182, 191, 128, 149, - 150, 159, 160, 178, 179, 191, 128, 145, - 146, 191, 128, 178, 179, 191, 128, 130, - 131, 132, 133, 134, 135, 136, 138, 139, - 140, 141, 144, 145, 146, 147, 150, 151, - 152, 153, 154, 156, 162, 163, 171, 176, - 177, 178, 129, 191, 128, 130, 131, 183, - 184, 191, 128, 130, 131, 175, 176, 191, - 128, 143, 144, 168, 169, 191, 128, 130, - 131, 166, 167, 191, 182, 128, 143, 144, - 178, 179, 191, 128, 130, 131, 178, 179, - 191, 128, 154, 156, 129, 132, 133, 191, - 146, 128, 171, 172, 191, 135, 137, 142, - 158, 128, 168, 169, 175, 176, 255, 159, - 191, 192, 255, 144, 128, 156, 157, 161, - 162, 191, 128, 134, 135, 138, 139, 191, - 128, 175, 176, 191, 134, 128, 131, 132, - 135, 136, 191, 128, 174, 175, 191, 128, - 151, 152, 155, 156, 191, 132, 128, 191, - 128, 170, 171, 191, 128, 153, 154, 191, - 160, 190, 192, 255, 128, 184, 185, 191, - 137, 128, 174, 175, 191, 128, 129, 177, - 178, 255, 144, 191, 192, 255, 128, 142, - 143, 144, 145, 146, 149, 129, 148, 150, - 191, 175, 191, 192, 255, 132, 191, 192, - 255, 128, 144, 129, 143, 145, 191, 144, - 153, 128, 143, 145, 152, 154, 191, 135, - 191, 192, 255, 160, 168, 169, 171, 172, - 173, 174, 188, 189, 190, 191, 128, 159, - 161, 167, 170, 187, 185, 191, 192, 255, - 128, 143, 144, 173, 174, 191, 128, 131, - 132, 162, 163, 183, 184, 188, 189, 255, - 133, 143, 145, 191, 192, 255, 128, 146, - 147, 159, 160, 191, 160, 128, 191, 128, - 129, 191, 192, 255, 159, 160, 171, 128, - 170, 172, 191, 192, 255, 173, 191, 192, - 255, 179, 191, 192, 255, 128, 176, 177, - 178, 129, 191, 128, 129, 130, 191, 171, - 175, 189, 191, 192, 255, 128, 136, 137, - 143, 144, 153, 154, 191, 144, 145, 146, - 147, 148, 149, 154, 155, 156, 157, 158, - 159, 128, 143, 150, 153, 160, 191, 149, - 157, 173, 186, 188, 160, 161, 163, 164, - 167, 168, 132, 134, 149, 157, 186, 191, - 139, 140, 192, 255, 133, 145, 128, 134, - 135, 137, 138, 255, 166, 167, 129, 155, - 187, 149, 181, 143, 175, 137, 169, 131, - 140, 191, 192, 255, 160, 163, 164, 165, - 184, 185, 186, 128, 159, 161, 162, 166, - 191, 133, 191, 192, 255, 132, 160, 163, - 167, 179, 184, 186, 128, 164, 165, 168, - 169, 187, 188, 191, 130, 135, 137, 139, - 144, 147, 151, 153, 155, 157, 159, 163, - 171, 179, 184, 189, 191, 128, 140, 141, - 148, 149, 160, 161, 164, 165, 166, 167, - 190, 138, 164, 170, 128, 155, 156, 160, - 161, 187, 188, 191, 128, 191, 155, 156, - 128, 191, 151, 191, 192, 255, 156, 157, - 160, 128, 191, 181, 191, 192, 255, 158, - 159, 186, 128, 185, 187, 191, 192, 255, - 162, 191, 192, 255, 160, 168, 128, 159, - 161, 167, 169, 191, 158, 191, 192, 255, - 10, 13, 128, 191, 192, 223, 224, 239, - 240, 247, 248, 255, 128, 191, 128, 191, - 128, 191, 128, 191, 128, 191, 10, 128, - 191, 128, 191, 128, 191, 36, 123, 37, - 123, 10, 128, 191, 128, 191, 128, 191, - 36, 123, 37, 123, 170, 181, 183, 186, - 128, 150, 152, 182, 184, 255, 192, 255, - 128, 255, 173, 130, 133, 146, 159, 165, - 171, 175, 255, 181, 190, 184, 185, 192, - 255, 140, 134, 138, 142, 161, 163, 255, - 182, 130, 136, 137, 176, 151, 152, 154, - 160, 190, 136, 144, 192, 255, 135, 129, - 130, 132, 133, 144, 170, 176, 178, 144, - 154, 160, 191, 128, 169, 174, 255, 148, - 169, 157, 158, 189, 190, 192, 255, 144, - 255, 139, 140, 178, 255, 186, 128, 181, - 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, - 128, 173, 128, 155, 160, 180, 182, 189, - 148, 161, 163, 255, 176, 164, 165, 132, - 169, 177, 141, 142, 145, 146, 179, 181, - 186, 187, 158, 133, 134, 137, 138, 143, - 150, 152, 155, 164, 165, 178, 255, 188, - 129, 131, 133, 138, 143, 144, 147, 168, - 170, 176, 178, 179, 181, 182, 184, 185, - 190, 255, 157, 131, 134, 137, 138, 142, - 144, 146, 152, 159, 165, 182, 255, 129, - 131, 133, 141, 143, 145, 147, 168, 170, - 176, 178, 179, 181, 185, 188, 255, 134, - 138, 142, 143, 145, 159, 164, 165, 176, - 184, 186, 255, 129, 131, 133, 140, 143, - 144, 147, 168, 170, 176, 178, 179, 181, - 185, 188, 191, 177, 128, 132, 135, 136, - 139, 141, 150, 151, 156, 157, 159, 163, - 166, 175, 156, 130, 131, 133, 138, 142, - 144, 146, 149, 153, 154, 158, 159, 163, - 164, 168, 170, 174, 185, 190, 191, 144, - 151, 128, 130, 134, 136, 138, 141, 166, - 175, 128, 131, 133, 140, 142, 144, 146, - 168, 170, 185, 189, 255, 133, 137, 151, - 142, 148, 155, 159, 164, 165, 176, 255, - 128, 131, 133, 140, 142, 144, 146, 168, - 170, 179, 181, 185, 188, 191, 158, 128, - 132, 134, 136, 138, 141, 149, 150, 160, - 163, 166, 175, 177, 178, 129, 131, 133, - 140, 142, 144, 146, 186, 189, 255, 133, - 137, 143, 147, 152, 158, 164, 165, 176, - 185, 192, 255, 189, 130, 131, 133, 150, - 154, 177, 179, 187, 138, 150, 128, 134, - 143, 148, 152, 159, 166, 175, 178, 179, - 129, 186, 128, 142, 144, 153, 132, 138, - 141, 165, 167, 129, 130, 135, 136, 148, - 151, 153, 159, 161, 163, 170, 171, 173, - 185, 187, 189, 134, 128, 132, 136, 141, - 144, 153, 156, 159, 128, 181, 183, 185, - 152, 153, 160, 169, 190, 191, 128, 135, - 137, 172, 177, 191, 128, 132, 134, 151, - 153, 188, 134, 128, 129, 130, 131, 137, - 138, 139, 140, 141, 142, 143, 144, 153, - 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, - 170, 173, 175, 176, 177, 178, 179, 181, - 182, 183, 188, 189, 190, 191, 132, 152, - 172, 184, 185, 187, 128, 191, 128, 137, - 144, 255, 158, 159, 134, 187, 136, 140, - 142, 143, 137, 151, 153, 142, 143, 158, - 159, 137, 177, 142, 143, 182, 183, 191, - 255, 128, 130, 133, 136, 150, 152, 255, - 145, 150, 151, 155, 156, 160, 168, 178, - 255, 128, 143, 160, 255, 182, 183, 190, - 255, 129, 255, 173, 174, 192, 255, 129, - 154, 160, 255, 171, 173, 185, 255, 128, - 140, 142, 148, 160, 180, 128, 147, 160, - 172, 174, 176, 178, 179, 148, 150, 152, - 155, 158, 159, 170, 255, 139, 141, 144, - 153, 160, 255, 184, 255, 128, 170, 176, - 255, 182, 255, 128, 158, 160, 171, 176, - 187, 134, 173, 176, 180, 128, 171, 176, - 255, 138, 143, 155, 255, 128, 155, 160, - 255, 159, 189, 190, 192, 255, 167, 128, - 137, 144, 153, 176, 189, 140, 143, 154, - 170, 180, 255, 180, 255, 128, 183, 128, - 137, 141, 189, 128, 136, 144, 146, 148, - 182, 184, 185, 128, 181, 187, 191, 150, - 151, 158, 159, 152, 154, 156, 158, 134, - 135, 142, 143, 190, 255, 190, 128, 180, - 182, 188, 130, 132, 134, 140, 144, 147, - 150, 155, 160, 172, 178, 180, 182, 188, - 128, 129, 130, 131, 132, 133, 134, 176, - 177, 178, 179, 180, 181, 182, 183, 191, - 255, 129, 147, 149, 176, 178, 190, 192, - 255, 144, 156, 161, 144, 156, 165, 176, - 130, 135, 149, 164, 166, 168, 138, 147, - 152, 157, 170, 185, 188, 191, 142, 133, - 137, 160, 255, 137, 255, 128, 174, 176, - 255, 159, 165, 170, 180, 255, 167, 173, - 128, 165, 176, 255, 168, 174, 176, 190, - 192, 255, 128, 150, 160, 166, 168, 174, - 176, 182, 184, 190, 128, 134, 136, 142, - 144, 150, 152, 158, 160, 191, 128, 129, - 130, 131, 132, 133, 134, 135, 144, 145, - 255, 133, 135, 161, 175, 177, 181, 184, - 188, 160, 151, 152, 187, 192, 255, 133, - 173, 177, 255, 143, 159, 187, 255, 176, - 191, 182, 183, 184, 191, 192, 255, 150, - 255, 128, 146, 147, 148, 152, 153, 154, - 155, 156, 158, 159, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 129, 255, 141, - 255, 144, 189, 141, 143, 172, 255, 191, - 128, 175, 180, 189, 151, 159, 162, 255, - 175, 137, 138, 184, 255, 183, 255, 168, - 255, 128, 179, 188, 134, 143, 154, 159, - 184, 186, 190, 255, 128, 173, 176, 255, - 148, 159, 189, 255, 129, 142, 154, 159, - 191, 255, 128, 182, 128, 141, 144, 153, - 160, 182, 186, 255, 128, 130, 155, 157, - 160, 175, 178, 182, 129, 134, 137, 142, - 145, 150, 160, 166, 168, 174, 176, 255, - 155, 166, 175, 128, 170, 172, 173, 176, - 185, 158, 159, 160, 255, 164, 175, 135, - 138, 188, 255, 164, 169, 171, 172, 173, - 174, 175, 180, 181, 182, 183, 184, 185, - 187, 188, 189, 190, 191, 165, 186, 174, - 175, 154, 255, 190, 128, 134, 147, 151, - 157, 168, 170, 182, 184, 188, 128, 129, - 131, 132, 134, 255, 147, 255, 190, 255, - 144, 145, 136, 175, 188, 255, 128, 143, - 160, 175, 179, 180, 141, 143, 176, 180, - 182, 255, 189, 255, 191, 144, 153, 161, - 186, 129, 154, 166, 255, 191, 255, 130, - 135, 138, 143, 146, 151, 154, 156, 144, - 145, 146, 147, 148, 150, 151, 152, 155, - 157, 158, 160, 170, 171, 172, 175, 161, - 169, 128, 129, 130, 131, 133, 135, 138, - 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 152, 156, 157, 160, 161, - 162, 163, 164, 166, 168, 169, 170, 171, - 172, 173, 174, 176, 177, 153, 155, 178, - 179, 128, 139, 141, 166, 168, 186, 188, - 189, 191, 255, 142, 143, 158, 255, 187, - 255, 128, 180, 189, 128, 156, 160, 255, - 145, 159, 161, 255, 128, 159, 176, 255, - 139, 143, 187, 255, 128, 157, 160, 255, - 144, 132, 135, 150, 255, 158, 159, 170, - 175, 148, 151, 188, 255, 128, 167, 176, - 255, 164, 255, 183, 255, 128, 149, 160, - 167, 136, 188, 128, 133, 138, 181, 183, - 184, 191, 255, 150, 159, 183, 255, 128, - 158, 160, 178, 180, 181, 128, 149, 160, - 185, 128, 183, 190, 191, 191, 128, 131, - 133, 134, 140, 147, 149, 151, 153, 179, - 184, 186, 160, 188, 128, 156, 128, 135, - 137, 166, 128, 181, 128, 149, 160, 178, - 128, 145, 128, 178, 129, 130, 131, 132, - 133, 135, 136, 138, 139, 140, 141, 144, - 145, 146, 147, 150, 151, 152, 153, 154, - 155, 156, 162, 163, 171, 176, 177, 178, - 128, 134, 135, 165, 176, 190, 144, 168, - 176, 185, 128, 180, 182, 191, 182, 144, - 179, 155, 133, 137, 141, 143, 157, 255, - 190, 128, 145, 147, 183, 136, 128, 134, - 138, 141, 143, 157, 159, 168, 176, 255, - 171, 175, 186, 255, 128, 131, 133, 140, - 143, 144, 147, 168, 170, 176, 178, 179, - 181, 185, 188, 191, 144, 151, 128, 132, - 135, 136, 139, 141, 157, 163, 166, 172, - 176, 180, 128, 138, 144, 153, 134, 136, - 143, 154, 255, 128, 181, 184, 255, 129, - 151, 158, 255, 129, 131, 133, 143, 154, - 255, 128, 137, 128, 153, 157, 171, 176, - 185, 160, 255, 170, 190, 192, 255, 128, - 184, 128, 136, 138, 182, 184, 191, 128, - 144, 153, 178, 255, 168, 144, 145, 183, - 255, 128, 142, 145, 149, 129, 141, 144, - 146, 147, 148, 175, 255, 132, 255, 128, - 144, 129, 143, 144, 153, 145, 152, 135, - 255, 160, 168, 169, 171, 172, 173, 174, - 188, 189, 190, 191, 161, 167, 185, 255, - 128, 158, 160, 169, 144, 173, 176, 180, - 128, 131, 144, 153, 163, 183, 189, 255, - 144, 255, 133, 143, 191, 255, 143, 159, - 160, 128, 129, 255, 159, 160, 171, 172, - 255, 173, 255, 179, 255, 128, 176, 177, - 178, 128, 129, 171, 175, 189, 255, 128, - 136, 144, 153, 157, 158, 133, 134, 137, - 144, 145, 146, 147, 148, 149, 154, 155, - 156, 157, 158, 159, 168, 169, 170, 150, - 153, 165, 169, 173, 178, 187, 255, 131, - 132, 140, 169, 174, 255, 130, 132, 149, - 157, 173, 186, 188, 160, 161, 163, 164, - 167, 168, 132, 134, 149, 157, 186, 139, - 140, 191, 255, 134, 128, 132, 138, 144, - 146, 255, 166, 167, 129, 155, 187, 149, - 181, 143, 175, 137, 169, 131, 140, 141, - 192, 255, 128, 182, 187, 255, 173, 180, - 182, 255, 132, 155, 159, 161, 175, 128, - 160, 163, 164, 165, 184, 185, 186, 161, - 162, 128, 134, 136, 152, 155, 161, 163, - 164, 166, 170, 133, 143, 151, 255, 139, - 143, 154, 255, 164, 167, 185, 187, 128, - 131, 133, 159, 161, 162, 169, 178, 180, - 183, 130, 135, 137, 139, 148, 151, 153, - 155, 157, 159, 164, 190, 141, 143, 145, - 146, 161, 162, 167, 170, 172, 178, 180, - 183, 185, 188, 128, 137, 139, 155, 161, - 163, 165, 169, 171, 187, 155, 156, 151, - 255, 156, 157, 160, 181, 255, 186, 187, - 255, 162, 255, 160, 168, 161, 167, 158, - 255, 160, 132, 135, 133, 134, 176, 255, - 128, 191, 154, 164, 168, 128, 149, 150, - 191, 128, 152, 153, 191, 181, 128, 159, - 160, 189, 190, 191, 189, 128, 131, 132, - 185, 186, 191, 144, 128, 151, 152, 161, - 162, 176, 177, 255, 169, 177, 129, 132, - 141, 142, 145, 146, 179, 181, 186, 188, - 190, 191, 192, 255, 142, 158, 128, 155, - 156, 161, 162, 175, 176, 177, 178, 191, - 169, 177, 180, 183, 128, 132, 133, 138, - 139, 142, 143, 144, 145, 146, 147, 185, - 186, 191, 157, 128, 152, 153, 158, 159, - 177, 178, 180, 181, 191, 142, 146, 169, - 177, 180, 189, 128, 132, 133, 185, 186, - 191, 144, 185, 128, 159, 160, 161, 162, - 191, 169, 177, 180, 189, 128, 132, 133, - 140, 141, 142, 143, 144, 145, 146, 147, - 185, 186, 191, 158, 177, 128, 155, 156, - 161, 162, 191, 131, 145, 155, 157, 128, - 132, 133, 138, 139, 141, 142, 149, 150, - 152, 153, 159, 160, 162, 163, 164, 165, - 167, 168, 170, 171, 173, 174, 185, 186, - 191, 144, 128, 191, 141, 145, 169, 189, - 128, 132, 133, 185, 186, 191, 128, 151, - 152, 154, 155, 159, 160, 161, 162, 191, - 128, 141, 145, 169, 180, 189, 129, 132, - 133, 185, 186, 191, 158, 128, 159, 160, - 161, 162, 176, 177, 178, 179, 191, 141, - 145, 189, 128, 132, 133, 186, 187, 191, - 142, 128, 147, 148, 150, 151, 158, 159, - 161, 162, 185, 186, 191, 178, 188, 128, - 132, 133, 150, 151, 153, 154, 189, 190, - 191, 128, 134, 135, 191, 128, 177, 129, - 179, 180, 191, 128, 131, 137, 141, 152, - 160, 164, 166, 172, 177, 189, 129, 132, - 133, 134, 135, 138, 139, 147, 148, 167, - 168, 169, 170, 179, 180, 191, 133, 128, - 134, 135, 155, 156, 159, 160, 191, 128, - 129, 191, 136, 128, 172, 173, 191, 128, - 135, 136, 140, 141, 191, 191, 128, 170, - 171, 190, 161, 128, 143, 144, 149, 150, - 153, 154, 157, 158, 164, 165, 166, 167, - 173, 174, 176, 177, 180, 181, 255, 130, - 141, 143, 159, 134, 187, 136, 140, 142, - 143, 137, 151, 153, 142, 143, 158, 159, - 137, 177, 191, 142, 143, 182, 183, 192, - 255, 129, 151, 128, 133, 134, 135, 136, - 255, 145, 150, 151, 155, 191, 192, 255, - 128, 143, 144, 159, 160, 255, 182, 183, - 190, 191, 192, 255, 128, 129, 255, 173, - 174, 192, 255, 128, 129, 154, 155, 159, - 160, 255, 171, 173, 185, 191, 192, 255, - 141, 128, 145, 146, 159, 160, 177, 178, - 191, 173, 128, 145, 146, 159, 160, 176, - 177, 191, 128, 179, 180, 191, 151, 156, - 128, 191, 128, 159, 160, 255, 184, 191, - 192, 255, 169, 128, 170, 171, 175, 176, - 255, 182, 191, 192, 255, 128, 158, 159, - 191, 128, 143, 144, 173, 174, 175, 176, - 180, 181, 191, 128, 171, 172, 175, 176, - 255, 138, 191, 192, 255, 128, 150, 151, - 159, 160, 255, 149, 191, 192, 255, 167, - 128, 191, 128, 132, 133, 179, 180, 191, - 128, 132, 133, 139, 140, 191, 128, 130, - 131, 160, 161, 173, 174, 175, 176, 185, - 186, 255, 166, 191, 192, 255, 128, 163, - 164, 191, 128, 140, 141, 143, 144, 153, - 154, 189, 190, 191, 128, 136, 137, 191, - 173, 128, 168, 169, 177, 178, 180, 181, - 182, 183, 191, 0, 127, 192, 255, 150, - 151, 158, 159, 152, 154, 156, 158, 134, - 135, 142, 143, 190, 191, 192, 255, 181, - 189, 191, 128, 190, 133, 181, 128, 129, - 130, 140, 141, 143, 144, 147, 148, 149, - 150, 155, 156, 159, 160, 172, 173, 177, - 178, 188, 189, 191, 177, 191, 128, 190, - 128, 143, 144, 156, 157, 191, 130, 135, - 148, 164, 166, 168, 128, 137, 138, 149, - 150, 151, 152, 157, 158, 169, 170, 185, - 186, 187, 188, 191, 142, 128, 132, 133, - 137, 138, 159, 160, 255, 137, 191, 192, - 255, 175, 128, 255, 159, 165, 170, 175, - 177, 180, 191, 192, 255, 166, 173, 128, - 167, 168, 175, 176, 255, 168, 174, 176, - 191, 192, 255, 167, 175, 183, 191, 128, - 150, 151, 159, 160, 190, 135, 143, 151, - 128, 158, 159, 191, 128, 132, 133, 135, - 136, 160, 161, 169, 170, 176, 177, 181, - 182, 183, 184, 188, 189, 191, 160, 151, - 154, 187, 192, 255, 128, 132, 133, 173, - 174, 176, 177, 255, 143, 159, 187, 191, - 192, 255, 128, 175, 176, 191, 150, 191, - 192, 255, 141, 191, 192, 255, 128, 143, - 144, 189, 190, 191, 141, 143, 160, 169, - 172, 191, 192, 255, 191, 128, 174, 175, - 190, 128, 157, 158, 159, 160, 255, 176, - 191, 192, 255, 128, 150, 151, 159, 160, - 161, 162, 255, 175, 137, 138, 184, 191, - 192, 255, 128, 182, 183, 255, 130, 134, - 139, 163, 191, 192, 255, 128, 129, 130, - 179, 180, 191, 187, 189, 128, 177, 178, - 183, 184, 191, 128, 137, 138, 165, 166, - 175, 176, 255, 135, 159, 189, 191, 192, - 255, 128, 131, 132, 178, 179, 191, 143, - 165, 191, 128, 159, 160, 175, 176, 185, - 186, 190, 128, 168, 169, 191, 131, 186, - 128, 139, 140, 159, 160, 182, 183, 189, - 190, 255, 176, 178, 180, 183, 184, 190, - 191, 192, 255, 129, 128, 130, 131, 154, - 155, 157, 158, 159, 160, 170, 171, 177, - 178, 180, 181, 191, 128, 167, 175, 129, - 134, 135, 136, 137, 142, 143, 144, 145, - 150, 151, 159, 160, 255, 155, 166, 175, - 128, 162, 163, 191, 164, 175, 135, 138, - 188, 191, 192, 255, 174, 175, 154, 191, - 192, 255, 157, 169, 183, 189, 191, 128, - 134, 135, 146, 147, 151, 152, 158, 159, - 190, 130, 133, 128, 255, 178, 191, 192, - 255, 128, 146, 147, 255, 190, 191, 192, - 255, 128, 143, 144, 255, 144, 145, 136, - 175, 188, 191, 192, 255, 181, 128, 175, - 176, 255, 189, 191, 192, 255, 128, 160, - 161, 186, 187, 191, 128, 129, 154, 155, - 165, 166, 255, 191, 192, 255, 128, 129, - 130, 135, 136, 137, 138, 143, 144, 145, - 146, 151, 152, 153, 154, 156, 157, 191, - 128, 191, 128, 129, 130, 131, 133, 138, - 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 152, 156, 157, 160, 161, - 162, 163, 164, 166, 168, 169, 170, 171, - 172, 173, 174, 176, 177, 132, 151, 153, - 155, 158, 175, 178, 179, 180, 191, 140, - 167, 187, 190, 128, 255, 142, 143, 158, - 191, 192, 255, 187, 191, 192, 255, 128, - 180, 181, 191, 128, 156, 157, 159, 160, - 255, 145, 191, 192, 255, 128, 159, 160, - 175, 176, 255, 139, 143, 182, 191, 192, - 255, 144, 132, 135, 150, 191, 192, 255, - 158, 175, 148, 151, 188, 191, 192, 255, - 128, 167, 168, 175, 176, 255, 164, 191, - 192, 255, 183, 191, 192, 255, 128, 149, - 150, 159, 160, 167, 168, 191, 136, 182, - 188, 128, 133, 134, 137, 138, 184, 185, - 190, 191, 255, 150, 159, 183, 191, 192, - 255, 179, 128, 159, 160, 181, 182, 191, - 128, 149, 150, 159, 160, 185, 186, 191, - 128, 183, 184, 189, 190, 191, 128, 148, - 152, 129, 143, 144, 179, 180, 191, 128, - 159, 160, 188, 189, 191, 128, 156, 157, - 191, 136, 128, 164, 165, 191, 128, 181, - 182, 191, 128, 149, 150, 159, 160, 178, - 179, 191, 128, 145, 146, 191, 128, 178, - 179, 191, 128, 130, 131, 132, 133, 134, - 135, 136, 138, 139, 140, 141, 144, 145, - 146, 147, 150, 151, 152, 153, 154, 156, - 162, 163, 171, 176, 177, 178, 129, 191, - 128, 130, 131, 183, 184, 191, 128, 130, - 131, 175, 176, 191, 128, 143, 144, 168, - 169, 191, 128, 130, 131, 166, 167, 191, - 182, 128, 143, 144, 178, 179, 191, 128, - 130, 131, 178, 179, 191, 128, 154, 156, - 129, 132, 133, 191, 146, 128, 171, 172, - 191, 135, 137, 142, 158, 128, 168, 169, - 175, 176, 255, 159, 191, 192, 255, 144, - 128, 156, 157, 161, 162, 191, 128, 134, - 135, 138, 139, 191, 128, 175, 176, 191, - 134, 128, 131, 132, 135, 136, 191, 128, - 174, 175, 191, 128, 151, 152, 155, 156, - 191, 132, 128, 191, 128, 170, 171, 191, - 128, 153, 154, 191, 160, 190, 192, 255, - 128, 184, 185, 191, 137, 128, 174, 175, - 191, 128, 129, 177, 178, 255, 144, 191, - 192, 255, 128, 142, 143, 144, 145, 146, - 149, 129, 148, 150, 191, 175, 191, 192, - 255, 132, 191, 192, 255, 128, 144, 129, - 143, 145, 191, 144, 153, 128, 143, 145, - 152, 154, 191, 135, 191, 192, 255, 160, - 168, 169, 171, 172, 173, 174, 188, 189, - 190, 191, 128, 159, 161, 167, 170, 187, - 185, 191, 192, 255, 128, 143, 144, 173, - 174, 191, 128, 131, 132, 162, 163, 183, - 184, 188, 189, 255, 133, 143, 145, 191, - 192, 255, 128, 146, 147, 159, 160, 191, - 160, 128, 191, 128, 129, 191, 192, 255, - 159, 160, 171, 128, 170, 172, 191, 192, - 255, 173, 191, 192, 255, 179, 191, 192, - 255, 128, 176, 177, 178, 129, 191, 128, - 129, 130, 191, 171, 175, 189, 191, 192, - 255, 128, 136, 137, 143, 144, 153, 154, - 191, 144, 145, 146, 147, 148, 149, 154, - 155, 156, 157, 158, 159, 128, 143, 150, - 153, 160, 191, 149, 157, 173, 186, 188, - 160, 161, 163, 164, 167, 168, 132, 134, - 149, 157, 186, 191, 139, 140, 192, 255, - 133, 145, 128, 134, 135, 137, 138, 255, - 166, 167, 129, 155, 187, 149, 181, 143, - 175, 137, 169, 131, 140, 191, 192, 255, - 160, 163, 164, 165, 184, 185, 186, 128, - 159, 161, 162, 166, 191, 133, 191, 192, - 255, 132, 160, 163, 167, 179, 184, 186, - 128, 164, 165, 168, 169, 187, 188, 191, - 130, 135, 137, 139, 144, 147, 151, 153, - 155, 157, 159, 163, 171, 179, 184, 189, - 191, 128, 140, 141, 148, 149, 160, 161, - 164, 165, 166, 167, 190, 138, 164, 170, - 128, 155, 156, 160, 161, 187, 188, 191, - 128, 191, 155, 156, 128, 191, 151, 191, - 192, 255, 156, 157, 160, 128, 191, 181, - 191, 192, 255, 158, 159, 186, 128, 185, - 187, 191, 192, 255, 162, 191, 192, 255, - 160, 168, 128, 159, 161, 167, 169, 191, - 158, 191, 192, 255, 9, 10, 13, 32, - 33, 34, 35, 38, 46, 47, 60, 61, - 62, 64, 92, 95, 123, 124, 125, 126, - 127, 194, 195, 198, 199, 203, 204, 205, - 206, 207, 210, 212, 213, 214, 215, 216, - 217, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 228, 233, 234, 237, 238, 239, - 240, 0, 36, 37, 45, 48, 57, 58, - 63, 65, 90, 91, 96, 97, 122, 192, - 193, 196, 218, 229, 236, 241, 247, 9, - 32, 10, 61, 10, 38, 46, 42, 47, - 46, 69, 101, 48, 57, 60, 61, 61, - 62, 61, 45, 95, 194, 195, 198, 199, - 203, 204, 205, 206, 207, 210, 212, 213, - 214, 215, 216, 217, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 233, 234, - 237, 239, 240, 243, 48, 57, 65, 90, - 97, 122, 196, 218, 229, 236, 124, 125, - 128, 191, 170, 181, 186, 128, 191, 151, - 183, 128, 255, 192, 255, 0, 127, 173, - 130, 133, 146, 159, 165, 171, 175, 191, - 192, 255, 181, 190, 128, 175, 176, 183, - 184, 185, 186, 191, 134, 139, 141, 162, - 128, 135, 136, 255, 182, 130, 137, 176, - 151, 152, 154, 160, 136, 191, 192, 255, - 128, 143, 144, 170, 171, 175, 176, 178, - 179, 191, 128, 159, 160, 191, 176, 128, - 138, 139, 173, 174, 255, 148, 150, 164, - 167, 173, 176, 185, 189, 190, 192, 255, - 144, 128, 145, 146, 175, 176, 191, 128, - 140, 141, 255, 166, 176, 178, 191, 192, - 255, 186, 128, 137, 138, 170, 171, 179, - 180, 181, 182, 191, 160, 161, 162, 164, - 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 128, 191, 128, 129, 130, 131, - 137, 138, 139, 140, 141, 142, 143, 144, - 153, 154, 155, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 182, 183, 184, 188, - 189, 190, 191, 132, 187, 129, 130, 132, - 133, 134, 176, 177, 178, 179, 180, 181, - 182, 183, 128, 191, 128, 129, 130, 131, - 132, 133, 134, 135, 144, 136, 143, 145, - 191, 192, 255, 182, 183, 184, 128, 191, - 128, 191, 191, 128, 190, 192, 255, 128, - 146, 147, 148, 152, 153, 154, 155, 156, - 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 129, 191, 192, 255, 158, - 159, 128, 157, 160, 191, 192, 255, 128, - 191, 164, 169, 171, 172, 173, 174, 175, - 180, 181, 182, 183, 184, 185, 187, 188, - 189, 190, 191, 128, 163, 165, 186, 144, - 145, 146, 147, 148, 150, 151, 152, 155, - 157, 158, 160, 170, 171, 172, 175, 128, - 159, 161, 169, 173, 191, 128, 191, 10, - 13, 34, 36, 37, 92, 128, 191, 192, - 223, 224, 239, 240, 247, 248, 255, 10, - 13, 34, 92, 36, 37, 128, 191, 192, - 223, 224, 239, 240, 247, 248, 255, 10, - 13, 36, 123, 123, 126, 126, 37, 123, - 126, 10, 13, 128, 191, 192, 223, 224, - 239, 240, 247, 248, 255, 128, 191, 128, - 191, 128, 191, 10, 13, 36, 37, 128, - 191, 192, 223, 224, 239, 240, 247, 248, - 255, 10, 13, 36, 37, 128, 191, 192, - 223, 224, 239, 240, 247, 248, 255, 10, - 13, 10, 13, 123, 10, 13, 126, 10, - 13, 126, 126, 128, 191, 128, 191, 128, - 191, 10, 13, 36, 37, 128, 191, 192, - 223, 224, 239, 240, 247, 248, 255, 10, - 13, 36, 37, 128, 191, 192, 223, 224, - 239, 240, 247, 248, 255, 10, 13, 10, - 13, 123, 10, 13, 126, 10, 13, 126, - 126, 128, 191, 128, 191, 128, 191, 95, - 194, 195, 198, 199, 203, 204, 205, 206, - 207, 210, 212, 213, 214, 215, 216, 217, - 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 233, 234, 237, 238, 239, 240, - 65, 90, 97, 122, 128, 191, 192, 193, - 196, 218, 229, 236, 241, 247, 248, 255, - 45, 95, 194, 195, 198, 199, 203, 204, - 205, 206, 207, 210, 212, 213, 214, 215, - 216, 217, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 233, 234, 237, 239, - 240, 243, 48, 57, 65, 90, 97, 122, - 196, 218, 229, 236, 128, 191, 170, 181, - 186, 128, 191, 151, 183, 128, 255, 192, - 255, 0, 127, 173, 130, 133, 146, 159, - 165, 171, 175, 191, 192, 255, 181, 190, - 128, 175, 176, 183, 184, 185, 186, 191, - 134, 139, 141, 162, 128, 135, 136, 255, - 182, 130, 137, 176, 151, 152, 154, 160, - 136, 191, 192, 255, 128, 143, 144, 170, - 171, 175, 176, 178, 179, 191, 128, 159, - 160, 191, 176, 128, 138, 139, 173, 174, - 255, 148, 150, 164, 167, 173, 176, 185, - 189, 190, 192, 255, 144, 128, 145, 146, - 175, 176, 191, 128, 140, 141, 255, 166, - 176, 178, 191, 192, 255, 186, 128, 137, - 138, 170, 171, 179, 180, 181, 182, 191, - 160, 161, 162, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 128, 191, - 128, 129, 130, 131, 137, 138, 139, 140, - 141, 142, 143, 144, 153, 154, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, - 182, 183, 184, 188, 189, 190, 191, 132, - 187, 129, 130, 132, 133, 134, 176, 177, - 178, 179, 180, 181, 182, 183, 128, 191, - 128, 129, 130, 131, 132, 133, 134, 135, - 144, 136, 143, 145, 191, 192, 255, 182, - 183, 184, 128, 191, 128, 191, 191, 128, - 190, 192, 255, 128, 146, 147, 148, 152, - 153, 154, 155, 156, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 129, - 191, 192, 255, 158, 159, 128, 157, 160, - 191, 192, 255, 128, 191, 164, 169, 171, - 172, 173, 174, 175, 180, 181, 182, 183, - 184, 185, 187, 188, 189, 190, 191, 128, - 163, 165, 186, 144, 145, 146, 147, 148, - 150, 151, 152, 155, 157, 158, 160, 170, - 171, 172, 175, 128, 159, 161, 169, 173, - 191, 128, 191, -} - -var _hcltok_single_lengths []byte = []byte{ - 0, 1, 1, 2, 3, 2, 0, 32, - 31, 36, 1, 4, 0, 0, 0, 0, - 1, 2, 1, 1, 1, 1, 0, 1, - 1, 0, 0, 2, 0, 0, 0, 1, - 32, 0, 0, 0, 0, 1, 3, 1, - 1, 1, 0, 2, 0, 1, 1, 2, - 0, 3, 0, 1, 0, 2, 1, 2, - 0, 0, 5, 1, 4, 0, 0, 1, - 43, 0, 0, 0, 2, 3, 2, 1, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 1, - 0, 15, 0, 0, 0, 1, 6, 1, - 0, 0, 1, 0, 2, 0, 0, 0, - 9, 0, 1, 1, 0, 0, 0, 3, - 0, 1, 0, 28, 0, 0, 0, 1, - 0, 1, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 2, - 0, 0, 18, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 16, 36, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 2, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 28, 0, 0, 0, 1, - 1, 1, 1, 0, 0, 2, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 4, 0, 0, 2, 2, - 0, 11, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 3, 0, 0, 4, 0, - 0, 0, 18, 0, 0, 0, 1, 4, - 1, 4, 1, 0, 3, 2, 2, 2, - 1, 0, 0, 1, 8, 0, 0, 0, - 4, 12, 0, 2, 0, 3, 0, 1, - 0, 2, 0, 1, 2, 0, 3, 1, - 2, 0, 0, 0, 0, 0, 1, 1, - 0, 0, 1, 28, 3, 0, 1, 1, - 2, 1, 0, 1, 1, 2, 1, 1, - 2, 1, 1, 0, 2, 1, 1, 1, - 1, 0, 0, 6, 1, 1, 0, 0, - 46, 1, 1, 0, 0, 0, 0, 2, - 1, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 13, 2, 0, 0, - 0, 9, 0, 1, 28, 0, 1, 3, - 0, 2, 0, 0, 0, 1, 0, 1, - 1, 2, 0, 18, 2, 0, 0, 16, - 35, 0, 0, 0, 1, 0, 28, 0, - 0, 0, 0, 1, 0, 2, 0, 0, - 1, 0, 0, 1, 0, 0, 1, 0, - 0, 0, 0, 1, 11, 0, 0, 0, - 0, 4, 0, 12, 1, 7, 0, 4, - 0, 0, 0, 0, 1, 2, 1, 1, - 1, 1, 0, 1, 1, 0, 0, 2, - 0, 0, 0, 1, 32, 0, 0, 0, - 0, 1, 3, 1, 1, 1, 0, 2, - 0, 1, 1, 2, 0, 3, 0, 1, - 0, 2, 1, 2, 0, 0, 5, 1, - 4, 0, 0, 1, 43, 0, 0, 0, - 2, 3, 2, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 4, 1, 0, 15, 0, 0, - 0, 1, 6, 1, 0, 0, 1, 0, - 2, 0, 0, 0, 9, 0, 1, 1, - 0, 0, 0, 3, 0, 1, 0, 28, - 0, 0, 0, 1, 0, 1, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 2, 0, 0, 18, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 16, 36, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 2, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 28, - 0, 0, 0, 1, 1, 1, 1, 0, - 0, 2, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 4, - 0, 0, 2, 2, 0, 11, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 3, - 0, 0, 4, 0, 0, 0, 18, 0, - 0, 0, 1, 4, 1, 4, 1, 0, - 3, 2, 2, 2, 1, 0, 0, 1, - 8, 0, 0, 0, 4, 12, 0, 2, - 0, 3, 0, 1, 0, 2, 0, 1, - 2, 0, 0, 3, 0, 1, 1, 1, - 2, 2, 4, 1, 6, 2, 4, 2, - 4, 1, 4, 0, 6, 1, 3, 1, - 2, 0, 2, 11, 1, 1, 1, 0, - 1, 1, 0, 2, 0, 3, 3, 2, - 1, 0, 0, 0, 1, 0, 1, 0, - 1, 1, 0, 2, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 4, 3, 2, 2, 0, 6, - 1, 0, 1, 1, 0, 2, 0, 4, - 3, 0, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 1, - 0, 3, 0, 2, 0, 0, 0, 3, - 0, 2, 1, 1, 3, 1, 0, 0, - 0, 0, 0, 5, 2, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 1, 1, - 0, 0, 35, 4, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 3, 0, 1, 0, 0, 3, - 0, 0, 1, 0, 0, 0, 0, 28, - 0, 0, 0, 0, 1, 0, 3, 1, - 4, 0, 1, 0, 0, 1, 0, 0, - 1, 0, 0, 0, 0, 1, 1, 0, - 7, 0, 0, 2, 2, 0, 11, 0, - 0, 0, 0, 0, 1, 1, 3, 0, - 0, 4, 0, 0, 0, 12, 1, 4, - 1, 5, 2, 0, 3, 2, 2, 2, - 1, 7, 0, 7, 17, 3, 0, 2, - 0, 3, 0, 0, 1, 0, 2, 0, - 2, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 2, 2, 1, 0, 0, 0, - 2, 2, 4, 0, 0, 0, 0, 1, - 2, 1, 1, 1, 1, 0, 1, 1, - 0, 0, 2, 0, 0, 0, 1, 32, - 0, 0, 0, 0, 1, 3, 1, 1, - 1, 0, 2, 0, 1, 1, 2, 0, - 3, 0, 1, 0, 2, 1, 2, 0, - 0, 5, 1, 4, 0, 0, 1, 43, - 0, 0, 0, 2, 3, 2, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 4, 1, 0, - 15, 0, 0, 0, 1, 6, 1, 0, - 0, 1, 0, 2, 0, 0, 0, 9, - 0, 1, 1, 0, 0, 0, 3, 0, - 1, 0, 28, 0, 0, 0, 1, 0, - 1, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 2, 0, - 0, 18, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 0, 16, 36, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 28, 0, 0, 0, 1, 1, - 1, 1, 0, 0, 2, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 4, 0, 0, 2, 2, 0, - 11, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 3, 0, 0, 4, 0, 0, - 0, 18, 0, 0, 0, 1, 4, 1, - 4, 1, 0, 3, 2, 2, 2, 1, - 0, 0, 1, 8, 0, 0, 0, 4, - 12, 0, 2, 0, 3, 0, 1, 0, - 2, 0, 1, 2, 0, 0, 3, 0, - 1, 1, 1, 2, 2, 4, 1, 6, - 2, 4, 2, 4, 1, 4, 0, 6, - 1, 3, 1, 2, 0, 2, 11, 1, - 1, 1, 0, 1, 1, 0, 2, 0, - 3, 3, 2, 1, 0, 0, 0, 1, - 0, 1, 0, 1, 1, 0, 2, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 4, 3, 2, - 2, 0, 6, 1, 0, 1, 1, 0, - 2, 0, 4, 3, 0, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 3, 0, 2, 0, - 0, 0, 3, 0, 2, 1, 1, 3, - 1, 0, 0, 0, 0, 0, 5, 2, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 1, 1, 0, 0, 35, 4, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 3, 0, 1, - 0, 0, 3, 0, 0, 1, 0, 0, - 0, 0, 28, 0, 0, 0, 0, 1, - 0, 3, 1, 4, 0, 1, 0, 0, - 1, 0, 0, 1, 0, 0, 0, 0, - 1, 1, 0, 7, 0, 0, 2, 2, - 0, 11, 0, 0, 0, 0, 0, 1, - 1, 3, 0, 0, 4, 0, 0, 0, - 12, 1, 4, 1, 5, 2, 0, 3, - 2, 2, 2, 1, 7, 0, 7, 17, - 3, 0, 2, 0, 3, 0, 0, 1, - 0, 2, 0, 53, 2, 1, 1, 1, - 1, 1, 2, 3, 2, 2, 1, 34, - 1, 1, 0, 3, 2, 0, 0, 0, - 1, 2, 4, 1, 0, 1, 0, 0, - 0, 0, 1, 1, 1, 0, 0, 1, - 30, 47, 13, 9, 3, 0, 1, 28, - 2, 0, 18, 16, 0, 6, 4, 2, - 2, 0, 1, 1, 1, 2, 1, 2, - 0, 0, 0, 4, 2, 2, 3, 3, - 2, 1, 1, 0, 0, 0, 4, 2, - 2, 3, 3, 2, 1, 1, 0, 0, - 0, 33, 34, 0, 3, 2, 0, 0, - 0, 1, 2, 4, 1, 0, 1, 0, - 0, 0, 0, 1, 1, 1, 0, 0, - 1, 30, 47, 13, 9, 3, 0, 1, - 28, 2, 0, 18, 16, 0, -} - -var _hcltok_range_lengths []byte = []byte{ - 0, 0, 0, 0, 1, 1, 1, 5, - 5, 5, 0, 0, 3, 0, 1, 1, - 4, 2, 3, 0, 1, 0, 2, 2, - 4, 2, 2, 3, 1, 1, 1, 1, - 0, 1, 1, 2, 2, 1, 4, 6, - 9, 6, 8, 5, 8, 7, 10, 4, - 6, 4, 7, 7, 5, 5, 4, 5, - 1, 2, 8, 4, 3, 3, 3, 0, - 3, 1, 2, 1, 2, 2, 3, 3, - 1, 3, 2, 2, 1, 2, 2, 2, - 3, 4, 4, 3, 1, 2, 1, 3, - 2, 2, 2, 2, 2, 3, 3, 1, - 1, 2, 1, 3, 2, 2, 3, 2, - 7, 0, 1, 4, 1, 2, 4, 2, - 1, 2, 0, 2, 2, 3, 5, 5, - 1, 4, 1, 1, 2, 2, 1, 0, - 0, 1, 1, 1, 1, 1, 2, 2, - 2, 2, 1, 1, 1, 4, 2, 2, - 3, 1, 4, 4, 6, 1, 3, 1, - 1, 2, 1, 1, 1, 5, 3, 1, - 1, 1, 2, 3, 3, 1, 2, 2, - 1, 4, 1, 2, 5, 2, 1, 1, - 0, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 1, 1, 2, 4, 2, 1, - 2, 2, 2, 6, 1, 1, 2, 1, - 2, 1, 1, 1, 2, 2, 2, 1, - 3, 2, 5, 2, 8, 6, 2, 2, - 2, 2, 3, 1, 3, 1, 2, 1, - 3, 2, 2, 3, 1, 1, 1, 1, - 1, 1, 1, 2, 2, 4, 1, 2, - 1, 0, 1, 1, 1, 1, 0, 1, - 2, 3, 1, 3, 3, 1, 0, 3, - 0, 2, 3, 1, 0, 0, 0, 0, - 2, 2, 2, 2, 1, 5, 2, 2, - 5, 7, 5, 0, 1, 0, 1, 1, - 1, 1, 1, 0, 1, 1, 0, 3, - 3, 1, 1, 2, 1, 3, 5, 1, - 1, 2, 2, 1, 1, 1, 1, 2, - 6, 3, 7, 2, 6, 1, 6, 2, - 8, 0, 4, 2, 5, 2, 3, 3, - 3, 1, 2, 8, 2, 0, 2, 1, - 2, 1, 5, 2, 1, 3, 3, 0, - 2, 1, 2, 1, 0, 1, 1, 3, - 1, 1, 2, 3, 0, 0, 3, 2, - 4, 1, 4, 1, 1, 3, 1, 1, - 1, 1, 2, 2, 1, 3, 1, 4, - 3, 3, 1, 1, 5, 2, 1, 1, - 2, 1, 2, 1, 3, 2, 0, 1, - 1, 1, 1, 1, 1, 1, 2, 1, - 1, 1, 1, 1, 1, 1, 0, 1, - 1, 2, 2, 1, 1, 1, 3, 2, - 1, 0, 2, 1, 1, 1, 1, 0, - 3, 0, 1, 1, 4, 2, 3, 0, - 1, 0, 2, 2, 4, 2, 2, 3, - 1, 1, 1, 1, 0, 1, 1, 2, - 2, 1, 4, 6, 9, 6, 8, 5, - 8, 7, 10, 4, 6, 4, 7, 7, - 5, 5, 4, 5, 1, 2, 8, 4, - 3, 3, 3, 0, 3, 1, 2, 1, - 2, 2, 3, 3, 1, 3, 2, 2, - 1, 2, 2, 2, 3, 4, 4, 3, - 1, 2, 1, 3, 2, 2, 2, 2, - 2, 3, 3, 1, 1, 2, 1, 3, - 2, 2, 3, 2, 7, 0, 1, 4, - 1, 2, 4, 2, 1, 2, 0, 2, - 2, 3, 5, 5, 1, 4, 1, 1, - 2, 2, 1, 0, 0, 1, 1, 1, - 1, 1, 2, 2, 2, 2, 1, 1, - 1, 4, 2, 2, 3, 1, 4, 4, - 6, 1, 3, 1, 1, 2, 1, 1, - 1, 5, 3, 1, 1, 1, 2, 3, - 3, 1, 2, 2, 1, 4, 1, 2, - 5, 2, 1, 1, 0, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 1, - 2, 4, 2, 1, 2, 2, 2, 6, - 1, 1, 2, 1, 2, 1, 1, 1, - 2, 2, 2, 1, 3, 2, 5, 2, - 8, 6, 2, 2, 2, 2, 3, 1, - 3, 1, 2, 1, 3, 2, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 2, - 2, 4, 1, 2, 1, 0, 1, 1, - 1, 1, 0, 1, 2, 3, 1, 3, - 3, 1, 0, 3, 0, 2, 3, 1, - 0, 0, 0, 0, 2, 2, 2, 2, - 1, 5, 2, 2, 5, 7, 5, 0, - 1, 0, 1, 1, 1, 1, 1, 0, - 1, 1, 1, 2, 2, 3, 3, 4, - 7, 5, 7, 5, 3, 3, 7, 3, - 13, 1, 3, 5, 3, 5, 3, 6, - 5, 2, 2, 8, 4, 1, 2, 3, - 2, 10, 2, 2, 0, 2, 3, 3, - 1, 2, 3, 3, 1, 2, 3, 3, - 4, 4, 2, 1, 2, 2, 3, 2, - 2, 5, 3, 2, 3, 2, 1, 3, - 3, 6, 2, 2, 5, 2, 5, 1, - 1, 2, 4, 1, 11, 1, 3, 8, - 4, 2, 1, 0, 4, 3, 3, 3, - 2, 9, 1, 1, 4, 3, 2, 2, - 2, 3, 4, 2, 3, 2, 4, 3, - 2, 2, 3, 3, 4, 3, 3, 4, - 2, 5, 4, 8, 7, 1, 2, 1, - 3, 1, 2, 5, 1, 2, 2, 2, - 2, 1, 3, 2, 2, 3, 3, 1, - 9, 1, 5, 1, 3, 2, 2, 3, - 2, 3, 3, 3, 1, 3, 3, 2, - 2, 4, 5, 3, 3, 4, 3, 3, - 3, 2, 2, 2, 4, 2, 2, 1, - 3, 3, 3, 3, 3, 3, 2, 2, - 3, 2, 3, 3, 2, 3, 2, 3, - 1, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 3, 2, 3, 2, - 3, 5, 3, 3, 1, 2, 3, 2, - 2, 1, 2, 3, 4, 3, 0, 3, - 0, 2, 3, 1, 0, 0, 0, 0, - 2, 3, 2, 4, 6, 4, 1, 1, - 2, 1, 2, 1, 3, 2, 3, 2, - 5, 1, 1, 1, 1, 1, 0, 1, - 1, 1, 0, 0, 0, 1, 1, 1, - 0, 0, 0, 3, 0, 1, 1, 4, - 2, 3, 0, 1, 0, 2, 2, 4, - 2, 2, 3, 1, 1, 1, 1, 0, - 1, 1, 2, 2, 1, 4, 6, 9, - 6, 8, 5, 8, 7, 10, 4, 6, - 4, 7, 7, 5, 5, 4, 5, 1, - 2, 8, 4, 3, 3, 3, 0, 3, - 1, 2, 1, 2, 2, 3, 3, 1, - 3, 2, 2, 1, 2, 2, 2, 3, - 4, 4, 3, 1, 2, 1, 3, 2, - 2, 2, 2, 2, 3, 3, 1, 1, - 2, 1, 3, 2, 2, 3, 2, 7, - 0, 1, 4, 1, 2, 4, 2, 1, - 2, 0, 2, 2, 3, 5, 5, 1, - 4, 1, 1, 2, 2, 1, 0, 0, - 1, 1, 1, 1, 1, 2, 2, 2, - 2, 1, 1, 1, 4, 2, 2, 3, - 1, 4, 4, 6, 1, 3, 1, 1, - 2, 1, 1, 1, 5, 3, 1, 1, - 1, 2, 3, 3, 1, 2, 2, 1, - 4, 1, 2, 5, 2, 1, 1, 0, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 1, 1, 2, 4, 2, 1, 2, - 2, 2, 6, 1, 1, 2, 1, 2, - 1, 1, 1, 2, 2, 2, 1, 3, - 2, 5, 2, 8, 6, 2, 2, 2, - 2, 3, 1, 3, 1, 2, 1, 3, - 2, 2, 3, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 4, 1, 2, 1, - 0, 1, 1, 1, 1, 0, 1, 2, - 3, 1, 3, 3, 1, 0, 3, 0, - 2, 3, 1, 0, 0, 0, 0, 2, - 2, 2, 2, 1, 5, 2, 2, 5, - 7, 5, 0, 1, 0, 1, 1, 1, - 1, 1, 0, 1, 1, 1, 2, 2, - 3, 3, 4, 7, 5, 7, 5, 3, - 3, 7, 3, 13, 1, 3, 5, 3, - 5, 3, 6, 5, 2, 2, 8, 4, - 1, 2, 3, 2, 10, 2, 2, 0, - 2, 3, 3, 1, 2, 3, 3, 1, - 2, 3, 3, 4, 4, 2, 1, 2, - 2, 3, 2, 2, 5, 3, 2, 3, - 2, 1, 3, 3, 6, 2, 2, 5, - 2, 5, 1, 1, 2, 4, 1, 11, - 1, 3, 8, 4, 2, 1, 0, 4, - 3, 3, 3, 2, 9, 1, 1, 4, - 3, 2, 2, 2, 3, 4, 2, 3, - 2, 4, 3, 2, 2, 3, 3, 4, - 3, 3, 4, 2, 5, 4, 8, 7, - 1, 2, 1, 3, 1, 2, 5, 1, - 2, 2, 2, 2, 1, 3, 2, 2, - 3, 3, 1, 9, 1, 5, 1, 3, - 2, 2, 3, 2, 3, 3, 3, 1, - 3, 3, 2, 2, 4, 5, 3, 3, - 4, 3, 3, 3, 2, 2, 2, 4, - 2, 2, 1, 3, 3, 3, 3, 3, - 3, 2, 2, 3, 2, 3, 3, 2, - 3, 2, 3, 1, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 3, - 2, 3, 2, 3, 5, 3, 3, 1, - 2, 3, 2, 2, 1, 2, 3, 4, - 3, 0, 3, 0, 2, 3, 1, 0, - 0, 0, 0, 2, 3, 2, 4, 6, - 4, 1, 1, 2, 1, 2, 1, 3, - 2, 3, 2, 11, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 5, - 0, 0, 1, 1, 1, 0, 1, 1, - 5, 4, 2, 0, 1, 0, 2, 2, - 5, 2, 3, 5, 3, 2, 3, 5, - 1, 1, 1, 3, 1, 1, 2, 2, - 3, 1, 2, 3, 1, 5, 6, 0, - 0, 0, 0, 0, 0, 0, 0, 5, - 1, 1, 1, 5, 6, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 5, 6, - 0, 0, 0, 0, 0, 0, 1, 1, - 1, 8, 5, 1, 1, 1, 0, 1, - 1, 5, 4, 2, 0, 1, 0, 2, - 2, 5, 2, 3, 5, 3, 2, 3, - 5, 1, 1, 1, 3, 1, 1, 2, - 2, 3, 1, 2, 3, 1, -} - -var _hcltok_index_offsets []int16 = []int16{ - 0, 0, 2, 4, 7, 12, 16, 18, - 56, 93, 135, 137, 142, 146, 147, 149, - 151, 157, 162, 167, 169, 172, 174, 177, - 181, 187, 190, 193, 199, 201, 203, 205, - 208, 241, 243, 245, 248, 251, 254, 262, - 270, 281, 289, 298, 306, 315, 324, 336, - 343, 350, 358, 366, 375, 381, 389, 395, - 403, 405, 408, 422, 428, 436, 440, 444, - 446, 493, 495, 498, 500, 505, 511, 517, - 522, 525, 529, 532, 535, 537, 540, 543, - 546, 550, 555, 560, 564, 566, 569, 571, - 575, 578, 581, 584, 587, 591, 596, 600, - 602, 604, 607, 609, 613, 616, 619, 627, - 631, 639, 655, 657, 662, 664, 668, 679, - 683, 685, 688, 690, 693, 698, 702, 708, - 714, 725, 730, 733, 736, 739, 742, 744, - 748, 749, 752, 754, 784, 786, 788, 791, - 795, 798, 802, 804, 806, 808, 814, 817, - 820, 824, 826, 831, 836, 843, 846, 850, - 854, 856, 859, 879, 881, 883, 890, 894, - 896, 898, 900, 903, 907, 911, 913, 917, - 920, 922, 927, 945, 984, 990, 993, 995, - 997, 999, 1002, 1005, 1008, 1011, 1014, 1018, - 1021, 1024, 1027, 1029, 1031, 1034, 1041, 1044, - 1046, 1049, 1052, 1055, 1063, 1065, 1067, 1070, - 1072, 1075, 1077, 1079, 1109, 1112, 1115, 1118, - 1121, 1126, 1130, 1137, 1140, 1149, 1158, 1161, - 1165, 1168, 1171, 1175, 1177, 1181, 1183, 1186, - 1188, 1192, 1196, 1200, 1208, 1210, 1212, 1216, - 1220, 1222, 1235, 1237, 1240, 1243, 1248, 1250, - 1253, 1255, 1257, 1260, 1265, 1267, 1269, 1274, - 1276, 1279, 1283, 1303, 1307, 1311, 1313, 1315, - 1323, 1325, 1332, 1337, 1339, 1343, 1346, 1349, - 1352, 1356, 1359, 1362, 1366, 1376, 1382, 1385, - 1388, 1398, 1418, 1424, 1427, 1429, 1433, 1435, - 1438, 1440, 1444, 1446, 1448, 1452, 1454, 1458, - 1463, 1469, 1471, 1473, 1476, 1478, 1482, 1489, - 1492, 1494, 1497, 1501, 1531, 1536, 1538, 1541, - 1545, 1554, 1559, 1567, 1571, 1579, 1583, 1591, - 1595, 1606, 1608, 1614, 1617, 1625, 1629, 1634, - 1639, 1644, 1646, 1649, 1664, 1668, 1670, 1673, - 1675, 1724, 1727, 1734, 1737, 1739, 1743, 1747, - 1750, 1754, 1756, 1759, 1761, 1763, 1765, 1767, - 1771, 1773, 1775, 1778, 1782, 1796, 1799, 1803, - 1806, 1811, 1822, 1827, 1830, 1860, 1864, 1867, - 1872, 1874, 1878, 1881, 1884, 1886, 1891, 1893, - 1899, 1904, 1910, 1912, 1932, 1940, 1943, 1945, - 1963, 2001, 2003, 2006, 2008, 2013, 2016, 2045, - 2047, 2049, 2051, 2053, 2056, 2058, 2062, 2065, - 2067, 2070, 2072, 2074, 2077, 2079, 2081, 2083, - 2085, 2087, 2090, 2093, 2096, 2109, 2111, 2115, - 2118, 2120, 2125, 2128, 2142, 2145, 2154, 2156, - 2161, 2165, 2166, 2168, 2170, 2176, 2181, 2186, - 2188, 2191, 2193, 2196, 2200, 2206, 2209, 2212, - 2218, 2220, 2222, 2224, 2227, 2260, 2262, 2264, - 2267, 2270, 2273, 2281, 2289, 2300, 2308, 2317, - 2325, 2334, 2343, 2355, 2362, 2369, 2377, 2385, - 2394, 2400, 2408, 2414, 2422, 2424, 2427, 2441, - 2447, 2455, 2459, 2463, 2465, 2512, 2514, 2517, - 2519, 2524, 2530, 2536, 2541, 2544, 2548, 2551, - 2554, 2556, 2559, 2562, 2565, 2569, 2574, 2579, - 2583, 2585, 2588, 2590, 2594, 2597, 2600, 2603, - 2606, 2610, 2615, 2619, 2621, 2623, 2626, 2628, - 2632, 2635, 2638, 2646, 2650, 2658, 2674, 2676, - 2681, 2683, 2687, 2698, 2702, 2704, 2707, 2709, - 2712, 2717, 2721, 2727, 2733, 2744, 2749, 2752, - 2755, 2758, 2761, 2763, 2767, 2768, 2771, 2773, - 2803, 2805, 2807, 2810, 2814, 2817, 2821, 2823, - 2825, 2827, 2833, 2836, 2839, 2843, 2845, 2850, - 2855, 2862, 2865, 2869, 2873, 2875, 2878, 2898, - 2900, 2902, 2909, 2913, 2915, 2917, 2919, 2922, - 2926, 2930, 2932, 2936, 2939, 2941, 2946, 2964, - 3003, 3009, 3012, 3014, 3016, 3018, 3021, 3024, - 3027, 3030, 3033, 3037, 3040, 3043, 3046, 3048, - 3050, 3053, 3060, 3063, 3065, 3068, 3071, 3074, - 3082, 3084, 3086, 3089, 3091, 3094, 3096, 3098, - 3128, 3131, 3134, 3137, 3140, 3145, 3149, 3156, - 3159, 3168, 3177, 3180, 3184, 3187, 3190, 3194, - 3196, 3200, 3202, 3205, 3207, 3211, 3215, 3219, - 3227, 3229, 3231, 3235, 3239, 3241, 3254, 3256, - 3259, 3262, 3267, 3269, 3272, 3274, 3276, 3279, - 3284, 3286, 3288, 3293, 3295, 3298, 3302, 3322, - 3326, 3330, 3332, 3334, 3342, 3344, 3351, 3356, - 3358, 3362, 3365, 3368, 3371, 3375, 3378, 3381, - 3385, 3395, 3401, 3404, 3407, 3417, 3437, 3443, - 3446, 3448, 3452, 3454, 3457, 3459, 3463, 3465, - 3467, 3471, 3473, 3475, 3481, 3484, 3489, 3494, - 3500, 3510, 3518, 3530, 3537, 3547, 3553, 3565, - 3571, 3589, 3592, 3600, 3606, 3616, 3623, 3630, - 3638, 3646, 3649, 3654, 3674, 3680, 3683, 3687, - 3691, 3695, 3707, 3710, 3715, 3716, 3722, 3729, - 3735, 3738, 3741, 3745, 3749, 3752, 3755, 3760, - 3764, 3770, 3776, 3779, 3783, 3786, 3789, 3794, - 3797, 3800, 3806, 3810, 3813, 3817, 3820, 3823, - 3827, 3831, 3838, 3841, 3844, 3850, 3853, 3860, - 3862, 3864, 3867, 3876, 3881, 3895, 3899, 3903, - 3918, 3924, 3927, 3930, 3932, 3937, 3943, 3947, - 3955, 3961, 3971, 3974, 3977, 3982, 3986, 3989, - 3992, 3995, 3999, 4004, 4008, 4012, 4015, 4020, - 4025, 4028, 4034, 4038, 4044, 4049, 4053, 4057, - 4065, 4068, 4076, 4082, 4092, 4103, 4106, 4109, - 4111, 4115, 4117, 4120, 4131, 4135, 4138, 4141, - 4144, 4147, 4149, 4153, 4157, 4160, 4164, 4169, - 4172, 4182, 4184, 4225, 4231, 4235, 4238, 4241, - 4245, 4248, 4252, 4256, 4261, 4263, 4267, 4271, - 4274, 4277, 4282, 4291, 4295, 4300, 4305, 4309, - 4316, 4320, 4323, 4327, 4330, 4335, 4338, 4341, - 4371, 4375, 4379, 4383, 4387, 4392, 4396, 4402, - 4406, 4414, 4417, 4422, 4426, 4429, 4434, 4437, - 4441, 4444, 4447, 4450, 4453, 4456, 4460, 4464, - 4467, 4477, 4480, 4483, 4488, 4494, 4497, 4512, - 4515, 4519, 4525, 4529, 4533, 4536, 4540, 4547, - 4550, 4553, 4559, 4562, 4566, 4571, 4587, 4589, - 4597, 4599, 4607, 4613, 4615, 4619, 4622, 4625, - 4628, 4632, 4643, 4646, 4658, 4682, 4690, 4692, - 4696, 4699, 4704, 4707, 4709, 4714, 4717, 4723, - 4726, 4734, 4736, 4738, 4740, 4742, 4744, 4746, - 4748, 4750, 4752, 4755, 4758, 4760, 4762, 4764, - 4766, 4769, 4772, 4777, 4781, 4782, 4784, 4786, - 4792, 4797, 4802, 4804, 4807, 4809, 4812, 4816, - 4822, 4825, 4828, 4834, 4836, 4838, 4840, 4843, - 4876, 4878, 4880, 4883, 4886, 4889, 4897, 4905, - 4916, 4924, 4933, 4941, 4950, 4959, 4971, 4978, - 4985, 4993, 5001, 5010, 5016, 5024, 5030, 5038, - 5040, 5043, 5057, 5063, 5071, 5075, 5079, 5081, - 5128, 5130, 5133, 5135, 5140, 5146, 5152, 5157, - 5160, 5164, 5167, 5170, 5172, 5175, 5178, 5181, - 5185, 5190, 5195, 5199, 5201, 5204, 5206, 5210, - 5213, 5216, 5219, 5222, 5226, 5231, 5235, 5237, - 5239, 5242, 5244, 5248, 5251, 5254, 5262, 5266, - 5274, 5290, 5292, 5297, 5299, 5303, 5314, 5318, - 5320, 5323, 5325, 5328, 5333, 5337, 5343, 5349, - 5360, 5365, 5368, 5371, 5374, 5377, 5379, 5383, - 5384, 5387, 5389, 5419, 5421, 5423, 5426, 5430, - 5433, 5437, 5439, 5441, 5443, 5449, 5452, 5455, - 5459, 5461, 5466, 5471, 5478, 5481, 5485, 5489, - 5491, 5494, 5514, 5516, 5518, 5525, 5529, 5531, - 5533, 5535, 5538, 5542, 5546, 5548, 5552, 5555, - 5557, 5562, 5580, 5619, 5625, 5628, 5630, 5632, - 5634, 5637, 5640, 5643, 5646, 5649, 5653, 5656, - 5659, 5662, 5664, 5666, 5669, 5676, 5679, 5681, - 5684, 5687, 5690, 5698, 5700, 5702, 5705, 5707, - 5710, 5712, 5714, 5744, 5747, 5750, 5753, 5756, - 5761, 5765, 5772, 5775, 5784, 5793, 5796, 5800, - 5803, 5806, 5810, 5812, 5816, 5818, 5821, 5823, - 5827, 5831, 5835, 5843, 5845, 5847, 5851, 5855, - 5857, 5870, 5872, 5875, 5878, 5883, 5885, 5888, - 5890, 5892, 5895, 5900, 5902, 5904, 5909, 5911, - 5914, 5918, 5938, 5942, 5946, 5948, 5950, 5958, - 5960, 5967, 5972, 5974, 5978, 5981, 5984, 5987, - 5991, 5994, 5997, 6001, 6011, 6017, 6020, 6023, - 6033, 6053, 6059, 6062, 6064, 6068, 6070, 6073, - 6075, 6079, 6081, 6083, 6087, 6089, 6091, 6097, - 6100, 6105, 6110, 6116, 6126, 6134, 6146, 6153, - 6163, 6169, 6181, 6187, 6205, 6208, 6216, 6222, - 6232, 6239, 6246, 6254, 6262, 6265, 6270, 6290, - 6296, 6299, 6303, 6307, 6311, 6323, 6326, 6331, - 6332, 6338, 6345, 6351, 6354, 6357, 6361, 6365, - 6368, 6371, 6376, 6380, 6386, 6392, 6395, 6399, - 6402, 6405, 6410, 6413, 6416, 6422, 6426, 6429, - 6433, 6436, 6439, 6443, 6447, 6454, 6457, 6460, - 6466, 6469, 6476, 6478, 6480, 6483, 6492, 6497, - 6511, 6515, 6519, 6534, 6540, 6543, 6546, 6548, - 6553, 6559, 6563, 6571, 6577, 6587, 6590, 6593, - 6598, 6602, 6605, 6608, 6611, 6615, 6620, 6624, - 6628, 6631, 6636, 6641, 6644, 6650, 6654, 6660, - 6665, 6669, 6673, 6681, 6684, 6692, 6698, 6708, - 6719, 6722, 6725, 6727, 6731, 6733, 6736, 6747, - 6751, 6754, 6757, 6760, 6763, 6765, 6769, 6773, - 6776, 6780, 6785, 6788, 6798, 6800, 6841, 6847, - 6851, 6854, 6857, 6861, 6864, 6868, 6872, 6877, - 6879, 6883, 6887, 6890, 6893, 6898, 6907, 6911, - 6916, 6921, 6925, 6932, 6936, 6939, 6943, 6946, - 6951, 6954, 6957, 6987, 6991, 6995, 6999, 7003, - 7008, 7012, 7018, 7022, 7030, 7033, 7038, 7042, - 7045, 7050, 7053, 7057, 7060, 7063, 7066, 7069, - 7072, 7076, 7080, 7083, 7093, 7096, 7099, 7104, - 7110, 7113, 7128, 7131, 7135, 7141, 7145, 7149, - 7152, 7156, 7163, 7166, 7169, 7175, 7178, 7182, - 7187, 7203, 7205, 7213, 7215, 7223, 7229, 7231, - 7235, 7238, 7241, 7244, 7248, 7259, 7262, 7274, - 7298, 7306, 7308, 7312, 7315, 7320, 7323, 7325, - 7330, 7333, 7339, 7342, 7407, 7410, 7412, 7414, - 7416, 7418, 7420, 7423, 7428, 7431, 7434, 7436, - 7476, 7478, 7480, 7482, 7487, 7491, 7492, 7494, - 7496, 7503, 7510, 7517, 7519, 7521, 7523, 7526, - 7529, 7535, 7538, 7543, 7550, 7555, 7558, 7562, - 7569, 7601, 7650, 7665, 7678, 7683, 7685, 7689, - 7720, 7726, 7728, 7749, 7769, 7771, 7783, 7794, - 7797, 7800, 7801, 7803, 7805, 7807, 7810, 7812, - 7820, 7822, 7824, 7826, 7836, 7845, 7848, 7852, - 7856, 7859, 7861, 7863, 7865, 7867, 7869, 7879, - 7888, 7891, 7895, 7899, 7902, 7904, 7906, 7908, - 7910, 7912, 7954, 7994, 7996, 8001, 8005, 8006, - 8008, 8010, 8017, 8024, 8031, 8033, 8035, 8037, - 8040, 8043, 8049, 8052, 8057, 8064, 8069, 8072, - 8076, 8083, 8115, 8164, 8179, 8192, 8197, 8199, - 8203, 8234, 8240, 8242, 8263, 8283, -} - -var _hcltok_indicies []int16 = []int16{ - 1, 0, 3, 2, 3, 4, 2, 6, - 8, 8, 7, 5, 9, 9, 7, 5, - 7, 5, 10, 11, 12, 13, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 39, 40, 41, - 42, 43, 11, 11, 14, 14, 38, 0, - 11, 12, 13, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 39, 40, 41, 42, 43, 11, - 11, 14, 14, 38, 0, 44, 45, 11, - 11, 46, 13, 15, 16, 17, 16, 47, - 48, 20, 49, 22, 23, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 37, 39, 63, 41, 64, 65, - 66, 11, 11, 11, 14, 38, 0, 44, - 0, 11, 11, 11, 11, 0, 11, 11, - 11, 0, 11, 0, 11, 11, 0, 0, - 0, 0, 0, 0, 11, 0, 0, 0, - 0, 11, 11, 11, 11, 11, 0, 0, - 11, 0, 0, 11, 0, 11, 0, 0, - 11, 0, 0, 0, 11, 11, 11, 11, - 11, 11, 0, 11, 11, 0, 11, 11, - 0, 0, 0, 0, 0, 0, 11, 11, - 0, 0, 11, 0, 11, 11, 11, 0, - 67, 68, 69, 70, 14, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 96, 97, - 0, 11, 0, 11, 0, 11, 11, 0, - 11, 11, 0, 0, 0, 11, 0, 0, - 0, 0, 0, 0, 0, 11, 0, 0, - 0, 0, 0, 0, 0, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, - 0, 0, 0, 0, 0, 0, 0, 0, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 0, 0, 0, 0, 0, 0, 0, - 0, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 0, 11, 11, 11, 11, 11, - 11, 11, 11, 0, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 0, - 11, 11, 11, 11, 11, 11, 0, 11, - 11, 11, 11, 11, 11, 0, 0, 0, - 0, 0, 0, 0, 0, 11, 11, 11, - 11, 11, 11, 11, 11, 0, 11, 11, - 11, 11, 11, 11, 11, 11, 0, 11, - 11, 11, 11, 11, 0, 0, 0, 0, - 0, 0, 0, 0, 11, 11, 11, 11, - 11, 11, 0, 11, 11, 11, 11, 11, - 11, 11, 0, 11, 0, 11, 11, 0, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 0, 11, 11, - 11, 11, 11, 0, 11, 11, 11, 11, - 11, 11, 11, 0, 11, 11, 11, 0, - 11, 11, 11, 0, 11, 0, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 16, - 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 126, 127, 128, 129, 130, - 131, 132, 14, 15, 133, 134, 135, 136, - 137, 14, 16, 14, 0, 11, 0, 11, - 11, 0, 0, 11, 0, 0, 0, 0, - 11, 0, 0, 0, 0, 0, 11, 0, - 0, 0, 0, 0, 11, 11, 11, 11, - 11, 0, 0, 0, 11, 0, 0, 0, - 11, 11, 11, 0, 0, 0, 11, 11, - 0, 0, 0, 11, 11, 11, 0, 0, - 0, 11, 11, 11, 11, 0, 11, 11, - 11, 11, 0, 0, 0, 0, 0, 11, - 11, 11, 11, 0, 0, 11, 11, 11, - 0, 0, 11, 11, 11, 11, 0, 11, - 11, 0, 11, 11, 0, 0, 0, 11, - 11, 11, 0, 0, 0, 0, 11, 11, - 11, 11, 11, 0, 0, 0, 0, 11, - 0, 11, 11, 0, 11, 11, 0, 11, - 0, 11, 11, 11, 0, 11, 11, 0, - 0, 0, 11, 0, 0, 0, 0, 0, - 0, 0, 11, 11, 11, 11, 0, 11, - 11, 11, 11, 11, 11, 11, 0, 138, - 139, 140, 141, 142, 143, 144, 145, 146, - 14, 147, 148, 149, 150, 151, 0, 11, - 0, 0, 0, 0, 0, 11, 11, 0, - 11, 11, 11, 0, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 0, 11, - 11, 11, 0, 0, 11, 11, 11, 0, - 0, 11, 0, 0, 11, 11, 11, 11, - 11, 0, 0, 0, 0, 11, 11, 11, - 11, 11, 11, 0, 11, 11, 11, 11, - 11, 0, 152, 109, 153, 154, 155, 14, - 156, 157, 16, 14, 0, 11, 11, 11, - 11, 0, 0, 0, 11, 0, 0, 11, - 11, 11, 0, 0, 0, 11, 11, 0, - 119, 0, 16, 14, 14, 158, 0, 14, - 0, 11, 16, 159, 160, 16, 161, 162, - 16, 57, 163, 164, 165, 166, 167, 16, - 168, 169, 170, 16, 171, 172, 173, 15, - 174, 175, 176, 15, 177, 16, 14, 0, - 0, 11, 11, 0, 0, 0, 11, 11, - 11, 11, 0, 11, 11, 0, 0, 0, - 0, 11, 11, 0, 0, 11, 11, 0, - 0, 0, 0, 0, 0, 11, 11, 11, - 0, 0, 0, 11, 0, 0, 0, 11, - 11, 0, 11, 11, 11, 11, 0, 11, - 11, 11, 11, 0, 11, 11, 11, 11, - 11, 11, 0, 0, 0, 11, 11, 11, - 11, 0, 178, 179, 0, 14, 0, 11, - 0, 0, 11, 16, 180, 181, 182, 183, - 57, 184, 185, 55, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 14, 0, 0, - 11, 0, 11, 11, 11, 11, 11, 11, - 11, 0, 11, 11, 11, 0, 11, 0, - 0, 11, 0, 11, 0, 0, 11, 11, - 11, 11, 0, 11, 11, 11, 0, 0, - 11, 11, 11, 11, 0, 11, 11, 0, - 0, 11, 11, 11, 11, 11, 0, 195, - 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 201, 206, 207, 208, 209, 38, - 0, 210, 211, 16, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 16, 14, 221, - 222, 223, 224, 16, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, 235, 236, - 237, 238, 239, 16, 144, 14, 240, 0, - 11, 11, 11, 11, 11, 0, 0, 0, - 11, 0, 11, 11, 0, 11, 0, 11, - 11, 0, 0, 0, 11, 11, 11, 0, - 0, 0, 11, 11, 11, 0, 0, 0, - 0, 11, 0, 0, 11, 0, 0, 11, - 11, 11, 0, 0, 11, 0, 11, 11, - 11, 0, 11, 11, 11, 11, 11, 11, - 0, 0, 0, 11, 11, 0, 11, 11, - 0, 11, 11, 0, 11, 11, 0, 11, - 11, 11, 11, 11, 11, 11, 0, 11, - 0, 11, 0, 11, 11, 0, 11, 0, - 11, 11, 0, 11, 0, 11, 0, 241, - 212, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 98, 251, 16, 252, 253, 254, - 16, 255, 129, 256, 257, 258, 259, 260, - 261, 262, 263, 16, 0, 0, 0, 11, - 11, 11, 0, 11, 11, 0, 11, 11, - 0, 0, 0, 0, 0, 11, 11, 11, - 11, 0, 11, 11, 11, 11, 11, 11, - 0, 0, 0, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 0, 11, 11, 11, - 11, 11, 11, 11, 11, 0, 11, 11, - 0, 0, 0, 0, 11, 11, 11, 0, - 0, 0, 11, 0, 0, 0, 11, 11, - 0, 11, 11, 11, 0, 11, 0, 0, - 0, 11, 11, 0, 11, 11, 11, 0, - 11, 11, 11, 0, 0, 0, 0, 11, - 16, 181, 264, 265, 14, 16, 14, 0, - 0, 11, 0, 11, 16, 264, 14, 0, - 16, 266, 14, 0, 0, 11, 16, 267, - 268, 269, 172, 270, 271, 16, 272, 273, - 274, 14, 0, 0, 11, 11, 11, 0, - 11, 11, 0, 11, 11, 11, 11, 0, - 0, 11, 0, 0, 11, 11, 0, 11, - 0, 16, 14, 0, 275, 16, 276, 0, - 14, 0, 11, 0, 11, 277, 16, 278, - 279, 0, 11, 0, 0, 0, 11, 11, - 11, 11, 0, 280, 281, 282, 16, 283, - 284, 285, 286, 287, 288, 289, 290, 291, - 292, 293, 294, 295, 296, 14, 0, 11, - 11, 11, 0, 0, 0, 0, 11, 11, - 0, 0, 11, 0, 0, 0, 0, 0, - 0, 0, 11, 0, 11, 0, 0, 0, - 0, 0, 0, 11, 11, 11, 11, 11, - 0, 0, 11, 0, 0, 0, 11, 0, - 0, 11, 0, 0, 11, 0, 0, 11, - 0, 0, 0, 11, 11, 11, 0, 0, - 0, 11, 11, 11, 11, 0, 297, 16, - 298, 16, 299, 300, 301, 302, 14, 0, - 11, 11, 11, 11, 11, 0, 0, 0, - 11, 0, 0, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 0, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 0, 11, 11, 11, 11, 11, 0, - 303, 16, 14, 0, 11, 304, 16, 100, - 14, 0, 11, 305, 0, 14, 0, 11, - 16, 306, 14, 0, 0, 11, 307, 0, - 16, 308, 14, 0, 0, 11, 11, 11, - 11, 0, 11, 11, 11, 11, 0, 11, - 11, 11, 11, 11, 0, 0, 11, 0, - 11, 11, 11, 0, 11, 0, 11, 11, - 11, 0, 0, 0, 0, 0, 0, 0, - 11, 11, 11, 0, 11, 0, 0, 0, - 11, 11, 11, 11, 0, 309, 310, 69, - 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, - 327, 328, 329, 331, 332, 333, 334, 335, - 336, 330, 0, 11, 11, 11, 11, 0, - 11, 0, 11, 11, 0, 11, 11, 11, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 11, 11, 11, 11, 11, 0, 11, - 11, 11, 11, 11, 11, 11, 0, 11, - 11, 11, 0, 11, 11, 11, 11, 11, - 11, 11, 0, 11, 11, 11, 0, 11, - 11, 11, 11, 11, 11, 11, 0, 11, - 11, 11, 0, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 0, 11, 0, - 11, 11, 11, 11, 11, 0, 11, 11, - 0, 11, 11, 11, 11, 11, 11, 11, - 0, 11, 11, 11, 0, 11, 11, 11, - 11, 0, 11, 11, 11, 11, 0, 11, - 11, 11, 11, 0, 11, 0, 11, 11, - 0, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 0, - 11, 11, 11, 0, 11, 0, 11, 11, - 0, 11, 0, 337, 338, 339, 101, 102, - 103, 104, 105, 340, 107, 108, 109, 110, - 111, 112, 341, 342, 167, 343, 258, 117, - 344, 119, 229, 269, 122, 345, 346, 347, - 348, 349, 350, 351, 352, 353, 354, 131, - 355, 16, 14, 15, 16, 134, 135, 136, - 137, 14, 14, 0, 11, 11, 0, 11, - 11, 11, 11, 11, 11, 0, 0, 0, - 11, 0, 11, 11, 11, 11, 0, 11, - 11, 11, 0, 11, 11, 0, 11, 11, - 11, 0, 0, 11, 11, 11, 0, 0, - 11, 11, 0, 11, 0, 11, 0, 11, - 11, 11, 0, 0, 11, 11, 0, 11, - 11, 0, 11, 11, 11, 0, 356, 140, - 142, 143, 144, 145, 146, 14, 357, 148, - 358, 150, 359, 0, 11, 11, 0, 0, - 0, 0, 11, 0, 0, 11, 11, 11, - 11, 11, 0, 360, 109, 361, 154, 155, - 14, 156, 157, 16, 14, 0, 11, 11, - 11, 11, 0, 0, 0, 11, 16, 159, - 160, 16, 362, 363, 219, 308, 163, 164, - 165, 364, 167, 365, 366, 367, 368, 369, - 370, 371, 372, 373, 374, 175, 176, 15, - 375, 16, 14, 0, 0, 0, 0, 11, - 11, 11, 0, 0, 0, 0, 0, 11, - 11, 0, 11, 11, 11, 0, 11, 11, - 0, 0, 0, 11, 11, 0, 11, 11, - 11, 11, 0, 11, 0, 11, 11, 11, - 11, 11, 0, 0, 0, 0, 0, 11, - 11, 11, 11, 11, 11, 0, 11, 0, - 16, 180, 181, 376, 183, 57, 184, 185, - 55, 186, 187, 377, 14, 190, 378, 192, - 193, 194, 14, 0, 11, 11, 11, 11, - 11, 11, 11, 0, 11, 11, 0, 11, - 0, 379, 380, 197, 198, 199, 381, 201, - 202, 382, 383, 384, 201, 206, 207, 208, - 209, 38, 0, 210, 211, 16, 212, 213, - 215, 385, 217, 386, 219, 220, 16, 14, - 387, 222, 223, 224, 16, 225, 226, 227, - 228, 229, 230, 231, 232, 388, 234, 235, - 389, 237, 238, 239, 16, 144, 14, 240, - 0, 0, 11, 0, 0, 11, 0, 11, - 11, 11, 11, 11, 0, 11, 11, 0, - 390, 391, 392, 393, 394, 395, 396, 397, - 247, 398, 319, 399, 213, 400, 401, 402, - 403, 404, 401, 405, 406, 407, 258, 408, - 260, 409, 410, 271, 0, 11, 0, 11, - 0, 11, 0, 11, 0, 11, 11, 0, - 11, 0, 11, 11, 11, 0, 11, 11, - 0, 0, 11, 11, 11, 0, 11, 0, - 11, 0, 11, 11, 0, 11, 0, 11, - 0, 11, 0, 11, 0, 11, 0, 0, - 0, 11, 11, 11, 0, 11, 11, 0, - 16, 267, 229, 411, 401, 412, 271, 16, - 413, 414, 274, 14, 0, 11, 0, 11, - 11, 11, 0, 0, 0, 11, 11, 0, - 277, 16, 278, 415, 0, 11, 11, 0, - 16, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 416, 14, 0, 0, 0, - 11, 16, 417, 16, 265, 300, 301, 302, - 14, 0, 0, 11, 419, 419, 419, 419, - 418, 419, 419, 419, 418, 419, 418, 419, - 419, 418, 418, 418, 418, 418, 418, 419, - 418, 418, 418, 418, 419, 419, 419, 419, - 419, 418, 418, 419, 418, 418, 419, 418, - 419, 418, 418, 419, 418, 418, 418, 419, - 419, 419, 419, 419, 419, 418, 419, 419, - 418, 419, 419, 418, 418, 418, 418, 418, - 418, 419, 419, 418, 418, 419, 418, 419, - 419, 419, 418, 421, 422, 423, 424, 425, - 426, 427, 428, 429, 430, 431, 432, 433, - 434, 435, 436, 437, 438, 439, 440, 441, - 442, 443, 444, 445, 446, 447, 448, 449, - 450, 451, 452, 418, 419, 418, 419, 418, - 419, 419, 418, 419, 419, 418, 418, 418, - 419, 418, 418, 418, 418, 418, 418, 418, - 419, 418, 418, 418, 418, 418, 418, 418, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 418, 418, 418, 418, 418, - 418, 418, 418, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 418, 418, 418, 418, - 418, 418, 418, 418, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 418, 419, 419, - 419, 419, 419, 419, 419, 419, 418, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 418, 419, 419, 419, 419, 419, - 419, 418, 419, 419, 419, 419, 419, 419, - 418, 418, 418, 418, 418, 418, 418, 418, - 419, 419, 419, 419, 419, 419, 419, 419, - 418, 419, 419, 419, 419, 419, 419, 419, - 419, 418, 419, 419, 419, 419, 419, 418, - 418, 418, 418, 418, 418, 418, 418, 419, - 419, 419, 419, 419, 419, 418, 419, 419, - 419, 419, 419, 419, 419, 418, 419, 418, - 419, 419, 418, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 418, 419, 419, 419, 419, 419, 418, 419, - 419, 419, 419, 419, 419, 419, 418, 419, - 419, 419, 418, 419, 419, 419, 418, 419, - 418, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, 478, 479, 480, 481, 482, 483, - 484, 485, 486, 487, 488, 425, 489, 490, - 491, 492, 493, 494, 425, 470, 425, 418, - 419, 418, 419, 419, 418, 418, 419, 418, - 418, 418, 418, 419, 418, 418, 418, 418, - 418, 419, 418, 418, 418, 418, 418, 419, - 419, 419, 419, 419, 418, 418, 418, 419, - 418, 418, 418, 419, 419, 419, 418, 418, - 418, 419, 419, 418, 418, 418, 419, 419, - 419, 418, 418, 418, 419, 419, 419, 419, - 418, 419, 419, 419, 419, 418, 418, 418, - 418, 418, 419, 419, 419, 419, 418, 418, - 419, 419, 419, 418, 418, 419, 419, 419, - 419, 418, 419, 419, 418, 419, 419, 418, - 418, 418, 419, 419, 419, 418, 418, 418, - 418, 419, 419, 419, 419, 419, 418, 418, - 418, 418, 419, 418, 419, 419, 418, 419, - 419, 418, 419, 418, 419, 419, 419, 418, - 419, 419, 418, 418, 418, 419, 418, 418, - 418, 418, 418, 418, 418, 419, 419, 419, - 419, 418, 419, 419, 419, 419, 419, 419, - 419, 418, 495, 496, 497, 498, 499, 500, - 501, 502, 503, 425, 504, 505, 506, 507, - 508, 418, 419, 418, 418, 418, 418, 418, - 419, 419, 418, 419, 419, 419, 418, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 418, 419, 419, 419, 418, 418, 419, - 419, 419, 418, 418, 419, 418, 418, 419, - 419, 419, 419, 419, 418, 418, 418, 418, - 419, 419, 419, 419, 419, 419, 418, 419, - 419, 419, 419, 419, 418, 509, 464, 510, - 511, 512, 425, 513, 514, 470, 425, 418, - 419, 419, 419, 419, 418, 418, 418, 419, - 418, 418, 419, 419, 419, 418, 418, 418, - 419, 419, 418, 475, 418, 470, 425, 425, - 515, 418, 425, 418, 419, 470, 516, 517, - 470, 518, 519, 470, 520, 521, 522, 523, - 524, 525, 470, 526, 527, 528, 470, 529, - 530, 531, 489, 532, 533, 534, 489, 535, - 470, 425, 418, 418, 419, 419, 418, 418, - 418, 419, 419, 419, 419, 418, 419, 419, - 418, 418, 418, 418, 419, 419, 418, 418, - 419, 419, 418, 418, 418, 418, 418, 418, - 419, 419, 419, 418, 418, 418, 419, 418, - 418, 418, 419, 419, 418, 419, 419, 419, - 419, 418, 419, 419, 419, 419, 418, 419, - 419, 419, 419, 419, 419, 418, 418, 418, - 419, 419, 419, 419, 418, 536, 537, 418, - 425, 418, 419, 418, 418, 419, 470, 538, - 539, 540, 541, 520, 542, 543, 544, 545, - 546, 547, 548, 549, 550, 551, 552, 553, - 425, 418, 418, 419, 418, 419, 419, 419, - 419, 419, 419, 419, 418, 419, 419, 419, - 418, 419, 418, 418, 419, 418, 419, 418, - 418, 419, 419, 419, 419, 418, 419, 419, - 419, 418, 418, 419, 419, 419, 419, 418, - 419, 419, 418, 418, 419, 419, 419, 419, - 419, 418, 554, 555, 556, 557, 558, 559, - 560, 561, 562, 563, 564, 560, 566, 567, - 568, 569, 565, 418, 570, 571, 470, 572, - 573, 574, 575, 576, 577, 578, 579, 580, - 470, 425, 581, 582, 583, 584, 470, 585, - 586, 587, 588, 589, 590, 591, 592, 593, - 594, 595, 596, 597, 598, 599, 470, 501, - 425, 600, 418, 419, 419, 419, 419, 419, - 418, 418, 418, 419, 418, 419, 419, 418, - 419, 418, 419, 419, 418, 418, 418, 419, - 419, 419, 418, 418, 418, 419, 419, 419, - 418, 418, 418, 418, 419, 418, 418, 419, - 418, 418, 419, 419, 419, 418, 418, 419, - 418, 419, 419, 419, 418, 419, 419, 419, - 419, 419, 419, 418, 418, 418, 419, 419, - 418, 419, 419, 418, 419, 419, 418, 419, - 419, 418, 419, 419, 419, 419, 419, 419, - 419, 418, 419, 418, 419, 418, 419, 419, - 418, 419, 418, 419, 419, 418, 419, 418, - 419, 418, 601, 572, 602, 603, 604, 605, - 606, 607, 608, 609, 610, 453, 611, 470, - 612, 613, 614, 470, 615, 485, 616, 617, - 618, 619, 620, 621, 622, 623, 470, 418, - 418, 418, 419, 419, 419, 418, 419, 419, - 418, 419, 419, 418, 418, 418, 418, 418, - 419, 419, 419, 419, 418, 419, 419, 419, - 419, 419, 419, 418, 418, 418, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 418, - 419, 419, 419, 419, 419, 419, 419, 419, - 418, 419, 419, 418, 418, 418, 418, 419, - 419, 419, 418, 418, 418, 419, 418, 418, - 418, 419, 419, 418, 419, 419, 419, 418, - 419, 418, 418, 418, 419, 419, 418, 419, - 419, 419, 418, 419, 419, 419, 418, 418, - 418, 418, 419, 470, 539, 624, 625, 425, - 470, 425, 418, 418, 419, 418, 419, 470, - 624, 425, 418, 470, 626, 425, 418, 418, - 419, 470, 627, 628, 629, 530, 630, 631, - 470, 632, 633, 634, 425, 418, 418, 419, - 419, 419, 418, 419, 419, 418, 419, 419, - 419, 419, 418, 418, 419, 418, 418, 419, - 419, 418, 419, 418, 470, 425, 418, 635, - 470, 636, 418, 425, 418, 419, 418, 419, - 637, 470, 638, 639, 418, 419, 418, 418, - 418, 419, 419, 419, 419, 418, 640, 641, - 642, 470, 643, 644, 645, 646, 647, 648, - 649, 650, 651, 652, 653, 654, 655, 656, - 425, 418, 419, 419, 419, 418, 418, 418, - 418, 419, 419, 418, 418, 419, 418, 418, - 418, 418, 418, 418, 418, 419, 418, 419, - 418, 418, 418, 418, 418, 418, 419, 419, - 419, 419, 419, 418, 418, 419, 418, 418, - 418, 419, 418, 418, 419, 418, 418, 419, - 418, 418, 419, 418, 418, 418, 419, 419, - 419, 418, 418, 418, 419, 419, 419, 419, - 418, 657, 470, 658, 470, 659, 660, 661, - 662, 425, 418, 419, 419, 419, 419, 419, - 418, 418, 418, 419, 418, 418, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 418, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 418, 419, 419, 419, - 419, 419, 418, 663, 470, 425, 418, 419, - 664, 470, 455, 425, 418, 419, 665, 418, - 425, 418, 419, 470, 666, 425, 418, 418, - 419, 667, 418, 470, 668, 425, 418, 418, - 419, 670, 669, 419, 419, 419, 419, 670, - 669, 419, 670, 669, 670, 670, 419, 670, - 669, 419, 670, 419, 670, 669, 419, 670, - 419, 670, 419, 669, 670, 670, 670, 670, - 670, 670, 670, 670, 669, 419, 419, 670, - 670, 419, 670, 419, 670, 669, 670, 670, - 670, 670, 670, 419, 670, 419, 670, 419, - 670, 669, 670, 670, 419, 670, 419, 670, - 669, 670, 670, 670, 670, 670, 419, 670, - 419, 670, 669, 419, 419, 670, 419, 670, - 669, 670, 670, 670, 419, 670, 419, 670, - 419, 670, 419, 670, 669, 670, 419, 670, - 419, 670, 669, 419, 670, 670, 670, 670, - 419, 670, 419, 670, 419, 670, 419, 670, - 419, 670, 419, 670, 669, 419, 670, 669, - 670, 670, 670, 419, 670, 419, 670, 669, - 670, 419, 670, 419, 670, 669, 419, 670, - 670, 670, 670, 419, 670, 419, 670, 669, - 419, 670, 419, 670, 419, 670, 669, 670, - 670, 419, 670, 419, 670, 669, 419, 670, - 419, 670, 419, 670, 419, 669, 670, 670, - 670, 419, 670, 419, 670, 669, 419, 670, - 669, 670, 670, 419, 670, 669, 670, 670, - 670, 419, 670, 670, 670, 670, 670, 670, - 419, 419, 670, 419, 670, 419, 670, 419, - 670, 669, 670, 419, 670, 419, 670, 669, - 419, 670, 669, 670, 419, 670, 669, 670, - 419, 670, 669, 419, 419, 670, 669, 419, - 670, 419, 670, 419, 670, 419, 670, 419, - 670, 419, 669, 670, 670, 419, 670, 670, - 670, 670, 419, 419, 670, 670, 670, 670, - 670, 419, 670, 670, 670, 670, 670, 669, - 419, 670, 670, 419, 670, 419, 669, 670, - 670, 419, 670, 669, 419, 419, 670, 419, - 669, 670, 670, 669, 419, 670, 419, 669, - 670, 669, 419, 670, 419, 670, 419, 669, - 670, 670, 669, 419, 670, 419, 670, 419, - 670, 669, 670, 419, 670, 419, 670, 669, - 419, 670, 669, 419, 419, 670, 669, 670, - 419, 669, 670, 669, 419, 670, 419, 670, - 419, 669, 670, 669, 419, 419, 670, 669, - 670, 419, 670, 419, 670, 669, 419, 670, - 419, 669, 670, 669, 419, 419, 670, 419, - 669, 670, 669, 419, 419, 670, 669, 670, - 419, 670, 669, 670, 419, 670, 669, 670, - 419, 670, 419, 670, 419, 669, 670, 669, - 419, 419, 670, 669, 670, 419, 670, 419, - 670, 669, 419, 670, 669, 670, 670, 419, - 670, 419, 670, 669, 669, 419, 669, 419, - 670, 670, 419, 670, 670, 670, 670, 670, - 670, 670, 669, 419, 670, 670, 670, 419, - 669, 670, 670, 670, 419, 670, 419, 670, - 419, 670, 419, 670, 419, 670, 669, 419, - 419, 670, 669, 670, 419, 670, 669, 419, - 419, 670, 419, 419, 419, 670, 419, 670, - 419, 670, 419, 670, 419, 669, 419, 670, - 419, 670, 419, 669, 670, 669, 419, 670, - 419, 669, 670, 419, 670, 670, 670, 669, - 419, 670, 419, 419, 670, 419, 669, 670, - 670, 669, 419, 670, 670, 670, 670, 419, - 670, 419, 669, 670, 670, 670, 419, 670, - 669, 670, 419, 670, 419, 670, 419, 670, - 419, 670, 669, 670, 670, 419, 670, 669, - 419, 670, 419, 670, 419, 669, 670, 670, - 669, 419, 670, 419, 669, 670, 669, 419, - 670, 669, 419, 670, 419, 670, 669, 670, - 670, 670, 669, 419, 419, 419, 670, 669, - 419, 670, 419, 669, 670, 669, 419, 670, - 419, 670, 419, 669, 670, 670, 670, 669, - 419, 670, 419, 669, 670, 670, 670, 670, - 669, 419, 670, 419, 670, 669, 419, 419, - 670, 419, 670, 669, 670, 419, 670, 419, - 669, 670, 670, 669, 419, 670, 419, 670, - 669, 419, 670, 670, 670, 419, 670, 419, - 669, 419, 670, 669, 670, 419, 419, 670, - 419, 670, 419, 669, 670, 670, 670, 670, - 669, 419, 670, 419, 670, 419, 670, 419, - 670, 419, 670, 669, 670, 670, 670, 419, - 670, 419, 670, 419, 670, 419, 669, 670, - 670, 419, 419, 670, 669, 670, 419, 670, - 670, 669, 419, 670, 419, 670, 669, 419, - 419, 670, 670, 670, 670, 419, 670, 419, - 670, 419, 669, 670, 670, 419, 669, 670, - 669, 419, 670, 419, 669, 670, 669, 419, - 670, 419, 669, 670, 419, 670, 670, 669, - 419, 670, 670, 419, 669, 670, 669, 419, - 670, 419, 670, 669, 670, 419, 670, 419, - 669, 670, 669, 419, 670, 419, 670, 419, - 670, 419, 670, 419, 670, 669, 671, 669, - 672, 673, 674, 675, 676, 677, 678, 679, - 680, 681, 682, 674, 683, 684, 685, 686, - 687, 674, 688, 689, 690, 691, 692, 693, - 694, 695, 696, 697, 698, 699, 700, 701, - 702, 674, 703, 671, 683, 671, 704, 671, - 669, 670, 670, 670, 670, 419, 669, 670, - 670, 669, 419, 670, 669, 419, 419, 670, - 669, 419, 670, 419, 669, 670, 669, 419, - 419, 670, 419, 669, 670, 670, 669, 419, - 670, 670, 670, 669, 419, 670, 419, 670, - 670, 669, 419, 419, 670, 419, 669, 670, - 669, 419, 670, 669, 419, 419, 670, 419, - 670, 669, 419, 670, 419, 419, 670, 419, - 670, 419, 669, 670, 670, 669, 419, 670, - 670, 419, 670, 669, 419, 670, 419, 670, - 669, 419, 670, 419, 669, 419, 670, 670, - 670, 419, 670, 669, 670, 419, 670, 669, - 419, 670, 669, 670, 419, 670, 669, 419, - 670, 669, 419, 670, 419, 670, 669, 419, - 670, 669, 419, 670, 669, 705, 706, 707, - 708, 709, 710, 711, 712, 713, 714, 715, - 716, 676, 717, 718, 719, 720, 721, 718, - 722, 723, 724, 725, 726, 727, 728, 729, - 730, 671, 669, 670, 419, 670, 669, 670, - 419, 670, 669, 670, 419, 670, 669, 670, - 419, 670, 669, 419, 670, 419, 670, 669, - 670, 419, 670, 669, 670, 419, 419, 419, - 670, 669, 670, 419, 670, 669, 670, 670, - 670, 670, 419, 670, 419, 669, 670, 669, - 419, 419, 670, 419, 670, 669, 670, 419, - 670, 669, 419, 670, 669, 670, 670, 419, - 670, 669, 419, 670, 669, 670, 419, 670, - 669, 419, 670, 669, 419, 670, 669, 419, - 670, 669, 670, 669, 419, 419, 670, 669, - 670, 419, 670, 669, 419, 670, 419, 669, - 670, 669, 419, 674, 731, 671, 674, 732, - 674, 733, 683, 671, 669, 670, 669, 419, - 670, 669, 419, 674, 732, 683, 671, 669, - 674, 734, 671, 683, 671, 669, 670, 669, - 419, 674, 735, 692, 736, 718, 737, 730, - 674, 738, 739, 740, 671, 683, 671, 669, - 670, 669, 419, 670, 419, 670, 669, 419, - 670, 419, 670, 419, 669, 670, 670, 669, - 419, 670, 419, 670, 669, 419, 670, 669, - 674, 683, 425, 669, 741, 674, 742, 683, - 671, 669, 425, 670, 669, 419, 670, 669, - 419, 743, 674, 744, 745, 671, 669, 419, - 670, 669, 670, 670, 669, 419, 419, 670, - 419, 670, 669, 674, 746, 747, 748, 749, - 750, 751, 752, 753, 754, 755, 756, 671, - 683, 671, 669, 670, 419, 670, 670, 670, - 670, 670, 670, 670, 419, 670, 419, 670, - 670, 670, 670, 670, 670, 669, 419, 670, - 670, 419, 670, 419, 669, 670, 419, 670, - 670, 670, 419, 670, 670, 419, 670, 670, - 419, 670, 670, 419, 670, 670, 669, 419, - 674, 757, 674, 733, 758, 759, 760, 671, - 683, 671, 669, 670, 669, 419, 670, 670, - 670, 419, 670, 670, 670, 419, 670, 419, - 670, 669, 419, 419, 419, 419, 670, 670, - 419, 419, 419, 419, 419, 670, 670, 670, - 670, 670, 670, 670, 419, 670, 419, 670, - 419, 669, 670, 670, 670, 419, 670, 419, - 670, 669, 683, 425, 761, 674, 683, 425, - 670, 669, 419, 762, 674, 763, 683, 425, - 670, 669, 419, 670, 419, 764, 683, 671, - 669, 425, 670, 669, 419, 674, 765, 671, - 683, 671, 669, 670, 669, 419, 766, 766, - 766, 768, 769, 770, 766, 767, 767, 771, - 768, 771, 769, 771, 767, 772, 773, 772, - 775, 774, 776, 774, 777, 774, 779, 778, - 781, 782, 780, 781, 783, 780, 785, 784, - 786, 784, 787, 784, 789, 788, 791, 792, - 790, 791, 793, 790, 795, 795, 795, 795, - 794, 795, 795, 795, 794, 795, 794, 795, - 795, 794, 794, 794, 794, 794, 794, 795, - 794, 794, 794, 794, 795, 795, 795, 795, - 795, 794, 794, 795, 794, 794, 795, 794, - 795, 794, 794, 795, 794, 794, 794, 795, - 795, 795, 795, 795, 795, 794, 795, 795, - 794, 795, 795, 794, 794, 794, 794, 794, - 794, 795, 795, 794, 794, 795, 794, 795, - 795, 795, 794, 797, 798, 799, 800, 801, - 802, 803, 804, 805, 806, 807, 808, 809, - 810, 811, 812, 813, 814, 815, 816, 817, - 818, 819, 820, 821, 822, 823, 824, 825, - 826, 827, 828, 794, 795, 794, 795, 794, - 795, 795, 794, 795, 795, 794, 794, 794, - 795, 794, 794, 794, 794, 794, 794, 794, - 795, 794, 794, 794, 794, 794, 794, 794, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 794, 794, 794, 794, 794, - 794, 794, 794, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 794, 794, 794, 794, - 794, 794, 794, 794, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 794, 795, 795, - 795, 795, 795, 795, 795, 795, 794, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 794, 795, 795, 795, 795, 795, - 795, 794, 795, 795, 795, 795, 795, 795, - 794, 794, 794, 794, 794, 794, 794, 794, - 795, 795, 795, 795, 795, 795, 795, 795, - 794, 795, 795, 795, 795, 795, 795, 795, - 795, 794, 795, 795, 795, 795, 795, 794, - 794, 794, 794, 794, 794, 794, 794, 795, - 795, 795, 795, 795, 795, 794, 795, 795, - 795, 795, 795, 795, 795, 794, 795, 794, - 795, 795, 794, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 794, 795, 795, 795, 795, 795, 794, 795, - 795, 795, 795, 795, 795, 795, 794, 795, - 795, 795, 794, 795, 795, 795, 794, 795, - 794, 829, 830, 831, 832, 833, 834, 835, - 836, 837, 838, 839, 840, 841, 842, 843, - 844, 845, 846, 847, 848, 849, 850, 851, - 852, 853, 854, 855, 856, 857, 858, 859, - 860, 861, 862, 863, 864, 801, 865, 866, - 867, 868, 869, 870, 801, 846, 801, 794, - 795, 794, 795, 795, 794, 794, 795, 794, - 794, 794, 794, 795, 794, 794, 794, 794, - 794, 795, 794, 794, 794, 794, 794, 795, - 795, 795, 795, 795, 794, 794, 794, 795, - 794, 794, 794, 795, 795, 795, 794, 794, - 794, 795, 795, 794, 794, 794, 795, 795, - 795, 794, 794, 794, 795, 795, 795, 795, - 794, 795, 795, 795, 795, 794, 794, 794, - 794, 794, 795, 795, 795, 795, 794, 794, - 795, 795, 795, 794, 794, 795, 795, 795, - 795, 794, 795, 795, 794, 795, 795, 794, - 794, 794, 795, 795, 795, 794, 794, 794, - 794, 795, 795, 795, 795, 795, 794, 794, - 794, 794, 795, 794, 795, 795, 794, 795, - 795, 794, 795, 794, 795, 795, 795, 794, - 795, 795, 794, 794, 794, 795, 794, 794, - 794, 794, 794, 794, 794, 795, 795, 795, - 795, 794, 795, 795, 795, 795, 795, 795, - 795, 794, 871, 872, 873, 874, 875, 876, - 877, 878, 879, 801, 880, 881, 882, 883, - 884, 794, 795, 794, 794, 794, 794, 794, - 795, 795, 794, 795, 795, 795, 794, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 794, 795, 795, 795, 794, 794, 795, - 795, 795, 794, 794, 795, 794, 794, 795, - 795, 795, 795, 795, 794, 794, 794, 794, - 795, 795, 795, 795, 795, 795, 794, 795, - 795, 795, 795, 795, 794, 885, 840, 886, - 887, 888, 801, 889, 890, 846, 801, 794, - 795, 795, 795, 795, 794, 794, 794, 795, - 794, 794, 795, 795, 795, 794, 794, 794, - 795, 795, 794, 851, 794, 846, 801, 801, - 891, 794, 801, 794, 795, 846, 892, 893, - 846, 894, 895, 846, 896, 897, 898, 899, - 900, 901, 846, 902, 903, 904, 846, 905, - 906, 907, 865, 908, 909, 910, 865, 911, - 846, 801, 794, 794, 795, 795, 794, 794, - 794, 795, 795, 795, 795, 794, 795, 795, - 794, 794, 794, 794, 795, 795, 794, 794, - 795, 795, 794, 794, 794, 794, 794, 794, - 795, 795, 795, 794, 794, 794, 795, 794, - 794, 794, 795, 795, 794, 795, 795, 795, - 795, 794, 795, 795, 795, 795, 794, 795, - 795, 795, 795, 795, 795, 794, 794, 794, - 795, 795, 795, 795, 794, 912, 913, 794, - 801, 794, 795, 794, 794, 795, 846, 914, - 915, 916, 917, 896, 918, 919, 920, 921, - 922, 923, 924, 925, 926, 927, 928, 929, - 801, 794, 794, 795, 794, 795, 795, 795, - 795, 795, 795, 795, 794, 795, 795, 795, - 794, 795, 794, 794, 795, 794, 795, 794, - 794, 795, 795, 795, 795, 794, 795, 795, - 795, 794, 794, 795, 795, 795, 795, 794, - 795, 795, 794, 794, 795, 795, 795, 795, - 795, 794, 930, 931, 932, 933, 934, 935, - 936, 937, 938, 939, 940, 936, 942, 943, - 944, 945, 941, 794, 946, 947, 846, 948, - 949, 950, 951, 952, 953, 954, 955, 956, - 846, 801, 957, 958, 959, 960, 846, 961, - 962, 963, 964, 965, 966, 967, 968, 969, - 970, 971, 972, 973, 974, 975, 846, 877, - 801, 976, 794, 795, 795, 795, 795, 795, - 794, 794, 794, 795, 794, 795, 795, 794, - 795, 794, 795, 795, 794, 794, 794, 795, - 795, 795, 794, 794, 794, 795, 795, 795, - 794, 794, 794, 794, 795, 794, 794, 795, - 794, 794, 795, 795, 795, 794, 794, 795, - 794, 795, 795, 795, 794, 795, 795, 795, - 795, 795, 795, 794, 794, 794, 795, 795, - 794, 795, 795, 794, 795, 795, 794, 795, - 795, 794, 795, 795, 795, 795, 795, 795, - 795, 794, 795, 794, 795, 794, 795, 795, - 794, 795, 794, 795, 795, 794, 795, 794, - 795, 794, 977, 948, 978, 979, 980, 981, - 982, 983, 984, 985, 986, 829, 987, 846, - 988, 989, 990, 846, 991, 861, 992, 993, - 994, 995, 996, 997, 998, 999, 846, 794, - 794, 794, 795, 795, 795, 794, 795, 795, - 794, 795, 795, 794, 794, 794, 794, 794, - 795, 795, 795, 795, 794, 795, 795, 795, - 795, 795, 795, 794, 794, 794, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 794, - 795, 795, 795, 795, 795, 795, 795, 795, - 794, 795, 795, 794, 794, 794, 794, 795, - 795, 795, 794, 794, 794, 795, 794, 794, - 794, 795, 795, 794, 795, 795, 795, 794, - 795, 794, 794, 794, 795, 795, 794, 795, - 795, 795, 794, 795, 795, 795, 794, 794, - 794, 794, 795, 846, 915, 1000, 1001, 801, - 846, 801, 794, 794, 795, 794, 795, 846, - 1000, 801, 794, 846, 1002, 801, 794, 794, - 795, 846, 1003, 1004, 1005, 906, 1006, 1007, - 846, 1008, 1009, 1010, 801, 794, 794, 795, - 795, 795, 794, 795, 795, 794, 795, 795, - 795, 795, 794, 794, 795, 794, 794, 795, - 795, 794, 795, 794, 846, 801, 794, 1011, - 846, 1012, 794, 801, 794, 795, 794, 795, - 1013, 846, 1014, 1015, 794, 795, 794, 794, - 794, 795, 795, 795, 795, 794, 1016, 1017, - 1018, 846, 1019, 1020, 1021, 1022, 1023, 1024, - 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, - 801, 794, 795, 795, 795, 794, 794, 794, - 794, 795, 795, 794, 794, 795, 794, 794, - 794, 794, 794, 794, 794, 795, 794, 795, - 794, 794, 794, 794, 794, 794, 795, 795, - 795, 795, 795, 794, 794, 795, 794, 794, - 794, 795, 794, 794, 795, 794, 794, 795, - 794, 794, 795, 794, 794, 794, 795, 795, - 795, 794, 794, 794, 795, 795, 795, 795, - 794, 1033, 846, 1034, 846, 1035, 1036, 1037, - 1038, 801, 794, 795, 795, 795, 795, 795, - 794, 794, 794, 795, 794, 794, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 794, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 794, 795, 795, 795, - 795, 795, 794, 1039, 846, 801, 794, 795, - 1040, 846, 831, 801, 794, 795, 1041, 794, - 801, 794, 795, 846, 1042, 801, 794, 794, - 795, 1043, 794, 846, 1044, 801, 794, 794, - 795, 1046, 1045, 795, 795, 795, 795, 1046, - 1045, 795, 1046, 1045, 1046, 1046, 795, 1046, - 1045, 795, 1046, 795, 1046, 1045, 795, 1046, - 795, 1046, 795, 1045, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1045, 795, 795, 1046, - 1046, 795, 1046, 795, 1046, 1045, 1046, 1046, - 1046, 1046, 1046, 795, 1046, 795, 1046, 795, - 1046, 1045, 1046, 1046, 795, 1046, 795, 1046, - 1045, 1046, 1046, 1046, 1046, 1046, 795, 1046, - 795, 1046, 1045, 795, 795, 1046, 795, 1046, - 1045, 1046, 1046, 1046, 795, 1046, 795, 1046, - 795, 1046, 795, 1046, 1045, 1046, 795, 1046, - 795, 1046, 1045, 795, 1046, 1046, 1046, 1046, - 795, 1046, 795, 1046, 795, 1046, 795, 1046, - 795, 1046, 795, 1046, 1045, 795, 1046, 1045, - 1046, 1046, 1046, 795, 1046, 795, 1046, 1045, - 1046, 795, 1046, 795, 1046, 1045, 795, 1046, - 1046, 1046, 1046, 795, 1046, 795, 1046, 1045, - 795, 1046, 795, 1046, 795, 1046, 1045, 1046, - 1046, 795, 1046, 795, 1046, 1045, 795, 1046, - 795, 1046, 795, 1046, 795, 1045, 1046, 1046, - 1046, 795, 1046, 795, 1046, 1045, 795, 1046, - 1045, 1046, 1046, 795, 1046, 1045, 1046, 1046, - 1046, 795, 1046, 1046, 1046, 1046, 1046, 1046, - 795, 795, 1046, 795, 1046, 795, 1046, 795, - 1046, 1045, 1046, 795, 1046, 795, 1046, 1045, - 795, 1046, 1045, 1046, 795, 1046, 1045, 1046, - 795, 1046, 1045, 795, 795, 1046, 1045, 795, - 1046, 795, 1046, 795, 1046, 795, 1046, 795, - 1046, 795, 1045, 1046, 1046, 795, 1046, 1046, - 1046, 1046, 795, 795, 1046, 1046, 1046, 1046, - 1046, 795, 1046, 1046, 1046, 1046, 1046, 1045, - 795, 1046, 1046, 795, 1046, 795, 1045, 1046, - 1046, 795, 1046, 1045, 795, 795, 1046, 795, - 1045, 1046, 1046, 1045, 795, 1046, 795, 1045, - 1046, 1045, 795, 1046, 795, 1046, 795, 1045, - 1046, 1046, 1045, 795, 1046, 795, 1046, 795, - 1046, 1045, 1046, 795, 1046, 795, 1046, 1045, - 795, 1046, 1045, 795, 795, 1046, 1045, 1046, - 795, 1045, 1046, 1045, 795, 1046, 795, 1046, - 795, 1045, 1046, 1045, 795, 795, 1046, 1045, - 1046, 795, 1046, 795, 1046, 1045, 795, 1046, - 795, 1045, 1046, 1045, 795, 795, 1046, 795, - 1045, 1046, 1045, 795, 795, 1046, 1045, 1046, - 795, 1046, 1045, 1046, 795, 1046, 1045, 1046, - 795, 1046, 795, 1046, 795, 1045, 1046, 1045, - 795, 795, 1046, 1045, 1046, 795, 1046, 795, - 1046, 1045, 795, 1046, 1045, 1046, 1046, 795, - 1046, 795, 1046, 1045, 1045, 795, 1045, 795, - 1046, 1046, 795, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1045, 795, 1046, 1046, 1046, 795, - 1045, 1046, 1046, 1046, 795, 1046, 795, 1046, - 795, 1046, 795, 1046, 795, 1046, 1045, 795, - 795, 1046, 1045, 1046, 795, 1046, 1045, 795, - 795, 1046, 795, 795, 795, 1046, 795, 1046, - 795, 1046, 795, 1046, 795, 1045, 795, 1046, - 795, 1046, 795, 1045, 1046, 1045, 795, 1046, - 795, 1045, 1046, 795, 1046, 1046, 1046, 1045, - 795, 1046, 795, 795, 1046, 795, 1045, 1046, - 1046, 1045, 795, 1046, 1046, 1046, 1046, 795, - 1046, 795, 1045, 1046, 1046, 1046, 795, 1046, - 1045, 1046, 795, 1046, 795, 1046, 795, 1046, - 795, 1046, 1045, 1046, 1046, 795, 1046, 1045, - 795, 1046, 795, 1046, 795, 1045, 1046, 1046, - 1045, 795, 1046, 795, 1045, 1046, 1045, 795, - 1046, 1045, 795, 1046, 795, 1046, 1045, 1046, - 1046, 1046, 1045, 795, 795, 795, 1046, 1045, - 795, 1046, 795, 1045, 1046, 1045, 795, 1046, - 795, 1046, 795, 1045, 1046, 1046, 1046, 1045, - 795, 1046, 795, 1045, 1046, 1046, 1046, 1046, - 1045, 795, 1046, 795, 1046, 1045, 795, 795, - 1046, 795, 1046, 1045, 1046, 795, 1046, 795, - 1045, 1046, 1046, 1045, 795, 1046, 795, 1046, - 1045, 795, 1046, 1046, 1046, 795, 1046, 795, - 1045, 795, 1046, 1045, 1046, 795, 795, 1046, - 795, 1046, 795, 1045, 1046, 1046, 1046, 1046, - 1045, 795, 1046, 795, 1046, 795, 1046, 795, - 1046, 795, 1046, 1045, 1046, 1046, 1046, 795, - 1046, 795, 1046, 795, 1046, 795, 1045, 1046, - 1046, 795, 795, 1046, 1045, 1046, 795, 1046, - 1046, 1045, 795, 1046, 795, 1046, 1045, 795, - 795, 1046, 1046, 1046, 1046, 795, 1046, 795, - 1046, 795, 1045, 1046, 1046, 795, 1045, 1046, - 1045, 795, 1046, 795, 1045, 1046, 1045, 795, - 1046, 795, 1045, 1046, 795, 1046, 1046, 1045, - 795, 1046, 1046, 795, 1045, 1046, 1045, 795, - 1046, 795, 1046, 1045, 1046, 795, 1046, 795, - 1045, 1046, 1045, 795, 1046, 795, 1046, 795, - 1046, 795, 1046, 795, 1046, 1045, 1047, 1045, - 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, - 1056, 1057, 1058, 1050, 1059, 1060, 1061, 1062, - 1063, 1050, 1064, 1065, 1066, 1067, 1068, 1069, - 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, - 1078, 1050, 1079, 1047, 1059, 1047, 1080, 1047, - 1045, 1046, 1046, 1046, 1046, 795, 1045, 1046, - 1046, 1045, 795, 1046, 1045, 795, 795, 1046, - 1045, 795, 1046, 795, 1045, 1046, 1045, 795, - 795, 1046, 795, 1045, 1046, 1046, 1045, 795, - 1046, 1046, 1046, 1045, 795, 1046, 795, 1046, - 1046, 1045, 795, 795, 1046, 795, 1045, 1046, - 1045, 795, 1046, 1045, 795, 795, 1046, 795, - 1046, 1045, 795, 1046, 795, 795, 1046, 795, - 1046, 795, 1045, 1046, 1046, 1045, 795, 1046, - 1046, 795, 1046, 1045, 795, 1046, 795, 1046, - 1045, 795, 1046, 795, 1045, 795, 1046, 1046, - 1046, 795, 1046, 1045, 1046, 795, 1046, 1045, - 795, 1046, 1045, 1046, 795, 1046, 1045, 795, - 1046, 1045, 795, 1046, 795, 1046, 1045, 795, - 1046, 1045, 795, 1046, 1045, 1081, 1082, 1083, - 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, - 1092, 1052, 1093, 1094, 1095, 1096, 1097, 1094, - 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, - 1106, 1047, 1045, 1046, 795, 1046, 1045, 1046, - 795, 1046, 1045, 1046, 795, 1046, 1045, 1046, - 795, 1046, 1045, 795, 1046, 795, 1046, 1045, - 1046, 795, 1046, 1045, 1046, 795, 795, 795, - 1046, 1045, 1046, 795, 1046, 1045, 1046, 1046, - 1046, 1046, 795, 1046, 795, 1045, 1046, 1045, - 795, 795, 1046, 795, 1046, 1045, 1046, 795, - 1046, 1045, 795, 1046, 1045, 1046, 1046, 795, - 1046, 1045, 795, 1046, 1045, 1046, 795, 1046, - 1045, 795, 1046, 1045, 795, 1046, 1045, 795, - 1046, 1045, 1046, 1045, 795, 795, 1046, 1045, - 1046, 795, 1046, 1045, 795, 1046, 795, 1045, - 1046, 1045, 795, 1050, 1107, 1047, 1050, 1108, - 1050, 1109, 1059, 1047, 1045, 1046, 1045, 795, - 1046, 1045, 795, 1050, 1108, 1059, 1047, 1045, - 1050, 1110, 1047, 1059, 1047, 1045, 1046, 1045, - 795, 1050, 1111, 1068, 1112, 1094, 1113, 1106, - 1050, 1114, 1115, 1116, 1047, 1059, 1047, 1045, - 1046, 1045, 795, 1046, 795, 1046, 1045, 795, - 1046, 795, 1046, 795, 1045, 1046, 1046, 1045, - 795, 1046, 795, 1046, 1045, 795, 1046, 1045, - 1050, 1059, 801, 1045, 1117, 1050, 1118, 1059, - 1047, 1045, 801, 1046, 1045, 795, 1046, 1045, - 795, 1119, 1050, 1120, 1121, 1047, 1045, 795, - 1046, 1045, 1046, 1046, 1045, 795, 795, 1046, - 795, 1046, 1045, 1050, 1122, 1123, 1124, 1125, - 1126, 1127, 1128, 1129, 1130, 1131, 1132, 1047, - 1059, 1047, 1045, 1046, 795, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 795, 1046, 795, 1046, - 1046, 1046, 1046, 1046, 1046, 1045, 795, 1046, - 1046, 795, 1046, 795, 1045, 1046, 795, 1046, - 1046, 1046, 795, 1046, 1046, 795, 1046, 1046, - 795, 1046, 1046, 795, 1046, 1046, 1045, 795, - 1050, 1133, 1050, 1109, 1134, 1135, 1136, 1047, - 1059, 1047, 1045, 1046, 1045, 795, 1046, 1046, - 1046, 795, 1046, 1046, 1046, 795, 1046, 795, - 1046, 1045, 795, 795, 795, 795, 1046, 1046, - 795, 795, 795, 795, 795, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 795, 1046, 795, 1046, - 795, 1045, 1046, 1046, 1046, 795, 1046, 795, - 1046, 1045, 1059, 801, 1137, 1050, 1059, 801, - 1046, 1045, 795, 1138, 1050, 1139, 1059, 801, - 1046, 1045, 795, 1046, 795, 1140, 1059, 1047, - 1045, 801, 1046, 1045, 795, 1050, 1141, 1047, - 1059, 1047, 1045, 1046, 1045, 795, 1142, 1143, - 1144, 1142, 1145, 1146, 1147, 1149, 1150, 1151, - 1152, 1153, 1154, 670, 670, 419, 1155, 1156, - 1157, 1158, 670, 1161, 1162, 1164, 1165, 1166, - 1160, 1167, 1168, 1169, 1170, 1171, 1172, 1173, - 1174, 1175, 1176, 1177, 1178, 1179, 1180, 1181, - 1182, 1183, 1184, 1185, 1186, 1188, 1189, 1190, - 1191, 1192, 1193, 670, 1148, 7, 1148, 419, - 1148, 419, 1160, 1163, 1187, 1194, 1159, 1142, - 1142, 1195, 1143, 1196, 1198, 1197, 4, 1147, - 1200, 1197, 1201, 1197, 2, 1147, 1197, 6, - 8, 8, 7, 1202, 1203, 1204, 1197, 1205, - 1206, 1197, 1207, 1197, 419, 419, 1209, 1210, - 489, 470, 1211, 470, 1212, 1213, 1214, 1215, - 1216, 1217, 1218, 1219, 1220, 1221, 1222, 544, - 1223, 520, 1224, 1225, 1226, 1227, 1228, 1229, - 1230, 1231, 1232, 1233, 1234, 1235, 419, 419, - 419, 425, 565, 1208, 1236, 1197, 1237, 1197, - 670, 1238, 419, 419, 419, 670, 1238, 670, - 670, 419, 1238, 419, 1238, 419, 1238, 419, - 670, 670, 670, 670, 670, 1238, 419, 670, - 670, 670, 419, 670, 419, 1238, 419, 670, - 670, 670, 670, 419, 1238, 670, 419, 670, - 419, 670, 419, 670, 670, 419, 670, 1238, - 419, 670, 419, 670, 419, 670, 1238, 670, - 419, 1238, 670, 419, 670, 419, 1238, 670, - 670, 670, 670, 670, 1238, 419, 419, 670, - 419, 670, 1238, 670, 419, 1238, 670, 670, - 1238, 419, 419, 670, 419, 670, 419, 670, - 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, - 1246, 1247, 1248, 1249, 715, 1250, 1251, 1252, - 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, - 1261, 1260, 1262, 1263, 1264, 1265, 1266, 671, - 1238, 1267, 1268, 1269, 1270, 1271, 1272, 1273, - 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1281, - 1282, 1283, 1284, 1285, 725, 1286, 1287, 1288, - 692, 1289, 1290, 1291, 1292, 1293, 1294, 671, - 1295, 1296, 1297, 1298, 1299, 1300, 1301, 1302, - 674, 1303, 671, 674, 1304, 1305, 1306, 1307, - 683, 1238, 1308, 1309, 1310, 1311, 703, 1312, - 1313, 683, 1314, 1315, 1316, 1317, 1318, 671, - 1238, 1319, 1278, 1320, 1321, 1322, 683, 1323, - 1324, 674, 671, 683, 425, 1238, 1288, 671, - 674, 683, 425, 683, 425, 1325, 683, 1238, - 425, 674, 1326, 1327, 674, 1328, 1329, 681, - 1330, 1331, 1332, 1333, 1334, 1284, 1335, 1336, - 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, - 1345, 1346, 1303, 1347, 674, 683, 425, 1238, - 1348, 1349, 683, 671, 1238, 425, 671, 1238, - 674, 1350, 731, 1351, 1352, 1353, 1354, 1355, - 1356, 1357, 1358, 671, 1359, 1360, 1361, 1362, - 1363, 1364, 671, 683, 1238, 1366, 1367, 1368, - 1369, 1370, 1371, 1372, 1373, 1374, 1375, 1376, - 1372, 1378, 1379, 1380, 1381, 1365, 1377, 1365, - 1238, 1365, 1238, 1382, 1382, 1383, 1384, 1385, - 1386, 1387, 1388, 1389, 1390, 1387, 767, 1391, - 1391, 1391, 1392, 1391, 1391, 768, 769, 770, - 1391, 767, 1382, 1382, 1393, 1396, 1397, 1395, - 1398, 1399, 1398, 1400, 1391, 1402, 1401, 1396, - 1403, 1395, 1405, 1404, 1394, 1394, 1394, 768, - 769, 770, 1394, 767, 767, 1406, 773, 1406, - 1407, 1406, 775, 1408, 1409, 1410, 1411, 1412, - 1413, 1414, 1411, 776, 775, 1408, 1415, 1415, - 777, 779, 1416, 1415, 776, 1418, 1419, 1417, - 1418, 1419, 1420, 1417, 775, 1408, 1421, 1415, - 775, 1408, 1415, 1423, 1422, 1425, 1424, 776, - 1426, 777, 1426, 779, 1426, 785, 1427, 1428, - 1429, 1430, 1431, 1432, 1433, 1430, 786, 785, - 1427, 1434, 1434, 787, 789, 1435, 1434, 786, - 1437, 1438, 1436, 1437, 1438, 1439, 1436, 785, - 1427, 1440, 1434, 785, 1427, 1434, 1442, 1441, - 1444, 1443, 786, 1445, 787, 1445, 789, 1445, - 795, 1448, 1449, 1451, 1452, 1453, 1447, 1454, - 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, - 1463, 1464, 1465, 1466, 1467, 1468, 1469, 1470, - 1471, 1472, 1473, 1475, 1476, 1477, 1478, 1479, - 1480, 795, 795, 1446, 1447, 1450, 1474, 1481, - 1446, 1046, 795, 795, 1483, 1484, 865, 846, - 1485, 846, 1486, 1487, 1488, 1489, 1490, 1491, - 1492, 1493, 1494, 1495, 1496, 920, 1497, 896, - 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, - 1506, 1507, 1508, 1509, 795, 795, 795, 801, - 941, 1482, 1046, 1510, 795, 795, 795, 1046, - 1510, 1046, 1046, 795, 1510, 795, 1510, 795, - 1510, 795, 1046, 1046, 1046, 1046, 1046, 1510, - 795, 1046, 1046, 1046, 795, 1046, 795, 1510, - 795, 1046, 1046, 1046, 1046, 795, 1510, 1046, - 795, 1046, 795, 1046, 795, 1046, 1046, 795, - 1046, 1510, 795, 1046, 795, 1046, 795, 1046, - 1510, 1046, 795, 1510, 1046, 795, 1046, 795, - 1510, 1046, 1046, 1046, 1046, 1046, 1510, 795, - 795, 1046, 795, 1046, 1510, 1046, 795, 1510, - 1046, 1046, 1510, 795, 795, 1046, 795, 1046, - 795, 1046, 1510, 1511, 1512, 1513, 1514, 1515, - 1516, 1517, 1518, 1519, 1520, 1521, 1091, 1522, - 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, - 1531, 1532, 1533, 1532, 1534, 1535, 1536, 1537, - 1538, 1047, 1510, 1539, 1540, 1541, 1542, 1543, - 1544, 1545, 1546, 1547, 1548, 1549, 1550, 1551, - 1552, 1553, 1554, 1555, 1556, 1557, 1101, 1558, - 1559, 1560, 1068, 1561, 1562, 1563, 1564, 1565, - 1566, 1047, 1567, 1568, 1569, 1570, 1571, 1572, - 1573, 1574, 1050, 1575, 1047, 1050, 1576, 1577, - 1578, 1579, 1059, 1510, 1580, 1581, 1582, 1583, - 1079, 1584, 1585, 1059, 1586, 1587, 1588, 1589, - 1590, 1047, 1510, 1591, 1550, 1592, 1593, 1594, - 1059, 1595, 1596, 1050, 1047, 1059, 801, 1510, - 1560, 1047, 1050, 1059, 801, 1059, 801, 1597, - 1059, 1510, 801, 1050, 1598, 1599, 1050, 1600, - 1601, 1057, 1602, 1603, 1604, 1605, 1606, 1556, - 1607, 1608, 1609, 1610, 1611, 1612, 1613, 1614, - 1615, 1616, 1617, 1618, 1575, 1619, 1050, 1059, - 801, 1510, 1620, 1621, 1059, 1047, 1510, 801, - 1047, 1510, 1050, 1622, 1107, 1623, 1624, 1625, - 1626, 1627, 1628, 1629, 1630, 1047, 1631, 1632, - 1633, 1634, 1635, 1636, 1047, 1059, 1510, 1638, - 1639, 1640, 1641, 1642, 1643, 1644, 1645, 1646, - 1647, 1648, 1644, 1650, 1651, 1652, 1653, 1637, - 1649, 1637, 1510, 1637, 1510, -} - -var _hcltok_trans_targs []int16 = []int16{ - 1459, 1459, 2, 3, 1459, 1459, 4, 1467, - 5, 6, 8, 9, 286, 12, 13, 14, - 15, 16, 287, 288, 19, 289, 21, 22, - 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 328, 348, 353, 127, 128, 129, - 356, 151, 371, 375, 1459, 10, 11, 17, - 18, 20, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 64, 105, 120, 131, - 154, 170, 283, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, - 121, 122, 123, 124, 125, 126, 130, 132, - 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, - 149, 150, 152, 153, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 171, 203, 227, 230, 231, - 233, 242, 243, 246, 250, 268, 275, 277, - 279, 281, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 199, 200, 201, - 202, 204, 205, 206, 207, 208, 209, 210, - 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, - 228, 229, 232, 234, 235, 236, 237, 238, - 239, 240, 241, 244, 245, 247, 248, 249, - 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, - 267, 269, 270, 271, 272, 273, 274, 276, - 278, 280, 282, 284, 285, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, - 327, 329, 330, 331, 332, 333, 334, 335, - 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, 346, 347, 349, 350, 351, 352, - 354, 355, 357, 358, 359, 360, 361, 362, - 363, 364, 365, 366, 367, 368, 369, 370, - 372, 373, 374, 376, 382, 404, 409, 411, - 413, 377, 378, 379, 380, 381, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, - 393, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 405, 406, 407, 408, 410, - 412, 414, 1459, 1471, 1459, 437, 438, 439, - 440, 417, 441, 442, 443, 444, 445, 446, - 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 469, 470, 471, - 472, 473, 474, 475, 476, 477, 478, 479, - 480, 481, 482, 483, 484, 485, 419, 486, - 487, 488, 489, 490, 491, 492, 493, 494, - 495, 496, 497, 498, 499, 500, 501, 502, - 503, 418, 504, 505, 506, 507, 508, 510, - 511, 512, 513, 514, 515, 516, 517, 518, - 519, 520, 521, 522, 523, 525, 526, 527, - 528, 529, 530, 534, 536, 537, 538, 539, - 434, 540, 541, 542, 543, 544, 545, 546, - 547, 548, 549, 550, 551, 552, 553, 554, - 556, 557, 559, 560, 561, 562, 563, 564, - 432, 565, 566, 567, 568, 569, 570, 571, - 572, 573, 575, 607, 631, 634, 635, 637, - 646, 647, 650, 654, 672, 532, 679, 681, - 683, 685, 576, 577, 578, 579, 580, 581, - 582, 583, 584, 585, 586, 587, 588, 589, - 590, 591, 592, 593, 594, 595, 596, 597, - 598, 599, 600, 601, 602, 603, 604, 605, - 606, 608, 609, 610, 611, 612, 613, 614, - 615, 616, 617, 618, 619, 620, 621, 622, - 623, 624, 625, 626, 627, 628, 629, 630, - 632, 633, 636, 638, 639, 640, 641, 642, - 643, 644, 645, 648, 649, 651, 652, 653, - 655, 656, 657, 658, 659, 660, 661, 662, - 663, 664, 665, 666, 667, 668, 669, 670, - 671, 673, 674, 675, 676, 677, 678, 680, - 682, 684, 686, 688, 689, 1459, 1459, 690, - 827, 828, 759, 829, 830, 831, 832, 833, - 834, 788, 835, 724, 836, 837, 838, 839, - 840, 841, 842, 843, 744, 844, 845, 846, - 847, 848, 849, 850, 851, 852, 853, 769, - 854, 856, 857, 858, 859, 860, 861, 862, - 863, 864, 865, 702, 866, 867, 868, 869, - 870, 871, 872, 873, 874, 740, 875, 876, - 877, 878, 879, 810, 881, 882, 885, 887, - 888, 889, 890, 891, 892, 895, 896, 898, - 899, 900, 902, 903, 904, 905, 906, 907, - 908, 909, 910, 911, 912, 914, 915, 916, - 917, 920, 922, 923, 925, 927, 1509, 1510, - 929, 930, 931, 1509, 1509, 932, 1523, 1523, - 1524, 935, 1523, 936, 1525, 1526, 1529, 1530, - 1534, 1534, 1535, 941, 1534, 942, 1536, 1537, - 1540, 1541, 1545, 1546, 1545, 968, 969, 970, - 971, 948, 972, 973, 974, 975, 976, 977, - 978, 979, 980, 981, 982, 983, 984, 985, - 986, 987, 988, 989, 990, 991, 992, 993, - 994, 995, 996, 997, 998, 1000, 1001, 1002, - 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, - 1011, 1012, 1013, 1014, 1015, 1016, 950, 1017, - 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, - 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, - 1034, 949, 1035, 1036, 1037, 1038, 1039, 1041, - 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, - 1050, 1051, 1052, 1053, 1054, 1056, 1057, 1058, - 1059, 1060, 1061, 1065, 1067, 1068, 1069, 1070, - 965, 1071, 1072, 1073, 1074, 1075, 1076, 1077, - 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, - 1087, 1088, 1090, 1091, 1092, 1093, 1094, 1095, - 963, 1096, 1097, 1098, 1099, 1100, 1101, 1102, - 1103, 1104, 1106, 1138, 1162, 1165, 1166, 1168, - 1177, 1178, 1181, 1185, 1203, 1063, 1210, 1212, - 1214, 1216, 1107, 1108, 1109, 1110, 1111, 1112, - 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1120, - 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, - 1129, 1130, 1131, 1132, 1133, 1134, 1135, 1136, - 1137, 1139, 1140, 1141, 1142, 1143, 1144, 1145, - 1146, 1147, 1148, 1149, 1150, 1151, 1152, 1153, - 1154, 1155, 1156, 1157, 1158, 1159, 1160, 1161, - 1163, 1164, 1167, 1169, 1170, 1171, 1172, 1173, - 1174, 1175, 1176, 1179, 1180, 1182, 1183, 1184, - 1186, 1187, 1188, 1189, 1190, 1191, 1192, 1193, - 1194, 1195, 1196, 1197, 1198, 1199, 1200, 1201, - 1202, 1204, 1205, 1206, 1207, 1208, 1209, 1211, - 1213, 1215, 1217, 1219, 1220, 1545, 1545, 1221, - 1358, 1359, 1290, 1360, 1361, 1362, 1363, 1364, - 1365, 1319, 1366, 1255, 1367, 1368, 1369, 1370, - 1371, 1372, 1373, 1374, 1275, 1375, 1376, 1377, - 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1300, - 1385, 1387, 1388, 1389, 1390, 1391, 1392, 1393, - 1394, 1395, 1396, 1233, 1397, 1398, 1399, 1400, - 1401, 1402, 1403, 1404, 1405, 1271, 1406, 1407, - 1408, 1409, 1410, 1341, 1412, 1413, 1416, 1418, - 1419, 1420, 1421, 1422, 1423, 1426, 1427, 1429, - 1430, 1431, 1433, 1434, 1435, 1436, 1437, 1438, - 1439, 1440, 1441, 1442, 1443, 1445, 1446, 1447, - 1448, 1451, 1453, 1454, 1456, 1458, 1460, 1459, - 1461, 1462, 1459, 1463, 1459, 1464, 1465, 1466, - 1468, 1469, 1470, 1459, 1472, 1459, 1473, 1459, - 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, - 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, - 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, - 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, - 1506, 1507, 1508, 1459, 1459, 1459, 1459, 1459, - 1459, 1, 1459, 7, 1459, 1459, 1459, 1459, - 1459, 415, 416, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 433, - 435, 436, 468, 509, 524, 531, 533, 535, - 555, 558, 574, 687, 1459, 1459, 1459, 691, - 692, 693, 694, 695, 696, 697, 698, 699, - 700, 701, 703, 704, 705, 706, 707, 708, - 709, 710, 711, 712, 713, 714, 715, 716, - 717, 718, 719, 720, 721, 722, 723, 725, - 726, 727, 728, 729, 730, 731, 732, 733, - 734, 735, 736, 737, 738, 739, 741, 742, - 743, 745, 746, 747, 748, 749, 750, 751, - 752, 753, 754, 755, 756, 757, 758, 760, - 761, 762, 763, 764, 765, 766, 767, 768, - 770, 771, 772, 773, 774, 775, 776, 777, - 778, 779, 780, 781, 782, 783, 784, 785, - 786, 787, 789, 790, 791, 792, 793, 794, - 795, 796, 797, 798, 799, 800, 801, 802, - 803, 804, 805, 806, 807, 808, 809, 811, - 812, 813, 814, 815, 816, 817, 818, 819, - 820, 821, 822, 823, 824, 825, 826, 855, - 880, 883, 884, 886, 893, 894, 897, 901, - 913, 918, 919, 921, 924, 926, 1511, 1509, - 1512, 1517, 1519, 1509, 1520, 1521, 1522, 1509, - 928, 1509, 1509, 1513, 1514, 1516, 1509, 1515, - 1509, 1509, 1509, 1518, 1509, 1509, 1509, 933, - 934, 938, 939, 1523, 1531, 1532, 1533, 1523, - 937, 1523, 1523, 934, 1527, 1528, 1523, 1523, - 1523, 1523, 1523, 940, 944, 945, 1534, 1542, - 1543, 1544, 1534, 943, 1534, 1534, 940, 1538, - 1539, 1534, 1534, 1534, 1534, 1534, 1545, 1547, - 1548, 1549, 1550, 1551, 1552, 1553, 1554, 1555, - 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, - 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, - 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, - 1580, 1581, 1545, 946, 947, 951, 952, 953, - 954, 955, 956, 957, 958, 959, 960, 961, - 962, 964, 966, 967, 999, 1040, 1055, 1062, - 1064, 1066, 1086, 1089, 1105, 1218, 1545, 1222, - 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, - 1231, 1232, 1234, 1235, 1236, 1237, 1238, 1239, - 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, - 1248, 1249, 1250, 1251, 1252, 1253, 1254, 1256, - 1257, 1258, 1259, 1260, 1261, 1262, 1263, 1264, - 1265, 1266, 1267, 1268, 1269, 1270, 1272, 1273, - 1274, 1276, 1277, 1278, 1279, 1280, 1281, 1282, - 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1291, - 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, - 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, - 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, - 1317, 1318, 1320, 1321, 1322, 1323, 1324, 1325, - 1326, 1327, 1328, 1329, 1330, 1331, 1332, 1333, - 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1342, - 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, - 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1386, - 1411, 1414, 1415, 1417, 1424, 1425, 1428, 1432, - 1444, 1449, 1450, 1452, 1455, 1457, -} - -var _hcltok_trans_actions []byte = []byte{ - 145, 107, 0, 0, 91, 141, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 121, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 143, 193, 149, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 147, 125, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 31, 169, - 0, 0, 0, 35, 33, 0, 55, 41, - 175, 0, 53, 0, 175, 175, 0, 0, - 75, 61, 181, 0, 73, 0, 181, 181, - 0, 0, 85, 187, 89, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 87, 79, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 93, - 0, 0, 119, 0, 111, 0, 7, 7, - 7, 0, 0, 113, 0, 115, 0, 123, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 7, - 7, 196, 196, 196, 196, 196, 196, 7, - 7, 196, 7, 127, 139, 135, 97, 133, - 103, 0, 129, 0, 101, 95, 109, 99, - 131, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 105, 117, 137, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 13, - 0, 0, 172, 17, 0, 7, 7, 23, - 0, 25, 27, 0, 0, 0, 151, 0, - 15, 19, 9, 0, 21, 11, 29, 0, - 0, 0, 0, 43, 0, 178, 178, 49, - 0, 157, 154, 1, 175, 175, 45, 37, - 47, 39, 51, 0, 0, 0, 63, 0, - 184, 184, 69, 0, 163, 160, 1, 181, - 181, 65, 57, 67, 59, 71, 77, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 7, - 190, 190, 190, 190, 190, 190, 7, 7, - 190, 7, 81, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 83, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -} - -var _hcltok_to_state_actions []byte = []byte{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 166, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 166, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -} - -var _hcltok_from_state_actions []byte = []byte{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 5, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 5, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 5, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 5, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -} - -var _hcltok_eof_trans []int16 = []int16{ - 0, 1, 1, 1, 6, 6, 6, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 419, - 419, 421, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 419, 419, 419, 419, 419, 419, - 419, 419, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 670, 670, 670, 670, 670, 670, 670, 670, - 767, 772, 772, 772, 773, 773, 775, 775, - 775, 779, 0, 0, 785, 785, 785, 789, - 0, 0, 795, 795, 797, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 795, 795, 795, - 795, 795, 795, 795, 795, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, - 1046, 1046, 1046, 0, 1196, 1197, 1198, 1200, - 1198, 1198, 1198, 1203, 1198, 1198, 1198, 1209, - 1198, 1198, 1239, 1239, 1239, 1239, 1239, 1239, - 1239, 1239, 1239, 1239, 1239, 1239, 1239, 1239, - 1239, 1239, 1239, 1239, 1239, 1239, 1239, 1239, - 1239, 1239, 1239, 1239, 1239, 1239, 1239, 1239, - 1239, 1239, 1239, 1239, 1239, 0, 1392, 1394, - 1395, 1399, 1399, 1392, 1402, 1395, 1405, 1395, - 1407, 1407, 1407, 0, 1416, 1418, 1418, 1416, - 1416, 1423, 1425, 1427, 1427, 1427, 0, 1435, - 1437, 1437, 1435, 1435, 1442, 1444, 1446, 1446, - 1446, 0, 1483, 1511, 1511, 1511, 1511, 1511, - 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - 1511, 1511, 1511, 1511, 1511, 1511, 1511, 1511, - 1511, 1511, 1511, 1511, 1511, 1511, -} - -const hcltok_start int = 1459 -const hcltok_first_final int = 1459 -const hcltok_error int = 0 - -const hcltok_en_stringTemplate int = 1509 -const hcltok_en_heredocTemplate int = 1523 -const hcltok_en_bareTemplate int = 1534 -const hcltok_en_identOnly int = 1545 -const hcltok_en_main int = 1459 - -//line scan_tokens.rl:16 - -func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []Token { - stripData := stripUTF8BOM(data) - start.Byte += len(data) - len(stripData) - data = stripData - - f := &tokenAccum{ - Filename: filename, - Bytes: data, - Pos: start, - StartByte: start.Byte, - } - -//line scan_tokens.rl:305 - - // Ragel state - p := 0 // "Pointer" into data - pe := len(data) // End-of-data "pointer" - ts := 0 - te := 0 - act := 0 - eof := pe - var stack []int - var top int - - var cs int // current state - switch mode { - case scanNormal: - cs = hcltok_en_main - case scanTemplate: - cs = hcltok_en_bareTemplate - case scanIdentOnly: - cs = hcltok_en_identOnly - default: - panic("invalid scanMode") - } - - braces := 0 - var retBraces []int // stack of brace levels that cause us to use fret - var heredocs []heredocInProgress // stack of heredocs we're currently processing - -//line scan_tokens.rl:340 - - // Make Go compiler happy - _ = ts - _ = te - _ = act - _ = eof - - token := func(ty TokenType) { - f.emitToken(ty, ts, te) - } - selfToken := func() { - b := data[ts:te] - if len(b) != 1 { - // should never happen - panic("selfToken only works for single-character tokens") - } - f.emitToken(TokenType(b[0]), ts, te) - } - -//line scan_tokens.go:4289 - { - top = 0 - ts = 0 - te = 0 - act = 0 - } - -//line scan_tokens.go:4297 - { - var _klen int - var _trans int - var _acts int - var _nacts uint - var _keys int - if p == pe { - goto _test_eof - } - if cs == 0 { - goto _out - } - _resume: - _acts = int(_hcltok_from_state_actions[cs]) - _nacts = uint(_hcltok_actions[_acts]) - _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _hcltok_actions[_acts-1] { - case 3: -//line NONE:1 - ts = p - -//line scan_tokens.go:4320 - } - } - - _keys = int(_hcltok_key_offsets[cs]) - _trans = int(_hcltok_index_offsets[cs]) - - _klen = int(_hcltok_single_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + _klen - 1) - for { - if _upper < _lower { - break - } - - _mid = _lower + ((_upper - _lower) >> 1) - switch { - case data[p] < _hcltok_trans_keys[_mid]: - _upper = _mid - 1 - case data[p] > _hcltok_trans_keys[_mid]: - _lower = _mid + 1 - default: - _trans += int(_mid - int(_keys)) - goto _match - } - } - _keys += _klen - _trans += _klen - } - - _klen = int(_hcltok_range_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + (_klen << 1) - 2) - for { - if _upper < _lower { - break - } - - _mid = _lower + (((_upper - _lower) >> 1) & ^1) - switch { - case data[p] < _hcltok_trans_keys[_mid]: - _upper = _mid - 2 - case data[p] > _hcltok_trans_keys[_mid+1]: - _lower = _mid + 2 - default: - _trans += int((_mid - int(_keys)) >> 1) - goto _match - } - } - _trans += _klen - } - - _match: - _trans = int(_hcltok_indicies[_trans]) - _eof_trans: - cs = int(_hcltok_trans_targs[_trans]) - - if _hcltok_trans_actions[_trans] == 0 { - goto _again - } - - _acts = int(_hcltok_trans_actions[_trans]) - _nacts = uint(_hcltok_actions[_acts]) - _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _hcltok_actions[_acts-1] { - case 0: -//line scan_tokens.rl:224 - p-- - - case 4: -//line NONE:1 - te = p + 1 - - case 5: -//line scan_tokens.rl:248 - act = 4 - case 6: -//line scan_tokens.rl:250 - act = 6 - case 7: -//line scan_tokens.rl:160 - te = p + 1 - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 8: -//line scan_tokens.rl:170 - te = p + 1 - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 9: -//line scan_tokens.rl:84 - te = p + 1 - { - token(TokenCQuote) - top-- - cs = stack[top] - { - stack = stack[:len(stack)-1] - } - goto _again - - } - case 10: -//line scan_tokens.rl:248 - te = p + 1 - { - token(TokenQuotedLit) - } - case 11: -//line scan_tokens.rl:251 - te = p + 1 - { - token(TokenBadUTF8) - } - case 12: -//line scan_tokens.rl:160 - te = p - p-- - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 13: -//line scan_tokens.rl:170 - te = p - p-- - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 14: -//line scan_tokens.rl:248 - te = p - p-- - { - token(TokenQuotedLit) - } - case 15: -//line scan_tokens.rl:249 - te = p - p-- - { - token(TokenQuotedNewline) - } - case 16: -//line scan_tokens.rl:250 - te = p - p-- - { - token(TokenInvalid) - } - case 17: -//line scan_tokens.rl:251 - te = p - p-- - { - token(TokenBadUTF8) - } - case 18: -//line scan_tokens.rl:248 - p = (te) - 1 - { - token(TokenQuotedLit) - } - case 19: -//line scan_tokens.rl:251 - p = (te) - 1 - { - token(TokenBadUTF8) - } - case 20: -//line NONE:1 - switch act { - case 4: - { - p = (te) - 1 - token(TokenQuotedLit) - } - case 6: - { - p = (te) - 1 - token(TokenInvalid) - } - } - - case 21: -//line scan_tokens.rl:148 - act = 11 - case 22: -//line scan_tokens.rl:259 - act = 12 - case 23: -//line scan_tokens.rl:160 - te = p + 1 - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 24: -//line scan_tokens.rl:170 - te = p + 1 - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 25: -//line scan_tokens.rl:111 - te = p + 1 - { - // This action is called specificially when a heredoc literal - // ends with a newline character. - - // This might actually be our end marker. - topdoc := &heredocs[len(heredocs)-1] - if topdoc.StartOfLine { - maybeMarker := bytes.TrimSpace(data[ts:te]) - if bytes.Equal(maybeMarker, topdoc.Marker) { - // We actually emit two tokens here: the end-of-heredoc - // marker first, and then separately the newline that - // follows it. This then avoids issues with the closing - // marker consuming a newline that would normally be used - // to mark the end of an attribute definition. - // We might have either a \n sequence or an \r\n sequence - // here, so we must handle both. - nls := te - 1 - nle := te - te-- - if data[te-1] == '\r' { - // back up one more byte - nls-- - te-- - } - token(TokenCHeredoc) - ts = nls - te = nle - token(TokenNewline) - heredocs = heredocs[:len(heredocs)-1] - top-- - cs = stack[top] - { - stack = stack[:len(stack)-1] - } - goto _again - - } - } - - topdoc.StartOfLine = true - token(TokenStringLit) - } - case 26: -//line scan_tokens.rl:259 - te = p + 1 - { - token(TokenBadUTF8) - } - case 27: -//line scan_tokens.rl:160 - te = p - p-- - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 28: -//line scan_tokens.rl:170 - te = p - p-- - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 29: -//line scan_tokens.rl:148 - te = p - p-- - { - // This action is called when a heredoc literal _doesn't_ end - // with a newline character, e.g. because we're about to enter - // an interpolation sequence. - heredocs[len(heredocs)-1].StartOfLine = false - token(TokenStringLit) - } - case 30: -//line scan_tokens.rl:259 - te = p - p-- - { - token(TokenBadUTF8) - } - case 31: -//line scan_tokens.rl:148 - p = (te) - 1 - { - // This action is called when a heredoc literal _doesn't_ end - // with a newline character, e.g. because we're about to enter - // an interpolation sequence. - heredocs[len(heredocs)-1].StartOfLine = false - token(TokenStringLit) - } - case 32: -//line NONE:1 - switch act { - case 0: - { - cs = 0 - goto _again - } - case 11: - { - p = (te) - 1 - - // This action is called when a heredoc literal _doesn't_ end - // with a newline character, e.g. because we're about to enter - // an interpolation sequence. - heredocs[len(heredocs)-1].StartOfLine = false - token(TokenStringLit) - } - case 12: - { - p = (te) - 1 - token(TokenBadUTF8) - } - } - - case 33: -//line scan_tokens.rl:156 - act = 15 - case 34: -//line scan_tokens.rl:266 - act = 16 - case 35: -//line scan_tokens.rl:160 - te = p + 1 - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 36: -//line scan_tokens.rl:170 - te = p + 1 - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 37: -//line scan_tokens.rl:156 - te = p + 1 - { - token(TokenStringLit) - } - case 38: -//line scan_tokens.rl:266 - te = p + 1 - { - token(TokenBadUTF8) - } - case 39: -//line scan_tokens.rl:160 - te = p - p-- - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 40: -//line scan_tokens.rl:170 - te = p - p-- - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1459 - goto _again - } - } - case 41: -//line scan_tokens.rl:156 - te = p - p-- - { - token(TokenStringLit) - } - case 42: -//line scan_tokens.rl:266 - te = p - p-- - { - token(TokenBadUTF8) - } - case 43: -//line scan_tokens.rl:156 - p = (te) - 1 - { - token(TokenStringLit) - } - case 44: -//line NONE:1 - switch act { - case 0: - { - cs = 0 - goto _again - } - case 15: - { - p = (te) - 1 - - token(TokenStringLit) - } - case 16: - { - p = (te) - 1 - token(TokenBadUTF8) - } - } - - case 45: -//line scan_tokens.rl:270 - act = 17 - case 46: -//line scan_tokens.rl:271 - act = 18 - case 47: -//line scan_tokens.rl:271 - te = p + 1 - { - token(TokenBadUTF8) - } - case 48: -//line scan_tokens.rl:272 - te = p + 1 - { - token(TokenInvalid) - } - case 49: -//line scan_tokens.rl:270 - te = p - p-- - { - token(TokenIdent) - } - case 50: -//line scan_tokens.rl:271 - te = p - p-- - { - token(TokenBadUTF8) - } - case 51: -//line scan_tokens.rl:270 - p = (te) - 1 - { - token(TokenIdent) - } - case 52: -//line scan_tokens.rl:271 - p = (te) - 1 - { - token(TokenBadUTF8) - } - case 53: -//line NONE:1 - switch act { - case 17: - { - p = (te) - 1 - token(TokenIdent) - } - case 18: - { - p = (te) - 1 - token(TokenBadUTF8) - } - } - - case 54: -//line scan_tokens.rl:278 - act = 22 - case 55: -//line scan_tokens.rl:301 - act = 39 - case 56: -//line scan_tokens.rl:280 - te = p + 1 - { - token(TokenComment) - } - case 57: -//line scan_tokens.rl:281 - te = p + 1 - { - token(TokenNewline) - } - case 58: -//line scan_tokens.rl:283 - te = p + 1 - { - token(TokenEqualOp) - } - case 59: -//line scan_tokens.rl:284 - te = p + 1 - { - token(TokenNotEqual) - } - case 60: -//line scan_tokens.rl:285 - te = p + 1 - { - token(TokenGreaterThanEq) - } - case 61: -//line scan_tokens.rl:286 - te = p + 1 - { - token(TokenLessThanEq) - } - case 62: -//line scan_tokens.rl:287 - te = p + 1 - { - token(TokenAnd) - } - case 63: -//line scan_tokens.rl:288 - te = p + 1 - { - token(TokenOr) - } - case 64: -//line scan_tokens.rl:289 - te = p + 1 - { - token(TokenEllipsis) - } - case 65: -//line scan_tokens.rl:290 - te = p + 1 - { - token(TokenFatArrow) - } - case 66: -//line scan_tokens.rl:291 - te = p + 1 - { - selfToken() - } - case 67: -//line scan_tokens.rl:180 - te = p + 1 - { - token(TokenOBrace) - braces++ - } - case 68: -//line scan_tokens.rl:185 - te = p + 1 - { - if len(retBraces) > 0 && retBraces[len(retBraces)-1] == braces { - token(TokenTemplateSeqEnd) - braces-- - retBraces = retBraces[0 : len(retBraces)-1] - top-- - cs = stack[top] - { - stack = stack[:len(stack)-1] - } - goto _again - - } else { - token(TokenCBrace) - braces-- - } - } - case 69: -//line scan_tokens.rl:197 - te = p + 1 - { - // Only consume from the retBraces stack and return if we are at - // a suitable brace nesting level, otherwise things will get - // confused. (Not entering this branch indicates a syntax error, - // which we will catch in the parser.) - if len(retBraces) > 0 && retBraces[len(retBraces)-1] == braces { - token(TokenTemplateSeqEnd) - braces-- - retBraces = retBraces[0 : len(retBraces)-1] - top-- - cs = stack[top] - { - stack = stack[:len(stack)-1] - } - goto _again - - } else { - // We intentionally generate a TokenTemplateSeqEnd here, - // even though the user apparently wanted a brace, because - // we want to allow the parser to catch the incorrect use - // of a ~} to balance a generic opening brace, rather than - // a template sequence. - token(TokenTemplateSeqEnd) - braces-- - } - } - case 70: -//line scan_tokens.rl:79 - te = p + 1 - { - token(TokenOQuote) - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1509 - goto _again - } - } - case 71: -//line scan_tokens.rl:89 - te = p + 1 - { - token(TokenOHeredoc) - // the token is currently the whole heredoc introducer, like - // < 0; _nacts-- { - _acts++ - switch _hcltok_actions[_acts-1] { - case 1: -//line NONE:1 - ts = 0 - - case 2: -//line NONE:1 - act = 0 - -//line scan_tokens.go:5073 - } - } - - if cs == 0 { - goto _out - } - p++ - if p != pe { - goto _resume - } - _test_eof: - { - } - if p == eof { - if _hcltok_eof_trans[cs] > 0 { - _trans = int(_hcltok_eof_trans[cs] - 1) - goto _eof_trans - } - } - - _out: - { - } - } - -//line scan_tokens.rl:363 - - // If we fall out here without being in a final state then we've - // encountered something that the scanner can't match, which we'll - // deal with as an invalid. - if cs < hcltok_first_final { - if mode == scanTemplate && len(stack) == 0 { - // If we're scanning a bare template then any straggling - // top-level stuff is actually literal string, rather than - // invalid. This handles the case where the template ends - // with a single "$" or "%", which trips us up because we - // want to see another character to decide if it's a sequence - // or an escape. - f.emitToken(TokenStringLit, ts, len(data)) - } else { - f.emitToken(TokenInvalid, ts, len(data)) - } - } - - // We always emit a synthetic EOF token at the end, since it gives the - // parser position information for an "unexpected EOF" diagnostic. - f.emitToken(TokenEOF, len(data), len(data)) - - return f.Tokens -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_tokens.rl b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_tokens.rl deleted file mode 100644 index 942ad92ba..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/scan_tokens.rl +++ /dev/null @@ -1,395 +0,0 @@ - -package hclsyntax - -import ( - "bytes" - - "github.com/hashicorp/hcl/v2" -) - -// This file is generated from scan_tokens.rl. DO NOT EDIT. -%%{ - # (except when you are actually in scan_tokens.rl here, so edit away!) - - machine hcltok; - write data; -}%% - -func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []Token { - stripData := stripUTF8BOM(data) - start.Byte += len(data) - len(stripData) - data = stripData - - f := &tokenAccum{ - Filename: filename, - Bytes: data, - Pos: start, - StartByte: start.Byte, - } - - %%{ - include UnicodeDerived "unicode_derived.rl"; - - UTF8Cont = 0x80 .. 0xBF; - AnyUTF8 = ( - 0x00..0x7F | - 0xC0..0xDF . UTF8Cont | - 0xE0..0xEF . UTF8Cont . UTF8Cont | - 0xF0..0xF7 . UTF8Cont . UTF8Cont . UTF8Cont - ); - BrokenUTF8 = any - AnyUTF8; - - NumberLitContinue = (digit|'.'|('e'|'E') ('+'|'-')? digit); - NumberLit = digit ("" | (NumberLitContinue - '.') | (NumberLitContinue* (NumberLitContinue - '.'))); - Ident = (ID_Start | '_') (ID_Continue | '-')*; - - # Symbols that just represent themselves are handled as a single rule. - SelfToken = "[" | "]" | "(" | ")" | "." | "," | "*" | "/" | "%" | "+" | "-" | "=" | "<" | ">" | "!" | "?" | ":" | "\n" | "&" | "|" | "~" | "^" | ";" | "`" | "'"; - - EqualOp = "=="; - NotEqual = "!="; - GreaterThanEqual = ">="; - LessThanEqual = "<="; - LogicalAnd = "&&"; - LogicalOr = "||"; - - Ellipsis = "..."; - FatArrow = "=>"; - - Newline = '\r' ? '\n'; - EndOfLine = Newline; - - BeginStringTmpl = '"'; - BeginHeredocTmpl = '<<' ('-')? Ident Newline; - - Comment = ( - # The :>> operator in these is a "finish-guarded concatenation", - # which terminates the sequence on its left when it completes - # the sequence on its right. - # In the single-line comment cases this is allowing us to make - # the trailing EndOfLine optional while still having the overall - # pattern terminate. In the multi-line case it ensures that - # the first comment in the file ends at the first */, rather than - # gobbling up all of the "any*" until the _final_ */ in the file. - ("#" (any - EndOfLine)* :>> EndOfLine?) | - ("//" (any - EndOfLine)* :>> EndOfLine?) | - ("/*" any* :>> "*/") - ); - - # Note: hclwrite assumes that only ASCII spaces appear between tokens, - # and uses this assumption to recreate the spaces between tokens by - # looking at byte offset differences. This means it will produce - # incorrect results in the presence of tabs, but that's acceptable - # because the canonical style (which hclwrite itself can impose - # automatically is to never use tabs). - Spaces = (' ' | 0x09)+; - - action beginStringTemplate { - token(TokenOQuote); - fcall stringTemplate; - } - - action endStringTemplate { - token(TokenCQuote); - fret; - } - - action beginHeredocTemplate { - token(TokenOHeredoc); - // the token is currently the whole heredoc introducer, like - // < 0 { - heredocs[len(heredocs)-1].StartOfLine = false; - } - fcall main; - } - - action beginTemplateControl { - token(TokenTemplateControl); - braces++; - retBraces = append(retBraces, braces); - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false; - } - fcall main; - } - - action openBrace { - token(TokenOBrace); - braces++; - } - - action closeBrace { - if len(retBraces) > 0 && retBraces[len(retBraces)-1] == braces { - token(TokenTemplateSeqEnd); - braces--; - retBraces = retBraces[0:len(retBraces)-1] - fret; - } else { - token(TokenCBrace); - braces--; - } - } - - action closeTemplateSeqEatWhitespace { - // Only consume from the retBraces stack and return if we are at - // a suitable brace nesting level, otherwise things will get - // confused. (Not entering this branch indicates a syntax error, - // which we will catch in the parser.) - if len(retBraces) > 0 && retBraces[len(retBraces)-1] == braces { - token(TokenTemplateSeqEnd); - braces--; - retBraces = retBraces[0:len(retBraces)-1] - fret; - } else { - // We intentionally generate a TokenTemplateSeqEnd here, - // even though the user apparently wanted a brace, because - // we want to allow the parser to catch the incorrect use - // of a ~} to balance a generic opening brace, rather than - // a template sequence. - token(TokenTemplateSeqEnd); - braces--; - } - } - - TemplateInterp = "${" ("~")?; - TemplateControl = "%{" ("~")?; - EndStringTmpl = '"'; - NewlineChars = ("\r"|"\n"); - NewlineCharsSeq = NewlineChars+; - StringLiteralChars = (AnyUTF8 - NewlineChars); - TemplateIgnoredNonBrace = (^'{' %{ fhold; }); - TemplateNotInterp = '$' (TemplateIgnoredNonBrace | TemplateInterp); - TemplateNotControl = '%' (TemplateIgnoredNonBrace | TemplateControl); - QuotedStringLiteralWithEsc = ('\\' StringLiteralChars) | (StringLiteralChars - ("$" | '%' | '"' | "\\")); - TemplateStringLiteral = ( - (TemplateNotInterp) | - (TemplateNotControl) | - (QuotedStringLiteralWithEsc)+ - ); - HeredocStringLiteral = ( - (TemplateNotInterp) | - (TemplateNotControl) | - (StringLiteralChars - ("$" | '%'))* - ); - BareStringLiteral = ( - (TemplateNotInterp) | - (TemplateNotControl) | - (StringLiteralChars - ("$" | '%'))* - ) Newline?; - - stringTemplate := |* - TemplateInterp => beginTemplateInterp; - TemplateControl => beginTemplateControl; - EndStringTmpl => endStringTemplate; - TemplateStringLiteral => { token(TokenQuotedLit); }; - NewlineCharsSeq => { token(TokenQuotedNewline); }; - AnyUTF8 => { token(TokenInvalid); }; - BrokenUTF8 => { token(TokenBadUTF8); }; - *|; - - heredocTemplate := |* - TemplateInterp => beginTemplateInterp; - TemplateControl => beginTemplateControl; - HeredocStringLiteral EndOfLine => heredocLiteralEOL; - HeredocStringLiteral => heredocLiteralMidline; - BrokenUTF8 => { token(TokenBadUTF8); }; - *|; - - bareTemplate := |* - TemplateInterp => beginTemplateInterp; - TemplateControl => beginTemplateControl; - BareStringLiteral => bareTemplateLiteral; - BrokenUTF8 => { token(TokenBadUTF8); }; - *|; - - identOnly := |* - Ident => { token(TokenIdent) }; - BrokenUTF8 => { token(TokenBadUTF8) }; - AnyUTF8 => { token(TokenInvalid) }; - *|; - - main := |* - Spaces => {}; - NumberLit => { token(TokenNumberLit) }; - Ident => { token(TokenIdent) }; - - Comment => { token(TokenComment) }; - Newline => { token(TokenNewline) }; - - EqualOp => { token(TokenEqualOp); }; - NotEqual => { token(TokenNotEqual); }; - GreaterThanEqual => { token(TokenGreaterThanEq); }; - LessThanEqual => { token(TokenLessThanEq); }; - LogicalAnd => { token(TokenAnd); }; - LogicalOr => { token(TokenOr); }; - Ellipsis => { token(TokenEllipsis); }; - FatArrow => { token(TokenFatArrow); }; - SelfToken => { selfToken() }; - - "{" => openBrace; - "}" => closeBrace; - - "~}" => closeTemplateSeqEatWhitespace; - - BeginStringTmpl => beginStringTemplate; - BeginHeredocTmpl => beginHeredocTemplate; - - BrokenUTF8 => { token(TokenBadUTF8) }; - AnyUTF8 => { token(TokenInvalid) }; - *|; - - }%% - - // Ragel state - p := 0 // "Pointer" into data - pe := len(data) // End-of-data "pointer" - ts := 0 - te := 0 - act := 0 - eof := pe - var stack []int - var top int - - var cs int // current state - switch mode { - case scanNormal: - cs = hcltok_en_main - case scanTemplate: - cs = hcltok_en_bareTemplate - case scanIdentOnly: - cs = hcltok_en_identOnly - default: - panic("invalid scanMode") - } - - braces := 0 - var retBraces []int // stack of brace levels that cause us to use fret - var heredocs []heredocInProgress // stack of heredocs we're currently processing - - %%{ - prepush { - stack = append(stack, 0); - } - postpop { - stack = stack[:len(stack)-1]; - } - }%% - - // Make Go compiler happy - _ = ts - _ = te - _ = act - _ = eof - - token := func (ty TokenType) { - f.emitToken(ty, ts, te) - } - selfToken := func () { - b := data[ts:te] - if len(b) != 1 { - // should never happen - panic("selfToken only works for single-character tokens") - } - f.emitToken(TokenType(b[0]), ts, te) - } - - %%{ - write init nocs; - write exec; - }%% - - // If we fall out here without being in a final state then we've - // encountered something that the scanner can't match, which we'll - // deal with as an invalid. - if cs < hcltok_first_final { - if mode == scanTemplate && len(stack) == 0 { - // If we're scanning a bare template then any straggling - // top-level stuff is actually literal string, rather than - // invalid. This handles the case where the template ends - // with a single "$" or "%", which trips us up because we - // want to see another character to decide if it's a sequence - // or an escape. - f.emitToken(TokenStringLit, ts, len(data)) - } else { - f.emitToken(TokenInvalid, ts, len(data)) - } - } - - // We always emit a synthetic EOF token at the end, since it gives the - // parser position information for an "unexpected EOF" diagnostic. - f.emitToken(TokenEOF, len(data), len(data)) - - return f.Tokens -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/spec.md b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/spec.md deleted file mode 100644 index 3fc5f5f1b..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/spec.md +++ /dev/null @@ -1,941 +0,0 @@ -# HCL Native Syntax Specification - -This is the specification of the syntax and semantics of the native syntax -for HCL. HCL is a system for defining configuration languages for applications. -The HCL information model is designed to support multiple concrete syntaxes -for configuration, but this native syntax is considered the primary format -and is optimized for human authoring and maintenance, as opposed to machine -generation of configuration. - -The language consists of three integrated sub-languages: - -- The _structural_ language defines the overall hierarchical configuration - structure, and is a serialization of HCL bodies, blocks and attributes. - -- The _expression_ language is used to express attribute values, either as - literals or as derivations of other values. - -- The _template_ language is used to compose values together into strings, - as one of several types of expression in the expression language. - -In normal use these three sub-languages are used together within configuration -files to describe an overall configuration, with the structural language -being used at the top level. The expression and template languages can also -be used in isolation, to implement features such as REPLs, debuggers, and -integration into more limited HCL syntaxes such as the JSON profile. - -## Syntax Notation - -Within this specification a semi-formal notation is used to illustrate the -details of syntax. This notation is intended for human consumption rather -than machine consumption, with the following conventions: - -- A naked name starting with an uppercase letter is a global production, - common to all of the syntax specifications in this document. -- A naked name starting with a lowercase letter is a local production, - meaningful only within the specification where it is defined. -- Double and single quotes (`"` and `'`) are used to mark literal character - sequences, which may be either punctuation markers or keywords. -- The default operator for combining items, which has no punctuation, - is concatenation. -- The symbol `|` indicates that any one of its left and right operands may - be present. -- The `*` symbol indicates zero or more repetitions of the item to its left. -- The `?` symbol indicates zero or one of the item to its left. -- Parentheses (`(` and `)`) are used to group items together to apply - the `|`, `*` and `?` operators to them collectively. - -The grammar notation does not fully describe the language. The prose may -augment or conflict with the illustrated grammar. In case of conflict, prose -has priority. - -## Source Code Representation - -Source code is unicode text expressed in the UTF-8 encoding. The language -itself does not perform unicode normalization, so syntax features such as -identifiers are sequences of unicode code points and so e.g. a precombined -accented character is distinct from a letter associated with a combining -accent. (String literals have some special handling with regard to Unicode -normalization which will be covered later in the relevant section.) - -UTF-8 encoded Unicode byte order marks are not permitted. Invalid or -non-normalized UTF-8 encoding is always a parse error. - -## Lexical Elements - -### Comments and Whitespace - -Comments and Whitespace are recognized as lexical elements but are ignored -except as described below. - -Whitespace is defined as a sequence of zero or more space characters -(U+0020). Newline sequences (either U+000A or U+000D followed by U+000A) -are _not_ considered whitespace but are ignored as such in certain contexts. -Horizontal tab characters (U+0009) are also treated as whitespace, but are -counted only as one "column" for the purpose of reporting source positions. - -Comments serve as program documentation and come in two forms: - -- _Line comments_ start with either the `//` or `#` sequences and end with - the next newline sequence. A line comment is considered equivalent to a - newline sequence. - -- _Inline comments_ start with the `/*` sequence and end with the `*/` - sequence, and may have any characters within except the ending sequence. - An inline comments is considered equivalent to a whitespace sequence. - -Comments and whitespace cannot begin within within other comments, or within -template literals except inside an interpolation sequence or template directive. - -### Identifiers - -Identifiers name entities such as blocks, attributes and expression variables. -Identifiers are interpreted as per [UAX #31][uax31] Section 2. Specifically, -their syntax is defined in terms of the `ID_Start` and `ID_Continue` -character properties as follows: - -```ebnf -Identifier = ID_Start (ID_Continue | '-')*; -``` - -The Unicode specification provides the normative requirements for identifier -parsing. Non-normatively, the spirit of this specification is that `ID_Start` -consists of Unicode letter and certain unambiguous punctuation tokens, while -`ID_Continue` augments that set with Unicode digits, combining marks, etc. - -The dash character `-` is additionally allowed in identifiers, even though -that is not part of the unicode `ID_Continue` definition. This is to allow -attribute names and block type names to contain dashes, although underscores -as word separators are considered the idiomatic usage. - -[uax31]: http://unicode.org/reports/tr31/ "Unicode Identifier and Pattern Syntax" - -### Keywords - -There are no globally-reserved words, but in some contexts certain identifiers -are reserved to function as keywords. These are discussed further in the -relevant documentation sections that follow. In such situations, the -identifier's role as a keyword supersedes any other valid interpretation that -may be possible. Outside of these specific situations, the keywords have no -special meaning and are interpreted as regular identifiers. - -### Operators and Delimiters - -The following character sequences represent operators, delimiters, and other -special tokens: - -``` -+ && == < : { [ ( ${ -- || != > ? } ] ) %{ -* ! <= = . -/ >= => , -% ... -``` - -### Numeric Literals - -A numeric literal is a decimal representation of a -real number. It has an integer part, a fractional part, -and an exponent part. - -```ebnf -NumericLit = decimal+ ("." decimal+)? (expmark decimal+)?; -decimal = '0' .. '9'; -expmark = ('e' | 'E') ("+" | "-")?; -``` - -## Structural Elements - -The structural language consists of syntax representing the following -constructs: - -- _Attributes_, which assign a value to a specified name. -- _Blocks_, which create a child body annotated by a type and optional labels. -- _Body Content_, which consists of a collection of attributes and blocks. - -These constructs correspond to the similarly-named concepts in the -language-agnostic HCL information model. - -```ebnf -ConfigFile = Body; -Body = (Attribute | Block | OneLineBlock)*; -Attribute = Identifier "=" Expression Newline; -Block = Identifier (StringLit|Identifier)* "{" Newline Body "}" Newline; -OneLineBlock = Identifier (StringLit|Identifier)* "{" (Identifier "=" Expression)? "}" Newline; -``` - -### Configuration Files - -A _configuration file_ is a sequence of characters whose top-level is -interpreted as a Body. - -### Bodies - -A _body_ is a collection of associated attributes and blocks. The meaning of -this association is defined by the calling application. - -### Attribute Definitions - -An _attribute definition_ assigns a value to a particular attribute name within -a body. Each distinct attribute name may be defined no more than once within a -single body. - -The attribute value is given as an expression, which is retained literally -for later evaluation by the calling application. - -### Blocks - -A _block_ creates a child body that is annotated with a block _type_ and -zero or more block _labels_. Blocks create a structural hierarchy which can be -interpreted by the calling application. - -Block labels can either be quoted literal strings or naked identifiers. - -## Expressions - -The expression sub-language is used within attribute definitions to specify -values. - -```ebnf -Expression = ( - ExprTerm | - Operation | - Conditional -); -``` - -### Types - -The value types used within the expression language are those defined by the -syntax-agnostic HCL information model. An expression may return any valid -type, but only a subset of the available types have first-class syntax. -A calling application may make other types available via _variables_ and -_functions_. - -### Expression Terms - -Expression _terms_ are the operands for unary and binary expressions, as well -as acting as expressions in their own right. - -```ebnf -ExprTerm = ( - LiteralValue | - CollectionValue | - TemplateExpr | - VariableExpr | - FunctionCall | - ForExpr | - ExprTerm Index | - ExprTerm GetAttr | - ExprTerm Splat | - "(" Expression ")" -); -``` - -The productions for these different term types are given in their corresponding -sections. - -Between the `(` and `)` characters denoting a sub-expression, newline -characters are ignored as whitespace. - -### Literal Values - -A _literal value_ immediately represents a particular value of a primitive -type. - -```ebnf -LiteralValue = ( - NumericLit | - "true" | - "false" | - "null" -); -``` - -- Numeric literals represent values of type _number_. -- The `true` and `false` keywords represent values of type _bool_. -- The `null` keyword represents a null value of the dynamic pseudo-type. - -String literals are not directly available in the expression sub-language, but -are available via the template sub-language, which can in turn be incorporated -via _template expressions_. - -### Collection Values - -A _collection value_ combines zero or more other expressions to produce a -collection value. - -```ebnf -CollectionValue = tuple | object; -tuple = "[" ( - (Expression ("," Expression)* ","?)? -) "]"; -object = "{" ( - (objectelem ("," objectelem)* ","?)? -) "}"; -objectelem = (Identifier | Expression) "=" Expression; -``` - -Only tuple and object values can be directly constructed via native syntax. -Tuple and object values can in turn be converted to list, set and map values -with other operations, which behaves as defined by the syntax-agnostic HCL -information model. - -When specifying an object element, an identifier is interpreted as a literal -attribute name as opposed to a variable reference. To populate an item key -from a variable, use parentheses to disambiguate: - -- `{foo = "baz"}` is interpreted as an attribute literally named `foo`. -- `{(foo) = "baz"}` is interpreted as an attribute whose name is taken - from the variable named `foo`. - -Between the open and closing delimiters of these sequences, newline sequences -are ignored as whitespace. - -There is a syntax ambiguity between _for expressions_ and collection values -whose first element is a reference to a variable named `for`. The -_for expression_ interpretation has priority, so to produce a tuple whose -first element is the value of a variable named `for`, or an object with a -key named `for`, use parentheses to disambiguate: - -- `[for, foo, baz]` is a syntax error. -- `[(for), foo, baz]` is a tuple whose first element is the value of variable - `for`. -- `{for: 1, baz: 2}` is a syntax error. -- `{(for): 1, baz: 2}` is an object with an attribute literally named `for`. -- `{baz: 2, for: 1}` is equivalent to the previous example, and resolves the - ambiguity by reordering. - -### Template Expressions - -A _template expression_ embeds a program written in the template sub-language -as an expression. Template expressions come in two forms: - -- A _quoted_ template expression is delimited by quote characters (`"`) and - defines a template as a single-line expression with escape characters. -- A _heredoc_ template expression is introduced by a `<<` sequence and - defines a template via a multi-line sequence terminated by a user-chosen - delimiter. - -In both cases the template interpolation and directive syntax is available for -use within the delimiters, and any text outside of these special sequences is -interpreted as a literal string. - -In _quoted_ template expressions any literal string sequences within the -template behave in a special way: literal newline sequences are not permitted -and instead _escape sequences_ can be included, starting with the -backslash `\`: - -``` - \n Unicode newline control character - \r Unicode carriage return control character - \t Unicode tab control character - \" Literal quote mark, used to prevent interpretation as end of string - \\ Literal backslash, used to prevent interpretation as escape sequence - \uNNNN Unicode character from Basic Multilingual Plane (NNNN is four hexadecimal digits) - \UNNNNNNNN Unicode character from supplementary planes (NNNNNNNN is eight hexadecimal digits) -``` - -The _heredoc_ template expression type is introduced by either `<<` or `<<-`, -followed by an identifier. The template expression ends when the given -identifier subsequently appears again on a line of its own. - -If a heredoc template is introduced with the `<<-` symbol, any literal string -at the start of each line is analyzed to find the minimum number of leading -spaces, and then that number of prefix spaces is removed from all line-leading -literal strings. The final closing marker may also have an arbitrary number -of spaces preceding it on its line. - -```ebnf -TemplateExpr = quotedTemplate | heredocTemplate; -quotedTemplate = (as defined in prose above); -heredocTemplate = ( - ("<<" | "<<-") Identifier Newline - (content as defined in prose above) - Identifier Newline -); -``` - -A quoted template expression containing only a single literal string serves -as a syntax for defining literal string _expressions_. In certain contexts -the template syntax is restricted in this manner: - -```ebnf -StringLit = '"' (quoted literals as defined in prose above) '"'; -``` - -The `StringLit` production permits the escape sequences discussed for quoted -template expressions as above, but does _not_ permit template interpolation -or directive sequences. - -### Variables and Variable Expressions - -A _variable_ is a value that has been assigned a symbolic name. Variables are -made available for use in expressions by the calling application, by populating -the _global scope_ used for expression evaluation. - -Variables can also be created by expressions themselves, which always creates -a _child scope_ that incorporates the variables from its parent scope but -(re-)defines zero or more names with new values. - -The value of a variable is accessed using a _variable expression_, which is -a standalone `Identifier` whose name corresponds to a defined variable: - -```ebnf -VariableExpr = Identifier; -``` - -Variables in a particular scope are immutable, but child scopes may _hide_ -a variable from an ancestor scope by defining a new variable of the same name. -When looking up variables, the most locally-defined variable of the given name -is used, and ancestor-scoped variables of the same name cannot be accessed. - -No direct syntax is provided for declaring or assigning variables, but other -expression constructs implicitly create child scopes and define variables as -part of their evaluation. - -### Functions and Function Calls - -A _function_ is an operation that has been assigned a symbolic name. Functions -are made available for use in expressions by the calling application, by -populating the _function table_ used for expression evaluation. - -The namespace of functions is distinct from the namespace of variables. A -function and a variable may share the same name with no implication that they -are in any way related. - -A function can be executed via a _function call_ expression: - -```ebnf -FunctionCall = Identifier "(" arguments ")"; -Arguments = ( - () || - (Expression ("," Expression)* ("," | "...")?) -); -``` - -The definition of functions and the semantics of calling them are defined by -the language-agnostic HCL information model. The given arguments are mapped -onto the function's _parameters_ and the result of a function call expression -is the return value of the named function when given those arguments. - -If the final argument expression is followed by the ellipsis symbol (`...`), -the final argument expression must evaluate to either a list or tuple value. -The elements of the value are each mapped to a single parameter of the -named function, beginning at the first parameter remaining after all other -argument expressions have been mapped. - -Within the parentheses that delimit the function arguments, newline sequences -are ignored as whitespace. - -### For Expressions - -A _for expression_ is a construct for constructing a collection by projecting -the items from another collection. - -```ebnf -ForExpr = forTupleExpr | forObjectExpr; -forTupleExpr = "[" forIntro Expression forCond? "]"; -forObjectExpr = "{" forIntro Expression "=>" Expression "..."? forCond? "}"; -forIntro = "for" Identifier ("," Identifier)? "in" Expression ":"; -forCond = "if" Expression; -``` - -The punctuation used to delimit a for expression decide whether it will produce -a tuple value (`[` and `]`) or an object value (`{` and `}`). - -The "introduction" is equivalent in both cases: the keyword `for` followed by -either one or two identifiers separated by a comma which define the temporary -variable names used for iteration, followed by the keyword `in` and then -an expression that must evaluate to a value that can be iterated. The -introduction is then terminated by the colon (`:`) symbol. - -If only one identifier is provided, it is the name of a variable that will -be temporarily assigned the value of each element during iteration. If both -are provided, the first is the key and the second is the value. - -Tuple, object, list, map, and set types are iterable. The type of collection -used defines how the key and value variables are populated: - -- For tuple and list types, the _key_ is the zero-based index into the - sequence for each element, and the _value_ is the element value. The - elements are visited in index order. -- For object and map types, the _key_ is the string attribute name or element - key, and the _value_ is the attribute or element value. The elements are - visited in the order defined by a lexicographic sort of the attribute names - or keys. -- For set types, the _key_ and _value_ are both the element value. The elements - are visited in an undefined but consistent order. - -The expression after the colon and (in the case of object `for`) the expression -after the `=>` are both evaluated once for each element of the source -collection, in a local scope that defines the key and value variable names -specified. - -The results of evaluating these expressions for each input element are used -to populate an element in the new collection. In the case of tuple `for`, the -single expression becomes an element, appending values to the tuple in visit -order. In the case of object `for`, the pair of expressions is used as an -attribute name and value respectively, creating an element in the resulting -object. - -In the case of object `for`, it is an error if two input elements produce -the same result from the attribute name expression, since duplicate -attributes are not possible. If the ellipsis symbol (`...`) appears -immediately after the value expression, this activates the grouping mode in -which each value in the resulting object is a _tuple_ of all of the values -that were produced against each distinct key. - -- `[for v in ["a", "b"]: v]` returns `["a", "b"]`. -- `[for i, v in ["a", "b"]: i]` returns `[0, 1]`. -- `{for i, v in ["a", "b"]: v => i}` returns `{a = 0, b = 1}`. -- `{for i, v in ["a", "a", "b"]: k => v}` produces an error, because attribute - `a` is defined twice. -- `{for i, v in ["a", "a", "b"]: v => i...}` returns `{a = [0, 1], b = [2]}`. - -If the `if` keyword is used after the element expression(s), it applies an -additional predicate that can be used to conditionally filter elements from -the source collection from consideration. The expression following `if` is -evaluated once for each source element, in the same scope used for the -element expression(s). It must evaluate to a boolean value; if `true`, the -element will be evaluated as normal, while if `false` the element will be -skipped. - -- `[for i, v in ["a", "b", "c"]: v if i < 2]` returns `["a", "b"]`. - -If the collection value, element expression(s) or condition expression return -unknown values that are otherwise type-valid, the result is a value of the -dynamic pseudo-type. - -### Index Operator - -The _index_ operator returns the value of a single element of a collection -value. It is a postfix operator and can be applied to any value that has -a tuple, object, map, or list type. - -```ebnf -Index = "[" Expression "]"; -``` - -The expression delimited by the brackets is the _key_ by which an element -will be looked up. - -If the index operator is applied to a value of tuple or list type, the -key expression must be an non-negative integer number representing the -zero-based element index to access. If applied to a value of object or map -type, the key expression must be a string representing the attribute name -or element key. If the given key value is not of the appropriate type, a -conversion is attempted using the conversion rules from the HCL -syntax-agnostic information model. - -An error is produced if the given key expression does not correspond to -an element in the collection, either because it is of an unconvertable type, -because it is outside the range of elements for a tuple or list, or because -the given attribute or key does not exist. - -If either the collection or the key are an unknown value of an -otherwise-suitable type, the return value is an unknown value whose type -matches what type would be returned given known values, or a value of the -dynamic pseudo-type if type information alone cannot determine a suitable -return type. - -Within the brackets that delimit the index key, newline sequences are ignored -as whitespace. - -The HCL native syntax also includes a _legacy_ index operator that exists -only for compatibility with the precursor language HIL: - -```ebnf -LegacyIndex = '.' digit+ -``` - -This legacy index operator must be supported by parser for compatibility but -should not be used in new configurations. This allows an attribute-access-like -syntax for indexing, must still be interpreted as an index operation rather -than attribute access. - -The legacy syntax does not support chaining of index operations, like -`foo.0.0.bar`, because the interpretation of `0.0` as a number literal token -takes priority and thus renders the resulting sequence invalid. - -### Attribute Access Operator - -The _attribute access_ operator returns the value of a single attribute in -an object value. It is a postfix operator and can be applied to any value -that has an object type. - -```ebnf -GetAttr = "." Identifier; -``` - -The given identifier is interpreted as the name of the attribute to access. -An error is produced if the object to which the operator is applied does not -have an attribute with the given name. - -If the object is an unknown value of a type that has the attribute named, the -result is an unknown value of the attribute's type. - -### Splat Operators - -The _splat operators_ allow convenient access to attributes or elements of -elements in a tuple, list, or set value. - -There are two kinds of "splat" operator: - -- The _attribute-only_ splat operator supports only attribute lookups into - the elements from a list, but supports an arbitrary number of them. - -- The _full_ splat operator additionally supports indexing into the elements - from a list, and allows any combination of attribute access and index - operations. - -```ebnf -Splat = attrSplat | fullSplat; -attrSplat = "." "*" GetAttr*; -fullSplat = "[" "*" "]" (GetAttr | Index)*; -``` - -The splat operators can be thought of as shorthands for common operations that -could otherwise be performed using _for expressions_: - -- `tuple.*.foo.bar[0]` is approximately equivalent to - `[for v in tuple: v.foo.bar][0]`. -- `tuple[*].foo.bar[0]` is approximately equivalent to - `[for v in tuple: v.foo.bar[0]]` - -Note the difference in how the trailing index operator is interpreted in -each case. This different interpretation is the key difference between the -_attribute-only_ and _full_ splat operators. - -Splat operators have one additional behavior compared to the equivalent -_for expressions_ shown above: if a splat operator is applied to a value that -is _not_ of tuple, list, or set type, the value is coerced automatically into -a single-value list of the value type: - -- `any_object.*.id` is equivalent to `[any_object.id]`, assuming that `any_object` - is a single object. -- `any_number.*` is equivalent to `[any_number]`, assuming that `any_number` - is a single number. - -If applied to a null value that is not tuple, list, or set, the result is always -an empty tuple, which allows conveniently converting a possibly-null scalar -value into a tuple of zero or one elements. It is illegal to apply a splat -operator to a null value of tuple, list, or set type. - -### Operations - -Operations apply a particular operator to either one or two expression terms. - -```ebnf -Operation = unaryOp | binaryOp; -unaryOp = ("-" | "!") ExprTerm; -binaryOp = ExprTerm binaryOperator ExprTerm; -binaryOperator = compareOperator | arithmeticOperator | logicOperator; -compareOperator = "==" | "!=" | "<" | ">" | "<=" | ">="; -arithmeticOperator = "+" | "-" | "*" | "/" | "%"; -logicOperator = "&&" | "||" | "!"; -``` - -The unary operators have the highest precedence. - -The binary operators are grouped into the following precedence levels: - -``` -Level Operators - 6 * / % - 5 + - - 4 > >= < <= - 3 == != - 2 && - 1 || -``` - -Higher values of "level" bind tighter. Operators within the same precedence -level have left-to-right associativity. For example, `x / y * z` is equivalent -to `(x / y) * z`. - -### Comparison Operators - -Comparison operators always produce boolean values, as a result of testing -the relationship between two values. - -The two equality operators apply to values of any type: - -``` -a == b equal -a != b not equal -``` - -Two values are equal if the are of identical types and their values are -equal as defined in the HCL syntax-agnostic information model. The equality -operators are commutative and opposite, such that `(a == b) == !(a != b)` -and `(a == b) == (b == a)` for all values `a` and `b`. - -The four numeric comparison operators apply only to numbers: - -``` -a < b less than -a <= b less than or equal to -a > b greater than -a >= b greater than or equal to -``` - -If either operand of a comparison operator is a correctly-typed unknown value -or a value of the dynamic pseudo-type, the result is an unknown boolean. - -### Arithmetic Operators - -Arithmetic operators apply only to number values and always produce number -values as results. - -``` -a + b sum (addition) -a - b difference (subtraction) -a * b product (multiplication) -a / b quotient (division) -a % b remainder (modulo) --a negation -``` - -Arithmetic operations are considered to be performed in an arbitrary-precision -number space. - -If either operand of an arithmetic operator is an unknown number or a value -of the dynamic pseudo-type, the result is an unknown number. - -### Logic Operators - -Logic operators apply only to boolean values and always produce boolean values -as results. - -``` -a && b logical AND -a || b logical OR -!a logical NOT -``` - -If either operand of a logic operator is an unknown bool value or a value -of the dynamic pseudo-type, the result is an unknown bool value. - -### Conditional Operator - -The conditional operator allows selecting from one of two expressions based on -the outcome of a boolean expression. - -```ebnf -Conditional = Expression "?" Expression ":" Expression; -``` - -The first expression is the _predicate_, which is evaluated and must produce -a boolean result. If the predicate value is `true`, the result of the second -expression is the result of the conditional. If the predicate value is -`false`, the result of the third expression is the result of the conditional. - -The second and third expressions must be of the same type or must be able to -unify into a common type using the type unification rules defined in the -HCL syntax-agnostic information model. This unified type is the result type -of the conditional, with both expressions converted as necessary to the -unified type. - -If the predicate is an unknown boolean value or a value of the dynamic -pseudo-type then the result is an unknown value of the unified type of the -other two expressions. - -If either the second or third expressions produce errors when evaluated, -these errors are passed through only if the erroneous expression is selected. -This allows for expressions such as -`length(some_list) > 0 ? some_list[0] : default` (given some suitable `length` -function) without producing an error when the predicate is `false`. - -## Templates - -The template sub-language is used within template expressions to concisely -combine strings and other values to produce other strings. It can also be -used in isolation as a standalone template language. - -```ebnf -Template = ( - TemplateLiteral | - TemplateInterpolation | - TemplateDirective -)* -TemplateDirective = TemplateIf | TemplateFor; -``` - -A template behaves like an expression that always returns a string value. -The different elements of the template are evaluated and combined into a -single string to return. If any of the elements produce an unknown string -or a value of the dynamic pseudo-type, the result is an unknown string. - -An important use-case for standalone templates is to enable the use of -expressions in alternative HCL syntaxes where a native expression grammar is -not available. For example, the HCL JSON profile treats the values of JSON -strings as standalone templates when attributes are evaluated in expression -mode. - -### Template Literals - -A template literal is a literal sequence of characters to include in the -resulting string. When the template sub-language is used standalone, a -template literal can contain any unicode character, with the exception -of the sequences that introduce interpolations and directives, and for the -sequences that escape those introductions. - -The interpolation and directive introductions are escaped by doubling their -leading characters. The `${` sequence is escaped as `$${` and the `%{` -sequence is escaped as `%%{`. - -When the template sub-language is embedded in the expression language via -_template expressions_, additional constraints and transforms are applied to -template literals as described in the definition of template expressions. - -The value of a template literal can be modified by _strip markers_ in any -interpolations or directives that are adjacent to it. A strip marker is -a tilde (`~`) placed immediately after the opening `{` or before the closing -`}` of a template sequence: - -- `hello ${~ "world" }` produces `"helloworld"`. -- `%{ if true ~} hello %{~ endif }` produces `"hello"`. - -When a strip marker is present, any spaces adjacent to it in the corresponding -string literal (if any) are removed before producing the final value. Space -characters are interpreted as per Unicode's definition. - -Stripping is done at syntax level rather than value level. Values returned -by interpolations or directives are not subject to stripping: - -- `${"hello" ~}${" world"}` produces `"hello world"`, and not `"helloworld"`, - because the space is not in a template literal directly adjacent to the - strip marker. - -### Template Interpolations - -An _interpolation sequence_ evaluates an expression (written in the -expression sub-language), converts the result to a string value, and -replaces itself with the resulting string. - -```ebnf -TemplateInterpolation = ("${" | "${~") Expression ("}" | "~}"; -``` - -If the expression result cannot be converted to a string, an error is -produced. - -### Template If Directive - -The template `if` directive is the template equivalent of the -_conditional expression_, allowing selection of one of two sub-templates based -on the value of a predicate expression. - -```ebnf -TemplateIf = ( - ("%{" | "%{~") "if" Expression ("}" | "~}") - Template - ( - ("%{" | "%{~") "else" ("}" | "~}") - Template - )? - ("%{" | "%{~") "endif" ("}" | "~}") -); -``` - -The evaluation of the `if` directive is equivalent to the conditional -expression, with the following exceptions: - -- The two sub-templates always produce strings, and thus the result value is - also always a string. -- The `else` clause may be omitted, in which case the conditional's third - expression result is implied to be the empty string. - -### Template For Directive - -The template `for` directive is the template equivalent of the _for expression_, -producing zero or more copies of its sub-template based on the elements of -a collection. - -```ebnf -TemplateFor = ( - ("%{" | "%{~") "for" Identifier ("," Identifier) "in" Expression ("}" | "~}") - Template - ("%{" | "%{~") "endfor" ("}" | "~}") -); -``` - -The evaluation of the `for` directive is equivalent to the _for expression_ -when producing a tuple, with the following exceptions: - -- The sub-template always produces a string. -- There is no equivalent of the "if" clause on the for expression. -- The elements of the resulting tuple are all converted to strings and - concatenated to produce a flat string result. - -### Template Interpolation Unwrapping - -As a special case, a template that consists only of a single interpolation, -with no surrounding literals, directives or other interpolations, is -"unwrapped". In this case, the result of the interpolation expression is -returned verbatim, without conversion to string. - -This special case exists primarily to enable the native template language -to be used inside strings in alternative HCL syntaxes that lack a first-class -template or expression syntax. Unwrapping allows arbitrary expressions to be -used to populate attributes when strings in such languages are interpreted -as templates. - -- `${true}` produces the boolean value `true` -- `${"${true}"}` produces the boolean value `true`, because both the inner - and outer interpolations are subject to unwrapping. -- `hello ${true}` produces the string `"hello true"` -- `${""}${true}` produces the string `"true"` because there are two - interpolation sequences, even though one produces an empty result. -- `%{ for v in [true] }${v}%{ endif }` produces the string `true` because - the presence of the `for` directive circumvents the unwrapping even though - the final result is a single value. - -In some contexts this unwrapping behavior may be circumvented by the calling -application, by converting the final template result to string. This is -necessary, for example, if a standalone template is being used to produce -the direct contents of a file, since the result in that case must always be a -string. - -## Static Analysis - -The HCL static analysis operations are implemented for some expression types -in the native syntax, as described in the following sections. - -A goal for static analysis of the native syntax is for the interpretation to -be as consistent as possible with the dynamic evaluation interpretation of -the given expression, though some deviations are intentionally made in order -to maximize the potential for analysis. - -### Static List - -The tuple construction syntax can be interpreted as a static list. All of -the expression elements given are returned as the static list elements, -with no further interpretation. - -### Static Map - -The object construction syntax can be interpreted as a static map. All of the -key/value pairs given are returned as the static pairs, with no further -interpretation. - -The usual requirement that an attribute name be interpretable as a string -does not apply to this static analysis, allowing callers to provide map-like -constructs with different key types by building on the map syntax. - -### Static Call - -The function call syntax can be interpreted as a static call. The called -function name is returned verbatim and the given argument expressions are -returned as the static arguments, with no further interpretation. - -### Static Traversal - -A variable expression and any attached attribute access operations and -constant index operations can be interpreted as a static traversal. - -The keywords `true`, `false` and `null` can also be interpreted as -static traversals, behaving as if they were references to variables of those -names, to allow callers to redefine the meaning of those keywords in certain -contexts. diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/structure.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/structure.go deleted file mode 100644 index 2f7470c77..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/structure.go +++ /dev/null @@ -1,394 +0,0 @@ -package hclsyntax - -import ( - "fmt" - "strings" - - "github.com/hashicorp/hcl/v2" -) - -// AsHCLBlock returns the block data expressed as a *hcl.Block. -func (b *Block) AsHCLBlock() *hcl.Block { - if b == nil { - return nil - } - - lastHeaderRange := b.TypeRange - if len(b.LabelRanges) > 0 { - lastHeaderRange = b.LabelRanges[len(b.LabelRanges)-1] - } - - return &hcl.Block{ - Type: b.Type, - Labels: b.Labels, - Body: b.Body, - - DefRange: hcl.RangeBetween(b.TypeRange, lastHeaderRange), - TypeRange: b.TypeRange, - LabelRanges: b.LabelRanges, - } -} - -// Body is the implementation of hcl.Body for the HCL native syntax. -type Body struct { - Attributes Attributes - Blocks Blocks - - // These are used with PartialContent to produce a "remaining items" - // body to return. They are nil on all bodies fresh out of the parser. - hiddenAttrs map[string]struct{} - hiddenBlocks map[string]struct{} - - SrcRange hcl.Range - EndRange hcl.Range // Final token of the body, for reporting missing items -} - -// Assert that *Body implements hcl.Body -var assertBodyImplBody hcl.Body = &Body{} - -func (b *Body) walkChildNodes(w internalWalkFunc) { - w(b.Attributes) - w(b.Blocks) -} - -func (b *Body) Range() hcl.Range { - return b.SrcRange -} - -func (b *Body) Content(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Diagnostics) { - content, remainHCL, diags := b.PartialContent(schema) - - // No we'll see if anything actually remains, to produce errors about - // extraneous items. - remain := remainHCL.(*Body) - - for name, attr := range b.Attributes { - if _, hidden := remain.hiddenAttrs[name]; !hidden { - var suggestions []string - for _, attrS := range schema.Attributes { - if _, defined := content.Attributes[attrS.Name]; defined { - continue - } - suggestions = append(suggestions, attrS.Name) - } - suggestion := nameSuggestion(name, suggestions) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } else { - // Is there a block of the same name? - for _, blockS := range schema.Blocks { - if blockS.Type == name { - suggestion = fmt.Sprintf(" Did you mean to define a block of type %q?", name) - break - } - } - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsupported argument", - Detail: fmt.Sprintf("An argument named %q is not expected here.%s", name, suggestion), - Subject: &attr.NameRange, - }) - } - } - - for _, block := range b.Blocks { - blockTy := block.Type - if _, hidden := remain.hiddenBlocks[blockTy]; !hidden { - var suggestions []string - for _, blockS := range schema.Blocks { - suggestions = append(suggestions, blockS.Type) - } - suggestion := nameSuggestion(blockTy, suggestions) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } else { - // Is there an attribute of the same name? - for _, attrS := range schema.Attributes { - if attrS.Name == blockTy { - suggestion = fmt.Sprintf(" Did you mean to define argument %q? If so, use the equals sign to assign it a value.", blockTy) - break - } - } - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsupported block type", - Detail: fmt.Sprintf("Blocks of type %q are not expected here.%s", blockTy, suggestion), - Subject: &block.TypeRange, - }) - } - } - - return content, diags -} - -func (b *Body) PartialContent(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Body, hcl.Diagnostics) { - attrs := make(hcl.Attributes) - var blocks hcl.Blocks - var diags hcl.Diagnostics - hiddenAttrs := make(map[string]struct{}) - hiddenBlocks := make(map[string]struct{}) - - if b.hiddenAttrs != nil { - for k, v := range b.hiddenAttrs { - hiddenAttrs[k] = v - } - } - if b.hiddenBlocks != nil { - for k, v := range b.hiddenBlocks { - hiddenBlocks[k] = v - } - } - - for _, attrS := range schema.Attributes { - name := attrS.Name - attr, exists := b.Attributes[name] - _, hidden := hiddenAttrs[name] - if hidden || !exists { - if attrS.Required { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing required argument", - Detail: fmt.Sprintf("The argument %q is required, but no definition was found.", attrS.Name), - Subject: b.MissingItemRange().Ptr(), - }) - } - continue - } - - hiddenAttrs[name] = struct{}{} - attrs[name] = attr.AsHCLAttribute() - } - - blocksWanted := make(map[string]hcl.BlockHeaderSchema) - for _, blockS := range schema.Blocks { - blocksWanted[blockS.Type] = blockS - } - - for _, block := range b.Blocks { - if _, hidden := hiddenBlocks[block.Type]; hidden { - continue - } - blockS, wanted := blocksWanted[block.Type] - if !wanted { - continue - } - - if len(block.Labels) > len(blockS.LabelNames) { - name := block.Type - if len(blockS.LabelNames) == 0 { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Extraneous label for %s", name), - Detail: fmt.Sprintf( - "No labels are expected for %s blocks.", name, - ), - Subject: block.LabelRanges[0].Ptr(), - Context: hcl.RangeBetween(block.TypeRange, block.OpenBraceRange).Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Extraneous label for %s", name), - Detail: fmt.Sprintf( - "Only %d labels (%s) are expected for %s blocks.", - len(blockS.LabelNames), strings.Join(blockS.LabelNames, ", "), name, - ), - Subject: block.LabelRanges[len(blockS.LabelNames)].Ptr(), - Context: hcl.RangeBetween(block.TypeRange, block.OpenBraceRange).Ptr(), - }) - } - continue - } - - if len(block.Labels) < len(blockS.LabelNames) { - name := block.Type - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Missing %s for %s", blockS.LabelNames[len(block.Labels)], name), - Detail: fmt.Sprintf( - "All %s blocks must have %d labels (%s).", - name, len(blockS.LabelNames), strings.Join(blockS.LabelNames, ", "), - ), - Subject: &block.OpenBraceRange, - Context: hcl.RangeBetween(block.TypeRange, block.OpenBraceRange).Ptr(), - }) - continue - } - - blocks = append(blocks, block.AsHCLBlock()) - } - - // We hide blocks only after we've processed all of them, since otherwise - // we can't process more than one of the same type. - for _, blockS := range schema.Blocks { - hiddenBlocks[blockS.Type] = struct{}{} - } - - remain := &Body{ - Attributes: b.Attributes, - Blocks: b.Blocks, - - hiddenAttrs: hiddenAttrs, - hiddenBlocks: hiddenBlocks, - - SrcRange: b.SrcRange, - EndRange: b.EndRange, - } - - return &hcl.BodyContent{ - Attributes: attrs, - Blocks: blocks, - - MissingItemRange: b.MissingItemRange(), - }, remain, diags -} - -func (b *Body) JustAttributes() (hcl.Attributes, hcl.Diagnostics) { - attrs := make(hcl.Attributes) - var diags hcl.Diagnostics - - if len(b.Blocks) > 0 { - example := b.Blocks[0] - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Unexpected %q block", example.Type), - Detail: "Blocks are not allowed here.", - Subject: &example.TypeRange, - }) - // we will continue processing anyway, and return the attributes - // we are able to find so that certain analyses can still be done - // in the face of errors. - } - - if b.Attributes == nil { - return attrs, diags - } - - for name, attr := range b.Attributes { - if _, hidden := b.hiddenAttrs[name]; hidden { - continue - } - attrs[name] = attr.AsHCLAttribute() - } - - return attrs, diags -} - -func (b *Body) MissingItemRange() hcl.Range { - return hcl.Range{ - Filename: b.SrcRange.Filename, - Start: b.SrcRange.Start, - End: b.SrcRange.Start, - } -} - -// Attributes is the collection of attribute definitions within a body. -type Attributes map[string]*Attribute - -func (a Attributes) walkChildNodes(w internalWalkFunc) { - for _, attr := range a { - w(attr) - } -} - -// Range returns the range of some arbitrary point within the set of -// attributes, or an invalid range if there are no attributes. -// -// This is provided only to complete the Node interface, but has no practical -// use. -func (a Attributes) Range() hcl.Range { - // An attributes doesn't really have a useful range to report, since - // it's just a grouping construct. So we'll arbitrarily take the - // range of one of the attributes, or produce an invalid range if we have - // none. In practice, there's little reason to ask for the range of - // an Attributes. - for _, attr := range a { - return attr.Range() - } - return hcl.Range{ - Filename: "", - } -} - -// Attribute represents a single attribute definition within a body. -type Attribute struct { - Name string - Expr Expression - - SrcRange hcl.Range - NameRange hcl.Range - EqualsRange hcl.Range -} - -func (a *Attribute) walkChildNodes(w internalWalkFunc) { - w(a.Expr) -} - -func (a *Attribute) Range() hcl.Range { - return a.SrcRange -} - -// AsHCLAttribute returns the block data expressed as a *hcl.Attribute. -func (a *Attribute) AsHCLAttribute() *hcl.Attribute { - if a == nil { - return nil - } - return &hcl.Attribute{ - Name: a.Name, - Expr: a.Expr, - - Range: a.SrcRange, - NameRange: a.NameRange, - } -} - -// Blocks is the list of nested blocks within a body. -type Blocks []*Block - -func (bs Blocks) walkChildNodes(w internalWalkFunc) { - for _, block := range bs { - w(block) - } -} - -// Range returns the range of some arbitrary point within the list of -// blocks, or an invalid range if there are no blocks. -// -// This is provided only to complete the Node interface, but has no practical -// use. -func (bs Blocks) Range() hcl.Range { - if len(bs) > 0 { - return bs[0].Range() - } - return hcl.Range{ - Filename: "", - } -} - -// Block represents a nested block structure -type Block struct { - Type string - Labels []string - Body *Body - - TypeRange hcl.Range - LabelRanges []hcl.Range - OpenBraceRange hcl.Range - CloseBraceRange hcl.Range -} - -func (b *Block) walkChildNodes(w internalWalkFunc) { - w(b.Body) -} - -func (b *Block) Range() hcl.Range { - return hcl.RangeBetween(b.TypeRange, b.CloseBraceRange) -} - -func (b *Block) DefRange() hcl.Range { - return hcl.RangeBetween(b.TypeRange, b.OpenBraceRange) -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/structure_at_pos.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/structure_at_pos.go deleted file mode 100644 index 587844ac2..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/structure_at_pos.go +++ /dev/null @@ -1,118 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl/v2" -) - -// ----------------------------------------------------------------------------- -// The methods in this file are all optional extension methods that serve to -// implement the methods of the same name on *hcl.File when its root body -// is provided by this package. -// ----------------------------------------------------------------------------- - -// BlocksAtPos implements the method of the same name for an *hcl.File that -// is backed by a *Body. -func (b *Body) BlocksAtPos(pos hcl.Pos) []*hcl.Block { - list, _ := b.blocksAtPos(pos, true) - return list -} - -// InnermostBlockAtPos implements the method of the same name for an *hcl.File -// that is backed by a *Body. -func (b *Body) InnermostBlockAtPos(pos hcl.Pos) *hcl.Block { - _, innermost := b.blocksAtPos(pos, false) - return innermost.AsHCLBlock() -} - -// OutermostBlockAtPos implements the method of the same name for an *hcl.File -// that is backed by a *Body. -func (b *Body) OutermostBlockAtPos(pos hcl.Pos) *hcl.Block { - return b.outermostBlockAtPos(pos).AsHCLBlock() -} - -// blocksAtPos is the internal engine of both BlocksAtPos and -// InnermostBlockAtPos, which both need to do the same logic but return a -// differently-shaped result. -// -// list is nil if makeList is false, avoiding an allocation. Innermost is -// always set, and if the returned list is non-nil it will always match the -// final element from that list. -func (b *Body) blocksAtPos(pos hcl.Pos, makeList bool) (list []*hcl.Block, innermost *Block) { - current := b - -Blocks: - for current != nil { - for _, block := range current.Blocks { - wholeRange := hcl.RangeBetween(block.TypeRange, block.CloseBraceRange) - if wholeRange.ContainsPos(pos) { - innermost = block - if makeList { - list = append(list, innermost.AsHCLBlock()) - } - current = block.Body - continue Blocks - } - } - - // If we fall out here then none of the current body's nested blocks - // contain the position we are looking for, and so we're done. - break - } - - return -} - -// outermostBlockAtPos is the internal version of OutermostBlockAtPos that -// returns a hclsyntax.Block rather than an hcl.Block, allowing for further -// analysis if necessary. -func (b *Body) outermostBlockAtPos(pos hcl.Pos) *Block { - // This is similar to blocksAtPos, but simpler because we know it only - // ever needs to search the first level of nested blocks. - - for _, block := range b.Blocks { - wholeRange := hcl.RangeBetween(block.TypeRange, block.CloseBraceRange) - if wholeRange.ContainsPos(pos) { - return block - } - } - - return nil -} - -// AttributeAtPos implements the method of the same name for an *hcl.File -// that is backed by a *Body. -func (b *Body) AttributeAtPos(pos hcl.Pos) *hcl.Attribute { - return b.attributeAtPos(pos).AsHCLAttribute() -} - -// attributeAtPos is the internal version of AttributeAtPos that returns a -// hclsyntax.Block rather than an hcl.Block, allowing for further analysis if -// necessary. -func (b *Body) attributeAtPos(pos hcl.Pos) *Attribute { - searchBody := b - _, block := b.blocksAtPos(pos, false) - if block != nil { - searchBody = block.Body - } - - for _, attr := range searchBody.Attributes { - if attr.SrcRange.ContainsPos(pos) { - return attr - } - } - - return nil -} - -// OutermostExprAtPos implements the method of the same name for an *hcl.File -// that is backed by a *Body. -func (b *Body) OutermostExprAtPos(pos hcl.Pos) hcl.Expression { - attr := b.attributeAtPos(pos) - if attr == nil { - return nil - } - if !attr.Expr.Range().ContainsPos(pos) { - return nil - } - return attr.Expr -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/token.go b/vendor/github.com/hashicorp/hcl/v2/hclsyntax/token.go deleted file mode 100644 index c7ffe2073..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclsyntax/token.go +++ /dev/null @@ -1,320 +0,0 @@ -package hclsyntax - -import ( - "bytes" - "fmt" - - "github.com/apparentlymart/go-textseg/textseg" - "github.com/hashicorp/hcl/v2" -) - -// Token represents a sequence of bytes from some HCL code that has been -// tagged with a type and its range within the source file. -type Token struct { - Type TokenType - Bytes []byte - Range hcl.Range -} - -// Tokens is a slice of Token. -type Tokens []Token - -// TokenType is an enumeration used for the Type field on Token. -type TokenType rune - -const ( - // Single-character tokens are represented by their own character, for - // convenience in producing these within the scanner. However, the values - // are otherwise arbitrary and just intended to be mnemonic for humans - // who might see them in debug output. - - TokenOBrace TokenType = '{' - TokenCBrace TokenType = '}' - TokenOBrack TokenType = '[' - TokenCBrack TokenType = ']' - TokenOParen TokenType = '(' - TokenCParen TokenType = ')' - TokenOQuote TokenType = '«' - TokenCQuote TokenType = '»' - TokenOHeredoc TokenType = 'H' - TokenCHeredoc TokenType = 'h' - - TokenStar TokenType = '*' - TokenSlash TokenType = '/' - TokenPlus TokenType = '+' - TokenMinus TokenType = '-' - TokenPercent TokenType = '%' - - TokenEqual TokenType = '=' - TokenEqualOp TokenType = '≔' - TokenNotEqual TokenType = '≠' - TokenLessThan TokenType = '<' - TokenLessThanEq TokenType = '≤' - TokenGreaterThan TokenType = '>' - TokenGreaterThanEq TokenType = '≥' - - TokenAnd TokenType = '∧' - TokenOr TokenType = '∨' - TokenBang TokenType = '!' - - TokenDot TokenType = '.' - TokenComma TokenType = ',' - - TokenEllipsis TokenType = '…' - TokenFatArrow TokenType = '⇒' - - TokenQuestion TokenType = '?' - TokenColon TokenType = ':' - - TokenTemplateInterp TokenType = '∫' - TokenTemplateControl TokenType = 'λ' - TokenTemplateSeqEnd TokenType = '∎' - - TokenQuotedLit TokenType = 'Q' // might contain backslash escapes - TokenStringLit TokenType = 'S' // cannot contain backslash escapes - TokenNumberLit TokenType = 'N' - TokenIdent TokenType = 'I' - - TokenComment TokenType = 'C' - - TokenNewline TokenType = '\n' - TokenEOF TokenType = '␄' - - // The rest are not used in the language but recognized by the scanner so - // we can generate good diagnostics in the parser when users try to write - // things that might work in other languages they are familiar with, or - // simply make incorrect assumptions about the HCL language. - - TokenBitwiseAnd TokenType = '&' - TokenBitwiseOr TokenType = '|' - TokenBitwiseNot TokenType = '~' - TokenBitwiseXor TokenType = '^' - TokenStarStar TokenType = '➚' - TokenApostrophe TokenType = '\'' - TokenBacktick TokenType = '`' - TokenSemicolon TokenType = ';' - TokenTabs TokenType = '␉' - TokenInvalid TokenType = '�' - TokenBadUTF8 TokenType = '💩' - TokenQuotedNewline TokenType = '␤' - - // TokenNil is a placeholder for when a token is required but none is - // available, e.g. when reporting errors. The scanner will never produce - // this as part of a token stream. - TokenNil TokenType = '\x00' -) - -func (t TokenType) GoString() string { - return fmt.Sprintf("hclsyntax.%s", t.String()) -} - -type scanMode int - -const ( - scanNormal scanMode = iota - scanTemplate - scanIdentOnly -) - -type tokenAccum struct { - Filename string - Bytes []byte - Pos hcl.Pos - Tokens []Token - StartByte int -} - -func (f *tokenAccum) emitToken(ty TokenType, startOfs, endOfs int) { - // Walk through our buffer to figure out how much we need to adjust - // the start pos to get our end pos. - - start := f.Pos - start.Column += startOfs + f.StartByte - f.Pos.Byte // Safe because only ASCII spaces can be in the offset - start.Byte = startOfs + f.StartByte - - end := start - end.Byte = endOfs + f.StartByte - b := f.Bytes[startOfs:endOfs] - for len(b) > 0 { - advance, seq, _ := textseg.ScanGraphemeClusters(b, true) - if (len(seq) == 1 && seq[0] == '\n') || (len(seq) == 2 && seq[0] == '\r' && seq[1] == '\n') { - end.Line++ - end.Column = 1 - } else { - end.Column++ - } - b = b[advance:] - } - - f.Pos = end - - f.Tokens = append(f.Tokens, Token{ - Type: ty, - Bytes: f.Bytes[startOfs:endOfs], - Range: hcl.Range{ - Filename: f.Filename, - Start: start, - End: end, - }, - }) -} - -type heredocInProgress struct { - Marker []byte - StartOfLine bool -} - -func tokenOpensFlushHeredoc(tok Token) bool { - if tok.Type != TokenOHeredoc { - return false - } - return bytes.HasPrefix(tok.Bytes, []byte{'<', '<', '-'}) -} - -// checkInvalidTokens does a simple pass across the given tokens and generates -// diagnostics for tokens that should _never_ appear in HCL source. This -// is intended to avoid the need for the parser to have special support -// for them all over. -// -// Returns a diagnostics with no errors if everything seems acceptable. -// Otherwise, returns zero or more error diagnostics, though tries to limit -// repetition of the same information. -func checkInvalidTokens(tokens Tokens) hcl.Diagnostics { - var diags hcl.Diagnostics - - toldBitwise := 0 - toldExponent := 0 - toldBacktick := 0 - toldApostrophe := 0 - toldSemicolon := 0 - toldTabs := 0 - toldBadUTF8 := 0 - - for _, tok := range tokens { - // copy token so it's safe to point to it - tok := tok - - switch tok.Type { - case TokenBitwiseAnd, TokenBitwiseOr, TokenBitwiseXor, TokenBitwiseNot: - if toldBitwise < 4 { - var suggestion string - switch tok.Type { - case TokenBitwiseAnd: - suggestion = " Did you mean boolean AND (\"&&\")?" - case TokenBitwiseOr: - suggestion = " Did you mean boolean OR (\"&&\")?" - case TokenBitwiseNot: - suggestion = " Did you mean boolean NOT (\"!\")?" - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsupported operator", - Detail: fmt.Sprintf("Bitwise operators are not supported.%s", suggestion), - Subject: &tok.Range, - }) - toldBitwise++ - } - case TokenStarStar: - if toldExponent < 1 { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsupported operator", - Detail: "\"**\" is not a supported operator. Exponentiation is not supported as an operator.", - Subject: &tok.Range, - }) - - toldExponent++ - } - case TokenBacktick: - // Only report for alternating (even) backticks, so we won't report both start and ends of the same - // backtick-quoted string. - if (toldBacktick % 2) == 0 { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid character", - Detail: "The \"`\" character is not valid. To create a multi-line string, use the \"heredoc\" syntax, like \"< -# -# This script uses the unicode spec to generate a Ragel state machine -# that recognizes unicode alphanumeric characters. It generates 5 -# character classes: uupper, ulower, ualpha, udigit, and ualnum. -# Currently supported encodings are UTF-8 [default] and UCS-4. -# -# Usage: unicode2ragel.rb [options] -# -e, --encoding [ucs4 | utf8] Data encoding -# -h, --help Show this message -# -# This script was originally written as part of the Ferret search -# engine library. -# -# Author: Rakan El-Khalil - -require 'optparse' -require 'open-uri' - -ENCODINGS = [ :utf8, :ucs4 ] -ALPHTYPES = { :utf8 => "byte", :ucs4 => "rune" } -DEFAULT_CHART_URL = "http://www.unicode.org/Public/5.1.0/ucd/DerivedCoreProperties.txt" -DEFAULT_MACHINE_NAME= "WChar" - -### -# Display vars & default option - -TOTAL_WIDTH = 80 -RANGE_WIDTH = 23 -@encoding = :utf8 -@chart_url = DEFAULT_CHART_URL -machine_name = DEFAULT_MACHINE_NAME -properties = [] -@output = $stdout - -### -# Option parsing - -cli_opts = OptionParser.new do |opts| - opts.on("-e", "--encoding [ucs4 | utf8]", "Data encoding") do |o| - @encoding = o.downcase.to_sym - end - opts.on("-h", "--help", "Show this message") do - puts opts - exit - end - opts.on("-u", "--url URL", "URL to process") do |o| - @chart_url = o - end - opts.on("-m", "--machine MACHINE_NAME", "Machine name") do |o| - machine_name = o - end - opts.on("-p", "--properties x,y,z", Array, "Properties to add to machine") do |o| - properties = o - end - opts.on("-o", "--output FILE", "output file") do |o| - @output = File.new(o, "w+") - end -end - -cli_opts.parse(ARGV) -unless ENCODINGS.member? @encoding - puts "Invalid encoding: #{@encoding}" - puts cli_opts - exit -end - -## -# Downloads the document at url and yields every alpha line's hex -# range and description. - -def each_alpha( url, property ) - open( url ) do |file| - file.each_line do |line| - next if line =~ /^#/; - next if line !~ /; #{property} #/; - - range, description = line.split(/;/) - range.strip! - description.gsub!(/.*#/, '').strip! - - if range =~ /\.\./ - start, stop = range.split '..' - else start = stop = range - end - - yield start.hex .. stop.hex, description - end - end -end - -### -# Formats to hex at minimum width - -def to_hex( n ) - r = "%0X" % n - r = "0#{r}" unless (r.length % 2).zero? - r -end - -### -# UCS4 is just a straight hex conversion of the unicode codepoint. - -def to_ucs4( range ) - rangestr = "0x" + to_hex(range.begin) - rangestr << "..0x" + to_hex(range.end) if range.begin != range.end - [ rangestr ] -end - -## -# 0x00 - 0x7f -> 0zzzzzzz[7] -# 0x80 - 0x7ff -> 110yyyyy[5] 10zzzzzz[6] -# 0x800 - 0xffff -> 1110xxxx[4] 10yyyyyy[6] 10zzzzzz[6] -# 0x010000 - 0x10ffff -> 11110www[3] 10xxxxxx[6] 10yyyyyy[6] 10zzzzzz[6] - -UTF8_BOUNDARIES = [0x7f, 0x7ff, 0xffff, 0x10ffff] - -def to_utf8_enc( n ) - r = 0 - if n <= 0x7f - r = n - elsif n <= 0x7ff - y = 0xc0 | (n >> 6) - z = 0x80 | (n & 0x3f) - r = y << 8 | z - elsif n <= 0xffff - x = 0xe0 | (n >> 12) - y = 0x80 | (n >> 6) & 0x3f - z = 0x80 | n & 0x3f - r = x << 16 | y << 8 | z - elsif n <= 0x10ffff - w = 0xf0 | (n >> 18) - x = 0x80 | (n >> 12) & 0x3f - y = 0x80 | (n >> 6) & 0x3f - z = 0x80 | n & 0x3f - r = w << 24 | x << 16 | y << 8 | z - end - - to_hex(r) -end - -def from_utf8_enc( n ) - n = n.hex - r = 0 - if n <= 0x7f - r = n - elsif n <= 0xdfff - y = (n >> 8) & 0x1f - z = n & 0x3f - r = y << 6 | z - elsif n <= 0xefffff - x = (n >> 16) & 0x0f - y = (n >> 8) & 0x3f - z = n & 0x3f - r = x << 10 | y << 6 | z - elsif n <= 0xf7ffffff - w = (n >> 24) & 0x07 - x = (n >> 16) & 0x3f - y = (n >> 8) & 0x3f - z = n & 0x3f - r = w << 18 | x << 12 | y << 6 | z - end - r -end - -### -# Given a range, splits it up into ranges that can be continuously -# encoded into utf8. Eg: 0x00 .. 0xff => [0x00..0x7f, 0x80..0xff] -# This is not strictly needed since the current [5.1] unicode standard -# doesn't have ranges that straddle utf8 boundaries. This is included -# for completeness as there is no telling if that will ever change. - -def utf8_ranges( range ) - ranges = [] - UTF8_BOUNDARIES.each do |max| - if range.begin <= max - if range.end <= max - ranges << range - return ranges - end - - ranges << (range.begin .. max) - range = (max + 1) .. range.end - end - end - ranges -end - -def build_range( start, stop ) - size = start.size/2 - left = size - 1 - return [""] if size < 1 - - a = start[0..1] - b = stop[0..1] - - ### - # Shared prefix - - if a == b - return build_range(start[2..-1], stop[2..-1]).map do |elt| - "0x#{a} " + elt - end - end - - ### - # Unshared prefix, end of run - - return ["0x#{a}..0x#{b} "] if left.zero? - - ### - # Unshared prefix, not end of run - # Range can be 0x123456..0x56789A - # Which is equivalent to: - # 0x123456 .. 0x12FFFF - # 0x130000 .. 0x55FFFF - # 0x560000 .. 0x56789A - - ret = [] - ret << build_range(start, a + "FF" * left) - - ### - # Only generate middle range if need be. - - if a.hex+1 != b.hex - max = to_hex(b.hex - 1) - max = "FF" if b == "FF" - ret << "0x#{to_hex(a.hex+1)}..0x#{max} " + "0x00..0xFF " * left - end - - ### - # Don't generate last range if it is covered by first range - - ret << build_range(b + "00" * left, stop) unless b == "FF" - ret.flatten! -end - -def to_utf8( range ) - utf8_ranges( range ).map do |r| - begin_enc = to_utf8_enc(r.begin) - end_enc = to_utf8_enc(r.end) - build_range begin_enc, end_enc - end.flatten! -end - -## -# Perform a 3-way comparison of the number of codepoints advertised by -# the unicode spec for the given range, the originally parsed range, -# and the resulting utf8 encoded range. - -def count_codepoints( code ) - code.split(' ').inject(1) do |acc, elt| - if elt =~ /0x(.+)\.\.0x(.+)/ - if @encoding == :utf8 - acc * (from_utf8_enc($2) - from_utf8_enc($1) + 1) - else - acc * ($2.hex - $1.hex + 1) - end - else - acc - end - end -end - -def is_valid?( range, desc, codes ) - spec_count = 1 - spec_count = $1.to_i if desc =~ /\[(\d+)\]/ - range_count = range.end - range.begin + 1 - - sum = codes.inject(0) { |acc, elt| acc + count_codepoints(elt) } - sum == spec_count and sum == range_count -end - -## -# Generate the state maching to stdout - -def generate_machine( name, property ) - pipe = " " - @output.puts " #{name} = " - each_alpha( @chart_url, property ) do |range, desc| - - codes = (@encoding == :ucs4) ? to_ucs4(range) : to_utf8(range) - - #raise "Invalid encoding of range #{range}: #{codes.inspect}" unless - # is_valid? range, desc, codes - - range_width = codes.map { |a| a.size }.max - range_width = RANGE_WIDTH if range_width < RANGE_WIDTH - - desc_width = TOTAL_WIDTH - RANGE_WIDTH - 11 - desc_width -= (range_width - RANGE_WIDTH) if range_width > RANGE_WIDTH - - if desc.size > desc_width - desc = desc[0..desc_width - 4] + "..." - end - - codes.each_with_index do |r, idx| - desc = "" unless idx.zero? - code = "%-#{range_width}s" % r - @output.puts " #{pipe} #{code} ##{desc}" - pipe = "|" - end - end - @output.puts " ;" - @output.puts "" -end - -@output.puts < 0: - line.lead[0].SpacesBefore = 2 * len(indents) - indents = append(indents, netBrackets) - case netBrackets < 0: - closed := -netBrackets - for closed > 0 && len(indents) > 0 { - switch { - - case closed > indents[len(indents)-1]: - closed -= indents[len(indents)-1] - indents = indents[:len(indents)-1] - - case closed < indents[len(indents)-1]: - indents[len(indents)-1] -= closed - closed = 0 - - default: - indents = indents[:len(indents)-1] - closed = 0 - } - } - line.lead[0].SpacesBefore = 2 * len(indents) - default: - line.lead[0].SpacesBefore = 2 * len(indents) - } - } -} - -func formatSpaces(lines []formatLine) { - for _, line := range lines { - for i, token := range line.lead { - var before, after *Token - if i > 0 { - before = line.lead[i-1] - } else { - before = nilToken - } - if i < (len(line.lead) - 1) { - after = line.lead[i+1] - } else { - after = nilToken - } - if spaceAfterToken(token, before, after) { - after.SpacesBefore = 1 - } else { - after.SpacesBefore = 0 - } - } - for i, token := range line.assign { - if i == 0 { - // first token in "assign" always has one space before to - // separate the equals sign from what it's assigning. - token.SpacesBefore = 1 - } - - var before, after *Token - if i > 0 { - before = line.assign[i-1] - } else { - before = nilToken - } - if i < (len(line.assign) - 1) { - after = line.assign[i+1] - } else { - after = nilToken - } - if spaceAfterToken(token, before, after) { - after.SpacesBefore = 1 - } else { - after.SpacesBefore = 0 - } - } - - } -} - -func formatCells(lines []formatLine) { - - chainStart := -1 - maxColumns := 0 - - // We'll deal with the "assign" cell first, since moving that will - // also impact the "comment" cell. - closeAssignChain := func(i int) { - for _, chainLine := range lines[chainStart:i] { - columns := chainLine.lead.Columns() - spaces := (maxColumns - columns) + 1 - chainLine.assign[0].SpacesBefore = spaces - } - chainStart = -1 - maxColumns = 0 - } - for i, line := range lines { - if line.assign == nil { - if chainStart != -1 { - closeAssignChain(i) - } - } else { - if chainStart == -1 { - chainStart = i - } - columns := line.lead.Columns() - if columns > maxColumns { - maxColumns = columns - } - } - } - if chainStart != -1 { - closeAssignChain(len(lines)) - } - - // Now we'll deal with the comments - closeCommentChain := func(i int) { - for _, chainLine := range lines[chainStart:i] { - columns := chainLine.lead.Columns() + chainLine.assign.Columns() - spaces := (maxColumns - columns) + 1 - chainLine.comment[0].SpacesBefore = spaces - } - chainStart = -1 - maxColumns = 0 - } - for i, line := range lines { - if line.comment == nil { - if chainStart != -1 { - closeCommentChain(i) - } - } else { - if chainStart == -1 { - chainStart = i - } - columns := line.lead.Columns() + line.assign.Columns() - if columns > maxColumns { - maxColumns = columns - } - } - } - if chainStart != -1 { - closeCommentChain(len(lines)) - } - -} - -// spaceAfterToken decides whether a particular subject token should have a -// space after it when surrounded by the given before and after tokens. -// "before" can be TokenNil, if the subject token is at the start of a sequence. -func spaceAfterToken(subject, before, after *Token) bool { - switch { - - case after.Type == hclsyntax.TokenNewline || after.Type == hclsyntax.TokenNil: - // Never add spaces before a newline - return false - - case subject.Type == hclsyntax.TokenIdent && after.Type == hclsyntax.TokenOParen: - // Don't split a function name from open paren in a call - return false - - case subject.Type == hclsyntax.TokenDot || after.Type == hclsyntax.TokenDot: - // Don't use spaces around attribute access dots - return false - - case after.Type == hclsyntax.TokenComma || after.Type == hclsyntax.TokenEllipsis: - // No space right before a comma or ... in an argument list - return false - - case subject.Type == hclsyntax.TokenComma: - // Always a space after a comma - return true - - case subject.Type == hclsyntax.TokenQuotedLit || subject.Type == hclsyntax.TokenStringLit || subject.Type == hclsyntax.TokenOQuote || subject.Type == hclsyntax.TokenOHeredoc || after.Type == hclsyntax.TokenQuotedLit || after.Type == hclsyntax.TokenStringLit || after.Type == hclsyntax.TokenCQuote || after.Type == hclsyntax.TokenCHeredoc: - // No extra spaces within templates - return false - - case inKeyword.TokenMatches(subject.asHCLSyntax()) && before.Type == hclsyntax.TokenIdent: - // This is a special case for inside for expressions where a user - // might want to use a literal tuple constructor: - // [for x in [foo]: x] - // ... in that case, we would normally produce in[foo] thinking that - // in is a reference, but we'll recognize it as a keyword here instead - // to make the result less confusing. - return true - - case after.Type == hclsyntax.TokenOBrack && (subject.Type == hclsyntax.TokenIdent || subject.Type == hclsyntax.TokenNumberLit || tokenBracketChange(subject) < 0): - return false - - case subject.Type == hclsyntax.TokenMinus: - // Since a minus can either be subtraction or negation, and the latter - // should _not_ have a space after it, we need to use some heuristics - // to decide which case this is. - // We guess that we have a negation if the token before doesn't look - // like it could be the end of an expression. - - switch before.Type { - - case hclsyntax.TokenNil: - // Minus at the start of input must be a negation - return false - - case hclsyntax.TokenOParen, hclsyntax.TokenOBrace, hclsyntax.TokenOBrack, hclsyntax.TokenEqual, hclsyntax.TokenColon, hclsyntax.TokenComma, hclsyntax.TokenQuestion: - // Minus immediately after an opening bracket or separator must be a negation. - return false - - case hclsyntax.TokenPlus, hclsyntax.TokenStar, hclsyntax.TokenSlash, hclsyntax.TokenPercent, hclsyntax.TokenMinus: - // Minus immediately after another arithmetic operator must be negation. - return false - - case hclsyntax.TokenEqualOp, hclsyntax.TokenNotEqual, hclsyntax.TokenGreaterThan, hclsyntax.TokenGreaterThanEq, hclsyntax.TokenLessThan, hclsyntax.TokenLessThanEq: - // Minus immediately after another comparison operator must be negation. - return false - - case hclsyntax.TokenAnd, hclsyntax.TokenOr, hclsyntax.TokenBang: - // Minus immediately after logical operator doesn't make sense but probably intended as negation. - return false - - default: - return true - } - - case subject.Type == hclsyntax.TokenOBrace || after.Type == hclsyntax.TokenCBrace: - // Unlike other bracket types, braces have spaces on both sides of them, - // both in single-line nested blocks foo { bar = baz } and in object - // constructor expressions foo = { bar = baz }. - if subject.Type == hclsyntax.TokenOBrace && after.Type == hclsyntax.TokenCBrace { - // An open brace followed by a close brace is an exception, however. - // e.g. foo {} rather than foo { } - return false - } - return true - - // In the unlikely event that an interpolation expression is just - // a single object constructor, we'll put a space between the ${ and - // the following { to make this more obvious, and then the same - // thing for the two braces at the end. - case (subject.Type == hclsyntax.TokenTemplateInterp || subject.Type == hclsyntax.TokenTemplateControl) && after.Type == hclsyntax.TokenOBrace: - return true - case subject.Type == hclsyntax.TokenCBrace && after.Type == hclsyntax.TokenTemplateSeqEnd: - return true - - // Don't add spaces between interpolated items - case subject.Type == hclsyntax.TokenTemplateSeqEnd && (after.Type == hclsyntax.TokenTemplateInterp || after.Type == hclsyntax.TokenTemplateControl): - return false - - case tokenBracketChange(subject) > 0: - // No spaces after open brackets - return false - - case tokenBracketChange(after) < 0: - // No spaces before close brackets - return false - - default: - // Most tokens are space-separated - return true - - } -} - -func linesForFormat(tokens Tokens) []formatLine { - if len(tokens) == 0 { - return make([]formatLine, 0) - } - - // first we'll count our lines, so we can allocate the array for them in - // a single block. (We want to minimize memory pressure in this codepath, - // so it can be run somewhat-frequently by editor integrations.) - lineCount := 1 // if there are zero newlines then there is one line - for _, tok := range tokens { - if tokenIsNewline(tok) { - lineCount++ - } - } - - // To start, we'll just put everything in the "lead" cell on each line, - // and then do another pass over the lines afterwards to adjust. - lines := make([]formatLine, lineCount) - li := 0 - lineStart := 0 - for i, tok := range tokens { - if tok.Type == hclsyntax.TokenEOF { - // The EOF token doesn't belong to any line, and terminates the - // token sequence. - lines[li].lead = tokens[lineStart:i] - break - } - - if tokenIsNewline(tok) { - lines[li].lead = tokens[lineStart : i+1] - lineStart = i + 1 - li++ - } - } - - // If a set of tokens doesn't end in TokenEOF (e.g. because it's a - // fragment of tokens from the middle of a file) then we might fall - // out here with a line still pending. - if lineStart < len(tokens) { - lines[li].lead = tokens[lineStart:] - if lines[li].lead[len(lines[li].lead)-1].Type == hclsyntax.TokenEOF { - lines[li].lead = lines[li].lead[:len(lines[li].lead)-1] - } - } - - // Now we'll pick off any trailing comments and attribute assignments - // to shuffle off into the "comment" and "assign" cells. - for i := range lines { - line := &lines[i] - - if len(line.lead) == 0 { - // if the line is empty then there's nothing for us to do - // (this should happen only for the final line, because all other - // lines would have a newline token of some kind) - continue - } - - if len(line.lead) > 1 && line.lead[len(line.lead)-1].Type == hclsyntax.TokenComment { - line.comment = line.lead[len(line.lead)-1:] - line.lead = line.lead[:len(line.lead)-1] - } - - for i, tok := range line.lead { - if i > 0 && tok.Type == hclsyntax.TokenEqual { - // We only move the tokens into "assign" if the RHS seems to - // be a whole expression, which we determine by counting - // brackets. If there's a net positive number of brackets - // then that suggests we're introducing a multi-line expression. - netBrackets := 0 - for _, token := range line.lead[i:] { - netBrackets += tokenBracketChange(token) - } - - if netBrackets == 0 { - line.assign = line.lead[i:] - line.lead = line.lead[:i] - } - break - } - } - } - - return lines -} - -func tokenIsNewline(tok *Token) bool { - if tok.Type == hclsyntax.TokenNewline { - return true - } else if tok.Type == hclsyntax.TokenComment { - // Single line tokens (# and //) consume their terminating newline, - // so we need to treat them as newline tokens as well. - if len(tok.Bytes) > 0 && tok.Bytes[len(tok.Bytes)-1] == '\n' { - return true - } - } - return false -} - -func tokenBracketChange(tok *Token) int { - switch tok.Type { - case hclsyntax.TokenOBrace, hclsyntax.TokenOBrack, hclsyntax.TokenOParen, hclsyntax.TokenTemplateControl, hclsyntax.TokenTemplateInterp: - return 1 - case hclsyntax.TokenCBrace, hclsyntax.TokenCBrack, hclsyntax.TokenCParen, hclsyntax.TokenTemplateSeqEnd: - return -1 - default: - return 0 - } -} - -// formatLine represents a single line of source code for formatting purposes, -// splitting its tokens into up to three "cells": -// -// lead: always present, representing everything up to one of the others -// assign: if line contains an attribute assignment, represents the tokens -// starting at (and including) the equals symbol -// comment: if line contains any non-comment tokens and ends with a -// single-line comment token, represents the comment. -// -// When formatting, the leading spaces of the first tokens in each of these -// cells is adjusted to align vertically their occurences on consecutive -// rows. -type formatLine struct { - lead Tokens - assign Tokens - comment Tokens -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclwrite/generate.go b/vendor/github.com/hashicorp/hcl/v2/hclwrite/generate.go deleted file mode 100644 index 289a30d68..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclwrite/generate.go +++ /dev/null @@ -1,250 +0,0 @@ -package hclwrite - -import ( - "fmt" - "unicode" - "unicode/utf8" - - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" - "github.com/zclconf/go-cty/cty" -) - -// TokensForValue returns a sequence of tokens that represents the given -// constant value. -// -// This function only supports types that are used by HCL. In particular, it -// does not support capsule types and will panic if given one. -// -// It is not possible to express an unknown value in source code, so this -// function will panic if the given value is unknown or contains any unknown -// values. A caller can call the value's IsWhollyKnown method to verify that -// no unknown values are present before calling TokensForValue. -func TokensForValue(val cty.Value) Tokens { - toks := appendTokensForValue(val, nil) - format(toks) // fiddle with the SpacesBefore field to get canonical spacing - return toks -} - -// TokensForTraversal returns a sequence of tokens that represents the given -// traversal. -// -// If the traversal is absolute then the result is a self-contained, valid -// reference expression. If the traversal is relative then the returned tokens -// could be appended to some other expression tokens to traverse into the -// represented expression. -func TokensForTraversal(traversal hcl.Traversal) Tokens { - toks := appendTokensForTraversal(traversal, nil) - format(toks) // fiddle with the SpacesBefore field to get canonical spacing - return toks -} - -func appendTokensForValue(val cty.Value, toks Tokens) Tokens { - switch { - - case !val.IsKnown(): - panic("cannot produce tokens for unknown value") - - case val.IsNull(): - toks = append(toks, &Token{ - Type: hclsyntax.TokenIdent, - Bytes: []byte(`null`), - }) - - case val.Type() == cty.Bool: - var src []byte - if val.True() { - src = []byte(`true`) - } else { - src = []byte(`false`) - } - toks = append(toks, &Token{ - Type: hclsyntax.TokenIdent, - Bytes: src, - }) - - case val.Type() == cty.Number: - bf := val.AsBigFloat() - srcStr := bf.Text('f', -1) - toks = append(toks, &Token{ - Type: hclsyntax.TokenNumberLit, - Bytes: []byte(srcStr), - }) - - case val.Type() == cty.String: - // TODO: If it's a multi-line string ending in a newline, format - // it as a HEREDOC instead. - src := escapeQuotedStringLit(val.AsString()) - toks = append(toks, &Token{ - Type: hclsyntax.TokenOQuote, - Bytes: []byte{'"'}, - }) - if len(src) > 0 { - toks = append(toks, &Token{ - Type: hclsyntax.TokenQuotedLit, - Bytes: src, - }) - } - toks = append(toks, &Token{ - Type: hclsyntax.TokenCQuote, - Bytes: []byte{'"'}, - }) - - case val.Type().IsListType() || val.Type().IsSetType() || val.Type().IsTupleType(): - toks = append(toks, &Token{ - Type: hclsyntax.TokenOBrack, - Bytes: []byte{'['}, - }) - - i := 0 - for it := val.ElementIterator(); it.Next(); { - if i > 0 { - toks = append(toks, &Token{ - Type: hclsyntax.TokenComma, - Bytes: []byte{','}, - }) - } - _, eVal := it.Element() - toks = appendTokensForValue(eVal, toks) - i++ - } - - toks = append(toks, &Token{ - Type: hclsyntax.TokenCBrack, - Bytes: []byte{']'}, - }) - - case val.Type().IsMapType() || val.Type().IsObjectType(): - toks = append(toks, &Token{ - Type: hclsyntax.TokenOBrace, - Bytes: []byte{'{'}, - }) - - i := 0 - for it := val.ElementIterator(); it.Next(); { - if i > 0 { - toks = append(toks, &Token{ - Type: hclsyntax.TokenComma, - Bytes: []byte{','}, - }) - } - eKey, eVal := it.Element() - if hclsyntax.ValidIdentifier(eKey.AsString()) { - toks = append(toks, &Token{ - Type: hclsyntax.TokenIdent, - Bytes: []byte(eKey.AsString()), - }) - } else { - toks = appendTokensForValue(eKey, toks) - } - toks = append(toks, &Token{ - Type: hclsyntax.TokenEqual, - Bytes: []byte{'='}, - }) - toks = appendTokensForValue(eVal, toks) - i++ - } - - toks = append(toks, &Token{ - Type: hclsyntax.TokenCBrace, - Bytes: []byte{'}'}, - }) - - default: - panic(fmt.Sprintf("cannot produce tokens for %#v", val)) - } - - return toks -} - -func appendTokensForTraversal(traversal hcl.Traversal, toks Tokens) Tokens { - for _, step := range traversal { - appendTokensForTraversalStep(step, toks) - } - return toks -} - -func appendTokensForTraversalStep(step hcl.Traverser, toks Tokens) { - switch ts := step.(type) { - case hcl.TraverseRoot: - toks = append(toks, &Token{ - Type: hclsyntax.TokenIdent, - Bytes: []byte(ts.Name), - }) - case hcl.TraverseAttr: - toks = append( - toks, - &Token{ - Type: hclsyntax.TokenDot, - Bytes: []byte{'.'}, - }, - &Token{ - Type: hclsyntax.TokenIdent, - Bytes: []byte(ts.Name), - }, - ) - case hcl.TraverseIndex: - toks = append(toks, &Token{ - Type: hclsyntax.TokenOBrack, - Bytes: []byte{'['}, - }) - appendTokensForValue(ts.Key, toks) - toks = append(toks, &Token{ - Type: hclsyntax.TokenCBrack, - Bytes: []byte{']'}, - }) - default: - panic(fmt.Sprintf("unsupported traversal step type %T", step)) - } -} - -func escapeQuotedStringLit(s string) []byte { - if len(s) == 0 { - return nil - } - buf := make([]byte, 0, len(s)) - for i, r := range s { - switch r { - case '\n': - buf = append(buf, '\\', 'n') - case '\r': - buf = append(buf, '\\', 'r') - case '\t': - buf = append(buf, '\\', 't') - case '"': - buf = append(buf, '\\', '"') - case '\\': - buf = append(buf, '\\', '\\') - case '$', '%': - buf = appendRune(buf, r) - remain := s[i+1:] - if len(remain) > 0 && remain[0] == '{' { - // Double up our template introducer symbol to escape it. - buf = appendRune(buf, r) - } - default: - if !unicode.IsPrint(r) { - var fmted string - if r < 65536 { - fmted = fmt.Sprintf("\\u%04x", r) - } else { - fmted = fmt.Sprintf("\\U%08x", r) - } - buf = append(buf, fmted...) - } else { - buf = appendRune(buf, r) - } - } - } - return buf -} - -func appendRune(b []byte, r rune) []byte { - l := utf8.RuneLen(r) - for i := 0; i < l; i++ { - b = append(b, 0) // make room at the end of our buffer - } - ch := b[len(b)-l:] - utf8.EncodeRune(ch, r) - return b -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclwrite/native_node_sorter.go b/vendor/github.com/hashicorp/hcl/v2/hclwrite/native_node_sorter.go deleted file mode 100644 index cedf68627..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclwrite/native_node_sorter.go +++ /dev/null @@ -1,23 +0,0 @@ -package hclwrite - -import ( - "github.com/hashicorp/hcl/v2/hclsyntax" -) - -type nativeNodeSorter struct { - Nodes []hclsyntax.Node -} - -func (s nativeNodeSorter) Len() int { - return len(s.Nodes) -} - -func (s nativeNodeSorter) Less(i, j int) bool { - rangeI := s.Nodes[i].Range() - rangeJ := s.Nodes[j].Range() - return rangeI.Start.Byte < rangeJ.Start.Byte -} - -func (s nativeNodeSorter) Swap(i, j int) { - s.Nodes[i], s.Nodes[j] = s.Nodes[j], s.Nodes[i] -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclwrite/node.go b/vendor/github.com/hashicorp/hcl/v2/hclwrite/node.go deleted file mode 100644 index 45669f7f9..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclwrite/node.go +++ /dev/null @@ -1,260 +0,0 @@ -package hclwrite - -import ( - "fmt" - - "github.com/google/go-cmp/cmp" -) - -// node represents a node in the AST. -type node struct { - content nodeContent - - list *nodes - before, after *node -} - -func newNode(c nodeContent) *node { - return &node{ - content: c, - } -} - -func (n *node) Equal(other *node) bool { - return cmp.Equal(n.content, other.content) -} - -func (n *node) BuildTokens(to Tokens) Tokens { - return n.content.BuildTokens(to) -} - -// Detach removes the receiver from the list it currently belongs to. If the -// node is not currently in a list, this is a no-op. -func (n *node) Detach() { - if n.list == nil { - return - } - if n.before != nil { - n.before.after = n.after - } - if n.after != nil { - n.after.before = n.before - } - if n.list.first == n { - n.list.first = n.after - } - if n.list.last == n { - n.list.last = n.before - } - n.list = nil - n.before = nil - n.after = nil -} - -// ReplaceWith removes the receiver from the list it currently belongs to and -// inserts a new node with the given content in its place. If the node is not -// currently in a list, this function will panic. -// -// The return value is the newly-constructed node, containing the given content. -// After this function returns, the reciever is no longer attached to a list. -func (n *node) ReplaceWith(c nodeContent) *node { - if n.list == nil { - panic("can't replace node that is not in a list") - } - - before := n.before - after := n.after - list := n.list - n.before, n.after, n.list = nil, nil, nil - - nn := newNode(c) - nn.before = before - nn.after = after - nn.list = list - if before != nil { - before.after = nn - } - if after != nil { - after.before = nn - } - return nn -} - -func (n *node) assertUnattached() { - if n.list != nil { - panic(fmt.Sprintf("attempt to attach already-attached node %#v", n)) - } -} - -// nodeContent is the interface type implemented by all AST content types. -type nodeContent interface { - walkChildNodes(w internalWalkFunc) - BuildTokens(to Tokens) Tokens -} - -// nodes is a list of nodes. -type nodes struct { - first, last *node -} - -func (ns *nodes) BuildTokens(to Tokens) Tokens { - for n := ns.first; n != nil; n = n.after { - to = n.BuildTokens(to) - } - return to -} - -func (ns *nodes) Clear() { - ns.first = nil - ns.last = nil -} - -func (ns *nodes) Append(c nodeContent) *node { - n := &node{ - content: c, - } - ns.AppendNode(n) - n.list = ns - return n -} - -func (ns *nodes) AppendNode(n *node) { - if ns.last != nil { - n.before = ns.last - ns.last.after = n - } - n.list = ns - ns.last = n - if ns.first == nil { - ns.first = n - } -} - -func (ns *nodes) AppendUnstructuredTokens(tokens Tokens) *node { - if len(tokens) == 0 { - return nil - } - n := newNode(tokens) - ns.AppendNode(n) - n.list = ns - return n -} - -// FindNodeWithContent searches the nodes for a node whose content equals -// the given content. If it finds one then it returns it. Otherwise it returns -// nil. -func (ns *nodes) FindNodeWithContent(content nodeContent) *node { - for n := ns.first; n != nil; n = n.after { - if n.content == content { - return n - } - } - return nil -} - -// nodeSet is an unordered set of nodes. It is used to describe a set of nodes -// that all belong to the same list that have some role or characteristic -// in common. -type nodeSet map[*node]struct{} - -func newNodeSet() nodeSet { - return make(nodeSet) -} - -func (ns nodeSet) Has(n *node) bool { - if ns == nil { - return false - } - _, exists := ns[n] - return exists -} - -func (ns nodeSet) Add(n *node) { - ns[n] = struct{}{} -} - -func (ns nodeSet) Remove(n *node) { - delete(ns, n) -} - -func (ns nodeSet) List() []*node { - if len(ns) == 0 { - return nil - } - - ret := make([]*node, 0, len(ns)) - - // Determine which list we are working with. We assume here that all of - // the nodes belong to the same list, since that is part of the contract - // for nodeSet. - var list *nodes - for n := range ns { - list = n.list - break - } - - // We recover the order by iterating over the whole list. This is not - // the most efficient way to do it, but our node lists should always be - // small so not worth making things more complex. - for n := list.first; n != nil; n = n.after { - if ns.Has(n) { - ret = append(ret, n) - } - } - return ret -} - -// FindNodeWithContent searches the nodes for a node whose content equals -// the given content. If it finds one then it returns it. Otherwise it returns -// nil. -func (ns nodeSet) FindNodeWithContent(content nodeContent) *node { - for n := range ns { - if n.content == content { - return n - } - } - return nil -} - -type internalWalkFunc func(*node) - -// inTree can be embedded into a content struct that has child nodes to get -// a standard implementation of the NodeContent interface and a record of -// a potential parent node. -type inTree struct { - parent *node - children *nodes -} - -func newInTree() inTree { - return inTree{ - children: &nodes{}, - } -} - -func (it *inTree) assertUnattached() { - if it.parent != nil { - panic(fmt.Sprintf("node is already attached to %T", it.parent.content)) - } -} - -func (it *inTree) walkChildNodes(w internalWalkFunc) { - for n := it.children.first; n != nil; n = n.after { - w(n) - } -} - -func (it *inTree) BuildTokens(to Tokens) Tokens { - for n := it.children.first; n != nil; n = n.after { - to = n.BuildTokens(to) - } - return to -} - -// leafNode can be embedded into a content struct to give it a do-nothing -// implementation of walkChildNodes -type leafNode struct { -} - -func (n *leafNode) walkChildNodes(w internalWalkFunc) { -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclwrite/parser.go b/vendor/github.com/hashicorp/hcl/v2/hclwrite/parser.go deleted file mode 100644 index d6cf532ea..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclwrite/parser.go +++ /dev/null @@ -1,599 +0,0 @@ -package hclwrite - -import ( - "fmt" - "sort" - - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" - "github.com/zclconf/go-cty/cty" -) - -// Our "parser" here is actually not doing any parsing of its own. Instead, -// it leans on the native parser in hclsyntax, and then uses the source ranges -// from the AST to partition the raw token sequence to match the raw tokens -// up to AST nodes. -// -// This strategy feels somewhat counter-intuitive, since most of the work the -// parser does is thrown away here, but this strategy is chosen because the -// normal parsing work done by hclsyntax is considered to be the "main case", -// while modifying and re-printing source is more of an edge case, used only -// in ancillary tools, and so it's good to keep all the main parsing logic -// with the main case but keep all of the extra complexity of token wrangling -// out of the main parser, which is already rather complex just serving the -// use-cases it already serves. -// -// If the parsing step produces any errors, the returned File is nil because -// we can't reliably extract tokens from the partial AST produced by an -// erroneous parse. -func parse(src []byte, filename string, start hcl.Pos) (*File, hcl.Diagnostics) { - file, diags := hclsyntax.ParseConfig(src, filename, start) - if diags.HasErrors() { - return nil, diags - } - - // To do our work here, we use the "native" tokens (those from hclsyntax) - // to match against source ranges in the AST, but ultimately produce - // slices from our sequence of "writer" tokens, which contain only - // *relative* position information that is more appropriate for - // transformation/writing use-cases. - nativeTokens, diags := hclsyntax.LexConfig(src, filename, start) - if diags.HasErrors() { - // should never happen, since we would've caught these diags in - // the first call above. - return nil, diags - } - writerTokens := writerTokens(nativeTokens) - - from := inputTokens{ - nativeTokens: nativeTokens, - writerTokens: writerTokens, - } - - before, root, after := parseBody(file.Body.(*hclsyntax.Body), from) - ret := &File{ - inTree: newInTree(), - - srcBytes: src, - body: root, - } - - nodes := ret.inTree.children - nodes.Append(before.Tokens()) - nodes.AppendNode(root) - nodes.Append(after.Tokens()) - - return ret, diags -} - -type inputTokens struct { - nativeTokens hclsyntax.Tokens - writerTokens Tokens -} - -func (it inputTokens) Partition(rng hcl.Range) (before, within, after inputTokens) { - start, end := partitionTokens(it.nativeTokens, rng) - before = it.Slice(0, start) - within = it.Slice(start, end) - after = it.Slice(end, len(it.nativeTokens)) - return -} - -func (it inputTokens) PartitionType(ty hclsyntax.TokenType) (before, within, after inputTokens) { - for i, t := range it.writerTokens { - if t.Type == ty { - return it.Slice(0, i), it.Slice(i, i+1), it.Slice(i+1, len(it.nativeTokens)) - } - } - panic(fmt.Sprintf("didn't find any token of type %s", ty)) -} - -func (it inputTokens) PartitionTypeSingle(ty hclsyntax.TokenType) (before inputTokens, found *Token, after inputTokens) { - before, within, after := it.PartitionType(ty) - if within.Len() != 1 { - panic("PartitionType found more than one token") - } - return before, within.Tokens()[0], after -} - -// PartitionIncludeComments is like Partition except the returned "within" -// range includes any lead and line comments associated with the range. -func (it inputTokens) PartitionIncludingComments(rng hcl.Range) (before, within, after inputTokens) { - start, end := partitionTokens(it.nativeTokens, rng) - start = partitionLeadCommentTokens(it.nativeTokens[:start]) - _, afterNewline := partitionLineEndTokens(it.nativeTokens[end:]) - end += afterNewline - - before = it.Slice(0, start) - within = it.Slice(start, end) - after = it.Slice(end, len(it.nativeTokens)) - return - -} - -// PartitionBlockItem is similar to PartitionIncludeComments but it returns -// the comments as separate token sequences so that they can be captured into -// AST attributes. It makes assumptions that apply only to block items, so -// should not be used for other constructs. -func (it inputTokens) PartitionBlockItem(rng hcl.Range) (before, leadComments, within, lineComments, newline, after inputTokens) { - before, within, after = it.Partition(rng) - before, leadComments = before.PartitionLeadComments() - lineComments, newline, after = after.PartitionLineEndTokens() - return -} - -func (it inputTokens) PartitionLeadComments() (before, within inputTokens) { - start := partitionLeadCommentTokens(it.nativeTokens) - before = it.Slice(0, start) - within = it.Slice(start, len(it.nativeTokens)) - return -} - -func (it inputTokens) PartitionLineEndTokens() (comments, newline, after inputTokens) { - afterComments, afterNewline := partitionLineEndTokens(it.nativeTokens) - comments = it.Slice(0, afterComments) - newline = it.Slice(afterComments, afterNewline) - after = it.Slice(afterNewline, len(it.nativeTokens)) - return -} - -func (it inputTokens) Slice(start, end int) inputTokens { - // When we slice, we create a new slice with no additional capacity because - // we expect that these slices will be mutated in order to insert - // new code into the AST, and we want to ensure that a new underlying - // array gets allocated in that case, rather than writing into some - // following slice and corrupting it. - return inputTokens{ - nativeTokens: it.nativeTokens[start:end:end], - writerTokens: it.writerTokens[start:end:end], - } -} - -func (it inputTokens) Len() int { - return len(it.nativeTokens) -} - -func (it inputTokens) Tokens() Tokens { - return it.writerTokens -} - -func (it inputTokens) Types() []hclsyntax.TokenType { - ret := make([]hclsyntax.TokenType, len(it.nativeTokens)) - for i, tok := range it.nativeTokens { - ret[i] = tok.Type - } - return ret -} - -// parseBody locates the given body within the given input tokens and returns -// the resulting *Body object as well as the tokens that appeared before and -// after it. -func parseBody(nativeBody *hclsyntax.Body, from inputTokens) (inputTokens, *node, inputTokens) { - before, within, after := from.PartitionIncludingComments(nativeBody.SrcRange) - - // The main AST doesn't retain the original source ordering of the - // body items, so we need to reconstruct that ordering by inspecting - // their source ranges. - nativeItems := make([]hclsyntax.Node, 0, len(nativeBody.Attributes)+len(nativeBody.Blocks)) - for _, nativeAttr := range nativeBody.Attributes { - nativeItems = append(nativeItems, nativeAttr) - } - for _, nativeBlock := range nativeBody.Blocks { - nativeItems = append(nativeItems, nativeBlock) - } - sort.Sort(nativeNodeSorter{nativeItems}) - - body := &Body{ - inTree: newInTree(), - items: newNodeSet(), - } - - remain := within - for _, nativeItem := range nativeItems { - beforeItem, item, afterItem := parseBodyItem(nativeItem, remain) - - if beforeItem.Len() > 0 { - body.AppendUnstructuredTokens(beforeItem.Tokens()) - } - body.appendItemNode(item) - - remain = afterItem - } - - if remain.Len() > 0 { - body.AppendUnstructuredTokens(remain.Tokens()) - } - - return before, newNode(body), after -} - -func parseBodyItem(nativeItem hclsyntax.Node, from inputTokens) (inputTokens, *node, inputTokens) { - before, leadComments, within, lineComments, newline, after := from.PartitionBlockItem(nativeItem.Range()) - - var item *node - - switch tItem := nativeItem.(type) { - case *hclsyntax.Attribute: - item = parseAttribute(tItem, within, leadComments, lineComments, newline) - case *hclsyntax.Block: - item = parseBlock(tItem, within, leadComments, lineComments, newline) - default: - // should never happen if caller is behaving - panic("unsupported native item type") - } - - return before, item, after -} - -func parseAttribute(nativeAttr *hclsyntax.Attribute, from, leadComments, lineComments, newline inputTokens) *node { - attr := &Attribute{ - inTree: newInTree(), - } - children := attr.inTree.children - - { - cn := newNode(newComments(leadComments.Tokens())) - attr.leadComments = cn - children.AppendNode(cn) - } - - before, nameTokens, from := from.Partition(nativeAttr.NameRange) - { - children.AppendUnstructuredTokens(before.Tokens()) - if nameTokens.Len() != 1 { - // Should never happen with valid input - panic("attribute name is not exactly one token") - } - token := nameTokens.Tokens()[0] - in := newNode(newIdentifier(token)) - attr.name = in - children.AppendNode(in) - } - - before, equalsTokens, from := from.Partition(nativeAttr.EqualsRange) - children.AppendUnstructuredTokens(before.Tokens()) - children.AppendUnstructuredTokens(equalsTokens.Tokens()) - - before, exprTokens, from := from.Partition(nativeAttr.Expr.Range()) - { - children.AppendUnstructuredTokens(before.Tokens()) - exprNode := parseExpression(nativeAttr.Expr, exprTokens) - attr.expr = exprNode - children.AppendNode(exprNode) - } - - { - cn := newNode(newComments(lineComments.Tokens())) - attr.lineComments = cn - children.AppendNode(cn) - } - - children.AppendUnstructuredTokens(newline.Tokens()) - - // Collect any stragglers, though there shouldn't be any - children.AppendUnstructuredTokens(from.Tokens()) - - return newNode(attr) -} - -func parseBlock(nativeBlock *hclsyntax.Block, from, leadComments, lineComments, newline inputTokens) *node { - block := &Block{ - inTree: newInTree(), - labels: newNodeSet(), - } - children := block.inTree.children - - { - cn := newNode(newComments(leadComments.Tokens())) - block.leadComments = cn - children.AppendNode(cn) - } - - before, typeTokens, from := from.Partition(nativeBlock.TypeRange) - { - children.AppendUnstructuredTokens(before.Tokens()) - if typeTokens.Len() != 1 { - // Should never happen with valid input - panic("block type name is not exactly one token") - } - token := typeTokens.Tokens()[0] - in := newNode(newIdentifier(token)) - block.typeName = in - children.AppendNode(in) - } - - for _, rng := range nativeBlock.LabelRanges { - var labelTokens inputTokens - before, labelTokens, from = from.Partition(rng) - children.AppendUnstructuredTokens(before.Tokens()) - tokens := labelTokens.Tokens() - var ln *node - if len(tokens) == 1 && tokens[0].Type == hclsyntax.TokenIdent { - ln = newNode(newIdentifier(tokens[0])) - } else { - ln = newNode(newQuoted(tokens)) - } - block.labels.Add(ln) - children.AppendNode(ln) - } - - before, oBrace, from := from.Partition(nativeBlock.OpenBraceRange) - children.AppendUnstructuredTokens(before.Tokens()) - children.AppendUnstructuredTokens(oBrace.Tokens()) - - // We go a bit out of order here: we go hunting for the closing brace - // so that we have a delimited body, but then we'll deal with the body - // before we actually append the closing brace and any straggling tokens - // that appear after it. - bodyTokens, cBrace, from := from.Partition(nativeBlock.CloseBraceRange) - before, body, after := parseBody(nativeBlock.Body, bodyTokens) - children.AppendUnstructuredTokens(before.Tokens()) - block.body = body - children.AppendNode(body) - children.AppendUnstructuredTokens(after.Tokens()) - - children.AppendUnstructuredTokens(cBrace.Tokens()) - - // stragglers - children.AppendUnstructuredTokens(from.Tokens()) - if lineComments.Len() > 0 { - // blocks don't actually have line comments, so we'll just treat - // them as extra stragglers - children.AppendUnstructuredTokens(lineComments.Tokens()) - } - children.AppendUnstructuredTokens(newline.Tokens()) - - return newNode(block) -} - -func parseExpression(nativeExpr hclsyntax.Expression, from inputTokens) *node { - expr := newExpression() - children := expr.inTree.children - - nativeVars := nativeExpr.Variables() - - for _, nativeTraversal := range nativeVars { - before, traversal, after := parseTraversal(nativeTraversal, from) - children.AppendUnstructuredTokens(before.Tokens()) - children.AppendNode(traversal) - expr.absTraversals.Add(traversal) - from = after - } - // Attach any stragglers that don't belong to a traversal to the expression - // itself. In an expression with no traversals at all, this is just the - // entirety of "from". - children.AppendUnstructuredTokens(from.Tokens()) - - return newNode(expr) -} - -func parseTraversal(nativeTraversal hcl.Traversal, from inputTokens) (before inputTokens, n *node, after inputTokens) { - traversal := newTraversal() - children := traversal.inTree.children - before, from, after = from.Partition(nativeTraversal.SourceRange()) - - stepAfter := from - for _, nativeStep := range nativeTraversal { - before, step, after := parseTraversalStep(nativeStep, stepAfter) - children.AppendUnstructuredTokens(before.Tokens()) - children.AppendNode(step) - traversal.steps.Add(step) - stepAfter = after - } - - return before, newNode(traversal), after -} - -func parseTraversalStep(nativeStep hcl.Traverser, from inputTokens) (before inputTokens, n *node, after inputTokens) { - var children *nodes - switch tNativeStep := nativeStep.(type) { - - case hcl.TraverseRoot, hcl.TraverseAttr: - step := newTraverseName() - children = step.inTree.children - before, from, after = from.Partition(nativeStep.SourceRange()) - inBefore, token, inAfter := from.PartitionTypeSingle(hclsyntax.TokenIdent) - name := newIdentifier(token) - children.AppendUnstructuredTokens(inBefore.Tokens()) - step.name = children.Append(name) - children.AppendUnstructuredTokens(inAfter.Tokens()) - return before, newNode(step), after - - case hcl.TraverseIndex: - step := newTraverseIndex() - children = step.inTree.children - before, from, after = from.Partition(nativeStep.SourceRange()) - - var inBefore, oBrack, keyTokens, cBrack inputTokens - inBefore, oBrack, from = from.PartitionType(hclsyntax.TokenOBrack) - children.AppendUnstructuredTokens(inBefore.Tokens()) - children.AppendUnstructuredTokens(oBrack.Tokens()) - keyTokens, cBrack, from = from.PartitionType(hclsyntax.TokenCBrack) - - keyVal := tNativeStep.Key - switch keyVal.Type() { - case cty.String: - key := newQuoted(keyTokens.Tokens()) - step.key = children.Append(key) - case cty.Number: - valBefore, valToken, valAfter := keyTokens.PartitionTypeSingle(hclsyntax.TokenNumberLit) - children.AppendUnstructuredTokens(valBefore.Tokens()) - key := newNumber(valToken) - step.key = children.Append(key) - children.AppendUnstructuredTokens(valAfter.Tokens()) - } - - children.AppendUnstructuredTokens(cBrack.Tokens()) - children.AppendUnstructuredTokens(from.Tokens()) - - return before, newNode(step), after - default: - panic(fmt.Sprintf("unsupported traversal step type %T", nativeStep)) - } - -} - -// writerTokens takes a sequence of tokens as produced by the main hclsyntax -// package and transforms it into an equivalent sequence of tokens using -// this package's own token model. -// -// The resulting list contains the same number of tokens and uses the same -// indices as the input, allowing the two sets of tokens to be correlated -// by index. -func writerTokens(nativeTokens hclsyntax.Tokens) Tokens { - // Ultimately we want a slice of token _pointers_, but since we can - // predict how much memory we're going to devote to tokens we'll allocate - // it all as a single flat buffer and thus give the GC less work to do. - tokBuf := make([]Token, len(nativeTokens)) - var lastByteOffset int - for i, mainToken := range nativeTokens { - // Create a copy of the bytes so that we can mutate without - // corrupting the original token stream. - bytes := make([]byte, len(mainToken.Bytes)) - copy(bytes, mainToken.Bytes) - - tokBuf[i] = Token{ - Type: mainToken.Type, - Bytes: bytes, - - // We assume here that spaces are always ASCII spaces, since - // that's what the scanner also assumes, and thus the number - // of bytes skipped is also the number of space characters. - SpacesBefore: mainToken.Range.Start.Byte - lastByteOffset, - } - - lastByteOffset = mainToken.Range.End.Byte - } - - // Now make a slice of pointers into the previous slice. - ret := make(Tokens, len(tokBuf)) - for i := range ret { - ret[i] = &tokBuf[i] - } - - return ret -} - -// partitionTokens takes a sequence of tokens and a hcl.Range and returns -// two indices within the token sequence that correspond with the range -// boundaries, such that the slice operator could be used to produce -// three token sequences for before, within, and after respectively: -// -// start, end := partitionTokens(toks, rng) -// before := toks[:start] -// within := toks[start:end] -// after := toks[end:] -// -// This works best when the range is aligned with token boundaries (e.g. -// because it was produced in terms of the scanner's result) but if that isn't -// true then it will make a best effort that may produce strange results at -// the boundaries. -// -// Native hclsyntax tokens are used here, because they contain the necessary -// absolute position information. However, since writerTokens produces a -// correlatable sequence of writer tokens, the resulting indices can be -// used also to index into its result, allowing the partitioning of writer -// tokens to be driven by the partitioning of native tokens. -// -// The tokens are assumed to be in source order and non-overlapping, which -// will be true if the token sequence from the scanner is used directly. -func partitionTokens(toks hclsyntax.Tokens, rng hcl.Range) (start, end int) { - // We us a linear search here because we assume tha in most cases our - // target range is close to the beginning of the sequence, and the seqences - // are generally small for most reasonable files anyway. - for i := 0; ; i++ { - if i >= len(toks) { - // No tokens for the given range at all! - return len(toks), len(toks) - } - - if toks[i].Range.Start.Byte >= rng.Start.Byte { - start = i - break - } - } - - for i := start; ; i++ { - if i >= len(toks) { - // The range "hangs off" the end of the token sequence - return start, len(toks) - } - - if toks[i].Range.Start.Byte >= rng.End.Byte { - end = i // end marker is exclusive - break - } - } - - return start, end -} - -// partitionLeadCommentTokens takes a sequence of tokens that is assumed -// to immediately precede a construct that can have lead comment tokens, -// and returns the index into that sequence where the lead comments begin. -// -// Lead comments are defined as whole lines containing only comment tokens -// with no blank lines between. If no such lines are found, the returned -// index will be len(toks). -func partitionLeadCommentTokens(toks hclsyntax.Tokens) int { - // single-line comments (which is what we're interested in here) - // consume their trailing newline, so we can just walk backwards - // until we stop seeing comment tokens. - for i := len(toks) - 1; i >= 0; i-- { - if toks[i].Type != hclsyntax.TokenComment { - return i + 1 - } - } - return 0 -} - -// partitionLineEndTokens takes a sequence of tokens that is assumed -// to immediately follow a construct that can have a line comment, and -// returns first the index where any line comments end and then second -// the index immediately after the trailing newline. -// -// Line comments are defined as comments that appear immediately after -// a construct on the same line where its significant tokens ended. -// -// Since single-line comment tokens (# and //) include the newline that -// terminates them, in the presence of these the two returned indices -// will be the same since the comment itself serves as the line end. -func partitionLineEndTokens(toks hclsyntax.Tokens) (afterComment, afterNewline int) { - for i := 0; i < len(toks); i++ { - tok := toks[i] - if tok.Type != hclsyntax.TokenComment { - switch tok.Type { - case hclsyntax.TokenNewline: - return i, i + 1 - case hclsyntax.TokenEOF: - // Although this is valid, we mustn't include the EOF - // itself as our "newline" or else strange things will - // happen when we try to append new items. - return i, i - default: - // If we have well-formed input here then nothing else should be - // possible. This path should never happen, because we only try - // to extract tokens from the sequence if the parser succeeded, - // and it should catch this problem itself. - panic("malformed line trailers: expected only comments and newlines") - } - } - - if len(tok.Bytes) > 0 && tok.Bytes[len(tok.Bytes)-1] == '\n' { - // Newline at the end of a single-line comment serves both as - // the end of comments *and* the end of the line. - return i + 1, i + 1 - } - } - return len(toks), len(toks) -} - -// lexConfig uses the hclsyntax scanner to get a token stream and then -// rewrites it into this package's token model. -// -// Any errors produced during scanning are ignored, so the results of this -// function should be used with care. -func lexConfig(src []byte) Tokens { - mainTokens, _ := hclsyntax.LexConfig(src, "", hcl.Pos{Byte: 0, Line: 1, Column: 1}) - return writerTokens(mainTokens) -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclwrite/public.go b/vendor/github.com/hashicorp/hcl/v2/hclwrite/public.go deleted file mode 100644 index 678a3aa45..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclwrite/public.go +++ /dev/null @@ -1,44 +0,0 @@ -package hclwrite - -import ( - "bytes" - - "github.com/hashicorp/hcl/v2" -) - -// NewFile creates a new file object that is empty and ready to have constructs -// added t it. -func NewFile() *File { - body := &Body{ - inTree: newInTree(), - items: newNodeSet(), - } - file := &File{ - inTree: newInTree(), - } - file.body = file.inTree.children.Append(body) - return file -} - -// ParseConfig interprets the given source bytes into a *hclwrite.File. The -// resulting AST can be used to perform surgical edits on the source code -// before turning it back into bytes again. -func ParseConfig(src []byte, filename string, start hcl.Pos) (*File, hcl.Diagnostics) { - return parse(src, filename, start) -} - -// Format takes source code and performs simple whitespace changes to transform -// it to a canonical layout style. -// -// Format skips constructing an AST and works directly with tokens, so it -// is less expensive than formatting via the AST for situations where no other -// changes will be made. It also ignores syntax errors and can thus be applied -// to partial source code, although the result in that case may not be -// desirable. -func Format(src []byte) []byte { - tokens := lexConfig(src) - format(tokens) - buf := &bytes.Buffer{} - tokens.WriteTo(buf) - return buf.Bytes() -} diff --git a/vendor/github.com/hashicorp/hcl/v2/hclwrite/tokens.go b/vendor/github.com/hashicorp/hcl/v2/hclwrite/tokens.go deleted file mode 100644 index 3bd3e5f48..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/hclwrite/tokens.go +++ /dev/null @@ -1,122 +0,0 @@ -package hclwrite - -import ( - "bytes" - "io" - - "github.com/apparentlymart/go-textseg/textseg" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" -) - -// Token is a single sequence of bytes annotated with a type. It is similar -// in purpose to hclsyntax.Token, but discards the source position information -// since that is not useful in code generation. -type Token struct { - Type hclsyntax.TokenType - Bytes []byte - - // We record the number of spaces before each token so that we can - // reproduce the exact layout of the original file when we're making - // surgical changes in-place. When _new_ code is created it will always - // be in the canonical style, but we preserve layout of existing code. - SpacesBefore int -} - -// asHCLSyntax returns the receiver expressed as an incomplete hclsyntax.Token. -// A complete token is not possible since we don't have source location -// information here, and so this method is unexported so we can be sure it will -// only be used for internal purposes where we know the range isn't important. -// -// This is primarily intended to allow us to re-use certain functionality from -// hclsyntax rather than re-implementing it against our own token type here. -func (t *Token) asHCLSyntax() hclsyntax.Token { - return hclsyntax.Token{ - Type: t.Type, - Bytes: t.Bytes, - Range: hcl.Range{ - Filename: "", - }, - } -} - -// Tokens is a flat list of tokens. -type Tokens []*Token - -func (ts Tokens) Bytes() []byte { - buf := &bytes.Buffer{} - ts.WriteTo(buf) - return buf.Bytes() -} - -func (ts Tokens) testValue() string { - return string(ts.Bytes()) -} - -// Columns returns the number of columns (grapheme clusters) the token sequence -// occupies. The result is not meaningful if there are newline or single-line -// comment tokens in the sequence. -func (ts Tokens) Columns() int { - ret := 0 - for _, token := range ts { - ret += token.SpacesBefore // spaces are always worth one column each - ct, _ := textseg.TokenCount(token.Bytes, textseg.ScanGraphemeClusters) - ret += ct - } - return ret -} - -// WriteTo takes an io.Writer and writes the bytes for each token to it, -// along with the spacing that separates each token. In other words, this -// allows serializing the tokens to a file or other such byte stream. -func (ts Tokens) WriteTo(wr io.Writer) (int64, error) { - // We know we're going to be writing a lot of small chunks of repeated - // space characters, so we'll prepare a buffer of these that we can - // easily pass to wr.Write without any further allocation. - spaces := make([]byte, 40) - for i := range spaces { - spaces[i] = ' ' - } - - var n int64 - var err error - for _, token := range ts { - if err != nil { - return n, err - } - - for spacesBefore := token.SpacesBefore; spacesBefore > 0; spacesBefore -= len(spaces) { - thisChunk := spacesBefore - if thisChunk > len(spaces) { - thisChunk = len(spaces) - } - var thisN int - thisN, err = wr.Write(spaces[:thisChunk]) - n += int64(thisN) - if err != nil { - return n, err - } - } - - var thisN int - thisN, err = wr.Write(token.Bytes) - n += int64(thisN) - } - - return n, err -} - -func (ts Tokens) walkChildNodes(w internalWalkFunc) { - // Unstructured tokens have no child nodes -} - -func (ts Tokens) BuildTokens(to Tokens) Tokens { - return append(to, ts...) -} - -func newIdentToken(name string) *Token { - return &Token{ - Type: hclsyntax.TokenIdent, - Bytes: []byte(name), - } -} diff --git a/vendor/github.com/hashicorp/hcl/v2/json/ast.go b/vendor/github.com/hashicorp/hcl/v2/json/ast.go deleted file mode 100644 index 9c580ca34..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/ast.go +++ /dev/null @@ -1,121 +0,0 @@ -package json - -import ( - "math/big" - - "github.com/hashicorp/hcl/v2" -) - -type node interface { - Range() hcl.Range - StartRange() hcl.Range -} - -type objectVal struct { - Attrs []*objectAttr - SrcRange hcl.Range // range of the entire object, brace-to-brace - OpenRange hcl.Range // range of the opening brace - CloseRange hcl.Range // range of the closing brace -} - -func (n *objectVal) Range() hcl.Range { - return n.SrcRange -} - -func (n *objectVal) StartRange() hcl.Range { - return n.OpenRange -} - -type objectAttr struct { - Name string - Value node - NameRange hcl.Range // range of the name string -} - -func (n *objectAttr) Range() hcl.Range { - return n.NameRange -} - -func (n *objectAttr) StartRange() hcl.Range { - return n.NameRange -} - -type arrayVal struct { - Values []node - SrcRange hcl.Range // range of the entire object, bracket-to-bracket - OpenRange hcl.Range // range of the opening bracket -} - -func (n *arrayVal) Range() hcl.Range { - return n.SrcRange -} - -func (n *arrayVal) StartRange() hcl.Range { - return n.OpenRange -} - -type booleanVal struct { - Value bool - SrcRange hcl.Range -} - -func (n *booleanVal) Range() hcl.Range { - return n.SrcRange -} - -func (n *booleanVal) StartRange() hcl.Range { - return n.SrcRange -} - -type numberVal struct { - Value *big.Float - SrcRange hcl.Range -} - -func (n *numberVal) Range() hcl.Range { - return n.SrcRange -} - -func (n *numberVal) StartRange() hcl.Range { - return n.SrcRange -} - -type stringVal struct { - Value string - SrcRange hcl.Range -} - -func (n *stringVal) Range() hcl.Range { - return n.SrcRange -} - -func (n *stringVal) StartRange() hcl.Range { - return n.SrcRange -} - -type nullVal struct { - SrcRange hcl.Range -} - -func (n *nullVal) Range() hcl.Range { - return n.SrcRange -} - -func (n *nullVal) StartRange() hcl.Range { - return n.SrcRange -} - -// invalidVal is used as a placeholder where a value is needed for a valid -// parse tree but the input was invalid enough to prevent one from being -// created. -type invalidVal struct { - SrcRange hcl.Range -} - -func (n invalidVal) Range() hcl.Range { - return n.SrcRange -} - -func (n invalidVal) StartRange() hcl.Range { - return n.SrcRange -} diff --git a/vendor/github.com/hashicorp/hcl/v2/json/didyoumean.go b/vendor/github.com/hashicorp/hcl/v2/json/didyoumean.go deleted file mode 100644 index fbdd8bff5..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/didyoumean.go +++ /dev/null @@ -1,33 +0,0 @@ -package json - -import ( - "github.com/agext/levenshtein" -) - -var keywords = []string{"false", "true", "null"} - -// keywordSuggestion tries to find a valid JSON keyword that is close to the -// given string and returns it if found. If no keyword is close enough, returns -// the empty string. -func keywordSuggestion(given string) string { - return nameSuggestion(given, keywords) -} - -// nameSuggestion tries to find a name from the given slice of suggested names -// that is close to the given name and returns it if found. If no suggestion -// is close enough, returns the empty string. -// -// The suggestions are tried in order, so earlier suggestions take precedence -// if the given string is similar to two or more suggestions. -// -// This function is intended to be used with a relatively-small number of -// suggestions. It's not optimized for hundreds or thousands of them. -func nameSuggestion(given string, suggestions []string) string { - for _, suggestion := range suggestions { - dist := levenshtein.Distance(given, suggestion, nil) - if dist < 3 { // threshold determined experimentally - return suggestion - } - } - return "" -} diff --git a/vendor/github.com/hashicorp/hcl/v2/json/doc.go b/vendor/github.com/hashicorp/hcl/v2/json/doc.go deleted file mode 100644 index 84d731939..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Package json is the JSON parser for HCL. It parses JSON files and returns -// implementations of the core HCL structural interfaces in terms of the -// JSON data inside. -// -// This is not a generic JSON parser. Instead, it deals with the mapping from -// the JSON information model to the HCL information model, using a number -// of hard-coded structural conventions. -// -// In most cases applications will not import this package directly, but will -// instead access its functionality indirectly through functions in the main -// "hcl" package and in the "hclparse" package. -package json diff --git a/vendor/github.com/hashicorp/hcl/v2/json/navigation.go b/vendor/github.com/hashicorp/hcl/v2/json/navigation.go deleted file mode 100644 index bc8a97f74..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/navigation.go +++ /dev/null @@ -1,70 +0,0 @@ -package json - -import ( - "fmt" - "strings" -) - -type navigation struct { - root node -} - -// Implementation of hcled.ContextString -func (n navigation) ContextString(offset int) string { - steps := navigationStepsRev(n.root, offset) - if steps == nil { - return "" - } - - // We built our slice backwards, so we'll reverse it in-place now. - half := len(steps) / 2 // integer division - for i := 0; i < half; i++ { - steps[i], steps[len(steps)-1-i] = steps[len(steps)-1-i], steps[i] - } - - ret := strings.Join(steps, "") - if len(ret) > 0 && ret[0] == '.' { - ret = ret[1:] - } - return ret -} - -func navigationStepsRev(v node, offset int) []string { - switch tv := v.(type) { - case *objectVal: - // Do any of our properties have an object that contains the target - // offset? - for _, attr := range tv.Attrs { - k := attr.Name - av := attr.Value - - switch av.(type) { - case *objectVal, *arrayVal: - // okay - default: - continue - } - - if av.Range().ContainsOffset(offset) { - return append(navigationStepsRev(av, offset), "."+k) - } - } - case *arrayVal: - // Do any of our elements contain the target offset? - for i, elem := range tv.Values { - - switch elem.(type) { - case *objectVal, *arrayVal: - // okay - default: - continue - } - - if elem.Range().ContainsOffset(offset) { - return append(navigationStepsRev(elem, offset), fmt.Sprintf("[%d]", i)) - } - } - } - - return nil -} diff --git a/vendor/github.com/hashicorp/hcl/v2/json/parser.go b/vendor/github.com/hashicorp/hcl/v2/json/parser.go deleted file mode 100644 index 7a54c51b6..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/parser.go +++ /dev/null @@ -1,496 +0,0 @@ -package json - -import ( - "encoding/json" - "fmt" - - "github.com/hashicorp/hcl/v2" - "github.com/zclconf/go-cty/cty" -) - -func parseFileContent(buf []byte, filename string) (node, hcl.Diagnostics) { - tokens := scan(buf, pos{ - Filename: filename, - Pos: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - }) - p := newPeeker(tokens) - node, diags := parseValue(p) - if len(diags) == 0 && p.Peek().Type != tokenEOF { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Extraneous data after value", - Detail: "Extra characters appear after the JSON value.", - Subject: p.Peek().Range.Ptr(), - }) - } - return node, diags -} - -func parseValue(p *peeker) (node, hcl.Diagnostics) { - tok := p.Peek() - - wrapInvalid := func(n node, diags hcl.Diagnostics) (node, hcl.Diagnostics) { - if n != nil { - return n, diags - } - return invalidVal{tok.Range}, diags - } - - switch tok.Type { - case tokenBraceO: - return wrapInvalid(parseObject(p)) - case tokenBrackO: - return wrapInvalid(parseArray(p)) - case tokenNumber: - return wrapInvalid(parseNumber(p)) - case tokenString: - return wrapInvalid(parseString(p)) - case tokenKeyword: - return wrapInvalid(parseKeyword(p)) - case tokenBraceC: - return wrapInvalid(nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Missing JSON value", - Detail: "A JSON value must start with a brace, a bracket, a number, a string, or a keyword.", - Subject: &tok.Range, - }, - }) - case tokenBrackC: - return wrapInvalid(nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Missing array element value", - Detail: "A JSON value must start with a brace, a bracket, a number, a string, or a keyword.", - Subject: &tok.Range, - }, - }) - case tokenEOF: - return wrapInvalid(nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Missing value", - Detail: "The JSON data ends prematurely.", - Subject: &tok.Range, - }, - }) - default: - return wrapInvalid(nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Invalid start of value", - Detail: "A JSON value must start with a brace, a bracket, a number, a string, or a keyword.", - Subject: &tok.Range, - }, - }) - } -} - -func tokenCanStartValue(tok token) bool { - switch tok.Type { - case tokenBraceO, tokenBrackO, tokenNumber, tokenString, tokenKeyword: - return true - default: - return false - } -} - -func parseObject(p *peeker) (node, hcl.Diagnostics) { - var diags hcl.Diagnostics - - open := p.Read() - attrs := []*objectAttr{} - - // recover is used to shift the peeker to what seems to be the end of - // our object, so that when we encounter an error we leave the peeker - // at a reasonable point in the token stream to continue parsing. - recover := func(tok token) { - open := 1 - for { - switch tok.Type { - case tokenBraceO: - open++ - case tokenBraceC: - open-- - if open <= 1 { - return - } - case tokenEOF: - // Ran out of source before we were able to recover, - // so we'll bail here and let the caller deal with it. - return - } - tok = p.Read() - } - } - -Token: - for { - if p.Peek().Type == tokenBraceC { - break Token - } - - keyNode, keyDiags := parseValue(p) - diags = diags.Extend(keyDiags) - if keyNode == nil { - return nil, diags - } - - keyStrNode, ok := keyNode.(*stringVal) - if !ok { - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid object property name", - Detail: "A JSON object property name must be a string", - Subject: keyNode.StartRange().Ptr(), - }) - } - - key := keyStrNode.Value - - colon := p.Read() - if colon.Type != tokenColon { - recover(colon) - - if colon.Type == tokenBraceC || colon.Type == tokenComma { - // Catch common mistake of using braces instead of brackets - // for an object. - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing object value", - Detail: "A JSON object attribute must have a value, introduced by a colon.", - Subject: &colon.Range, - }) - } - - if colon.Type == tokenEquals { - // Possible confusion with native HCL syntax. - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing property value colon", - Detail: "JSON uses a colon as its name/value delimiter, not an equals sign.", - Subject: &colon.Range, - }) - } - - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing property value colon", - Detail: "A colon must appear between an object property's name and its value.", - Subject: &colon.Range, - }) - } - - valNode, valDiags := parseValue(p) - diags = diags.Extend(valDiags) - if valNode == nil { - return nil, diags - } - - attrs = append(attrs, &objectAttr{ - Name: key, - Value: valNode, - NameRange: keyStrNode.SrcRange, - }) - - switch p.Peek().Type { - case tokenComma: - comma := p.Read() - if p.Peek().Type == tokenBraceC { - // Special error message for this common mistake - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Trailing comma in object", - Detail: "JSON does not permit a trailing comma after the final property in an object.", - Subject: &comma.Range, - }) - } - continue Token - case tokenEOF: - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unclosed object", - Detail: "No closing brace was found for this JSON object.", - Subject: &open.Range, - }) - case tokenBrackC: - // Consume the bracket anyway, so that we don't return with the peeker - // at a strange place. - p.Read() - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Mismatched braces", - Detail: "A JSON object must be closed with a brace, not a bracket.", - Subject: p.Peek().Range.Ptr(), - }) - case tokenBraceC: - break Token - default: - recover(p.Read()) - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing attribute seperator comma", - Detail: "A comma must appear between each property definition in an object.", - Subject: p.Peek().Range.Ptr(), - }) - } - - } - - close := p.Read() - return &objectVal{ - Attrs: attrs, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - OpenRange: open.Range, - CloseRange: close.Range, - }, diags -} - -func parseArray(p *peeker) (node, hcl.Diagnostics) { - var diags hcl.Diagnostics - - open := p.Read() - vals := []node{} - - // recover is used to shift the peeker to what seems to be the end of - // our array, so that when we encounter an error we leave the peeker - // at a reasonable point in the token stream to continue parsing. - recover := func(tok token) { - open := 1 - for { - switch tok.Type { - case tokenBrackO: - open++ - case tokenBrackC: - open-- - if open <= 1 { - return - } - case tokenEOF: - // Ran out of source before we were able to recover, - // so we'll bail here and let the caller deal with it. - return - } - tok = p.Read() - } - } - -Token: - for { - if p.Peek().Type == tokenBrackC { - break Token - } - - valNode, valDiags := parseValue(p) - diags = diags.Extend(valDiags) - if valNode == nil { - return nil, diags - } - - vals = append(vals, valNode) - - switch p.Peek().Type { - case tokenComma: - comma := p.Read() - if p.Peek().Type == tokenBrackC { - // Special error message for this common mistake - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Trailing comma in array", - Detail: "JSON does not permit a trailing comma after the final value in an array.", - Subject: &comma.Range, - }) - } - continue Token - case tokenColon: - recover(p.Read()) - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid array value", - Detail: "A colon is not used to introduce values in a JSON array.", - Subject: p.Peek().Range.Ptr(), - }) - case tokenEOF: - recover(p.Read()) - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unclosed object", - Detail: "No closing bracket was found for this JSON array.", - Subject: &open.Range, - }) - case tokenBraceC: - recover(p.Read()) - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Mismatched brackets", - Detail: "A JSON array must be closed with a bracket, not a brace.", - Subject: p.Peek().Range.Ptr(), - }) - case tokenBrackC: - break Token - default: - recover(p.Read()) - return nil, diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing attribute seperator comma", - Detail: "A comma must appear between each value in an array.", - Subject: p.Peek().Range.Ptr(), - }) - } - - } - - close := p.Read() - return &arrayVal{ - Values: vals, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - OpenRange: open.Range, - }, diags -} - -func parseNumber(p *peeker) (node, hcl.Diagnostics) { - tok := p.Read() - - // Use encoding/json to validate the number syntax. - // TODO: Do this more directly to produce better diagnostics. - var num json.Number - err := json.Unmarshal(tok.Bytes, &num) - if err != nil { - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Invalid JSON number", - Detail: fmt.Sprintf("There is a syntax error in the given JSON number."), - Subject: &tok.Range, - }, - } - } - - // We want to guarantee that we parse numbers the same way as cty (and thus - // native syntax HCL) would here, so we'll use the cty parser even though - // in most other cases we don't actually introduce cty concepts until - // decoding time. We'll unwrap the parsed float immediately afterwards, so - // the cty value is just a temporary helper. - nv, err := cty.ParseNumberVal(string(num)) - if err != nil { - // Should never happen if above passed, since JSON numbers are a subset - // of what cty can parse... - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Invalid JSON number", - Detail: fmt.Sprintf("There is a syntax error in the given JSON number."), - Subject: &tok.Range, - }, - } - } - - return &numberVal{ - Value: nv.AsBigFloat(), - SrcRange: tok.Range, - }, nil -} - -func parseString(p *peeker) (node, hcl.Diagnostics) { - tok := p.Read() - var str string - err := json.Unmarshal(tok.Bytes, &str) - - if err != nil { - var errRange hcl.Range - if serr, ok := err.(*json.SyntaxError); ok { - errOfs := serr.Offset - errPos := tok.Range.Start - errPos.Byte += int(errOfs) - - // TODO: Use the byte offset to properly count unicode - // characters for the column, and mark the whole of the - // character that was wrong as part of our range. - errPos.Column += int(errOfs) - - errEndPos := errPos - errEndPos.Byte++ - errEndPos.Column++ - - errRange = hcl.Range{ - Filename: tok.Range.Filename, - Start: errPos, - End: errEndPos, - } - } else { - errRange = tok.Range - } - - var contextRange *hcl.Range - if errRange != tok.Range { - contextRange = &tok.Range - } - - // FIXME: Eventually we should parse strings directly here so - // we can produce a more useful error message in the face fo things - // such as invalid escapes, etc. - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Invalid JSON string", - Detail: fmt.Sprintf("There is a syntax error in the given JSON string."), - Subject: &errRange, - Context: contextRange, - }, - } - } - - return &stringVal{ - Value: str, - SrcRange: tok.Range, - }, nil -} - -func parseKeyword(p *peeker) (node, hcl.Diagnostics) { - tok := p.Read() - s := string(tok.Bytes) - - switch s { - case "true": - return &booleanVal{ - Value: true, - SrcRange: tok.Range, - }, nil - case "false": - return &booleanVal{ - Value: false, - SrcRange: tok.Range, - }, nil - case "null": - return &nullVal{ - SrcRange: tok.Range, - }, nil - case "undefined", "NaN", "Infinity": - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Invalid JSON keyword", - Detail: fmt.Sprintf("The JavaScript identifier %q cannot be used in JSON.", s), - Subject: &tok.Range, - }, - } - default: - var dym string - if suggest := keywordSuggestion(s); suggest != "" { - dym = fmt.Sprintf(" Did you mean %q?", suggest) - } - - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Invalid JSON keyword", - Detail: fmt.Sprintf("%q is not a valid JSON keyword.%s", s, dym), - Subject: &tok.Range, - }, - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/v2/json/peeker.go b/vendor/github.com/hashicorp/hcl/v2/json/peeker.go deleted file mode 100644 index fc7bbf582..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/peeker.go +++ /dev/null @@ -1,25 +0,0 @@ -package json - -type peeker struct { - tokens []token - pos int -} - -func newPeeker(tokens []token) *peeker { - return &peeker{ - tokens: tokens, - pos: 0, - } -} - -func (p *peeker) Peek() token { - return p.tokens[p.pos] -} - -func (p *peeker) Read() token { - ret := p.tokens[p.pos] - if ret.Type != tokenEOF { - p.pos++ - } - return ret -} diff --git a/vendor/github.com/hashicorp/hcl/v2/json/public.go b/vendor/github.com/hashicorp/hcl/v2/json/public.go deleted file mode 100644 index 8dc4a36af..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/public.go +++ /dev/null @@ -1,94 +0,0 @@ -package json - -import ( - "fmt" - "io/ioutil" - "os" - - "github.com/hashicorp/hcl/v2" -) - -// Parse attempts to parse the given buffer as JSON and, if successful, returns -// a hcl.File for the HCL configuration represented by it. -// -// This is not a generic JSON parser. Instead, it deals only with the profile -// of JSON used to express HCL configuration. -// -// The returned file is valid only if the returned diagnostics returns false -// from its HasErrors method. If HasErrors returns true, the file represents -// the subset of data that was able to be parsed, which may be none. -func Parse(src []byte, filename string) (*hcl.File, hcl.Diagnostics) { - rootNode, diags := parseFileContent(src, filename) - - switch rootNode.(type) { - case *objectVal, *arrayVal: - // okay - default: - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Root value must be object", - Detail: "The root value in a JSON-based configuration must be either a JSON object or a JSON array of objects.", - Subject: rootNode.StartRange().Ptr(), - }) - - // Since we've already produced an error message for this being - // invalid, we'll return an empty placeholder here so that trying to - // extract content from our root body won't produce a redundant - // error saying the same thing again in more general terms. - fakePos := hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - } - fakeRange := hcl.Range{ - Filename: filename, - Start: fakePos, - End: fakePos, - } - rootNode = &objectVal{ - Attrs: []*objectAttr{}, - SrcRange: fakeRange, - OpenRange: fakeRange, - } - } - - file := &hcl.File{ - Body: &body{ - val: rootNode, - }, - Bytes: src, - Nav: navigation{rootNode}, - } - return file, diags -} - -// ParseFile is a convenience wrapper around Parse that first attempts to load -// data from the given filename, passing the result to Parse if successful. -// -// If the file cannot be read, an error diagnostic with nil context is returned. -func ParseFile(filename string) (*hcl.File, hcl.Diagnostics) { - f, err := os.Open(filename) - if err != nil { - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Failed to open file", - Detail: fmt.Sprintf("The file %q could not be opened.", filename), - }, - } - } - defer f.Close() - - src, err := ioutil.ReadAll(f) - if err != nil { - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Failed to read file", - Detail: fmt.Sprintf("The file %q was opened, but an error occured while reading it.", filename), - }, - } - } - - return Parse(src, filename) -} diff --git a/vendor/github.com/hashicorp/hcl/v2/json/scanner.go b/vendor/github.com/hashicorp/hcl/v2/json/scanner.go deleted file mode 100644 index 912eabce2..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/scanner.go +++ /dev/null @@ -1,297 +0,0 @@ -package json - -import ( - "fmt" - - "github.com/apparentlymart/go-textseg/textseg" - "github.com/hashicorp/hcl/v2" -) - -//go:generate stringer -type tokenType scanner.go -type tokenType rune - -const ( - tokenBraceO tokenType = '{' - tokenBraceC tokenType = '}' - tokenBrackO tokenType = '[' - tokenBrackC tokenType = ']' - tokenComma tokenType = ',' - tokenColon tokenType = ':' - tokenKeyword tokenType = 'K' - tokenString tokenType = 'S' - tokenNumber tokenType = 'N' - tokenEOF tokenType = '␄' - tokenInvalid tokenType = 0 - tokenEquals tokenType = '=' // used only for reminding the user of JSON syntax -) - -type token struct { - Type tokenType - Bytes []byte - Range hcl.Range -} - -// scan returns the primary tokens for the given JSON buffer in sequence. -// -// The responsibility of this pass is to just mark the slices of the buffer -// as being of various types. It is lax in how it interprets the multi-byte -// token types keyword, string and number, preferring to capture erroneous -// extra bytes that we presume the user intended to be part of the token -// so that we can generate more helpful diagnostics in the parser. -func scan(buf []byte, start pos) []token { - var tokens []token - p := start - for { - if len(buf) == 0 { - tokens = append(tokens, token{ - Type: tokenEOF, - Bytes: nil, - Range: posRange(p, p), - }) - return tokens - } - - buf, p = skipWhitespace(buf, p) - - if len(buf) == 0 { - tokens = append(tokens, token{ - Type: tokenEOF, - Bytes: nil, - Range: posRange(p, p), - }) - return tokens - } - - start = p - - first := buf[0] - switch { - case first == '{' || first == '}' || first == '[' || first == ']' || first == ',' || first == ':' || first == '=': - p.Pos.Column++ - p.Pos.Byte++ - tokens = append(tokens, token{ - Type: tokenType(first), - Bytes: buf[0:1], - Range: posRange(start, p), - }) - buf = buf[1:] - case first == '"': - var tokBuf []byte - tokBuf, buf, p = scanString(buf, p) - tokens = append(tokens, token{ - Type: tokenString, - Bytes: tokBuf, - Range: posRange(start, p), - }) - case byteCanStartNumber(first): - var tokBuf []byte - tokBuf, buf, p = scanNumber(buf, p) - tokens = append(tokens, token{ - Type: tokenNumber, - Bytes: tokBuf, - Range: posRange(start, p), - }) - case byteCanStartKeyword(first): - var tokBuf []byte - tokBuf, buf, p = scanKeyword(buf, p) - tokens = append(tokens, token{ - Type: tokenKeyword, - Bytes: tokBuf, - Range: posRange(start, p), - }) - default: - tokens = append(tokens, token{ - Type: tokenInvalid, - Bytes: buf[:1], - Range: start.Range(1, 1), - }) - // If we've encountered an invalid then we might as well stop - // scanning since the parser won't proceed beyond this point. - return tokens - } - } -} - -func byteCanStartNumber(b byte) bool { - switch b { - // We are slightly more tolerant than JSON requires here since we - // expect the parser will make a stricter interpretation of the - // number bytes, but we specifically don't allow 'e' or 'E' here - // since we want the scanner to treat that as the start of an - // invalid keyword instead, to produce more intelligible error messages. - case '-', '+', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - return true - default: - return false - } -} - -func scanNumber(buf []byte, start pos) ([]byte, []byte, pos) { - // The scanner doesn't check that the sequence of digit-ish bytes is - // in a valid order. The parser must do this when decoding a number - // token. - var i int - p := start -Byte: - for i = 0; i < len(buf); i++ { - switch buf[i] { - case '-', '+', '.', 'e', 'E', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - p.Pos.Byte++ - p.Pos.Column++ - default: - break Byte - } - } - return buf[:i], buf[i:], p -} - -func byteCanStartKeyword(b byte) bool { - switch { - // We allow any sequence of alphabetical characters here, even though - // JSON is more constrained, so that we can collect what we presume - // the user intended to be a single keyword and then check its validity - // in the parser, where we can generate better diagnostics. - // So e.g. we want to be able to say: - // unrecognized keyword "True". Did you mean "true"? - case isAlphabetical(b): - return true - default: - return false - } -} - -func scanKeyword(buf []byte, start pos) ([]byte, []byte, pos) { - var i int - p := start -Byte: - for i = 0; i < len(buf); i++ { - b := buf[i] - switch { - case isAlphabetical(b) || b == '_': - p.Pos.Byte++ - p.Pos.Column++ - default: - break Byte - } - } - return buf[:i], buf[i:], p -} - -func scanString(buf []byte, start pos) ([]byte, []byte, pos) { - // The scanner doesn't validate correct use of escapes, etc. It pays - // attention to escapes only for the purpose of identifying the closing - // quote character. It's the parser's responsibility to do proper - // validation. - // - // The scanner also doesn't specifically detect unterminated string - // literals, though they can be identified in the parser by checking if - // the final byte in a string token is the double-quote character. - - // Skip the opening quote symbol - i := 1 - p := start - p.Pos.Byte++ - p.Pos.Column++ - escaping := false -Byte: - for i < len(buf) { - b := buf[i] - - switch { - case b == '\\': - escaping = !escaping - p.Pos.Byte++ - p.Pos.Column++ - i++ - case b == '"': - p.Pos.Byte++ - p.Pos.Column++ - i++ - if !escaping { - break Byte - } - escaping = false - case b < 32: - break Byte - default: - // Advance by one grapheme cluster, so that we consider each - // grapheme to be a "column". - // Ignoring error because this scanner cannot produce errors. - advance, _, _ := textseg.ScanGraphemeClusters(buf[i:], true) - - p.Pos.Byte += advance - p.Pos.Column++ - i += advance - - escaping = false - } - } - return buf[:i], buf[i:], p -} - -func skipWhitespace(buf []byte, start pos) ([]byte, pos) { - var i int - p := start -Byte: - for i = 0; i < len(buf); i++ { - switch buf[i] { - case ' ': - p.Pos.Byte++ - p.Pos.Column++ - case '\n': - p.Pos.Byte++ - p.Pos.Column = 1 - p.Pos.Line++ - case '\r': - // For the purpose of line/column counting we consider a - // carriage return to take up no space, assuming that it will - // be paired up with a newline (on Windows, for example) that - // will account for both of them. - p.Pos.Byte++ - case '\t': - // We arbitrarily count a tab as if it were two spaces, because - // we need to choose _some_ number here. This means any system - // that renders code on-screen with markers must itself treat - // tabs as a pair of spaces for rendering purposes, or instead - // use the byte offset and back into its own column position. - p.Pos.Byte++ - p.Pos.Column += 2 - default: - break Byte - } - } - return buf[i:], p -} - -type pos struct { - Filename string - Pos hcl.Pos -} - -func (p *pos) Range(byteLen, charLen int) hcl.Range { - start := p.Pos - end := p.Pos - end.Byte += byteLen - end.Column += charLen - return hcl.Range{ - Filename: p.Filename, - Start: start, - End: end, - } -} - -func posRange(start, end pos) hcl.Range { - return hcl.Range{ - Filename: start.Filename, - Start: start.Pos, - End: end.Pos, - } -} - -func (t token) GoString() string { - return fmt.Sprintf("json.token{json.%s, []byte(%q), %#v}", t.Type, t.Bytes, t.Range) -} - -func isAlphabetical(b byte) bool { - return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') -} diff --git a/vendor/github.com/hashicorp/hcl/v2/json/spec.md b/vendor/github.com/hashicorp/hcl/v2/json/spec.md deleted file mode 100644 index dac5729d4..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/spec.md +++ /dev/null @@ -1,405 +0,0 @@ -# HCL JSON Syntax Specification - -This is the specification for the JSON serialization for hcl. HCL is a system -for defining configuration languages for applications. The HCL information -model is designed to support multiple concrete syntaxes for configuration, -and this JSON-based format complements [the native syntax](../hclsyntax/spec.md) -by being easy to machine-generate, whereas the native syntax is oriented -towards human authoring and maintenance - -This syntax is defined in terms of JSON as defined in -[RFC7159](https://tools.ietf.org/html/rfc7159). As such it inherits the JSON -grammar as-is, and merely defines a specific methodology for interpreting -JSON constructs into HCL structural elements and expressions. - -This mapping is defined such that valid JSON-serialized HCL input can be -_produced_ using standard JSON implementations in various programming languages. -_Parsing_ such JSON has some additional constraints not beyond what is normally -supported by JSON parsers, so a specialized parser may be required that -is able to: - -- Preserve the relative ordering of properties defined in an object. -- Preserve multiple definitions of the same property name. -- Preserve numeric values to the precision required by the number type - in [the HCL syntax-agnostic information model](../spec.md). -- Retain source location information for parsed tokens/constructs in order - to produce good error messages. - -## Structural Elements - -[The HCL syntax-agnostic information model](../spec.md) defines a _body_ as an -abstract container for attribute definitions and child blocks. A body is -represented in JSON as either a single JSON object or a JSON array of objects. - -Body processing is in terms of JSON object properties, visited in the order -they appear in the input. Where a body is represented by a single JSON object, -the properties of that object are visited in order. Where a body is -represented by a JSON array, each of its elements are visited in order and -each element has its properties visited in order. If any element of the array -is not a JSON object then the input is erroneous. - -When a body is being processed in the _dynamic attributes_ mode, the allowance -of a JSON array in the previous paragraph does not apply and instead a single -JSON object is always required. - -As defined in the language-agnostic model, body processing is in terms -of a schema which provides context for interpreting the body's content. For -JSON bodies, the schema is crucial to allow differentiation of attribute -definitions and block definitions, both of which are represented via object -properties. - -The special property name `"//"`, when used in an object representing a HCL -body, is parsed and ignored. A property with this name can be used to -include human-readable comments. (This special property name is _not_ -processed in this way for any _other_ HCL constructs that are represented as -JSON objects.) - -### Attributes - -Where the given schema describes an attribute with a given name, the object -property with the matching name — if present — serves as the attribute's -definition. - -When a body is being processed in the _dynamic attributes_ mode, each object -property serves as an attribute definition for the attribute whose name -matches the property name. - -The value of an attribute definition property is interpreted as an _expression_, -as described in a later section. - -Given a schema that calls for an attribute named "foo", a JSON object like -the following provides a definition for that attribute: - -```json -{ - "foo": "bar baz" -} -``` - -### Blocks - -Where the given schema describes a block with a given type name, each object -property with the matching name serves as a definition of zero or more blocks -of that type. - -Processing of child blocks is in terms of nested JSON objects and arrays. -If the schema defines one or more _labels_ for the block type, a nested JSON -object or JSON array of objects is required for each labelling level. These -are flattened to a single ordered sequence of object properties using the -same algorithm as for body content as defined above. Each object property -serves as a label value at the corresponding level. - -After any labelling levels, the next nested value is either a JSON object -representing a single block body, or a JSON array of JSON objects that each -represent a single block body. Use of an array accommodates the definition -of multiple blocks that have identical type and labels. - -Given a schema that calls for a block type named "foo" with no labels, the -following JSON objects are all valid definitions of zero or more blocks of this -type: - -```json -{ - "foo": { - "child_attr": "baz" - } -} -``` - -```json -{ - "foo": [ - { - "child_attr": "baz" - }, - { - "child_attr": "boz" - } - ] -} -``` - -```json -{ - "foo": [] -} -``` - -The first of these defines a single child block of type "foo". The second -defines _two_ such blocks. The final example shows a degenerate definition -of zero blocks, though generators should prefer to omit the property entirely -in this scenario. - -Given a schema that calls for a block type named "foo" with _two_ labels, the -extra label levels must be represented as objects or arrays of objects as in -the following examples: - -```json -{ - "foo": { - "bar": { - "baz": { - "child_attr": "baz" - }, - "boz": { - "child_attr": "baz" - } - }, - "boz": { - "baz": { - "child_attr": "baz" - } - } - } -} -``` - -```json -{ - "foo": { - "bar": { - "baz": { - "child_attr": "baz" - }, - "boz": { - "child_attr": "baz" - } - }, - "boz": { - "baz": [ - { - "child_attr": "baz" - }, - { - "child_attr": "boz" - } - ] - } - } -} -``` - -```json -{ - "foo": [ - { - "bar": { - "baz": { - "child_attr": "baz" - }, - "boz": { - "child_attr": "baz" - } - } - }, - { - "bar": { - "baz": [ - { - "child_attr": "baz" - }, - { - "child_attr": "boz" - } - ] - } - } - ] -} -``` - -```json -{ - "foo": { - "bar": { - "baz": { - "child_attr": "baz" - }, - "boz": { - "child_attr": "baz" - } - }, - "bar": { - "baz": [ - { - "child_attr": "baz" - }, - { - "child_attr": "boz" - } - ] - } - } -} -``` - -Arrays can be introduced at either the label definition or block body -definition levels to define multiple definitions of the same block type -or labels while preserving order. - -A JSON HCL parser _must_ support duplicate definitions of the same property -name within a single object, preserving all of them and the relative ordering -between them. The array-based forms are also required so that JSON HCL -configurations can be produced with JSON producing libraries that are not -able to preserve property definition order and multiple definitions of -the same property. - -## Expressions - -JSON lacks a native expression syntax, so the HCL JSON syntax instead defines -a mapping for each of the JSON value types, including a special mapping for -strings that allows optional use of arbitrary expressions. - -### Objects - -When interpreted as an expression, a JSON object represents a value of a HCL -object type. - -Each property of the JSON object represents an attribute of the HCL object type. -The property name string given in the JSON input is interpreted as a string -expression as described below, and its result is converted to string as defined -by the syntax-agnostic information model. If such a conversion is not possible, -an error is produced and evaluation fails. - -An instance of the constructed object type is then created, whose values -are interpreted by again recursively applying the mapping rules defined in -this section to each of the property values. - -If any evaluated property name strings produce null values, an error is -produced and evaluation fails. If any produce _unknown_ values, the _entire -object's_ result is an unknown value of the dynamic pseudo-type, signalling -that the type of the object cannot be determined. - -It is an error to define the same property name multiple times within a single -JSON object interpreted as an expression. In full expression mode, this -constraint applies to the name expression results after conversion to string, -rather than the raw string that may contain interpolation expressions. - -### Arrays - -When interpreted as an expression, a JSON array represents a value of a HCL -tuple type. - -Each element of the JSON array represents an element of the HCL tuple type. -The tuple type is constructed by enumerating the JSON array elements, creating -for each an element whose type is the result of recursively applying the -expression mapping rules. Correspondence is preserved between the array element -indices and the tuple element indices. - -An instance of the constructed tuple type is then created, whose values are -interpreted by again recursively applying the mapping rules defined in this -section. - -### Numbers - -When interpreted as an expression, a JSON number represents a HCL number value. - -HCL numbers are arbitrary-precision decimal values, so a JSON HCL parser must -be able to translate exactly the value given to a number of corresponding -precision, within the constraints set by the HCL syntax-agnostic information -model. - -In practice, off-the-shelf JSON serializers often do not support customizing the -processing of numbers, and instead force processing as 32-bit or 64-bit -floating point values. - -A _producer_ of JSON HCL that uses such a serializer can provide numeric values -as JSON strings where they have precision too great for representation in the -serializer's chosen numeric type in situations where the result will be -converted to number (using the standard conversion rules) by a calling -application. - -Alternatively, for expressions that are evaluated in full expression mode an -embedded template interpolation can be used to faithfully represent a number, -such as `"${1e150}"`, which will then be evaluated by the underlying HCL native -syntax expression evaluator. - -### Boolean Values - -The JSON boolean values `true` and `false`, when interpreted as expressions, -represent the corresponding HCL boolean values. - -### The Null Value - -The JSON value `null`, when interpreted as an expression, represents a -HCL null value of the dynamic pseudo-type. - -### Strings - -When interpreted as an expression, a JSON string may be interpreted in one of -two ways depending on the evaluation mode. - -If evaluating in literal-only mode (as defined by the syntax-agnostic -information model) the literal string is intepreted directly as a HCL string -value, by directly using the exact sequence of unicode characters represented. -Template interpolations and directives MUST NOT be processed in this mode, -allowing any characters that appear as introduction sequences to pass through -literally: - -```json -"Hello world! Template sequences like ${ are not intepreted here." -``` - -When evaluating in full expression mode (again, as defined by the syntax- -agnostic information model) the literal string is instead interpreted as a -_standalone template_ in the HCL Native Syntax. The expression evaluation -result is then the direct result of evaluating that template with the current -variable scope and function table. - -```json -"Hello, ${name}! Template sequences are interpreted in full expression mode." -``` - -In particular the _Template Interpolation Unwrapping_ requirement from the -HCL native syntax specification must be implemented, allowing the use of -single-interpolation templates to represent expressions that would not -otherwise be representable in JSON, such as the following example where -the result must be a number, rather than a string representation of a number: - -```json -"${ a + b }" -``` - -## Static Analysis - -The HCL static analysis operations are implemented for JSON values that -represent expressions, as described in the following sections. - -Due to the limited expressive power of the JSON syntax alone, use of these -static analyses functions rather than normal expression evaluation is used -as additional context for how a JSON value is to be interpreted, which means -that static analyses can result in a different interpretation of a given -expression than normal evaluation. - -### Static List - -An expression interpreted as a static list must be a JSON array. Each of the -values in the array is interpreted as an expression and returned. - -### Static Map - -An expression interpreted as a static map must be a JSON object. Each of the -key/value pairs in the object is presented as a pair of expressions. Since -object property names are always strings, evaluating the key expression with -a non-`nil` evaluation context will evaluate any template sequences given -in the property name. - -### Static Call - -An expression interpreted as a static call must be a string. The content of -the string is interpreted as a native syntax expression (not a _template_, -unlike normal evaluation) and then the static call analysis is delegated to -that expression. - -If the original expression is not a string or its contents cannot be parsed -as a native syntax expression then static call analysis is not supported. - -### Static Traversal - -An expression interpreted as a static traversal must be a string. The content -of the string is interpreted as a native syntax expression (not a _template_, -unlike normal evaluation) and then static traversal analysis is delegated -to that expression. - -If the original expression is not a string or its contents cannot be parsed -as a native syntax expression then static call analysis is not supported. diff --git a/vendor/github.com/hashicorp/hcl/v2/json/structure.go b/vendor/github.com/hashicorp/hcl/v2/json/structure.go deleted file mode 100644 index 76c9d7399..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/structure.go +++ /dev/null @@ -1,637 +0,0 @@ -package json - -import ( - "fmt" - - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" -) - -// body is the implementation of "Body" used for files processed with the JSON -// parser. -type body struct { - val node - - // If non-nil, the keys of this map cause the corresponding attributes to - // be treated as non-existing. This is used when Body.PartialContent is - // called, to produce the "remaining content" Body. - hiddenAttrs map[string]struct{} -} - -// expression is the implementation of "Expression" used for files processed -// with the JSON parser. -type expression struct { - src node -} - -func (b *body) Content(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Diagnostics) { - content, newBody, diags := b.PartialContent(schema) - - hiddenAttrs := newBody.(*body).hiddenAttrs - - var nameSuggestions []string - for _, attrS := range schema.Attributes { - if _, ok := hiddenAttrs[attrS.Name]; !ok { - // Only suggest an attribute name if we didn't use it already. - nameSuggestions = append(nameSuggestions, attrS.Name) - } - } - for _, blockS := range schema.Blocks { - // Blocks can appear multiple times, so we'll suggest their type - // names regardless of whether they've already been used. - nameSuggestions = append(nameSuggestions, blockS.Type) - } - - jsonAttrs, attrDiags := b.collectDeepAttrs(b.val, nil) - diags = append(diags, attrDiags...) - - for _, attr := range jsonAttrs { - k := attr.Name - if k == "//" { - // Ignore "//" keys in objects representing bodies, to allow - // their use as comments. - continue - } - - if _, ok := hiddenAttrs[k]; !ok { - suggestion := nameSuggestion(k, nameSuggestions) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Extraneous JSON object property", - Detail: fmt.Sprintf("No argument or block type is named %q.%s", k, suggestion), - Subject: &attr.NameRange, - Context: attr.Range().Ptr(), - }) - } - } - - return content, diags -} - -func (b *body) PartialContent(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Body, hcl.Diagnostics) { - var diags hcl.Diagnostics - - jsonAttrs, attrDiags := b.collectDeepAttrs(b.val, nil) - diags = append(diags, attrDiags...) - - usedNames := map[string]struct{}{} - if b.hiddenAttrs != nil { - for k := range b.hiddenAttrs { - usedNames[k] = struct{}{} - } - } - - content := &hcl.BodyContent{ - Attributes: map[string]*hcl.Attribute{}, - Blocks: nil, - - MissingItemRange: b.MissingItemRange(), - } - - // Create some more convenient data structures for our work below. - attrSchemas := map[string]hcl.AttributeSchema{} - blockSchemas := map[string]hcl.BlockHeaderSchema{} - for _, attrS := range schema.Attributes { - attrSchemas[attrS.Name] = attrS - } - for _, blockS := range schema.Blocks { - blockSchemas[blockS.Type] = blockS - } - - for _, jsonAttr := range jsonAttrs { - attrName := jsonAttr.Name - if _, used := b.hiddenAttrs[attrName]; used { - continue - } - - if attrS, defined := attrSchemas[attrName]; defined { - if existing, exists := content.Attributes[attrName]; exists { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Duplicate argument", - Detail: fmt.Sprintf("The argument %q was already set at %s.", attrName, existing.Range), - Subject: &jsonAttr.NameRange, - Context: jsonAttr.Range().Ptr(), - }) - continue - } - - content.Attributes[attrS.Name] = &hcl.Attribute{ - Name: attrS.Name, - Expr: &expression{src: jsonAttr.Value}, - Range: hcl.RangeBetween(jsonAttr.NameRange, jsonAttr.Value.Range()), - NameRange: jsonAttr.NameRange, - } - usedNames[attrName] = struct{}{} - - } else if blockS, defined := blockSchemas[attrName]; defined { - bv := jsonAttr.Value - blockDiags := b.unpackBlock(bv, blockS.Type, &jsonAttr.NameRange, blockS.LabelNames, nil, nil, &content.Blocks) - diags = append(diags, blockDiags...) - usedNames[attrName] = struct{}{} - } - - // We ignore anything that isn't defined because that's the - // PartialContent contract. The Content method will catch leftovers. - } - - // Make sure we got all the required attributes. - for _, attrS := range schema.Attributes { - if !attrS.Required { - continue - } - if _, defined := content.Attributes[attrS.Name]; !defined { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing required argument", - Detail: fmt.Sprintf("The argument %q is required, but no definition was found.", attrS.Name), - Subject: b.MissingItemRange().Ptr(), - }) - } - } - - unusedBody := &body{ - val: b.val, - hiddenAttrs: usedNames, - } - - return content, unusedBody, diags -} - -// JustAttributes for JSON bodies interprets all properties of the wrapped -// JSON object as attributes and returns them. -func (b *body) JustAttributes() (hcl.Attributes, hcl.Diagnostics) { - var diags hcl.Diagnostics - attrs := make(map[string]*hcl.Attribute) - - obj, ok := b.val.(*objectVal) - if !ok { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect JSON value type", - Detail: "A JSON object is required here, setting the arguments for this block.", - Subject: b.val.StartRange().Ptr(), - }) - return attrs, diags - } - - for _, jsonAttr := range obj.Attrs { - name := jsonAttr.Name - if name == "//" { - // Ignore "//" keys in objects representing bodies, to allow - // their use as comments. - continue - } - - if _, hidden := b.hiddenAttrs[name]; hidden { - continue - } - - if existing, exists := attrs[name]; exists { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Duplicate attribute definition", - Detail: fmt.Sprintf("The argument %q was already set at %s.", name, existing.Range), - Subject: &jsonAttr.NameRange, - }) - continue - } - - attrs[name] = &hcl.Attribute{ - Name: name, - Expr: &expression{src: jsonAttr.Value}, - Range: hcl.RangeBetween(jsonAttr.NameRange, jsonAttr.Value.Range()), - NameRange: jsonAttr.NameRange, - } - } - - // No diagnostics possible here, since the parser already took care of - // finding duplicates and every JSON value can be a valid attribute value. - return attrs, diags -} - -func (b *body) MissingItemRange() hcl.Range { - switch tv := b.val.(type) { - case *objectVal: - return tv.CloseRange - case *arrayVal: - return tv.OpenRange - default: - // Should not happen in correct operation, but might show up if the - // input is invalid and we are producing partial results. - return tv.StartRange() - } -} - -func (b *body) unpackBlock(v node, typeName string, typeRange *hcl.Range, labelsLeft []string, labelsUsed []string, labelRanges []hcl.Range, blocks *hcl.Blocks) (diags hcl.Diagnostics) { - if len(labelsLeft) > 0 { - labelName := labelsLeft[0] - jsonAttrs, attrDiags := b.collectDeepAttrs(v, &labelName) - diags = append(diags, attrDiags...) - - if len(jsonAttrs) == 0 { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing block label", - Detail: fmt.Sprintf("At least one object property is required, whose name represents the %s block's %s.", typeName, labelName), - Subject: v.StartRange().Ptr(), - }) - return - } - labelsUsed := append(labelsUsed, "") - labelRanges := append(labelRanges, hcl.Range{}) - for _, p := range jsonAttrs { - pk := p.Name - labelsUsed[len(labelsUsed)-1] = pk - labelRanges[len(labelRanges)-1] = p.NameRange - diags = append(diags, b.unpackBlock(p.Value, typeName, typeRange, labelsLeft[1:], labelsUsed, labelRanges, blocks)...) - } - return - } - - // By the time we get here, we've peeled off all the labels and we're ready - // to deal with the block's actual content. - - // need to copy the label slices because their underlying arrays will - // continue to be mutated after we return. - labels := make([]string, len(labelsUsed)) - copy(labels, labelsUsed) - labelR := make([]hcl.Range, len(labelRanges)) - copy(labelR, labelRanges) - - switch tv := v.(type) { - case *nullVal: - // There is no block content, e.g the value is null. - return - case *objectVal: - // Single instance of the block - *blocks = append(*blocks, &hcl.Block{ - Type: typeName, - Labels: labels, - Body: &body{ - val: tv, - }, - - DefRange: tv.OpenRange, - TypeRange: *typeRange, - LabelRanges: labelR, - }) - case *arrayVal: - // Multiple instances of the block - for _, av := range tv.Values { - *blocks = append(*blocks, &hcl.Block{ - Type: typeName, - Labels: labels, - Body: &body{ - val: av, // might be mistyped; we'll find out when content is requested for this body - }, - - DefRange: tv.OpenRange, - TypeRange: *typeRange, - LabelRanges: labelR, - }) - } - default: - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect JSON value type", - Detail: fmt.Sprintf("Either a JSON object or a JSON array is required, representing the contents of one or more %q blocks.", typeName), - Subject: v.StartRange().Ptr(), - }) - } - return -} - -// collectDeepAttrs takes either a single object or an array of objects and -// flattens it into a list of object attributes, collecting attributes from -// all of the objects in a given array. -// -// Ordering is preserved, so a list of objects that each have one property -// will result in those properties being returned in the same order as the -// objects appeared in the array. -// -// This is appropriate for use only for objects representing bodies or labels -// within a block. -// -// The labelName argument, if non-null, is used to tailor returned error -// messages to refer to block labels rather than attributes and child blocks. -// It has no other effect. -func (b *body) collectDeepAttrs(v node, labelName *string) ([]*objectAttr, hcl.Diagnostics) { - var diags hcl.Diagnostics - var attrs []*objectAttr - - switch tv := v.(type) { - case *nullVal: - // If a value is null, then we don't return any attributes or return an error. - - case *objectVal: - attrs = append(attrs, tv.Attrs...) - - case *arrayVal: - for _, ev := range tv.Values { - switch tev := ev.(type) { - case *objectVal: - attrs = append(attrs, tev.Attrs...) - default: - if labelName != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect JSON value type", - Detail: fmt.Sprintf("A JSON object is required here, to specify %s labels for this block.", *labelName), - Subject: ev.StartRange().Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect JSON value type", - Detail: "A JSON object is required here, to define arguments and child blocks.", - Subject: ev.StartRange().Ptr(), - }) - } - } - } - - default: - if labelName != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect JSON value type", - Detail: fmt.Sprintf("Either a JSON object or JSON array of objects is required here, to specify %s labels for this block.", *labelName), - Subject: v.StartRange().Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect JSON value type", - Detail: "Either a JSON object or JSON array of objects is required here, to define arguments and child blocks.", - Subject: v.StartRange().Ptr(), - }) - } - } - - return attrs, diags -} - -func (e *expression) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - switch v := e.src.(type) { - case *stringVal: - if ctx != nil { - // Parse string contents as a HCL native language expression. - // We only do this if we have a context, so passing a nil context - // is how the caller specifies that interpolations are not allowed - // and that the string should just be returned verbatim. - templateSrc := v.Value - expr, diags := hclsyntax.ParseTemplate( - []byte(templateSrc), - v.SrcRange.Filename, - - // This won't produce _exactly_ the right result, since - // the hclsyntax parser can't "see" any escapes we removed - // while parsing JSON, but it's better than nothing. - hcl.Pos{ - Line: v.SrcRange.Start.Line, - - // skip over the opening quote mark - Byte: v.SrcRange.Start.Byte + 1, - Column: v.SrcRange.Start.Column + 1, - }, - ) - if diags.HasErrors() { - return cty.DynamicVal, diags - } - val, evalDiags := expr.Value(ctx) - diags = append(diags, evalDiags...) - return val, diags - } - - return cty.StringVal(v.Value), nil - case *numberVal: - return cty.NumberVal(v.Value), nil - case *booleanVal: - return cty.BoolVal(v.Value), nil - case *arrayVal: - var diags hcl.Diagnostics - vals := []cty.Value{} - for _, jsonVal := range v.Values { - val, valDiags := (&expression{src: jsonVal}).Value(ctx) - vals = append(vals, val) - diags = append(diags, valDiags...) - } - return cty.TupleVal(vals), diags - case *objectVal: - var diags hcl.Diagnostics - attrs := map[string]cty.Value{} - attrRanges := map[string]hcl.Range{} - known := true - for _, jsonAttr := range v.Attrs { - // In this one context we allow keys to contain interpolation - // expressions too, assuming we're evaluating in interpolation - // mode. This achieves parity with the native syntax where - // object expressions can have dynamic keys, while block contents - // may not. - name, nameDiags := (&expression{src: &stringVal{ - Value: jsonAttr.Name, - SrcRange: jsonAttr.NameRange, - }}).Value(ctx) - valExpr := &expression{src: jsonAttr.Value} - val, valDiags := valExpr.Value(ctx) - diags = append(diags, nameDiags...) - diags = append(diags, valDiags...) - - var err error - name, err = convert.Convert(name, cty.String) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid object key expression", - Detail: fmt.Sprintf("Cannot use this expression as an object key: %s.", err), - Subject: &jsonAttr.NameRange, - Expression: valExpr, - EvalContext: ctx, - }) - continue - } - if name.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid object key expression", - Detail: "Cannot use null value as an object key.", - Subject: &jsonAttr.NameRange, - Expression: valExpr, - EvalContext: ctx, - }) - continue - } - if !name.IsKnown() { - // This is a bit of a weird case, since our usual rules require - // us to tolerate unknowns and just represent the result as - // best we can but if we don't know the key then we can't - // know the type of our object at all, and thus we must turn - // the whole thing into cty.DynamicVal. This is consistent with - // how this situation is handled in the native syntax. - // We'll keep iterating so we can collect other errors in - // subsequent attributes. - known = false - continue - } - nameStr := name.AsString() - if _, defined := attrs[nameStr]; defined { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Duplicate object attribute", - Detail: fmt.Sprintf("An attribute named %q was already defined at %s.", nameStr, attrRanges[nameStr]), - Subject: &jsonAttr.NameRange, - Expression: e, - EvalContext: ctx, - }) - continue - } - attrs[nameStr] = val - attrRanges[nameStr] = jsonAttr.NameRange - } - if !known { - // We encountered an unknown key somewhere along the way, so - // we can't know what our type will eventually be. - return cty.DynamicVal, diags - } - return cty.ObjectVal(attrs), diags - case *nullVal: - return cty.NullVal(cty.DynamicPseudoType), nil - default: - // Default to DynamicVal so that ASTs containing invalid nodes can - // still be partially-evaluated. - return cty.DynamicVal, nil - } -} - -func (e *expression) Variables() []hcl.Traversal { - var vars []hcl.Traversal - - switch v := e.src.(type) { - case *stringVal: - templateSrc := v.Value - expr, diags := hclsyntax.ParseTemplate( - []byte(templateSrc), - v.SrcRange.Filename, - - // This won't produce _exactly_ the right result, since - // the hclsyntax parser can't "see" any escapes we removed - // while parsing JSON, but it's better than nothing. - hcl.Pos{ - Line: v.SrcRange.Start.Line, - - // skip over the opening quote mark - Byte: v.SrcRange.Start.Byte + 1, - Column: v.SrcRange.Start.Column + 1, - }, - ) - if diags.HasErrors() { - return vars - } - return expr.Variables() - - case *arrayVal: - for _, jsonVal := range v.Values { - vars = append(vars, (&expression{src: jsonVal}).Variables()...) - } - case *objectVal: - for _, jsonAttr := range v.Attrs { - keyExpr := &stringVal{ // we're going to treat key as an expression in this context - Value: jsonAttr.Name, - SrcRange: jsonAttr.NameRange, - } - vars = append(vars, (&expression{src: keyExpr}).Variables()...) - vars = append(vars, (&expression{src: jsonAttr.Value}).Variables()...) - } - } - - return vars -} - -func (e *expression) Range() hcl.Range { - return e.src.Range() -} - -func (e *expression) StartRange() hcl.Range { - return e.src.StartRange() -} - -// Implementation for hcl.AbsTraversalForExpr. -func (e *expression) AsTraversal() hcl.Traversal { - // In JSON-based syntax a traversal is given as a string containing - // traversal syntax as defined by hclsyntax.ParseTraversalAbs. - - switch v := e.src.(type) { - case *stringVal: - traversal, diags := hclsyntax.ParseTraversalAbs([]byte(v.Value), v.SrcRange.Filename, v.SrcRange.Start) - if diags.HasErrors() { - return nil - } - return traversal - default: - return nil - } -} - -// Implementation for hcl.ExprCall. -func (e *expression) ExprCall() *hcl.StaticCall { - // In JSON-based syntax a static call is given as a string containing - // an expression in the native syntax that also supports ExprCall. - - switch v := e.src.(type) { - case *stringVal: - expr, diags := hclsyntax.ParseExpression([]byte(v.Value), v.SrcRange.Filename, v.SrcRange.Start) - if diags.HasErrors() { - return nil - } - - call, diags := hcl.ExprCall(expr) - if diags.HasErrors() { - return nil - } - - return call - default: - return nil - } -} - -// Implementation for hcl.ExprList. -func (e *expression) ExprList() []hcl.Expression { - switch v := e.src.(type) { - case *arrayVal: - ret := make([]hcl.Expression, len(v.Values)) - for i, node := range v.Values { - ret[i] = &expression{src: node} - } - return ret - default: - return nil - } -} - -// Implementation for hcl.ExprMap. -func (e *expression) ExprMap() []hcl.KeyValuePair { - switch v := e.src.(type) { - case *objectVal: - ret := make([]hcl.KeyValuePair, len(v.Attrs)) - for i, jsonAttr := range v.Attrs { - ret[i] = hcl.KeyValuePair{ - Key: &expression{src: &stringVal{ - Value: jsonAttr.Name, - SrcRange: jsonAttr.NameRange, - }}, - Value: &expression{src: jsonAttr.Value}, - } - } - return ret - default: - return nil - } -} diff --git a/vendor/github.com/hashicorp/hcl/v2/json/tokentype_string.go b/vendor/github.com/hashicorp/hcl/v2/json/tokentype_string.go deleted file mode 100644 index bbcce5b30..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/json/tokentype_string.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by "stringer -type tokenType scanner.go"; DO NOT EDIT. - -package json - -import "strconv" - -const _tokenType_name = "tokenInvalidtokenCommatokenColontokenEqualstokenKeywordtokenNumbertokenStringtokenBrackOtokenBrackCtokenBraceOtokenBraceCtokenEOF" - -var _tokenType_map = map[tokenType]string{ - 0: _tokenType_name[0:12], - 44: _tokenType_name[12:22], - 58: _tokenType_name[22:32], - 61: _tokenType_name[32:43], - 75: _tokenType_name[43:55], - 78: _tokenType_name[55:66], - 83: _tokenType_name[66:77], - 91: _tokenType_name[77:88], - 93: _tokenType_name[88:99], - 123: _tokenType_name[99:110], - 125: _tokenType_name[110:121], - 9220: _tokenType_name[121:129], -} - -func (i tokenType) String() string { - if str, ok := _tokenType_map[i]; ok { - return str - } - return "tokenType(" + strconv.FormatInt(int64(i), 10) + ")" -} diff --git a/vendor/github.com/hashicorp/hcl/v2/merged.go b/vendor/github.com/hashicorp/hcl/v2/merged.go deleted file mode 100644 index 96e62a58d..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/merged.go +++ /dev/null @@ -1,226 +0,0 @@ -package hcl - -import ( - "fmt" -) - -// MergeFiles combines the given files to produce a single body that contains -// configuration from all of the given files. -// -// The ordering of the given files decides the order in which contained -// elements will be returned. If any top-level attributes are defined with -// the same name across multiple files, a diagnostic will be produced from -// the Content and PartialContent methods describing this error in a -// user-friendly way. -func MergeFiles(files []*File) Body { - var bodies []Body - for _, file := range files { - bodies = append(bodies, file.Body) - } - return MergeBodies(bodies) -} - -// MergeBodies is like MergeFiles except it deals directly with bodies, rather -// than with entire files. -func MergeBodies(bodies []Body) Body { - if len(bodies) == 0 { - // Swap out for our singleton empty body, to reduce the number of - // empty slices we have hanging around. - return emptyBody - } - - // If any of the given bodies are already merged bodies, we'll unpack - // to flatten to a single mergedBodies, since that's conceptually simpler. - // This also, as a side-effect, eliminates any empty bodies, since - // empties are merged bodies with no inner bodies. - var newLen int - var flatten bool - for _, body := range bodies { - if children, merged := body.(mergedBodies); merged { - newLen += len(children) - flatten = true - } else { - newLen++ - } - } - - if !flatten { // not just newLen == len, because we might have mergedBodies with single bodies inside - return mergedBodies(bodies) - } - - if newLen == 0 { - // Don't allocate a new empty when we already have one - return emptyBody - } - - new := make([]Body, 0, newLen) - for _, body := range bodies { - if children, merged := body.(mergedBodies); merged { - new = append(new, children...) - } else { - new = append(new, body) - } - } - return mergedBodies(new) -} - -var emptyBody = mergedBodies([]Body{}) - -// EmptyBody returns a body with no content. This body can be used as a -// placeholder when a body is required but no body content is available. -func EmptyBody() Body { - return emptyBody -} - -type mergedBodies []Body - -// Content returns the content produced by applying the given schema to all -// of the merged bodies and merging the result. -// -// Although required attributes _are_ supported, they should be used sparingly -// with merged bodies since in this case there is no contextual information -// with which to return good diagnostics. Applications working with merged -// bodies may wish to mark all attributes as optional and then check for -// required attributes afterwards, to produce better diagnostics. -func (mb mergedBodies) Content(schema *BodySchema) (*BodyContent, Diagnostics) { - // the returned body will always be empty in this case, because mergedContent - // will only ever call Content on the child bodies. - content, _, diags := mb.mergedContent(schema, false) - return content, diags -} - -func (mb mergedBodies) PartialContent(schema *BodySchema) (*BodyContent, Body, Diagnostics) { - return mb.mergedContent(schema, true) -} - -func (mb mergedBodies) JustAttributes() (Attributes, Diagnostics) { - attrs := make(map[string]*Attribute) - var diags Diagnostics - - for _, body := range mb { - thisAttrs, thisDiags := body.JustAttributes() - - if len(thisDiags) != 0 { - diags = append(diags, thisDiags...) - } - - if thisAttrs != nil { - for name, attr := range thisAttrs { - if existing := attrs[name]; existing != nil { - diags = diags.Append(&Diagnostic{ - Severity: DiagError, - Summary: "Duplicate argument", - Detail: fmt.Sprintf( - "Argument %q was already set at %s", - name, existing.NameRange.String(), - ), - Subject: &attr.NameRange, - }) - continue - } - - attrs[name] = attr - } - } - } - - return attrs, diags -} - -func (mb mergedBodies) MissingItemRange() Range { - if len(mb) == 0 { - // Nothing useful to return here, so we'll return some garbage. - return Range{ - Filename: "", - } - } - - // arbitrarily use the first body's missing item range - return mb[0].MissingItemRange() -} - -func (mb mergedBodies) mergedContent(schema *BodySchema, partial bool) (*BodyContent, Body, Diagnostics) { - // We need to produce a new schema with none of the attributes marked as - // required, since _any one_ of our bodies can contribute an attribute value. - // We'll separately check that all required attributes are present at - // the end. - mergedSchema := &BodySchema{ - Blocks: schema.Blocks, - } - for _, attrS := range schema.Attributes { - mergedAttrS := attrS - mergedAttrS.Required = false - mergedSchema.Attributes = append(mergedSchema.Attributes, mergedAttrS) - } - - var mergedLeftovers []Body - content := &BodyContent{ - Attributes: map[string]*Attribute{}, - } - - var diags Diagnostics - for _, body := range mb { - var thisContent *BodyContent - var thisLeftovers Body - var thisDiags Diagnostics - - if partial { - thisContent, thisLeftovers, thisDiags = body.PartialContent(mergedSchema) - } else { - thisContent, thisDiags = body.Content(mergedSchema) - } - - if thisLeftovers != nil { - mergedLeftovers = append(mergedLeftovers, thisLeftovers) - } - if len(thisDiags) != 0 { - diags = append(diags, thisDiags...) - } - - if thisContent.Attributes != nil { - for name, attr := range thisContent.Attributes { - if existing := content.Attributes[name]; existing != nil { - diags = diags.Append(&Diagnostic{ - Severity: DiagError, - Summary: "Duplicate argument", - Detail: fmt.Sprintf( - "Argument %q was already set at %s", - name, existing.NameRange.String(), - ), - Subject: &attr.NameRange, - }) - continue - } - content.Attributes[name] = attr - } - } - - if len(thisContent.Blocks) != 0 { - content.Blocks = append(content.Blocks, thisContent.Blocks...) - } - } - - // Finally, we check for required attributes. - for _, attrS := range schema.Attributes { - if !attrS.Required { - continue - } - - if content.Attributes[attrS.Name] == nil { - // We don't have any context here to produce a good diagnostic, - // which is why we warn in the Content docstring to minimize the - // use of required attributes on merged bodies. - diags = diags.Append(&Diagnostic{ - Severity: DiagError, - Summary: "Missing required argument", - Detail: fmt.Sprintf( - "The argument %q is required, but was not set.", - attrS.Name, - ), - }) - } - } - - leftoverBody := MergeBodies(mergedLeftovers) - return content, leftoverBody, diags -} diff --git a/vendor/github.com/hashicorp/hcl/v2/ops.go b/vendor/github.com/hashicorp/hcl/v2/ops.go deleted file mode 100644 index 5d2910c13..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/ops.go +++ /dev/null @@ -1,288 +0,0 @@ -package hcl - -import ( - "fmt" - "math/big" - - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" -) - -// Index is a helper function that performs the same operation as the index -// operator in the HCL expression language. That is, the result is the -// same as it would be for collection[key] in a configuration expression. -// -// This is exported so that applications can perform indexing in a manner -// consistent with how the language does it, including handling of null and -// unknown values, etc. -// -// Diagnostics are produced if the given combination of values is not valid. -// Therefore a pointer to a source range must be provided to use in diagnostics, -// though nil can be provided if the calling application is going to -// ignore the subject of the returned diagnostics anyway. -func Index(collection, key cty.Value, srcRange *Range) (cty.Value, Diagnostics) { - if collection.IsNull() { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Attempt to index null value", - Detail: "This value is null, so it does not have any indices.", - Subject: srcRange, - }, - } - } - if key.IsNull() { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: "Can't use a null value as an indexing key.", - Subject: srcRange, - }, - } - } - ty := collection.Type() - kty := key.Type() - if kty == cty.DynamicPseudoType || ty == cty.DynamicPseudoType { - return cty.DynamicVal, nil - } - - switch { - - case ty.IsListType() || ty.IsTupleType() || ty.IsMapType(): - var wantType cty.Type - switch { - case ty.IsListType() || ty.IsTupleType(): - wantType = cty.Number - case ty.IsMapType(): - wantType = cty.String - default: - // should never happen - panic("don't know what key type we want") - } - - key, keyErr := convert.Convert(key, wantType) - if keyErr != nil { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: fmt.Sprintf( - "The given key does not identify an element in this collection value: %s.", - keyErr.Error(), - ), - Subject: srcRange, - }, - } - } - - has := collection.HasIndex(key) - if !has.IsKnown() { - if ty.IsTupleType() { - return cty.DynamicVal, nil - } else { - return cty.UnknownVal(ty.ElementType()), nil - } - } - if has.False() { - // We have a more specialized error message for the situation of - // using a fractional number to index into a sequence, because - // that will tend to happen if the user is trying to use division - // to calculate an index and not realizing that HCL does float - // division rather than integer division. - if (ty.IsListType() || ty.IsTupleType()) && key.Type().Equals(cty.Number) { - if key.IsKnown() && !key.IsNull() { - bf := key.AsBigFloat() - if _, acc := bf.Int(nil); acc != big.Exact { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: fmt.Sprintf("The given key does not identify an element in this collection value: indexing a sequence requires a whole number, but the given index (%g) has a fractional part.", bf), - Subject: srcRange, - }, - } - } - } - } - - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: "The given key does not identify an element in this collection value.", - Subject: srcRange, - }, - } - } - - return collection.Index(key), nil - - case ty.IsObjectType(): - key, keyErr := convert.Convert(key, cty.String) - if keyErr != nil { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: fmt.Sprintf( - "The given key does not identify an element in this collection value: %s.", - keyErr.Error(), - ), - Subject: srcRange, - }, - } - } - if !collection.IsKnown() { - return cty.DynamicVal, nil - } - if !key.IsKnown() { - return cty.DynamicVal, nil - } - - attrName := key.AsString() - - if !ty.HasAttribute(attrName) { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: "The given key does not identify an element in this collection value.", - Subject: srcRange, - }, - } - } - - return collection.GetAttr(attrName), nil - - default: - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: "This value does not have any indices.", - Subject: srcRange, - }, - } - } - -} - -// GetAttr is a helper function that performs the same operation as the -// attribute access in the HCL expression language. That is, the result is the -// same as it would be for obj.attr in a configuration expression. -// -// This is exported so that applications can access attributes in a manner -// consistent with how the language does it, including handling of null and -// unknown values, etc. -// -// Diagnostics are produced if the given combination of values is not valid. -// Therefore a pointer to a source range must be provided to use in diagnostics, -// though nil can be provided if the calling application is going to -// ignore the subject of the returned diagnostics anyway. -func GetAttr(obj cty.Value, attrName string, srcRange *Range) (cty.Value, Diagnostics) { - if obj.IsNull() { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Attempt to get attribute from null value", - Detail: "This value is null, so it does not have any attributes.", - Subject: srcRange, - }, - } - } - - ty := obj.Type() - switch { - case ty.IsObjectType(): - if !ty.HasAttribute(attrName) { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Unsupported attribute", - Detail: fmt.Sprintf("This object does not have an attribute named %q.", attrName), - Subject: srcRange, - }, - } - } - - if !obj.IsKnown() { - return cty.UnknownVal(ty.AttributeType(attrName)), nil - } - - return obj.GetAttr(attrName), nil - case ty.IsMapType(): - if !obj.IsKnown() { - return cty.UnknownVal(ty.ElementType()), nil - } - - idx := cty.StringVal(attrName) - if obj.HasIndex(idx).False() { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Missing map element", - Detail: fmt.Sprintf("This map does not have an element with the key %q.", attrName), - Subject: srcRange, - }, - } - } - - return obj.Index(idx), nil - case ty == cty.DynamicPseudoType: - return cty.DynamicVal, nil - default: - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Unsupported attribute", - Detail: "This value does not have any attributes.", - Subject: srcRange, - }, - } - } - -} - -// ApplyPath is a helper function that applies a cty.Path to a value using the -// indexing and attribute access operations from HCL. -// -// This is similar to calling the path's own Apply method, but ApplyPath uses -// the more relaxed typing rules that apply to these operations in HCL, rather -// than cty's relatively-strict rules. ApplyPath is implemented in terms of -// Index and GetAttr, and so it has the same behavior for individual steps -// but will stop and return any errors returned by intermediate steps. -// -// Diagnostics are produced if the given path cannot be applied to the given -// value. Therefore a pointer to a source range must be provided to use in -// diagnostics, though nil can be provided if the calling application is going -// to ignore the subject of the returned diagnostics anyway. -func ApplyPath(val cty.Value, path cty.Path, srcRange *Range) (cty.Value, Diagnostics) { - var diags Diagnostics - - for _, step := range path { - var stepDiags Diagnostics - switch ts := step.(type) { - case cty.IndexStep: - val, stepDiags = Index(val, ts.Key, srcRange) - case cty.GetAttrStep: - val, stepDiags = GetAttr(val, ts.Name, srcRange) - default: - // Should never happen because the above are all of the step types. - diags = diags.Append(&Diagnostic{ - Severity: DiagError, - Summary: "Invalid path step", - Detail: fmt.Sprintf("Go type %T is not a valid path step. This is a bug in this program.", step), - Subject: srcRange, - }) - return cty.DynamicVal, diags - } - - diags = append(diags, stepDiags...) - if stepDiags.HasErrors() { - return cty.DynamicVal, diags - } - } - - return val, diags -} diff --git a/vendor/github.com/hashicorp/hcl/v2/pos.go b/vendor/github.com/hashicorp/hcl/v2/pos.go deleted file mode 100644 index 06db8bfbd..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/pos.go +++ /dev/null @@ -1,275 +0,0 @@ -package hcl - -import "fmt" - -// Pos represents a single position in a source file, by addressing the -// start byte of a unicode character encoded in UTF-8. -// -// Pos is generally used only in the context of a Range, which then defines -// which source file the position is within. -type Pos struct { - // Line is the source code line where this position points. Lines are - // counted starting at 1 and incremented for each newline character - // encountered. - Line int - - // Column is the source code column where this position points, in - // unicode characters, with counting starting at 1. - // - // Column counts characters as they appear visually, so for example a - // latin letter with a combining diacritic mark counts as one character. - // This is intended for rendering visual markers against source code in - // contexts where these diacritics would be rendered in a single character - // cell. Technically speaking, Column is counting grapheme clusters as - // used in unicode normalization. - Column int - - // Byte is the byte offset into the file where the indicated character - // begins. This is a zero-based offset to the first byte of the first - // UTF-8 codepoint sequence in the character, and thus gives a position - // that can be resolved _without_ awareness of Unicode characters. - Byte int -} - -// InitialPos is a suitable position to use to mark the start of a file. -var InitialPos = Pos{Byte: 0, Line: 1, Column: 1} - -// Range represents a span of characters between two positions in a source -// file. -// -// This struct is usually used by value in types that represent AST nodes, -// but by pointer in types that refer to the positions of other objects, -// such as in diagnostics. -type Range struct { - // Filename is the name of the file into which this range's positions - // point. - Filename string - - // Start and End represent the bounds of this range. Start is inclusive - // and End is exclusive. - Start, End Pos -} - -// RangeBetween returns a new range that spans from the beginning of the -// start range to the end of the end range. -// -// The result is meaningless if the two ranges do not belong to the same -// source file or if the end range appears before the start range. -func RangeBetween(start, end Range) Range { - return Range{ - Filename: start.Filename, - Start: start.Start, - End: end.End, - } -} - -// RangeOver returns a new range that covers both of the given ranges and -// possibly additional content between them if the two ranges do not overlap. -// -// If either range is empty then it is ignored. The result is empty if both -// given ranges are empty. -// -// The result is meaningless if the two ranges to not belong to the same -// source file. -func RangeOver(a, b Range) Range { - if a.Empty() { - return b - } - if b.Empty() { - return a - } - - var start, end Pos - if a.Start.Byte < b.Start.Byte { - start = a.Start - } else { - start = b.Start - } - if a.End.Byte > b.End.Byte { - end = a.End - } else { - end = b.End - } - return Range{ - Filename: a.Filename, - Start: start, - End: end, - } -} - -// ContainsPos returns true if and only if the given position is contained within -// the receiving range. -// -// In the unlikely case that the line/column information disagree with the byte -// offset information in the given position or receiving range, the byte -// offsets are given priority. -func (r Range) ContainsPos(pos Pos) bool { - return r.ContainsOffset(pos.Byte) -} - -// ContainsOffset returns true if and only if the given byte offset is within -// the receiving Range. -func (r Range) ContainsOffset(offset int) bool { - return offset >= r.Start.Byte && offset < r.End.Byte -} - -// Ptr returns a pointer to a copy of the receiver. This is a convenience when -// ranges in places where pointers are required, such as in Diagnostic, but -// the range in question is returned from a method. Go would otherwise not -// allow one to take the address of a function call. -func (r Range) Ptr() *Range { - return &r -} - -// String returns a compact string representation of the receiver. -// Callers should generally prefer to present a range more visually, -// e.g. via markers directly on the relevant portion of source code. -func (r Range) String() string { - if r.Start.Line == r.End.Line { - return fmt.Sprintf( - "%s:%d,%d-%d", - r.Filename, - r.Start.Line, r.Start.Column, - r.End.Column, - ) - } else { - return fmt.Sprintf( - "%s:%d,%d-%d,%d", - r.Filename, - r.Start.Line, r.Start.Column, - r.End.Line, r.End.Column, - ) - } -} - -func (r Range) Empty() bool { - return r.Start.Byte == r.End.Byte -} - -// CanSliceBytes returns true if SliceBytes could return an accurate -// sub-slice of the given slice. -// -// This effectively tests whether the start and end offsets of the range -// are within the bounds of the slice, and thus whether SliceBytes can be -// trusted to produce an accurate start and end position within that slice. -func (r Range) CanSliceBytes(b []byte) bool { - switch { - case r.Start.Byte < 0 || r.Start.Byte > len(b): - return false - case r.End.Byte < 0 || r.End.Byte > len(b): - return false - case r.End.Byte < r.Start.Byte: - return false - default: - return true - } -} - -// SliceBytes returns a sub-slice of the given slice that is covered by the -// receiving range, assuming that the given slice is the source code of the -// file indicated by r.Filename. -// -// If the receiver refers to any byte offsets that are outside of the slice -// then the result is constrained to the overlapping portion only, to avoid -// a panic. Use CanSliceBytes to determine if the result is guaranteed to -// be an accurate span of the requested range. -func (r Range) SliceBytes(b []byte) []byte { - start := r.Start.Byte - end := r.End.Byte - if start < 0 { - start = 0 - } else if start > len(b) { - start = len(b) - } - if end < 0 { - end = 0 - } else if end > len(b) { - end = len(b) - } - if end < start { - end = start - } - return b[start:end] -} - -// Overlaps returns true if the receiver and the other given range share any -// characters in common. -func (r Range) Overlaps(other Range) bool { - switch { - case r.Filename != other.Filename: - // If the ranges are in different files then they can't possibly overlap - return false - case r.Empty() || other.Empty(): - // Empty ranges can never overlap - return false - case r.ContainsOffset(other.Start.Byte) || r.ContainsOffset(other.End.Byte): - return true - case other.ContainsOffset(r.Start.Byte) || other.ContainsOffset(r.End.Byte): - return true - default: - return false - } -} - -// Overlap finds a range that is either identical to or a sub-range of both -// the receiver and the other given range. It returns an empty range -// within the receiver if there is no overlap between the two ranges. -// -// A non-empty result is either identical to or a subset of the receiver. -func (r Range) Overlap(other Range) Range { - if !r.Overlaps(other) { - // Start == End indicates an empty range - return Range{ - Filename: r.Filename, - Start: r.Start, - End: r.Start, - } - } - - var start, end Pos - if r.Start.Byte > other.Start.Byte { - start = r.Start - } else { - start = other.Start - } - if r.End.Byte < other.End.Byte { - end = r.End - } else { - end = other.End - } - - return Range{ - Filename: r.Filename, - Start: start, - End: end, - } -} - -// PartitionAround finds the portion of the given range that overlaps with -// the reciever and returns three ranges: the portion of the reciever that -// precedes the overlap, the overlap itself, and then the portion of the -// reciever that comes after the overlap. -// -// If the two ranges do not overlap then all three returned ranges are empty. -// -// If the given range aligns with or extends beyond either extent of the -// reciever then the corresponding outer range will be empty. -func (r Range) PartitionAround(other Range) (before, overlap, after Range) { - overlap = r.Overlap(other) - if overlap.Empty() { - return overlap, overlap, overlap - } - - before = Range{ - Filename: r.Filename, - Start: r.Start, - End: overlap.Start, - } - after = Range{ - Filename: r.Filename, - Start: overlap.End, - End: r.End, - } - - return before, overlap, after -} diff --git a/vendor/github.com/hashicorp/hcl/v2/pos_scanner.go b/vendor/github.com/hashicorp/hcl/v2/pos_scanner.go deleted file mode 100644 index 17c0d7c6b..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/pos_scanner.go +++ /dev/null @@ -1,152 +0,0 @@ -package hcl - -import ( - "bufio" - "bytes" - - "github.com/apparentlymart/go-textseg/textseg" -) - -// RangeScanner is a helper that will scan over a buffer using a bufio.SplitFunc -// and visit a source range for each token matched. -// -// For example, this can be used with bufio.ScanLines to find the source range -// for each line in the file, skipping over the actual newline characters, which -// may be useful when printing source code snippets as part of diagnostic -// messages. -// -// The line and column information in the returned ranges is produced by -// counting newline characters and grapheme clusters respectively, which -// mimics the behavior we expect from a parser when producing ranges. -type RangeScanner struct { - filename string - b []byte - cb bufio.SplitFunc - - pos Pos // position of next byte to process in b - cur Range // latest range - tok []byte // slice of b that is covered by cur - err error // error from last scan, if any -} - -// NewRangeScanner creates a new RangeScanner for the given buffer, producing -// ranges for the given filename. -// -// Since ranges have grapheme-cluster granularity rather than byte granularity, -// the scanner will produce incorrect results if the given SplitFunc creates -// tokens between grapheme cluster boundaries. In particular, it is incorrect -// to use RangeScanner with bufio.ScanRunes because it will produce tokens -// around individual UTF-8 sequences, which will split any multi-sequence -// grapheme clusters. -func NewRangeScanner(b []byte, filename string, cb bufio.SplitFunc) *RangeScanner { - return NewRangeScannerFragment(b, filename, InitialPos, cb) -} - -// NewRangeScannerFragment is like NewRangeScanner but the ranges it produces -// will be offset by the given starting position, which is appropriate for -// sub-slices of a file, whereas NewRangeScanner assumes it is scanning an -// entire file. -func NewRangeScannerFragment(b []byte, filename string, start Pos, cb bufio.SplitFunc) *RangeScanner { - return &RangeScanner{ - filename: filename, - b: b, - cb: cb, - pos: start, - } -} - -func (sc *RangeScanner) Scan() bool { - if sc.pos.Byte >= len(sc.b) || sc.err != nil { - // All done - return false - } - - // Since we're operating on an in-memory buffer, we always pass the whole - // remainder of the buffer to our SplitFunc and set isEOF to let it know - // that it has the whole thing. - advance, token, err := sc.cb(sc.b[sc.pos.Byte:], true) - - // Since we are setting isEOF to true this should never happen, but - // if it does we will just abort and assume the SplitFunc is misbehaving. - if advance == 0 && token == nil && err == nil { - return false - } - - if err != nil { - sc.err = err - sc.cur = Range{ - Filename: sc.filename, - Start: sc.pos, - End: sc.pos, - } - sc.tok = nil - return false - } - - sc.tok = token - start := sc.pos - end := sc.pos - new := sc.pos - - // adv is similar to token but it also includes any subsequent characters - // we're being asked to skip over by the SplitFunc. - // adv is a slice covering any additional bytes we are skipping over, based - // on what the SplitFunc told us to do with advance. - adv := sc.b[sc.pos.Byte : sc.pos.Byte+advance] - - // We now need to scan over our token to count the grapheme clusters - // so we can correctly advance Column, and count the newlines so we - // can correctly advance Line. - advR := bytes.NewReader(adv) - gsc := bufio.NewScanner(advR) - advanced := 0 - gsc.Split(textseg.ScanGraphemeClusters) - for gsc.Scan() { - gr := gsc.Bytes() - new.Byte += len(gr) - new.Column++ - - // We rely here on the fact that \r\n is considered a grapheme cluster - // and so we don't need to worry about miscounting additional lines - // on files with Windows-style line endings. - if len(gr) != 0 && (gr[0] == '\r' || gr[0] == '\n') { - new.Column = 1 - new.Line++ - } - - if advanced < len(token) { - // If we've not yet found the end of our token then we'll - // also push our "end" marker along. - // (if advance > len(token) then we'll stop moving "end" early - // so that the caller only sees the range covered by token.) - end = new - } - advanced += len(gr) - } - - sc.cur = Range{ - Filename: sc.filename, - Start: start, - End: end, - } - sc.pos = new - return true -} - -// Range returns a range that covers the latest token obtained after a call -// to Scan returns true. -func (sc *RangeScanner) Range() Range { - return sc.cur -} - -// Bytes returns the slice of the input buffer that is covered by the range -// that would be returned by Range. -func (sc *RangeScanner) Bytes() []byte { - return sc.tok -} - -// Err can be called after Scan returns false to determine if the latest read -// resulted in an error, and obtain that error if so. -func (sc *RangeScanner) Err() error { - return sc.err -} diff --git a/vendor/github.com/hashicorp/hcl/v2/schema.go b/vendor/github.com/hashicorp/hcl/v2/schema.go deleted file mode 100644 index 891257acb..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/schema.go +++ /dev/null @@ -1,21 +0,0 @@ -package hcl - -// BlockHeaderSchema represents the shape of a block header, and is -// used for matching blocks within bodies. -type BlockHeaderSchema struct { - Type string - LabelNames []string -} - -// AttributeSchema represents the requirements for an attribute, and is used -// for matching attributes within bodies. -type AttributeSchema struct { - Name string - Required bool -} - -// BodySchema represents the desired shallow structure of a body. -type BodySchema struct { - Attributes []AttributeSchema - Blocks []BlockHeaderSchema -} diff --git a/vendor/github.com/hashicorp/hcl/v2/spec.md b/vendor/github.com/hashicorp/hcl/v2/spec.md deleted file mode 100644 index 97ef61318..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/spec.md +++ /dev/null @@ -1,691 +0,0 @@ -# HCL Syntax-Agnostic Information Model - -This is the specification for the general information model (abstract types and -semantics) for hcl. HCL is a system for defining configuration languages for -applications. The HCL information model is designed to support multiple -concrete syntaxes for configuration, each with a mapping to the model defined -in this specification. - -The two primary syntaxes intended for use in conjunction with this model are -[the HCL native syntax](./hclsyntax/spec.md) and [the JSON syntax](./json/spec.md). -In principle other syntaxes are possible as long as either their language model -is sufficiently rich to express the concepts described in this specification -or the language targets a well-defined subset of the specification. - -## Structural Elements - -The primary structural element is the _body_, which is a container representing -a set of zero or more _attributes_ and a set of zero or more _blocks_. - -A _configuration file_ is the top-level object, and will usually be produced -by reading a file from disk and parsing it as a particular syntax. A -configuration file has its own _body_, representing the top-level attributes -and blocks. - -An _attribute_ is a name and value pair associated with a body. Attribute names -are unique within a given body. Attribute values are provided as _expressions_, -which are discussed in detail in a later section. - -A _block_ is a nested structure that has a _type name_, zero or more string -_labels_ (e.g. identifiers), and a nested body. - -Together the structural elements create a hierarchical data structure, with -attributes intended to represent the direct properties of a particular object -in the calling application, and blocks intended to represent child objects -of a particular object. - -## Body Content - -To support the expression of the HCL concepts in languages whose information -model is a subset of HCL's, such as JSON, a _body_ is an opaque container -whose content can only be accessed by providing information on the expected -structure of the content. - -The specification for each syntax must describe how its physical constructs -are mapped on to body content given a schema. For syntaxes that have -first-class syntax distinguishing attributes and bodies this can be relatively -straightforward, while more detailed mapping rules may be required in syntaxes -where the representation of attributes vs. blocks is ambiguous. - -### Schema-driven Processing - -Schema-driven processing is the primary way to access body content. -A _body schema_ is a description of what is expected within a particular body, -which can then be used to extract the _body content_, which then provides -access to the specific attributes and blocks requested. - -A _body schema_ consists of a list of _attribute schemata_ and -_block header schemata_: - -- An _attribute schema_ provides the name of an attribute and whether its - presence is required. - -- A _block header schema_ provides a block type name and the semantic names - assigned to each of the labels of that block type, if any. - -Within a schema, it is an error to request the same attribute name twice or -to request a block type whose name is also an attribute name. While this can -in principle be supported in some syntaxes, in other syntaxes the attribute -and block namespaces are combined and so an attribute cannot coexist with -a block whose type name is identical to the attribute name. - -The result of applying a body schema to a body is _body content_, which -consists of an _attribute map_ and a _block sequence_: - -- The _attribute map_ is a map data structure whose keys are attribute names - and whose values are _expressions_ that represent the corresponding attribute - values. - -- The _block sequence_ is an ordered sequence of blocks, with each specifying - a block _type name_, the sequence of _labels_ specified for the block, - and the body object (not body _content_) representing the block's own body. - -After obtaining _body content_, the calling application may continue processing -by evaluating attribute expressions and/or recursively applying further -schema-driven processing to the child block bodies. - -**Note:** The _body schema_ is intentionally minimal, to reduce the set of -mapping rules that must be defined for each syntax. Higher-level utility -libraries may be provided to assist in the construction of a schema and -perform additional processing, such as automatically evaluating attribute -expressions and assigning their result values into a data structure, or -recursively applying a schema to child blocks. Such utilities are not part of -this core specification and will vary depending on the capabilities and idiom -of the implementation language. - -### _Dynamic Attributes_ Processing - -The _schema-driven_ processing model is useful when the expected structure -of a body is known a priori by the calling application. Some blocks are -instead more free-form, such as a user-provided set of arbitrary key/value -pairs. - -The alternative _dynamic attributes_ processing mode allows for this more -ad-hoc approach. Processing in this mode behaves as if a schema had been -constructed without any _block header schemata_ and with an attribute -schema for each distinct key provided within the physical representation -of the body. - -The means by which _distinct keys_ are identified is dependent on the -physical syntax; this processing mode assumes that the syntax has a way -to enumerate keys provided by the author and identify expressions that -correspond with those keys, but does not define the means by which this is -done. - -The result of _dynamic attributes_ processing is an _attribute map_ as -defined in the previous section. No _block sequence_ is produced in this -processing mode. - -### Partial Processing of Body Content - -Under _schema-driven processing_, by default the given schema is assumed -to be exhaustive, such that any attribute or block not matched by schema -elements is considered an error. This allows feedback about unsupported -attributes and blocks (such as typos) to be provided. - -An alternative is _partial processing_, where any additional elements within -the body are not considered an error. - -Under partial processing, the result is both body content as described -above _and_ a new body that represents any body elements that remain after -the schema has been processed. - -Specifically: - -- Any attribute whose name is specified in the schema is returned in body - content and elided from the new body. - -- Any block whose type is specified in the schema is returned in body content - and elided from the new body. - -- Any attribute or block _not_ meeting the above conditions is placed into - the new body, unmodified. - -The new body can then be recursively processed using any of the body -processing models. This facility allows different subsets of body content -to be processed by different parts of the calling application. - -Processing a body in two steps — first partial processing of a source body, -then exhaustive processing of the returned body — is equivalent to single-step -processing with a schema that is the union of the schemata used -across the two steps. - -## Expressions - -Attribute values are represented by _expressions_. Depending on the concrete -syntax in use, an expression may just be a literal value or it may describe -a computation in terms of literal values, variables, and functions. - -Each syntax defines its own representation of expressions. For syntaxes based -in languages that do not have any non-literal expression syntax, it is -recommended to embed the template language from -[the native syntax](./hclsyntax/spec.md) e.g. as a post-processing step on -string literals. - -### Expression Evaluation - -In order to obtain a concrete value, each expression must be _evaluated_. -Evaluation is performed in terms of an evaluation context, which -consists of the following: - -- An _evaluation mode_, which is defined below. -- A _variable scope_, which provides a set of named variables for use in - expressions. -- A _function table_, which provides a set of named functions for use in - expressions. - -The _evaluation mode_ allows for two different interpretations of an -expression: - -- In _literal-only mode_, variables and functions are not available and it - is assumed that the calling application's intent is to treat the attribute - value as a literal. - -- In _full expression mode_, variables and functions are defined and it is - assumed that the calling application wishes to provide a full expression - language for definition of the attribute value. - -The actual behavior of these two modes depends on the syntax in use. For -languages with first-class expression syntax, these two modes may be considered -equivalent, with _literal-only mode_ simply not defining any variables or -functions. For languages that embed arbitrary expressions via string templates, -_literal-only mode_ may disable such processing, allowing literal strings to -pass through without interpretation as templates. - -Since literal-only mode does not support variables and functions, it is an -error for the calling application to enable this mode and yet provide a -variable scope and/or function table. - -## Values and Value Types - -The result of expression evaluation is a _value_. Each value has a _type_, -which is dynamically determined during evaluation. The _variable scope_ in -the evaluation context is a map from variable name to value, using the same -definition of value. - -The type system for HCL values is intended to be of a level abstraction -suitable for configuration of various applications. A well-defined, -implementation-language-agnostic type system is defined to allow for -consistent processing of configuration across many implementation languages. -Concrete implementations may provide additional functionality to lower -HCL values and types to corresponding native language types, which may then -impose additional constraints on the values outside of the scope of this -specification. - -Two values are _equal_ if and only if they have identical types and their -values are equal according to the rules of their shared type. - -### Primitive Types - -The primitive types are _string_, _bool_, and _number_. - -A _string_ is a sequence of unicode characters. Two strings are equal if -NFC normalization ([UAX#15](http://unicode.org/reports/tr15/) -of each string produces two identical sequences of characters. -NFC normalization ensures that, for example, a precomposed combination of a -latin letter and a diacritic compares equal with the letter followed by -a combining diacritic. - -The _bool_ type has only two non-null values: _true_ and _false_. Two bool -values are equal if and only if they are either both true or both false. - -A _number_ is an arbitrary-precision floating point value. An implementation -_must_ make the full-precision values available to the calling application -for interpretation into any suitable number representation. An implementation -may in practice implement numbers with limited precision so long as the -following constraints are met: - -- Integers are represented with at least 256 bits. -- Non-integer numbers are represented as floating point values with a - mantissa of at least 256 bits and a signed binary exponent of at least - 16 bits. -- An error is produced if an integer value given in source cannot be - represented precisely. -- An error is produced if a non-integer value cannot be represented due to - overflow. -- A non-integer number is rounded to the nearest possible value when a - value is of too high a precision to be represented. - -The _number_ type also requires representation of both positive and negative -infinity. A "not a number" (NaN) value is _not_ provided nor used. - -Two number values are equal if they are numerically equal to the precision -associated with the number. Positive infinity and negative infinity are -equal to themselves but not to each other. Positive infinity is greater than -any other number value, and negative infinity is less than any other number -value. - -Some syntaxes may be unable to represent numeric literals of arbitrary -precision. This must be defined in the syntax specification as part of its -description of mapping numeric literals to HCL values. - -### Structural Types - -_Structural types_ are types that are constructed by combining other types. -Each distinct combination of other types is itself a distinct type. There -are two structural type _kinds_: - -- _Object types_ are constructed of a set of named attributes, each of which - has a type. Attribute names are always strings. (_Object_ attributes are a - distinct idea from _body_ attributes, though calling applications - may choose to blur the distinction by use of common naming schemes.) -- _Tuple types_ are constructed of a sequence of elements, each of which - has a type. - -Values of structural types are compared for equality in terms of their -attributes or elements. A structural type value is equal to another if and -only if all of the corresponding attributes or elements are equal. - -Two structural types are identical if they are of the same kind and -have attributes or elements with identical types. - -### Collection Types - -_Collection types_ are types that combine together an arbitrary number of -values of some other single type. There are three collection type _kinds_: - -- _List types_ represent ordered sequences of values of their element type. -- _Map types_ represent values of their element type accessed via string keys. -- _Set types_ represent unordered sets of distinct values of their element type. - -For each of these kinds and each distinct element type there is a distinct -collection type. For example, "list of string" is a distinct type from -"set of string", and "list of number" is a distinct type from "list of string". - -Values of collection types are compared for equality in terms of their -elements. A collection type value is equal to another if and only if both -have the same number of elements and their corresponding elements are equal. - -Two collection types are identical if they are of the same kind and have -the same element type. - -### Null values - -Each type has a null value. The null value of a type represents the absence -of a value, but with type information retained to allow for type checking. - -Null values are used primarily to represent the conditional absence of a -body attribute. In a syntax with a conditional operator, one of the result -values of that conditional may be null to indicate that the attribute should be -considered not present in that case. - -Calling applications _should_ consider an attribute with a null value as -equivalent to the value not being present at all. - -A null value of a particular type is equal to itself. - -### Unknown Values and the Dynamic Pseudo-type - -An _unknown value_ is a placeholder for a value that is not yet known. -Operations on unknown values themselves return unknown values that have a -type appropriate to the operation. For example, adding together two unknown -numbers yields an unknown number, while comparing two unknown values of any -type for equality yields an unknown bool. - -Each type has a distinct unknown value. For example, an unknown _number_ is -a distinct value from an unknown _string_. - -_The dynamic pseudo-type_ is a placeholder for a type that is not yet known. -The only values of this type are its null value and its unknown value. It is -referred to as a _pseudo-type_ because it should not be considered a type in -its own right, but rather as a placeholder for a type yet to be established. -The unknown value of the dynamic pseudo-type is referred to as _the dynamic -value_. - -Operations on values of the dynamic pseudo-type behave as if it is a value -of the expected type, optimistically assuming that once the value and type -are known they will be valid for the operation. For example, adding together -a number and the dynamic value produces an unknown number. - -Unknown values and the dynamic pseudo-type can be used as a mechanism for -partial type checking and semantic checking: by evaluating an expression with -all variables set to an unknown value, the expression can be evaluated to -produce an unknown value of a given type, or produce an error if any operation -is provably invalid with only type information. - -Unknown values and the dynamic pseudo-type must never be returned from -operations unless at least one operand is unknown or dynamic. Calling -applications are guaranteed that unless the global scope includes unknown -values, or the function table includes functions that return unknown values, -no expression will evaluate to an unknown value. The calling application is -thus in total control over the use and meaning of unknown values. - -The dynamic pseudo-type is identical only to itself. - -### Capsule Types - -A _capsule type_ is a custom type defined by the calling application. A value -of a capsule type is considered opaque to HCL, but may be accepted -by functions provided by the calling application. - -A particular capsule type is identical only to itself. The equality of two -values of the same capsule type is defined by the calling application. No -other operations are supported for values of capsule types. - -Support for capsule types in a HCL implementation is optional. Capsule types -are intended to allow calling applications to pass through values that are -not part of the standard type system. For example, an application that -deals with raw binary data may define a capsule type representing a byte -array, and provide functions that produce or operate on byte arrays. - -### Type Specifications - -In certain situations it is necessary to define expectations about the expected -type of a value. Whereas two _types_ have a commutative _identity_ relationship, -a type has a non-commutative _matches_ relationship with a _type specification_. -A type specification is, in practice, just a different interpretation of a -type such that: - -- Any type _matches_ any type that it is identical to. - -- Any type _matches_ the dynamic pseudo-type. - -For example, given a type specification "list of dynamic pseudo-type", the -concrete types "list of string" and "list of map" match, but the -type "set of string" does not. - -## Functions and Function Calls - -The evaluation context used to evaluate an expression includes a function -table, which represents an application-defined set of named functions -available for use in expressions. - -Each syntax defines whether function calls are supported and how they are -physically represented in source code, but the semantics of function calls are -defined here to ensure consistent results across syntaxes and to allow -applications to provide functions that are interoperable with all syntaxes. - -A _function_ is defined from the following elements: - -- Zero or more _positional parameters_, each with a name used for documentation, - a type specification for expected argument values, and a flag for whether - each of null values, unknown values, and values of the dynamic pseudo-type - are accepted. - -- Zero or one _variadic parameters_, with the same structure as the _positional_ - parameters, which if present collects any additional arguments provided at - the function call site. - -- A _result type definition_, which specifies the value type returned for each - valid sequence of argument values. - -- A _result value definition_, which specifies the value returned for each - valid sequence of argument values. - -A _function call_, regardless of source syntax, consists of a sequence of -argument values. The argument values are each mapped to a corresponding -parameter as follows: - -- For each of the function's positional parameters in sequence, take the next - argument. If there are no more arguments, the call is erroneous. - -- If the function has a variadic parameter, take all remaining arguments that - where not yet assigned to a positional parameter and collect them into - a sequence of variadic arguments that each correspond to the variadic - parameter. - -- If the function has _no_ variadic parameter, it is an error if any arguments - remain after taking one argument for each positional parameter. - -After mapping each argument to a parameter, semantic checking proceeds -for each argument: - -- If the argument value corresponding to a parameter does not match the - parameter's type specification, the call is erroneous. - -- If the argument value corresponding to a parameter is null and the parameter - is not specified as accepting nulls, the call is erroneous. - -- If the argument value corresponding to a parameter is the dynamic value - and the parameter is not specified as accepting values of the dynamic - pseudo-type, the call is valid but its _result type_ is forced to be the - dynamic pseudo type. - -- If neither of the above conditions holds for any argument, the call is - valid and the function's value type definition is used to determine the - call's _result type_. A function _may_ vary its result type depending on - the argument _values_ as well as the argument _types_; for example, a - function that decodes a JSON value will return a different result type - depending on the data structure described by the given JSON source code. - -If semantic checking succeeds without error, the call is _executed_: - -- For each argument, if its value is unknown and its corresponding parameter - is not specified as accepting unknowns, the _result value_ is forced to be an - unknown value of the result type. - -- If the previous condition does not apply, the function's result value - definition is used to determine the call's _result value_. - -The result of a function call expression is either an error, if one of the -erroneous conditions above applies, or the _result value_. - -## Type Conversions and Unification - -Values given in configuration may not always match the expectations of the -operations applied to them or to the calling application. In such situations, -automatic type conversion is attempted as a convenience to the user. - -Along with conversions to a _specified_ type, it is sometimes necessary to -ensure that a selection of values are all of the _same_ type, without any -constraint on which type that is. This is the process of _type unification_, -which attempts to find the most general type that all of the given types can -be converted to. - -Both type conversions and unification are defined in the syntax-agnostic -model to ensure consistency of behavior between syntaxes. - -Type conversions are broadly characterized into two categories: _safe_ and -_unsafe_. A conversion is "safe" if any distinct value of the source type -has a corresponding distinct value in the target type. A conversion is -"unsafe" if either the target type values are _not_ distinct (information -may be lost in conversion) or if some values of the source type do not have -any corresponding value in the target type. An unsafe conversion may result -in an error. - -A given type can always be converted to itself, which is a no-op. - -### Conversion of Null Values - -All null values are safely convertable to a null value of any other type, -regardless of other type-specific rules specified in the sections below. - -### Conversion to and from the Dynamic Pseudo-type - -Conversion _from_ the dynamic pseudo-type _to_ any other type always succeeds, -producing an unknown value of the target type. - -Conversion of any value _to_ the dynamic pseudo-type is a no-op. The result -is the input value, verbatim. This is the only situation where the conversion -result value is not of the given target type. - -### Primitive Type Conversions - -Bidirectional conversions are available between the string and number types, -and between the string and boolean types. - -The bool value true corresponds to the string containing the characters "true", -while the bool value false corresponds to the string containing the characters -"false". Conversion from bool to string is safe, while the converse is -unsafe. The strings "1" and "0" are alternative string representations -of true and false respectively. It is an error to convert a string other than -the four in this paragraph to type bool. - -A number value is converted to string by translating its integer portion -into a sequence of decimal digits (`0` through `9`), and then if it has a -non-zero fractional part, a period `.` followed by a sequence of decimal -digits representing its fractional part. No exponent portion is included. -The number is converted at its full precision. Conversion from number to -string is safe. - -A string is converted to a number value by reversing the above mapping. -No exponent portion is allowed. Conversion from string to number is unsafe. -It is an error to convert a string that does not comply with the expected -syntax to type number. - -No direct conversion is available between the bool and number types. - -### Collection and Structural Type Conversions - -Conversion from set types to list types is _safe_, as long as their -element types are safely convertable. If the element types are _unsafely_ -convertable, then the collection conversion is also unsafe. Each set element -becomes a corresponding list element, in an undefined order. Although no -particular ordering is required, implementations _should_ produce list -elements in a consistent order for a given input set, as a convenience -to calling applications. - -Conversion from list types to set types is _unsafe_, as long as their element -types are convertable. Each distinct list item becomes a distinct set item. -If two list items are equal, one of the two is lost in the conversion. - -Conversion from tuple types to list types permitted if all of the -tuple element types are convertable to the target list element type. -The safety of the conversion depends on the safety of each of the element -conversions. Each element in turn is converted to the list element type, -producing a list of identical length. - -Conversion from tuple types to set types is permitted, behaving as if the -tuple type was first converted to a list of the same element type and then -that list converted to the target set type. - -Conversion from object types to map types is permitted if all of the object -attribute types are convertable to the target map element type. The safety -of the conversion depends on the safety of each of the attribute conversions. -Each attribute in turn is converted to the map element type, and map element -keys are set to the name of each corresponding object attribute. - -Conversion from list and set types to tuple types is permitted, following -the opposite steps as the converse conversions. Such conversions are _unsafe_. -It is an error to convert a list or set to a tuple type whose number of -elements does not match the list or set length. - -Conversion from map types to object types is permitted if each map key -corresponds to an attribute in the target object type. It is an error to -convert from a map value whose set of keys does not exactly match the target -type's attributes. The conversion takes the opposite steps of the converse -conversion. - -Conversion from one object type to another is permitted as long as the -common attribute names have convertable types. Any attribute present in the -target type but not in the source type is populated with a null value of -the appropriate type. - -Conversion from one tuple type to another is permitted as long as the -tuples have the same length and the elements have convertable types. - -### Type Unification - -Type unification is an operation that takes a list of types and attempts -to find a single type to which they can all be converted. Since some -type pairs have bidirectional conversions, preference is given to _safe_ -conversions. In technical terms, all possible types are arranged into -a lattice, from which a most general supertype is selected where possible. - -The type resulting from type unification may be one of the input types, or -it may be an entirely new type produced by combination of two or more -input types. - -The following rules do not guarantee a valid result. In addition to these -rules, unification fails if any of the given types are not convertable -(per the above rules) to the selected result type. - -The following unification rules apply transitively. That is, if a rule is -defined from A to B, and one from B to C, then A can unify to C. - -Number and bool types both unify with string by preferring string. - -Two collection types of the same kind unify according to the unification -of their element types. - -List and set types unify by preferring the list type. - -Map and object types unify by preferring the object type. - -List, set and tuple types unify by preferring the tuple type. - -The dynamic pseudo-type unifies with any other type by selecting that other -type. The dynamic pseudo-type is the result type only if _all_ input types -are the dynamic pseudo-type. - -Two object types unify by constructing a new type whose attributes are -the union of those of the two input types. Any common attributes themselves -have their types unified. - -Two tuple types of the same length unify constructing a new type of the -same length whose elements are the unification of the corresponding elements -in the two input types. - -## Static Analysis - -In most applications, full expression evaluation is sufficient for understanding -the provided configuration. However, some specialized applications require more -direct access to the physical structures in the expressions, which can for -example allow the construction of new language constructs in terms of the -existing syntax elements. - -Since static analysis analyses the physical structure of configuration, the -details will vary depending on syntax. Each syntax must decide which of its -physical structures corresponds to the following analyses, producing error -diagnostics if they are applied to inappropriate expressions. - -The following are the required static analysis functions: - -- **Static List**: Require list/tuple construction syntax to be used and - return a list of expressions for each of the elements given. - -- **Static Map**: Require map/object construction syntax to be used and - return a list of key/value pairs -- both expressions -- for each of - the elements given. The usual constraint that a map key must be a string - must not apply to this analysis, thus allowing applications to interpret - arbitrary keys as they see fit. - -- **Static Call**: Require function call syntax to be used and return an - object describing the called function name and a list of expressions - representing each of the call arguments. - -- **Static Traversal**: Require a reference to a symbol in the variable - scope and return a description of the path from the root scope to the - accessed attribute or index. - -The intent of a calling application using these features is to require a more -rigid interpretation of the configuration than in expression evaluation. -Syntax implementations should make use of the extra contextual information -provided in order to make an intuitive mapping onto the constructs of the -underlying syntax, possibly interpreting the expression slightly differently -than it would be interpreted in normal evaluation. - -Each syntax must define which of its expression elements each of the analyses -above applies to, and how those analyses behave given those expression elements. - -## Implementation Considerations - -Implementations of this specification are free to adopt any strategy that -produces behavior consistent with the specification. This non-normative -section describes some possible implementation strategies that are consistent -with the goals of this specification. - -### Language-agnosticism - -The language-agnosticism of this specification assumes that certain behaviors -are implemented separately for each syntax: - -- Matching of a body schema with the physical elements of a body in the - source language, to determine correspondence between physical constructs - and schema elements. - -- Implementing the _dynamic attributes_ body processing mode by either - interpreting all physical constructs as attributes or producing an error - if non-attribute constructs are present. - -- Providing an evaluation function for all possible expressions that produces - a value given an evaluation context. - -- Providing the static analysis functionality described above in a manner that - makes sense within the convention of the syntax. - -The suggested implementation strategy is to use an implementation language's -closest concept to an _abstract type_, _virtual type_ or _interface type_ -to represent both Body and Expression. Each language-specific implementation -can then provide an implementation of each of these types wrapping AST nodes -or other physical constructs from the language parser. diff --git a/vendor/github.com/hashicorp/hcl/v2/static_expr.go b/vendor/github.com/hashicorp/hcl/v2/static_expr.go deleted file mode 100644 index 98ada87b6..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/static_expr.go +++ /dev/null @@ -1,40 +0,0 @@ -package hcl - -import ( - "github.com/zclconf/go-cty/cty" -) - -type staticExpr struct { - val cty.Value - rng Range -} - -// StaticExpr returns an Expression that always evaluates to the given value. -// -// This is useful to substitute default values for expressions that are -// not explicitly given in configuration and thus would otherwise have no -// Expression to return. -// -// Since expressions are expected to have a source range, the caller must -// provide one. Ideally this should be a real source range, but it can -// be a synthetic one (with an empty-string filename) if no suitable range -// is available. -func StaticExpr(val cty.Value, rng Range) Expression { - return staticExpr{val, rng} -} - -func (e staticExpr) Value(ctx *EvalContext) (cty.Value, Diagnostics) { - return e.val, nil -} - -func (e staticExpr) Variables() []Traversal { - return nil -} - -func (e staticExpr) Range() Range { - return e.rng -} - -func (e staticExpr) StartRange() Range { - return e.rng -} diff --git a/vendor/github.com/hashicorp/hcl/v2/structure.go b/vendor/github.com/hashicorp/hcl/v2/structure.go deleted file mode 100644 index aab09457d..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/structure.go +++ /dev/null @@ -1,151 +0,0 @@ -package hcl - -import ( - "github.com/zclconf/go-cty/cty" -) - -// File is the top-level node that results from parsing a HCL file. -type File struct { - Body Body - Bytes []byte - - // Nav is used to integrate with the "hcled" editor integration package, - // and with diagnostic information formatters. It is not for direct use - // by a calling application. - Nav interface{} -} - -// Block represents a nested block within a Body. -type Block struct { - Type string - Labels []string - Body Body - - DefRange Range // Range that can be considered the "definition" for seeking in an editor - TypeRange Range // Range for the block type declaration specifically. - LabelRanges []Range // Ranges for the label values specifically. -} - -// Blocks is a sequence of Block. -type Blocks []*Block - -// Attributes is a set of attributes keyed by their names. -type Attributes map[string]*Attribute - -// Body is a container for attributes and blocks. It serves as the primary -// unit of hierarchical structure within configuration. -// -// The content of a body cannot be meaningfully interpreted without a schema, -// so Body represents the raw body content and has methods that allow the -// content to be extracted in terms of a given schema. -type Body interface { - // Content verifies that the entire body content conforms to the given - // schema and then returns it, and/or returns diagnostics. The returned - // body content is valid if non-nil, regardless of whether Diagnostics - // are provided, but diagnostics should still be eventually shown to - // the user. - Content(schema *BodySchema) (*BodyContent, Diagnostics) - - // PartialContent is like Content except that it permits the configuration - // to contain additional blocks or attributes not specified in the - // schema. If any are present, the returned Body is non-nil and contains - // the remaining items from the body that were not selected by the schema. - PartialContent(schema *BodySchema) (*BodyContent, Body, Diagnostics) - - // JustAttributes attempts to interpret all of the contents of the body - // as attributes, allowing for the contents to be accessed without a priori - // knowledge of the structure. - // - // The behavior of this method depends on the body's source language. - // Some languages, like JSON, can't distinguish between attributes and - // blocks without schema hints, but for languages that _can_ error - // diagnostics will be generated if any blocks are present in the body. - // - // Diagnostics may be produced for other reasons too, such as duplicate - // declarations of the same attribute. - JustAttributes() (Attributes, Diagnostics) - - // MissingItemRange returns a range that represents where a missing item - // might hypothetically be inserted. This is used when producing - // diagnostics about missing required attributes or blocks. Not all bodies - // will have an obvious single insertion point, so the result here may - // be rather arbitrary. - MissingItemRange() Range -} - -// BodyContent is the result of applying a BodySchema to a Body. -type BodyContent struct { - Attributes Attributes - Blocks Blocks - - MissingItemRange Range -} - -// Attribute represents an attribute from within a body. -type Attribute struct { - Name string - Expr Expression - - Range Range - NameRange Range -} - -// Expression is a literal value or an expression provided in the -// configuration, which can be evaluated within a scope to produce a value. -type Expression interface { - // Value returns the value resulting from evaluating the expression - // in the given evaluation context. - // - // The context may be nil, in which case the expression may contain - // only constants and diagnostics will be produced for any non-constant - // sub-expressions. (The exact definition of this depends on the source - // language.) - // - // The context may instead be set but have either its Variables or - // Functions maps set to nil, in which case only use of these features - // will return diagnostics. - // - // Different diagnostics are provided depending on whether the given - // context maps are nil or empty. In the former case, the message - // tells the user that variables/functions are not permitted at all, - // while in the latter case usage will produce a "not found" error for - // the specific symbol in question. - Value(ctx *EvalContext) (cty.Value, Diagnostics) - - // Variables returns a list of variables referenced in the receiving - // expression. These are expressed as absolute Traversals, so may include - // additional information about how the variable is used, such as - // attribute lookups, which the calling application can potentially use - // to only selectively populate the scope. - Variables() []Traversal - - Range() Range - StartRange() Range -} - -// OfType filters the receiving block sequence by block type name, -// returning a new block sequence including only the blocks of the -// requested type. -func (els Blocks) OfType(typeName string) Blocks { - ret := make(Blocks, 0) - for _, el := range els { - if el.Type == typeName { - ret = append(ret, el) - } - } - return ret -} - -// ByType transforms the receiving block sequence into a map from type -// name to block sequences of only that type. -func (els Blocks) ByType() map[string]Blocks { - ret := make(map[string]Blocks) - for _, el := range els { - ty := el.Type - if ret[ty] == nil { - ret[ty] = make(Blocks, 0, 1) - } - ret[ty] = append(ret[ty], el) - } - return ret -} diff --git a/vendor/github.com/hashicorp/hcl/v2/structure_at_pos.go b/vendor/github.com/hashicorp/hcl/v2/structure_at_pos.go deleted file mode 100644 index 8521814e5..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/structure_at_pos.go +++ /dev/null @@ -1,117 +0,0 @@ -package hcl - -// ----------------------------------------------------------------------------- -// The methods in this file all have the general pattern of making a best-effort -// to find one or more constructs that contain a given source position. -// -// These all operate by delegating to an optional method of the same name and -// signature on the file's root body, allowing each syntax to potentially -// provide its own implementations of these. For syntaxes that don't implement -// them, the result is always nil. -// ----------------------------------------------------------------------------- - -// BlocksAtPos attempts to find all of the blocks that contain the given -// position, ordered so that the outermost block is first and the innermost -// block is last. This is a best-effort method that may not be able to produce -// a complete result for all positions or for all HCL syntaxes. -// -// If the returned slice is non-empty, the first element is guaranteed to -// represent the same block as would be the result of OutermostBlockAtPos and -// the last element the result of InnermostBlockAtPos. However, the -// implementation may return two different objects describing the same block, -// so comparison by pointer identity is not possible. -// -// The result is nil if no blocks at all contain the given position. -func (f *File) BlocksAtPos(pos Pos) []*Block { - // The root body of the file must implement this interface in order - // to support BlocksAtPos. - type Interface interface { - BlocksAtPos(pos Pos) []*Block - } - - impl, ok := f.Body.(Interface) - if !ok { - return nil - } - return impl.BlocksAtPos(pos) -} - -// OutermostBlockAtPos attempts to find a top-level block in the receiving file -// that contains the given position. This is a best-effort method that may not -// be able to produce a result for all positions or for all HCL syntaxes. -// -// The result is nil if no single block could be selected for any reason. -func (f *File) OutermostBlockAtPos(pos Pos) *Block { - // The root body of the file must implement this interface in order - // to support OutermostBlockAtPos. - type Interface interface { - OutermostBlockAtPos(pos Pos) *Block - } - - impl, ok := f.Body.(Interface) - if !ok { - return nil - } - return impl.OutermostBlockAtPos(pos) -} - -// InnermostBlockAtPos attempts to find the most deeply-nested block in the -// receiving file that contains the given position. This is a best-effort -// method that may not be able to produce a result for all positions or for -// all HCL syntaxes. -// -// The result is nil if no single block could be selected for any reason. -func (f *File) InnermostBlockAtPos(pos Pos) *Block { - // The root body of the file must implement this interface in order - // to support InnermostBlockAtPos. - type Interface interface { - InnermostBlockAtPos(pos Pos) *Block - } - - impl, ok := f.Body.(Interface) - if !ok { - return nil - } - return impl.InnermostBlockAtPos(pos) -} - -// OutermostExprAtPos attempts to find an expression in the receiving file -// that contains the given position. This is a best-effort method that may not -// be able to produce a result for all positions or for all HCL syntaxes. -// -// Since expressions are often nested inside one another, this method returns -// the outermost "root" expression that is not contained by any other. -// -// The result is nil if no single expression could be selected for any reason. -func (f *File) OutermostExprAtPos(pos Pos) Expression { - // The root body of the file must implement this interface in order - // to support OutermostExprAtPos. - type Interface interface { - OutermostExprAtPos(pos Pos) Expression - } - - impl, ok := f.Body.(Interface) - if !ok { - return nil - } - return impl.OutermostExprAtPos(pos) -} - -// AttributeAtPos attempts to find an attribute definition in the receiving -// file that contains the given position. This is a best-effort method that may -// not be able to produce a result for all positions or for all HCL syntaxes. -// -// The result is nil if no single attribute could be selected for any reason. -func (f *File) AttributeAtPos(pos Pos) *Attribute { - // The root body of the file must implement this interface in order - // to support OutermostExprAtPos. - type Interface interface { - AttributeAtPos(pos Pos) *Attribute - } - - impl, ok := f.Body.(Interface) - if !ok { - return nil - } - return impl.AttributeAtPos(pos) -} diff --git a/vendor/github.com/hashicorp/hcl/v2/traversal.go b/vendor/github.com/hashicorp/hcl/v2/traversal.go deleted file mode 100644 index d71019700..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/traversal.go +++ /dev/null @@ -1,293 +0,0 @@ -package hcl - -import ( - "fmt" - - "github.com/zclconf/go-cty/cty" -) - -// A Traversal is a description of traversing through a value through a -// series of operations such as attribute lookup, index lookup, etc. -// -// It is used to look up values in scopes, for example. -// -// The traversal operations are implementations of interface Traverser. -// This is a closed set of implementations, so the interface cannot be -// implemented from outside this package. -// -// A traversal can be absolute (its first value is a symbol name) or relative -// (starts from an existing value). -type Traversal []Traverser - -// TraversalJoin appends a relative traversal to an absolute traversal to -// produce a new absolute traversal. -func TraversalJoin(abs Traversal, rel Traversal) Traversal { - if abs.IsRelative() { - panic("first argument to TraversalJoin must be absolute") - } - if !rel.IsRelative() { - panic("second argument to TraversalJoin must be relative") - } - - ret := make(Traversal, len(abs)+len(rel)) - copy(ret, abs) - copy(ret[len(abs):], rel) - return ret -} - -// TraverseRel applies the receiving traversal to the given value, returning -// the resulting value. This is supported only for relative traversals, -// and will panic if applied to an absolute traversal. -func (t Traversal) TraverseRel(val cty.Value) (cty.Value, Diagnostics) { - if !t.IsRelative() { - panic("can't use TraverseRel on an absolute traversal") - } - - current := val - var diags Diagnostics - for _, tr := range t { - var newDiags Diagnostics - current, newDiags = tr.TraversalStep(current) - diags = append(diags, newDiags...) - if newDiags.HasErrors() { - return cty.DynamicVal, diags - } - } - return current, diags -} - -// TraverseAbs applies the receiving traversal to the given eval context, -// returning the resulting value. This is supported only for absolute -// traversals, and will panic if applied to a relative traversal. -func (t Traversal) TraverseAbs(ctx *EvalContext) (cty.Value, Diagnostics) { - if t.IsRelative() { - panic("can't use TraverseAbs on a relative traversal") - } - - split := t.SimpleSplit() - root := split.Abs[0].(TraverseRoot) - name := root.Name - - thisCtx := ctx - hasNonNil := false - for thisCtx != nil { - if thisCtx.Variables == nil { - thisCtx = thisCtx.parent - continue - } - hasNonNil = true - val, exists := thisCtx.Variables[name] - if exists { - return split.Rel.TraverseRel(val) - } - thisCtx = thisCtx.parent - } - - if !hasNonNil { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Variables not allowed", - Detail: "Variables may not be used here.", - Subject: &root.SrcRange, - }, - } - } - - suggestions := make([]string, 0, len(ctx.Variables)) - thisCtx = ctx - for thisCtx != nil { - for k := range thisCtx.Variables { - suggestions = append(suggestions, k) - } - thisCtx = thisCtx.parent - } - suggestion := nameSuggestion(name, suggestions) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } - - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Unknown variable", - Detail: fmt.Sprintf("There is no variable named %q.%s", name, suggestion), - Subject: &root.SrcRange, - }, - } -} - -// IsRelative returns true if the receiver is a relative traversal, or false -// otherwise. -func (t Traversal) IsRelative() bool { - if len(t) == 0 { - return true - } - if _, firstIsRoot := t[0].(TraverseRoot); firstIsRoot { - return false - } - return true -} - -// SimpleSplit returns a TraversalSplit where the name lookup is the absolute -// part and the remainder is the relative part. Supported only for -// absolute traversals, and will panic if applied to a relative traversal. -// -// This can be used by applications that have a relatively-simple variable -// namespace where only the top-level is directly populated in the scope, with -// everything else handled by relative lookups from those initial values. -func (t Traversal) SimpleSplit() TraversalSplit { - if t.IsRelative() { - panic("can't use SimpleSplit on a relative traversal") - } - return TraversalSplit{ - Abs: t[0:1], - Rel: t[1:], - } -} - -// RootName returns the root name for a absolute traversal. Will panic if -// called on a relative traversal. -func (t Traversal) RootName() string { - if t.IsRelative() { - panic("can't use RootName on a relative traversal") - - } - return t[0].(TraverseRoot).Name -} - -// SourceRange returns the source range for the traversal. -func (t Traversal) SourceRange() Range { - if len(t) == 0 { - // Nothing useful to return here, but we'll return something - // that's correctly-typed at least. - return Range{} - } - - return RangeBetween(t[0].SourceRange(), t[len(t)-1].SourceRange()) -} - -// TraversalSplit represents a pair of traversals, the first of which is -// an absolute traversal and the second of which is relative to the first. -// -// This is used by calling applications that only populate prefixes of the -// traversals in the scope, with Abs representing the part coming from the -// scope and Rel representing the remaining steps once that part is -// retrieved. -type TraversalSplit struct { - Abs Traversal - Rel Traversal -} - -// TraverseAbs traverses from a scope to the value resulting from the -// absolute traversal. -func (t TraversalSplit) TraverseAbs(ctx *EvalContext) (cty.Value, Diagnostics) { - return t.Abs.TraverseAbs(ctx) -} - -// TraverseRel traverses from a given value, assumed to be the result of -// TraverseAbs on some scope, to a final result for the entire split traversal. -func (t TraversalSplit) TraverseRel(val cty.Value) (cty.Value, Diagnostics) { - return t.Rel.TraverseRel(val) -} - -// Traverse is a convenience function to apply TraverseAbs followed by -// TraverseRel. -func (t TraversalSplit) Traverse(ctx *EvalContext) (cty.Value, Diagnostics) { - v1, diags := t.TraverseAbs(ctx) - if diags.HasErrors() { - return cty.DynamicVal, diags - } - v2, newDiags := t.TraverseRel(v1) - diags = append(diags, newDiags...) - return v2, diags -} - -// Join concatenates together the Abs and Rel parts to produce a single -// absolute traversal. -func (t TraversalSplit) Join() Traversal { - return TraversalJoin(t.Abs, t.Rel) -} - -// RootName returns the root name for the absolute part of the split. -func (t TraversalSplit) RootName() string { - return t.Abs.RootName() -} - -// A Traverser is a step within a Traversal. -type Traverser interface { - TraversalStep(cty.Value) (cty.Value, Diagnostics) - SourceRange() Range - isTraverserSigil() isTraverser -} - -// Embed this in a struct to declare it as a Traverser -type isTraverser struct { -} - -func (tr isTraverser) isTraverserSigil() isTraverser { - return isTraverser{} -} - -// TraverseRoot looks up a root name in a scope. It is used as the first step -// of an absolute Traversal, and cannot itself be traversed directly. -type TraverseRoot struct { - isTraverser - Name string - SrcRange Range -} - -// TraversalStep on a TraverseName immediately panics, because absolute -// traversals cannot be directly traversed. -func (tn TraverseRoot) TraversalStep(cty.Value) (cty.Value, Diagnostics) { - panic("Cannot traverse an absolute traversal") -} - -func (tn TraverseRoot) SourceRange() Range { - return tn.SrcRange -} - -// TraverseAttr looks up an attribute in its initial value. -type TraverseAttr struct { - isTraverser - Name string - SrcRange Range -} - -func (tn TraverseAttr) TraversalStep(val cty.Value) (cty.Value, Diagnostics) { - return GetAttr(val, tn.Name, &tn.SrcRange) -} - -func (tn TraverseAttr) SourceRange() Range { - return tn.SrcRange -} - -// TraverseIndex applies the index operation to its initial value. -type TraverseIndex struct { - isTraverser - Key cty.Value - SrcRange Range -} - -func (tn TraverseIndex) TraversalStep(val cty.Value) (cty.Value, Diagnostics) { - return Index(val, tn.Key, &tn.SrcRange) -} - -func (tn TraverseIndex) SourceRange() Range { - return tn.SrcRange -} - -// TraverseSplat applies the splat operation to its initial value. -type TraverseSplat struct { - isTraverser - Each Traversal - SrcRange Range -} - -func (tn TraverseSplat) TraversalStep(val cty.Value) (cty.Value, Diagnostics) { - panic("TraverseSplat not yet implemented") -} - -func (tn TraverseSplat) SourceRange() Range { - return tn.SrcRange -} diff --git a/vendor/github.com/hashicorp/hcl/v2/traversal_for_expr.go b/vendor/github.com/hashicorp/hcl/v2/traversal_for_expr.go deleted file mode 100644 index f69d5fe9b..000000000 --- a/vendor/github.com/hashicorp/hcl/v2/traversal_for_expr.go +++ /dev/null @@ -1,124 +0,0 @@ -package hcl - -// AbsTraversalForExpr attempts to interpret the given expression as -// an absolute traversal, or returns error diagnostic(s) if that is -// not possible for the given expression. -// -// A particular Expression implementation can support this function by -// offering a method called AsTraversal that takes no arguments and -// returns either a valid absolute traversal or nil to indicate that -// no traversal is possible. Alternatively, an implementation can support -// UnwrapExpression to delegate handling of this function to a wrapped -// Expression object. -// -// In most cases the calling application is interested in the value -// that results from an expression, but in rarer cases the application -// needs to see the the name of the variable and subsequent -// attributes/indexes itself, for example to allow users to give references -// to the variables themselves rather than to their values. An implementer -// of this function should at least support attribute and index steps. -func AbsTraversalForExpr(expr Expression) (Traversal, Diagnostics) { - type asTraversal interface { - AsTraversal() Traversal - } - - physExpr := UnwrapExpressionUntil(expr, func(expr Expression) bool { - _, supported := expr.(asTraversal) - return supported - }) - - if asT, supported := physExpr.(asTraversal); supported { - if traversal := asT.AsTraversal(); traversal != nil { - return traversal, nil - } - } - return nil, Diagnostics{ - &Diagnostic{ - Severity: DiagError, - Summary: "Invalid expression", - Detail: "A single static variable reference is required: only attribute access and indexing with constant keys. No calculations, function calls, template expressions, etc are allowed here.", - Subject: expr.Range().Ptr(), - }, - } -} - -// RelTraversalForExpr is similar to AbsTraversalForExpr but it returns -// a relative traversal instead. Due to the nature of HCL expressions, the -// first element of the returned traversal is always a TraverseAttr, and -// then it will be followed by zero or more other expressions. -// -// Any expression accepted by AbsTraversalForExpr is also accepted by -// RelTraversalForExpr. -func RelTraversalForExpr(expr Expression) (Traversal, Diagnostics) { - traversal, diags := AbsTraversalForExpr(expr) - if len(traversal) > 0 { - ret := make(Traversal, len(traversal)) - copy(ret, traversal) - root := traversal[0].(TraverseRoot) - ret[0] = TraverseAttr{ - Name: root.Name, - SrcRange: root.SrcRange, - } - return ret, diags - } - return traversal, diags -} - -// ExprAsKeyword attempts to interpret the given expression as a static keyword, -// returning the keyword string if possible, and the empty string if not. -// -// A static keyword, for the sake of this function, is a single identifier. -// For example, the following attribute has an expression that would produce -// the keyword "foo": -// -// example = foo -// -// This function is a variant of AbsTraversalForExpr, which uses the same -// interface on the given expression. This helper constrains the result -// further by requiring only a single root identifier. -// -// This function is intended to be used with the following idiom, to recognize -// situations where one of a fixed set of keywords is required and arbitrary -// expressions are not allowed: -// -// switch hcl.ExprAsKeyword(expr) { -// case "allow": -// // (take suitable action for keyword "allow") -// case "deny": -// // (take suitable action for keyword "deny") -// default: -// diags = append(diags, &hcl.Diagnostic{ -// // ... "invalid keyword" diagnostic message ... -// }) -// } -// -// The above approach will generate the same message for both the use of an -// unrecognized keyword and for not using a keyword at all, which is usually -// reasonable if the message specifies that the given value must be a keyword -// from that fixed list. -// -// Note that in the native syntax the keywords "true", "false", and "null" are -// recognized as literal values during parsing and so these reserved words -// cannot not be accepted as keywords by this function. -// -// Since interpreting an expression as a keyword bypasses usual expression -// evaluation, it should be used sparingly for situations where e.g. one of -// a fixed set of keywords is used in a structural way in a special attribute -// to affect the further processing of a block. -func ExprAsKeyword(expr Expression) string { - type asTraversal interface { - AsTraversal() Traversal - } - - physExpr := UnwrapExpressionUntil(expr, func(expr Expression) bool { - _, supported := expr.(asTraversal) - return supported - }) - - if asT, supported := physExpr.(asTraversal); supported { - if traversal := asT.AsTraversal(); len(traversal) == 1 { - return traversal.RootName() - } - } - return "" -} diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/README.md b/vendor/github.com/hashicorp/hcl2/ext/dynblock/README.md similarity index 100% rename from vendor/github.com/hashicorp/hcl/v2/ext/dynblock/README.md rename to vendor/github.com/hashicorp/hcl2/ext/dynblock/README.md diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/expand_body.go b/vendor/github.com/hashicorp/hcl2/ext/dynblock/expand_body.go similarity index 99% rename from vendor/github.com/hashicorp/hcl/v2/ext/dynblock/expand_body.go rename to vendor/github.com/hashicorp/hcl2/ext/dynblock/expand_body.go index 65a9eab2d..dd3082239 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/expand_body.go +++ b/vendor/github.com/hashicorp/hcl2/ext/dynblock/expand_body.go @@ -3,7 +3,7 @@ package dynblock import ( "fmt" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/expand_spec.go b/vendor/github.com/hashicorp/hcl2/ext/dynblock/expand_spec.go similarity index 99% rename from vendor/github.com/hashicorp/hcl/v2/ext/dynblock/expand_spec.go rename to vendor/github.com/hashicorp/hcl2/ext/dynblock/expand_spec.go index 98a51eadd..41c0be267 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/expand_spec.go +++ b/vendor/github.com/hashicorp/hcl2/ext/dynblock/expand_spec.go @@ -3,7 +3,7 @@ package dynblock import ( "fmt" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" ) diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/expr_wrap.go b/vendor/github.com/hashicorp/hcl2/ext/dynblock/expr_wrap.go similarity index 96% rename from vendor/github.com/hashicorp/hcl/v2/ext/dynblock/expr_wrap.go rename to vendor/github.com/hashicorp/hcl2/ext/dynblock/expr_wrap.go index 460a1d2a3..6916fc158 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/expr_wrap.go +++ b/vendor/github.com/hashicorp/hcl2/ext/dynblock/expr_wrap.go @@ -1,7 +1,7 @@ package dynblock import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/iteration.go b/vendor/github.com/hashicorp/hcl2/ext/dynblock/iteration.go similarity index 97% rename from vendor/github.com/hashicorp/hcl/v2/ext/dynblock/iteration.go rename to vendor/github.com/hashicorp/hcl2/ext/dynblock/iteration.go index c56638868..7056d3360 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/iteration.go +++ b/vendor/github.com/hashicorp/hcl2/ext/dynblock/iteration.go @@ -1,7 +1,7 @@ package dynblock import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/public.go b/vendor/github.com/hashicorp/hcl2/ext/dynblock/public.go similarity index 87% rename from vendor/github.com/hashicorp/hcl/v2/ext/dynblock/public.go rename to vendor/github.com/hashicorp/hcl2/ext/dynblock/public.go index a5bfd94ec..b7e8ca951 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/public.go +++ b/vendor/github.com/hashicorp/hcl2/ext/dynblock/public.go @@ -1,10 +1,7 @@ -// Package dynblock provides an extension to HCL that allows dynamic -// declaration of nested blocks in certain contexts via a special block type -// named "dynamic". package dynblock import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) // Expand "dynamic" blocks in the given body, returning a new body that diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/schema.go b/vendor/github.com/hashicorp/hcl2/ext/dynblock/schema.go similarity index 95% rename from vendor/github.com/hashicorp/hcl/v2/ext/dynblock/schema.go rename to vendor/github.com/hashicorp/hcl2/ext/dynblock/schema.go index b3907d6ea..dc8ed5a2f 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/schema.go +++ b/vendor/github.com/hashicorp/hcl2/ext/dynblock/schema.go @@ -1,6 +1,6 @@ package dynblock -import "github.com/hashicorp/hcl/v2" +import "github.com/hashicorp/hcl2/hcl" var dynamicBlockHeaderSchema = hcl.BlockHeaderSchema{ Type: "dynamic", diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/unknown_body.go b/vendor/github.com/hashicorp/hcl2/ext/dynblock/unknown_body.go similarity index 98% rename from vendor/github.com/hashicorp/hcl/v2/ext/dynblock/unknown_body.go rename to vendor/github.com/hashicorp/hcl2/ext/dynblock/unknown_body.go index ce98259a5..932f6a32b 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/unknown_body.go +++ b/vendor/github.com/hashicorp/hcl2/ext/dynblock/unknown_body.go @@ -1,7 +1,7 @@ package dynblock import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/variables.go b/vendor/github.com/hashicorp/hcl2/ext/dynblock/variables.go similarity index 99% rename from vendor/github.com/hashicorp/hcl/v2/ext/dynblock/variables.go rename to vendor/github.com/hashicorp/hcl2/ext/dynblock/variables.go index 192339295..ad838f3e8 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/variables.go +++ b/vendor/github.com/hashicorp/hcl2/ext/dynblock/variables.go @@ -1,7 +1,7 @@ package dynblock import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/variables_hcldec.go b/vendor/github.com/hashicorp/hcl2/ext/dynblock/variables_hcldec.go similarity index 95% rename from vendor/github.com/hashicorp/hcl/v2/ext/dynblock/variables_hcldec.go rename to vendor/github.com/hashicorp/hcl2/ext/dynblock/variables_hcldec.go index 907ef3eba..a078d915c 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/dynblock/variables_hcldec.go +++ b/vendor/github.com/hashicorp/hcl2/ext/dynblock/variables_hcldec.go @@ -1,8 +1,8 @@ package dynblock import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hcldec" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcldec" ) // VariablesHCLDec is a wrapper around WalkVariables that uses the given hcldec diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/README.md b/vendor/github.com/hashicorp/hcl2/ext/typeexpr/README.md similarity index 98% rename from vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/README.md rename to vendor/github.com/hashicorp/hcl2/ext/typeexpr/README.md index ec7094702..ff2b3f229 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/README.md +++ b/vendor/github.com/hashicorp/hcl2/ext/typeexpr/README.md @@ -35,7 +35,7 @@ to allow only calls and keywords the JSON syntax is able to parse the given string directly as an expression, rather than as a template as would be the case for normal expression evaluation. -For more information, see [the godoc reference](http://godoc.org/github.com/hashicorp/hcl/v2/ext/typeexpr). +For more information, see [the godoc reference](http://godoc.org/github.com/hashicorp/hcl2/ext/typeexpr). ## Type Expression Syntax diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/doc.go b/vendor/github.com/hashicorp/hcl2/ext/typeexpr/doc.go similarity index 100% rename from vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/doc.go rename to vendor/github.com/hashicorp/hcl2/ext/typeexpr/doc.go diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/get_type.go b/vendor/github.com/hashicorp/hcl2/ext/typeexpr/get_type.go similarity index 99% rename from vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/get_type.go rename to vendor/github.com/hashicorp/hcl2/ext/typeexpr/get_type.go index 11b068979..a84338a85 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/get_type.go +++ b/vendor/github.com/hashicorp/hcl2/ext/typeexpr/get_type.go @@ -3,7 +3,7 @@ package typeexpr import ( "fmt" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/public.go b/vendor/github.com/hashicorp/hcl2/ext/typeexpr/public.go similarity index 97% rename from vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/public.go rename to vendor/github.com/hashicorp/hcl2/ext/typeexpr/public.go index 3b8f618fb..e3f5eef59 100644 --- a/vendor/github.com/hashicorp/hcl/v2/ext/typeexpr/public.go +++ b/vendor/github.com/hashicorp/hcl2/ext/typeexpr/public.go @@ -5,9 +5,9 @@ import ( "fmt" "sort" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/hcl/v2/hcldec/block_labels.go b/vendor/github.com/hashicorp/hcl2/hcldec/block_labels.go similarity index 90% rename from vendor/github.com/hashicorp/hcl/v2/hcldec/block_labels.go rename to vendor/github.com/hashicorp/hcl2/hcldec/block_labels.go index 71de45193..7e652e9bc 100644 --- a/vendor/github.com/hashicorp/hcl/v2/hcldec/block_labels.go +++ b/vendor/github.com/hashicorp/hcl2/hcldec/block_labels.go @@ -1,7 +1,7 @@ package hcldec import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) type blockLabel struct { diff --git a/vendor/github.com/hashicorp/hcl/v2/hcldec/decode.go b/vendor/github.com/hashicorp/hcl2/hcldec/decode.go similarity index 96% rename from vendor/github.com/hashicorp/hcl/v2/hcldec/decode.go rename to vendor/github.com/hashicorp/hcl2/hcldec/decode.go index c6e42236d..6cf93fedd 100644 --- a/vendor/github.com/hashicorp/hcl/v2/hcldec/decode.go +++ b/vendor/github.com/hashicorp/hcl2/hcldec/decode.go @@ -1,7 +1,7 @@ package hcldec import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/hcl/v2/hcldec/doc.go b/vendor/github.com/hashicorp/hcl2/hcldec/doc.go similarity index 100% rename from vendor/github.com/hashicorp/hcl/v2/hcldec/doc.go rename to vendor/github.com/hashicorp/hcl2/hcldec/doc.go diff --git a/vendor/github.com/hashicorp/hcl/v2/hcldec/gob.go b/vendor/github.com/hashicorp/hcl2/hcldec/gob.go similarity index 100% rename from vendor/github.com/hashicorp/hcl/v2/hcldec/gob.go rename to vendor/github.com/hashicorp/hcl2/hcldec/gob.go diff --git a/vendor/github.com/hashicorp/hcl/v2/hcldec/public.go b/vendor/github.com/hashicorp/hcl2/hcldec/public.go similarity index 98% rename from vendor/github.com/hashicorp/hcl/v2/hcldec/public.go rename to vendor/github.com/hashicorp/hcl2/hcldec/public.go index 1fa548d0c..3c803632d 100644 --- a/vendor/github.com/hashicorp/hcl/v2/hcldec/public.go +++ b/vendor/github.com/hashicorp/hcl2/hcldec/public.go @@ -1,7 +1,7 @@ package hcldec import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/hcl/v2/hcldec/schema.go b/vendor/github.com/hashicorp/hcl2/hcldec/schema.go similarity index 96% rename from vendor/github.com/hashicorp/hcl/v2/hcldec/schema.go rename to vendor/github.com/hashicorp/hcl2/hcldec/schema.go index ddbe7fa4a..b57bd9692 100644 --- a/vendor/github.com/hashicorp/hcl/v2/hcldec/schema.go +++ b/vendor/github.com/hashicorp/hcl2/hcldec/schema.go @@ -1,7 +1,7 @@ package hcldec import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) // ImpliedSchema returns the *hcl.BodySchema implied by the given specification. diff --git a/vendor/github.com/hashicorp/hcl/v2/hcldec/spec.go b/vendor/github.com/hashicorp/hcl2/hcldec/spec.go similarity index 99% rename from vendor/github.com/hashicorp/hcl/v2/hcldec/spec.go rename to vendor/github.com/hashicorp/hcl2/hcldec/spec.go index 6f2d9732c..f9da7f65b 100644 --- a/vendor/github.com/hashicorp/hcl/v2/hcldec/spec.go +++ b/vendor/github.com/hashicorp/hcl2/hcldec/spec.go @@ -5,7 +5,7 @@ import ( "fmt" "sort" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" "github.com/zclconf/go-cty/cty/function" diff --git a/vendor/github.com/hashicorp/hcl/v2/hcldec/variables.go b/vendor/github.com/hashicorp/hcl2/hcldec/variables.go similarity index 97% rename from vendor/github.com/hashicorp/hcl/v2/hcldec/variables.go rename to vendor/github.com/hashicorp/hcl2/hcldec/variables.go index f8440eb60..7662516ca 100644 --- a/vendor/github.com/hashicorp/hcl/v2/hcldec/variables.go +++ b/vendor/github.com/hashicorp/hcl2/hcldec/variables.go @@ -1,7 +1,7 @@ package hcldec import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) // Variables processes the given body with the given spec and returns a diff --git a/vendor/github.com/hashicorp/hcl/v2/hcled/doc.go b/vendor/github.com/hashicorp/hcl2/hcled/doc.go similarity index 100% rename from vendor/github.com/hashicorp/hcl/v2/hcled/doc.go rename to vendor/github.com/hashicorp/hcl2/hcled/doc.go diff --git a/vendor/github.com/hashicorp/hcl/v2/hcled/navigation.go b/vendor/github.com/hashicorp/hcl2/hcled/navigation.go similarity index 96% rename from vendor/github.com/hashicorp/hcl/v2/hcled/navigation.go rename to vendor/github.com/hashicorp/hcl2/hcled/navigation.go index 050ad758f..5d10cd86c 100644 --- a/vendor/github.com/hashicorp/hcl/v2/hcled/navigation.go +++ b/vendor/github.com/hashicorp/hcl2/hcled/navigation.go @@ -1,7 +1,7 @@ package hcled import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) type contextStringer interface { diff --git a/vendor/github.com/hashicorp/hil/.gitignore b/vendor/github.com/hashicorp/hil/.gitignore deleted file mode 100644 index 9d6e5df38..000000000 --- a/vendor/github.com/hashicorp/hil/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.DS_Store -.idea -*.iml diff --git a/vendor/github.com/hashicorp/hil/.travis.yml b/vendor/github.com/hashicorp/hil/.travis.yml deleted file mode 100644 index a78544422..000000000 --- a/vendor/github.com/hashicorp/hil/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -sudo: false -language: go -go: 1.7 diff --git a/vendor/github.com/hashicorp/hil/README.md b/vendor/github.com/hashicorp/hil/README.md deleted file mode 100644 index 186ed2518..000000000 --- a/vendor/github.com/hashicorp/hil/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# HIL - -[![GoDoc](https://godoc.org/github.com/hashicorp/hil?status.png)](https://godoc.org/github.com/hashicorp/hil) [![Build Status](https://travis-ci.org/hashicorp/hil.svg?branch=master)](https://travis-ci.org/hashicorp/hil) - -HIL (HashiCorp Interpolation Language) is a lightweight embedded language used -primarily for configuration interpolation. The goal of HIL is to make a simple -language for interpolations in the various configurations of HashiCorp tools. - -HIL is built to interpolate any string, but is in use by HashiCorp primarily -with [HCL](https://github.com/hashicorp/hcl). HCL is _not required_ in any -way for use with HIL. - -HIL isn't meant to be a general purpose language. It was built for basic -configuration interpolations. Therefore, you can't currently write functions, -have conditionals, set intermediary variables, etc. within HIL itself. It is -possible some of these may be added later but the right use case must exist. - -## Why? - -Many of our tools have support for something similar to templates, but -within the configuration itself. The most prominent requirement was in -[Terraform](https://github.com/hashicorp/terraform) where we wanted the -configuration to be able to reference values from elsewhere in the -configuration. Example: - - foo = "hi ${var.world}" - -We originally used a full templating language for this, but found it -was too heavy weight. Additionally, many full languages required bindings -to C (and thus the usage of cgo) which we try to avoid to make cross-compilation -easier. We then moved to very basic regular expression based -string replacement, but found the need for basic arithmetic and function -calls resulting in overly complex regular expressions. - -Ultimately, we wrote our own mini-language within Terraform itself. As -we built other projects such as [Nomad](https://nomadproject.io) and -[Otto](https://ottoproject.io), the need for basic interpolations arose -again. - -Thus HIL was born. It is extracted from Terraform, cleaned up, and -better tested for general purpose use. - -## Syntax - -For a complete grammar, please see the parser itself. A high-level overview -of the syntax and grammer is listed here. - -Code begins within `${` and `}`. Outside of this, text is treated -literally. For example, `foo` is a valid HIL program that is just the -string "foo", but `foo ${bar}` is an HIL program that is the string "foo " -concatened with the value of `bar`. For the remainder of the syntax -docs, we'll assume you're within `${}`. - - * Identifiers are any text in the format of `[a-zA-Z0-9-.]`. Example - identifiers: `foo`, `var.foo`, `foo-bar`. - - * Strings are double quoted and can contain any UTF-8 characters. - Example: `"Hello, World"` - - * Numbers are assumed to be base 10. If you prefix a number with 0x, - it is treated as a hexadecimal. If it is prefixed with 0, it is - treated as an octal. Numbers can be in scientific notation: "1e10". - - * Unary `-` can be used for negative numbers. Example: `-10` or `-0.2` - - * Boolean values: `true`, `false` - - * The following arithmetic operations are allowed: +, -, *, /, %. - - * Function calls are in the form of `name(arg1, arg2, ...)`. Example: - `add(1, 5)`. Arguments can be any valid HIL expression, example: - `add(1, var.foo)` or even nested function calls: - `add(1, get("some value"))`. - - * Within strings, further interpolations can be opened with `${}`. - Example: `"Hello ${nested}"`. A full example including the - original `${}` (remember this list assumes were inside of one - already) could be: `foo ${func("hello ${var.foo}")}`. - -## Language Changes - -We've used this mini-language in Terraform for years. For backwards compatibility -reasons, we're unlikely to make an incompatible change to the language but -we're not currently making that promise, either. - -The internal API of this project may very well change as we evolve it -to work with more of our projects. We recommend using some sort of dependency -management solution with this package. - -## Future Changes - -The following changes are already planned to be made at some point: - - * Richer types: lists, maps, etc. - - * Convert to a more standard Go parser structure similar to HCL. This - will improve our error messaging as well as allow us to have automatic - formatting. - - * Allow interpolations to result in more types than just a string. While - within the interpolation basic types are honored, the result is always - a string. diff --git a/vendor/github.com/hashicorp/hil/appveyor.yml b/vendor/github.com/hashicorp/hil/appveyor.yml deleted file mode 100644 index feaf7a34e..000000000 --- a/vendor/github.com/hashicorp/hil/appveyor.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: "build-{branch}-{build}" -image: Visual Studio 2015 -clone_folder: c:\gopath\src\github.com\hashicorp\hil -environment: - GOPATH: c:\gopath -init: - - git config --global core.autocrlf true -install: -- cmd: >- - echo %Path% - - go version - - go env - - go get -d -v -t ./... -build_script: -- cmd: go test -v ./... diff --git a/vendor/github.com/hashicorp/hil/builtins.go b/vendor/github.com/hashicorp/hil/builtins.go deleted file mode 100644 index 909c788a2..000000000 --- a/vendor/github.com/hashicorp/hil/builtins.go +++ /dev/null @@ -1,331 +0,0 @@ -package hil - -import ( - "errors" - "strconv" - - "github.com/hashicorp/hil/ast" -) - -// NOTE: All builtins are tested in engine_test.go - -func registerBuiltins(scope *ast.BasicScope) *ast.BasicScope { - if scope == nil { - scope = new(ast.BasicScope) - } - if scope.FuncMap == nil { - scope.FuncMap = make(map[string]ast.Function) - } - - // Implicit conversions - scope.FuncMap["__builtin_BoolToString"] = builtinBoolToString() - scope.FuncMap["__builtin_FloatToInt"] = builtinFloatToInt() - scope.FuncMap["__builtin_FloatToString"] = builtinFloatToString() - scope.FuncMap["__builtin_IntToFloat"] = builtinIntToFloat() - scope.FuncMap["__builtin_IntToString"] = builtinIntToString() - scope.FuncMap["__builtin_StringToInt"] = builtinStringToInt() - scope.FuncMap["__builtin_StringToFloat"] = builtinStringToFloat() - scope.FuncMap["__builtin_StringToBool"] = builtinStringToBool() - - // Math operations - scope.FuncMap["__builtin_IntMath"] = builtinIntMath() - scope.FuncMap["__builtin_FloatMath"] = builtinFloatMath() - scope.FuncMap["__builtin_BoolCompare"] = builtinBoolCompare() - scope.FuncMap["__builtin_FloatCompare"] = builtinFloatCompare() - scope.FuncMap["__builtin_IntCompare"] = builtinIntCompare() - scope.FuncMap["__builtin_StringCompare"] = builtinStringCompare() - scope.FuncMap["__builtin_Logical"] = builtinLogical() - return scope -} - -func builtinFloatMath() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - Variadic: true, - VariadicType: ast.TypeFloat, - ReturnType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - result := args[1].(float64) - for _, raw := range args[2:] { - arg := raw.(float64) - switch op { - case ast.ArithmeticOpAdd: - result += arg - case ast.ArithmeticOpSub: - result -= arg - case ast.ArithmeticOpMul: - result *= arg - case ast.ArithmeticOpDiv: - result /= arg - } - } - - return result, nil - }, - } -} - -func builtinIntMath() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - Variadic: true, - VariadicType: ast.TypeInt, - ReturnType: ast.TypeInt, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - result := args[1].(int) - for _, raw := range args[2:] { - arg := raw.(int) - switch op { - case ast.ArithmeticOpAdd: - result += arg - case ast.ArithmeticOpSub: - result -= arg - case ast.ArithmeticOpMul: - result *= arg - case ast.ArithmeticOpDiv: - if arg == 0 { - return nil, errors.New("divide by zero") - } - - result /= arg - case ast.ArithmeticOpMod: - if arg == 0 { - return nil, errors.New("divide by zero") - } - - result = result % arg - } - } - - return result, nil - }, - } -} - -func builtinBoolCompare() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt, ast.TypeBool, ast.TypeBool}, - Variadic: false, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - lhs := args[1].(bool) - rhs := args[2].(bool) - - switch op { - case ast.ArithmeticOpEqual: - return lhs == rhs, nil - case ast.ArithmeticOpNotEqual: - return lhs != rhs, nil - default: - return nil, errors.New("invalid comparison operation") - } - }, - } -} - -func builtinFloatCompare() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt, ast.TypeFloat, ast.TypeFloat}, - Variadic: false, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - lhs := args[1].(float64) - rhs := args[2].(float64) - - switch op { - case ast.ArithmeticOpEqual: - return lhs == rhs, nil - case ast.ArithmeticOpNotEqual: - return lhs != rhs, nil - case ast.ArithmeticOpLessThan: - return lhs < rhs, nil - case ast.ArithmeticOpLessThanOrEqual: - return lhs <= rhs, nil - case ast.ArithmeticOpGreaterThan: - return lhs > rhs, nil - case ast.ArithmeticOpGreaterThanOrEqual: - return lhs >= rhs, nil - default: - return nil, errors.New("invalid comparison operation") - } - }, - } -} - -func builtinIntCompare() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt, ast.TypeInt, ast.TypeInt}, - Variadic: false, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - lhs := args[1].(int) - rhs := args[2].(int) - - switch op { - case ast.ArithmeticOpEqual: - return lhs == rhs, nil - case ast.ArithmeticOpNotEqual: - return lhs != rhs, nil - case ast.ArithmeticOpLessThan: - return lhs < rhs, nil - case ast.ArithmeticOpLessThanOrEqual: - return lhs <= rhs, nil - case ast.ArithmeticOpGreaterThan: - return lhs > rhs, nil - case ast.ArithmeticOpGreaterThanOrEqual: - return lhs >= rhs, nil - default: - return nil, errors.New("invalid comparison operation") - } - }, - } -} - -func builtinStringCompare() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt, ast.TypeString, ast.TypeString}, - Variadic: false, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - lhs := args[1].(string) - rhs := args[2].(string) - - switch op { - case ast.ArithmeticOpEqual: - return lhs == rhs, nil - case ast.ArithmeticOpNotEqual: - return lhs != rhs, nil - default: - return nil, errors.New("invalid comparison operation") - } - }, - } -} - -func builtinLogical() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - Variadic: true, - VariadicType: ast.TypeBool, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - result := args[1].(bool) - for _, raw := range args[2:] { - arg := raw.(bool) - switch op { - case ast.ArithmeticOpLogicalOr: - result = result || arg - case ast.ArithmeticOpLogicalAnd: - result = result && arg - default: - return nil, errors.New("invalid logical operator") - } - } - - return result, nil - }, - } -} - -func builtinFloatToInt() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat}, - ReturnType: ast.TypeInt, - Callback: func(args []interface{}) (interface{}, error) { - return int(args[0].(float64)), nil - }, - } -} - -func builtinFloatToString() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return strconv.FormatFloat( - args[0].(float64), 'g', -1, 64), nil - }, - } -} - -func builtinIntToFloat() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - ReturnType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - return float64(args[0].(int)), nil - }, - } -} - -func builtinIntToString() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return strconv.FormatInt(int64(args[0].(int)), 10), nil - }, - } -} - -func builtinStringToInt() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - v, err := strconv.ParseInt(args[0].(string), 0, 0) - if err != nil { - return nil, err - } - - return int(v), nil - }, - } -} - -func builtinStringToFloat() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - v, err := strconv.ParseFloat(args[0].(string), 64) - if err != nil { - return nil, err - } - - return v, nil - }, - } -} - -func builtinBoolToString() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeBool}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return strconv.FormatBool(args[0].(bool)), nil - }, - } -} - -func builtinStringToBool() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - v, err := strconv.ParseBool(args[0].(string)) - if err != nil { - return nil, err - } - - return v, nil - }, - } -} diff --git a/vendor/github.com/hashicorp/hil/check_identifier.go b/vendor/github.com/hashicorp/hil/check_identifier.go deleted file mode 100644 index 474f50588..000000000 --- a/vendor/github.com/hashicorp/hil/check_identifier.go +++ /dev/null @@ -1,88 +0,0 @@ -package hil - -import ( - "fmt" - "sync" - - "github.com/hashicorp/hil/ast" -) - -// IdentifierCheck is a SemanticCheck that checks that all identifiers -// resolve properly and that the right number of arguments are passed -// to functions. -type IdentifierCheck struct { - Scope ast.Scope - - err error - lock sync.Mutex -} - -func (c *IdentifierCheck) Visit(root ast.Node) error { - c.lock.Lock() - defer c.lock.Unlock() - defer c.reset() - root.Accept(c.visit) - return c.err -} - -func (c *IdentifierCheck) visit(raw ast.Node) ast.Node { - if c.err != nil { - return raw - } - - switch n := raw.(type) { - case *ast.Call: - c.visitCall(n) - case *ast.VariableAccess: - c.visitVariableAccess(n) - case *ast.Output: - // Ignore - case *ast.LiteralNode: - // Ignore - default: - // Ignore - } - - // We never do replacement with this visitor - return raw -} - -func (c *IdentifierCheck) visitCall(n *ast.Call) { - // Look up the function in the map - function, ok := c.Scope.LookupFunc(n.Func) - if !ok { - c.createErr(n, fmt.Sprintf("unknown function called: %s", n.Func)) - return - } - - // Break up the args into what is variadic and what is required - args := n.Args - if function.Variadic && len(args) > len(function.ArgTypes) { - args = n.Args[:len(function.ArgTypes)] - } - - // Verify the number of arguments - if len(args) != len(function.ArgTypes) { - c.createErr(n, fmt.Sprintf( - "%s: expected %d arguments, got %d", - n.Func, len(function.ArgTypes), len(n.Args))) - return - } -} - -func (c *IdentifierCheck) visitVariableAccess(n *ast.VariableAccess) { - // Look up the variable in the map - if _, ok := c.Scope.LookupVar(n.Name); !ok { - c.createErr(n, fmt.Sprintf( - "unknown variable accessed: %s", n.Name)) - return - } -} - -func (c *IdentifierCheck) createErr(n ast.Node, str string) { - c.err = fmt.Errorf("%s: %s", n.Pos(), str) -} - -func (c *IdentifierCheck) reset() { - c.err = nil -} diff --git a/vendor/github.com/hashicorp/hil/check_types.go b/vendor/github.com/hashicorp/hil/check_types.go deleted file mode 100644 index f16da3918..000000000 --- a/vendor/github.com/hashicorp/hil/check_types.go +++ /dev/null @@ -1,668 +0,0 @@ -package hil - -import ( - "fmt" - "sync" - - "github.com/hashicorp/hil/ast" -) - -// TypeCheck implements ast.Visitor for type checking an AST tree. -// It requires some configuration to look up the type of nodes. -// -// It also optionally will not type error and will insert an implicit -// type conversions for specific types if specified by the Implicit -// field. Note that this is kind of organizationally weird to put into -// this structure but we'd rather do that than duplicate the type checking -// logic multiple times. -type TypeCheck struct { - Scope ast.Scope - - // Implicit is a map of implicit type conversions that we can do, - // and that shouldn't error. The key of the first map is the from type, - // the key of the second map is the to type, and the final string - // value is the function to call (which must be registered in the Scope). - Implicit map[ast.Type]map[ast.Type]string - - // Stack of types. This shouldn't be used directly except by implementations - // of TypeCheckNode. - Stack []ast.Type - - err error - lock sync.Mutex -} - -// TypeCheckNode is the interface that must be implemented by any -// ast.Node that wants to support type-checking. If the type checker -// encounters a node that doesn't implement this, it will error. -type TypeCheckNode interface { - TypeCheck(*TypeCheck) (ast.Node, error) -} - -func (v *TypeCheck) Visit(root ast.Node) error { - v.lock.Lock() - defer v.lock.Unlock() - defer v.reset() - root.Accept(v.visit) - - // If the resulting type is unknown, then just let the whole thing go. - if v.err == errExitUnknown { - v.err = nil - } - - return v.err -} - -func (v *TypeCheck) visit(raw ast.Node) ast.Node { - if v.err != nil { - return raw - } - - var result ast.Node - var err error - switch n := raw.(type) { - case *ast.Arithmetic: - tc := &typeCheckArithmetic{n} - result, err = tc.TypeCheck(v) - case *ast.Call: - tc := &typeCheckCall{n} - result, err = tc.TypeCheck(v) - case *ast.Conditional: - tc := &typeCheckConditional{n} - result, err = tc.TypeCheck(v) - case *ast.Index: - tc := &typeCheckIndex{n} - result, err = tc.TypeCheck(v) - case *ast.Output: - tc := &typeCheckOutput{n} - result, err = tc.TypeCheck(v) - case *ast.LiteralNode: - tc := &typeCheckLiteral{n} - result, err = tc.TypeCheck(v) - case *ast.VariableAccess: - tc := &typeCheckVariableAccess{n} - result, err = tc.TypeCheck(v) - default: - tc, ok := raw.(TypeCheckNode) - if !ok { - err = fmt.Errorf("unknown node for type check: %#v", raw) - break - } - - result, err = tc.TypeCheck(v) - } - - if err != nil { - pos := raw.Pos() - v.err = fmt.Errorf("At column %d, line %d: %s", - pos.Column, pos.Line, err) - } - - return result -} - -type typeCheckArithmetic struct { - n *ast.Arithmetic -} - -func (tc *typeCheckArithmetic) TypeCheck(v *TypeCheck) (ast.Node, error) { - // The arguments are on the stack in reverse order, so pop them off. - exprs := make([]ast.Type, len(tc.n.Exprs)) - for i, _ := range tc.n.Exprs { - exprs[len(tc.n.Exprs)-1-i] = v.StackPop() - } - - // If any operand is unknown then our result is automatically unknown - for _, ty := range exprs { - if ty == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - } - - switch tc.n.Op { - case ast.ArithmeticOpLogicalAnd, ast.ArithmeticOpLogicalOr: - return tc.checkLogical(v, exprs) - case ast.ArithmeticOpEqual, ast.ArithmeticOpNotEqual, - ast.ArithmeticOpLessThan, ast.ArithmeticOpGreaterThan, - ast.ArithmeticOpGreaterThanOrEqual, ast.ArithmeticOpLessThanOrEqual: - return tc.checkComparison(v, exprs) - default: - return tc.checkNumeric(v, exprs) - } - -} - -func (tc *typeCheckArithmetic) checkNumeric(v *TypeCheck, exprs []ast.Type) (ast.Node, error) { - // Determine the resulting type we want. We do this by going over - // every expression until we find one with a type we recognize. - // We do this because the first expr might be a string ("var.foo") - // and we need to know what to implicit to. - mathFunc := "__builtin_IntMath" - mathType := ast.TypeInt - for _, v := range exprs { - // We assume int math but if we find ANY float, the entire - // expression turns into floating point math. - if v == ast.TypeFloat { - mathFunc = "__builtin_FloatMath" - mathType = v - break - } - } - - // Verify the args - for i, arg := range exprs { - if arg != mathType { - cn := v.ImplicitConversion(exprs[i], mathType, tc.n.Exprs[i]) - if cn != nil { - tc.n.Exprs[i] = cn - continue - } - - return nil, fmt.Errorf( - "operand %d should be %s, got %s", - i+1, mathType, arg) - } - } - - // Modulo doesn't work for floats - if mathType == ast.TypeFloat && tc.n.Op == ast.ArithmeticOpMod { - return nil, fmt.Errorf("modulo cannot be used with floats") - } - - // Return type - v.StackPush(mathType) - - // Replace our node with a call to the proper function. This isn't - // type checked but we already verified types. - args := make([]ast.Node, len(tc.n.Exprs)+1) - args[0] = &ast.LiteralNode{ - Value: tc.n.Op, - Typex: ast.TypeInt, - Posx: tc.n.Pos(), - } - copy(args[1:], tc.n.Exprs) - return &ast.Call{ - Func: mathFunc, - Args: args, - Posx: tc.n.Pos(), - }, nil -} - -func (tc *typeCheckArithmetic) checkComparison(v *TypeCheck, exprs []ast.Type) (ast.Node, error) { - if len(exprs) != 2 { - // This should never happen, because the parser never produces - // nodes that violate this. - return nil, fmt.Errorf( - "comparison operators must have exactly two operands", - ) - } - - // The first operand always dictates the type for a comparison. - compareFunc := "" - compareType := exprs[0] - switch compareType { - case ast.TypeBool: - compareFunc = "__builtin_BoolCompare" - case ast.TypeFloat: - compareFunc = "__builtin_FloatCompare" - case ast.TypeInt: - compareFunc = "__builtin_IntCompare" - case ast.TypeString: - compareFunc = "__builtin_StringCompare" - default: - return nil, fmt.Errorf( - "comparison operators apply only to bool, float, int, and string", - ) - } - - // For non-equality comparisons, we will do implicit conversions to - // integer types if possible. In this case, we need to go through and - // determine the type of comparison we're doing to enable the implicit - // conversion. - if tc.n.Op != ast.ArithmeticOpEqual && tc.n.Op != ast.ArithmeticOpNotEqual { - compareFunc = "__builtin_IntCompare" - compareType = ast.TypeInt - for _, expr := range exprs { - if expr == ast.TypeFloat { - compareFunc = "__builtin_FloatCompare" - compareType = ast.TypeFloat - break - } - } - } - - // Verify (and possibly, convert) the args - for i, arg := range exprs { - if arg != compareType { - cn := v.ImplicitConversion(exprs[i], compareType, tc.n.Exprs[i]) - if cn != nil { - tc.n.Exprs[i] = cn - continue - } - - return nil, fmt.Errorf( - "operand %d should be %s, got %s", - i+1, compareType, arg, - ) - } - } - - // Only ints and floats can have the <, >, <= and >= operators applied - switch tc.n.Op { - case ast.ArithmeticOpEqual, ast.ArithmeticOpNotEqual: - // anything goes - default: - switch compareType { - case ast.TypeFloat, ast.TypeInt: - // fine - default: - return nil, fmt.Errorf( - "<, >, <= and >= may apply only to int and float values", - ) - } - } - - // Comparison operators always return bool - v.StackPush(ast.TypeBool) - - // Replace our node with a call to the proper function. This isn't - // type checked but we already verified types. - args := make([]ast.Node, len(tc.n.Exprs)+1) - args[0] = &ast.LiteralNode{ - Value: tc.n.Op, - Typex: ast.TypeInt, - Posx: tc.n.Pos(), - } - copy(args[1:], tc.n.Exprs) - return &ast.Call{ - Func: compareFunc, - Args: args, - Posx: tc.n.Pos(), - }, nil -} - -func (tc *typeCheckArithmetic) checkLogical(v *TypeCheck, exprs []ast.Type) (ast.Node, error) { - for i, t := range exprs { - if t != ast.TypeBool { - cn := v.ImplicitConversion(t, ast.TypeBool, tc.n.Exprs[i]) - if cn == nil { - return nil, fmt.Errorf( - "logical operators require boolean operands, not %s", - t, - ) - } - tc.n.Exprs[i] = cn - } - } - - // Return type is always boolean - v.StackPush(ast.TypeBool) - - // Arithmetic nodes are replaced with a call to a built-in function - args := make([]ast.Node, len(tc.n.Exprs)+1) - args[0] = &ast.LiteralNode{ - Value: tc.n.Op, - Typex: ast.TypeInt, - Posx: tc.n.Pos(), - } - copy(args[1:], tc.n.Exprs) - return &ast.Call{ - Func: "__builtin_Logical", - Args: args, - Posx: tc.n.Pos(), - }, nil -} - -type typeCheckCall struct { - n *ast.Call -} - -func (tc *typeCheckCall) TypeCheck(v *TypeCheck) (ast.Node, error) { - // Look up the function in the map - function, ok := v.Scope.LookupFunc(tc.n.Func) - if !ok { - return nil, fmt.Errorf("unknown function called: %s", tc.n.Func) - } - - // The arguments are on the stack in reverse order, so pop them off. - args := make([]ast.Type, len(tc.n.Args)) - for i, _ := range tc.n.Args { - args[len(tc.n.Args)-1-i] = v.StackPop() - } - - // Verify the args - for i, expected := range function.ArgTypes { - if expected == ast.TypeAny { - continue - } - - if args[i] == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - - if args[i] != expected { - cn := v.ImplicitConversion(args[i], expected, tc.n.Args[i]) - if cn != nil { - tc.n.Args[i] = cn - continue - } - - return nil, fmt.Errorf( - "%s: argument %d should be %s, got %s", - tc.n.Func, i+1, expected.Printable(), args[i].Printable()) - } - } - - // If we're variadic, then verify the types there - if function.Variadic && function.VariadicType != ast.TypeAny { - args = args[len(function.ArgTypes):] - for i, t := range args { - if t == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - - if t != function.VariadicType { - realI := i + len(function.ArgTypes) - cn := v.ImplicitConversion( - t, function.VariadicType, tc.n.Args[realI]) - if cn != nil { - tc.n.Args[realI] = cn - continue - } - - return nil, fmt.Errorf( - "%s: argument %d should be %s, got %s", - tc.n.Func, realI, - function.VariadicType.Printable(), t.Printable()) - } - } - } - - // Return type - v.StackPush(function.ReturnType) - - return tc.n, nil -} - -type typeCheckConditional struct { - n *ast.Conditional -} - -func (tc *typeCheckConditional) TypeCheck(v *TypeCheck) (ast.Node, error) { - // On the stack we have the types of the condition, true and false - // expressions, but they are in reverse order. - falseType := v.StackPop() - trueType := v.StackPop() - condType := v.StackPop() - - if condType == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - - if condType != ast.TypeBool { - cn := v.ImplicitConversion(condType, ast.TypeBool, tc.n.CondExpr) - if cn == nil { - return nil, fmt.Errorf( - "condition must be type bool, not %s", condType.Printable(), - ) - } - tc.n.CondExpr = cn - } - - // The types of the true and false expression must match - if trueType != falseType && trueType != ast.TypeUnknown && falseType != ast.TypeUnknown { - - // Since passing around stringified versions of other types is - // common, we pragmatically allow the false expression to dictate - // the result type when the true expression is a string. - if trueType == ast.TypeString { - cn := v.ImplicitConversion(trueType, falseType, tc.n.TrueExpr) - if cn == nil { - return nil, fmt.Errorf( - "true and false expression types must match; have %s and %s", - trueType.Printable(), falseType.Printable(), - ) - } - tc.n.TrueExpr = cn - trueType = falseType - } else { - cn := v.ImplicitConversion(falseType, trueType, tc.n.FalseExpr) - if cn == nil { - return nil, fmt.Errorf( - "true and false expression types must match; have %s and %s", - trueType.Printable(), falseType.Printable(), - ) - } - tc.n.FalseExpr = cn - falseType = trueType - } - } - - // Currently list and map types cannot be used, because we cannot - // generally assert that their element types are consistent. - // Such support might be added later, either by improving the type - // system or restricting usage to only variable and literal expressions, - // but for now this is simply prohibited because it doesn't seem to - // be a common enough case to be worth the complexity. - switch trueType { - case ast.TypeList: - return nil, fmt.Errorf( - "conditional operator cannot be used with list values", - ) - case ast.TypeMap: - return nil, fmt.Errorf( - "conditional operator cannot be used with map values", - ) - } - - // Result type (guaranteed to also match falseType due to the above) - if trueType == ast.TypeUnknown { - // falseType may also be unknown, but that's okay because two - // unknowns means our result is unknown anyway. - v.StackPush(falseType) - } else { - v.StackPush(trueType) - } - - return tc.n, nil -} - -type typeCheckOutput struct { - n *ast.Output -} - -func (tc *typeCheckOutput) TypeCheck(v *TypeCheck) (ast.Node, error) { - n := tc.n - types := make([]ast.Type, len(n.Exprs)) - for i, _ := range n.Exprs { - types[len(n.Exprs)-1-i] = v.StackPop() - } - - for _, ty := range types { - if ty == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - } - - // If there is only one argument and it is a list, we evaluate to a list - if len(types) == 1 { - switch t := types[0]; t { - case ast.TypeList: - fallthrough - case ast.TypeMap: - v.StackPush(t) - return n, nil - } - } - - // Otherwise, all concat args must be strings, so validate that - resultType := ast.TypeString - for i, t := range types { - - if t == ast.TypeUnknown { - resultType = ast.TypeUnknown - continue - } - - if t != ast.TypeString { - cn := v.ImplicitConversion(t, ast.TypeString, n.Exprs[i]) - if cn != nil { - n.Exprs[i] = cn - continue - } - - return nil, fmt.Errorf( - "output of an HIL expression must be a string, or a single list (argument %d is %s)", i+1, t) - } - } - - // This always results in type string, unless there are unknowns - v.StackPush(resultType) - - return n, nil -} - -type typeCheckLiteral struct { - n *ast.LiteralNode -} - -func (tc *typeCheckLiteral) TypeCheck(v *TypeCheck) (ast.Node, error) { - v.StackPush(tc.n.Typex) - return tc.n, nil -} - -type typeCheckVariableAccess struct { - n *ast.VariableAccess -} - -func (tc *typeCheckVariableAccess) TypeCheck(v *TypeCheck) (ast.Node, error) { - // Look up the variable in the map - variable, ok := v.Scope.LookupVar(tc.n.Name) - if !ok { - return nil, fmt.Errorf( - "unknown variable accessed: %s", tc.n.Name) - } - - // Add the type to the stack - v.StackPush(variable.Type) - - return tc.n, nil -} - -type typeCheckIndex struct { - n *ast.Index -} - -func (tc *typeCheckIndex) TypeCheck(v *TypeCheck) (ast.Node, error) { - keyType := v.StackPop() - targetType := v.StackPop() - - if keyType == ast.TypeUnknown || targetType == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - - // Ensure we have a VariableAccess as the target - varAccessNode, ok := tc.n.Target.(*ast.VariableAccess) - if !ok { - return nil, fmt.Errorf( - "target of an index must be a VariableAccess node, was %T", tc.n.Target) - } - - // Get the variable - variable, ok := v.Scope.LookupVar(varAccessNode.Name) - if !ok { - return nil, fmt.Errorf( - "unknown variable accessed: %s", varAccessNode.Name) - } - - switch targetType { - case ast.TypeList: - if keyType != ast.TypeInt { - tc.n.Key = v.ImplicitConversion(keyType, ast.TypeInt, tc.n.Key) - if tc.n.Key == nil { - return nil, fmt.Errorf( - "key of an index must be an int, was %s", keyType) - } - } - - valType, err := ast.VariableListElementTypesAreHomogenous( - varAccessNode.Name, variable.Value.([]ast.Variable)) - if err != nil { - return tc.n, err - } - - v.StackPush(valType) - return tc.n, nil - case ast.TypeMap: - if keyType != ast.TypeString { - tc.n.Key = v.ImplicitConversion(keyType, ast.TypeString, tc.n.Key) - if tc.n.Key == nil { - return nil, fmt.Errorf( - "key of an index must be a string, was %s", keyType) - } - } - - valType, err := ast.VariableMapValueTypesAreHomogenous( - varAccessNode.Name, variable.Value.(map[string]ast.Variable)) - if err != nil { - return tc.n, err - } - - v.StackPush(valType) - return tc.n, nil - default: - return nil, fmt.Errorf("invalid index operation into non-indexable type: %s", variable.Type) - } -} - -func (v *TypeCheck) ImplicitConversion( - actual ast.Type, expected ast.Type, n ast.Node) ast.Node { - if v.Implicit == nil { - return nil - } - - fromMap, ok := v.Implicit[actual] - if !ok { - return nil - } - - toFunc, ok := fromMap[expected] - if !ok { - return nil - } - - return &ast.Call{ - Func: toFunc, - Args: []ast.Node{n}, - Posx: n.Pos(), - } -} - -func (v *TypeCheck) reset() { - v.Stack = nil - v.err = nil -} - -func (v *TypeCheck) StackPush(t ast.Type) { - v.Stack = append(v.Stack, t) -} - -func (v *TypeCheck) StackPop() ast.Type { - var x ast.Type - x, v.Stack = v.Stack[len(v.Stack)-1], v.Stack[:len(v.Stack)-1] - return x -} - -func (v *TypeCheck) StackPeek() ast.Type { - if len(v.Stack) == 0 { - return ast.TypeInvalid - } - - return v.Stack[len(v.Stack)-1] -} diff --git a/vendor/github.com/hashicorp/hil/convert.go b/vendor/github.com/hashicorp/hil/convert.go deleted file mode 100644 index 184e029b0..000000000 --- a/vendor/github.com/hashicorp/hil/convert.go +++ /dev/null @@ -1,174 +0,0 @@ -package hil - -import ( - "fmt" - "reflect" - - "github.com/hashicorp/hil/ast" - "github.com/mitchellh/mapstructure" -) - -// UnknownValue is a sentinel value that can be used to denote -// that a value of a variable (or map element, list element, etc.) -// is unknown. This will always have the type ast.TypeUnknown. -const UnknownValue = "74D93920-ED26-11E3-AC10-0800200C9A66" - -var hilMapstructureDecodeHookSlice []interface{} -var hilMapstructureDecodeHookStringSlice []string -var hilMapstructureDecodeHookMap map[string]interface{} - -// hilMapstructureWeakDecode behaves in the same way as mapstructure.WeakDecode -// but has a DecodeHook which defeats the backward compatibility mode of mapstructure -// which WeakDecodes []interface{}{} into an empty map[string]interface{}. This -// allows us to use WeakDecode (desirable), but not fail on empty lists. -func hilMapstructureWeakDecode(m interface{}, rawVal interface{}) error { - config := &mapstructure.DecoderConfig{ - DecodeHook: func(source reflect.Type, target reflect.Type, val interface{}) (interface{}, error) { - sliceType := reflect.TypeOf(hilMapstructureDecodeHookSlice) - stringSliceType := reflect.TypeOf(hilMapstructureDecodeHookStringSlice) - mapType := reflect.TypeOf(hilMapstructureDecodeHookMap) - - if (source == sliceType || source == stringSliceType) && target == mapType { - return nil, fmt.Errorf("Cannot convert %s into a %s", source, target) - } - - return val, nil - }, - WeaklyTypedInput: true, - Result: rawVal, - } - - decoder, err := mapstructure.NewDecoder(config) - if err != nil { - return err - } - - return decoder.Decode(m) -} - -func InterfaceToVariable(input interface{}) (ast.Variable, error) { - if iv, ok := input.(ast.Variable); ok { - return iv, nil - } - - // This is just to maintain backward compatibility - // after https://github.com/mitchellh/mapstructure/pull/98 - if v, ok := input.([]ast.Variable); ok { - return ast.Variable{ - Type: ast.TypeList, - Value: v, - }, nil - } - if v, ok := input.(map[string]ast.Variable); ok { - return ast.Variable{ - Type: ast.TypeMap, - Value: v, - }, nil - } - - var stringVal string - if err := hilMapstructureWeakDecode(input, &stringVal); err == nil { - // Special case the unknown value to turn into "unknown" - if stringVal == UnknownValue { - return ast.Variable{Value: UnknownValue, Type: ast.TypeUnknown}, nil - } - - // Otherwise return the string value - return ast.Variable{ - Type: ast.TypeString, - Value: stringVal, - }, nil - } - - var mapVal map[string]interface{} - if err := hilMapstructureWeakDecode(input, &mapVal); err == nil { - elements := make(map[string]ast.Variable) - for i, element := range mapVal { - varElement, err := InterfaceToVariable(element) - if err != nil { - return ast.Variable{}, err - } - elements[i] = varElement - } - - return ast.Variable{ - Type: ast.TypeMap, - Value: elements, - }, nil - } - - var sliceVal []interface{} - if err := hilMapstructureWeakDecode(input, &sliceVal); err == nil { - elements := make([]ast.Variable, len(sliceVal)) - for i, element := range sliceVal { - varElement, err := InterfaceToVariable(element) - if err != nil { - return ast.Variable{}, err - } - elements[i] = varElement - } - - return ast.Variable{ - Type: ast.TypeList, - Value: elements, - }, nil - } - - return ast.Variable{}, fmt.Errorf("value for conversion must be a string, interface{} or map[string]interface: got %T", input) -} - -func VariableToInterface(input ast.Variable) (interface{}, error) { - if input.Type == ast.TypeString { - if inputStr, ok := input.Value.(string); ok { - return inputStr, nil - } else { - return nil, fmt.Errorf("ast.Variable with type string has value which is not a string") - } - } - - if input.Type == ast.TypeList { - inputList, ok := input.Value.([]ast.Variable) - if !ok { - return nil, fmt.Errorf("ast.Variable with type list has value which is not a []ast.Variable") - } - - result := make([]interface{}, 0) - if len(inputList) == 0 { - return result, nil - } - - for _, element := range inputList { - if convertedElement, err := VariableToInterface(element); err == nil { - result = append(result, convertedElement) - } else { - return nil, err - } - } - - return result, nil - } - - if input.Type == ast.TypeMap { - inputMap, ok := input.Value.(map[string]ast.Variable) - if !ok { - return nil, fmt.Errorf("ast.Variable with type map has value which is not a map[string]ast.Variable") - } - - result := make(map[string]interface{}, 0) - if len(inputMap) == 0 { - return result, nil - } - - for key, value := range inputMap { - if convertedValue, err := VariableToInterface(value); err == nil { - result[key] = convertedValue - } else { - return nil, err - } - } - - return result, nil - } - - return nil, fmt.Errorf("unknown input type: %s", input.Type) -} diff --git a/vendor/github.com/hashicorp/hil/eval.go b/vendor/github.com/hashicorp/hil/eval.go deleted file mode 100644 index 27820769e..000000000 --- a/vendor/github.com/hashicorp/hil/eval.go +++ /dev/null @@ -1,472 +0,0 @@ -package hil - -import ( - "bytes" - "errors" - "fmt" - "sync" - - "github.com/hashicorp/hil/ast" -) - -// EvalConfig is the configuration for evaluating. -type EvalConfig struct { - // GlobalScope is the global scope of execution for evaluation. - GlobalScope *ast.BasicScope - - // SemanticChecks is a list of additional semantic checks that will be run - // on the tree prior to evaluating it. The type checker, identifier checker, - // etc. will be run before these automatically. - SemanticChecks []SemanticChecker -} - -// SemanticChecker is the type that must be implemented to do a -// semantic check on an AST tree. This will be called with the root node. -type SemanticChecker func(ast.Node) error - -// EvaluationResult is a struct returned from the hil.Eval function, -// representing the result of an interpolation. Results are returned in their -// "natural" Go structure rather than in terms of the HIL AST. For the types -// currently implemented, this means that the Value field can be interpreted as -// the following Go types: -// TypeInvalid: undefined -// TypeString: string -// TypeList: []interface{} -// TypeMap: map[string]interface{} -// TypBool: bool -type EvaluationResult struct { - Type EvalType - Value interface{} -} - -// InvalidResult is a structure representing the result of a HIL interpolation -// which has invalid syntax, missing variables, or some other type of error. -// The error is described out of band in the accompanying error return value. -var InvalidResult = EvaluationResult{Type: TypeInvalid, Value: nil} - -// errExitUnknown is an internal error that when returned means the result -// is an unknown value. We use this for early exit. -var errExitUnknown = errors.New("unknown value") - -func Eval(root ast.Node, config *EvalConfig) (EvaluationResult, error) { - output, outputType, err := internalEval(root, config) - if err != nil { - return InvalidResult, err - } - - // If the result contains any nested unknowns then the result as a whole - // is unknown, so that callers only have to deal with "entirely known" - // or "entirely unknown" as outcomes. - if ast.IsUnknown(ast.Variable{Type: outputType, Value: output}) { - outputType = ast.TypeUnknown - output = UnknownValue - } - - switch outputType { - case ast.TypeList: - val, err := VariableToInterface(ast.Variable{ - Type: ast.TypeList, - Value: output, - }) - return EvaluationResult{ - Type: TypeList, - Value: val, - }, err - case ast.TypeMap: - val, err := VariableToInterface(ast.Variable{ - Type: ast.TypeMap, - Value: output, - }) - return EvaluationResult{ - Type: TypeMap, - Value: val, - }, err - case ast.TypeString: - return EvaluationResult{ - Type: TypeString, - Value: output, - }, nil - case ast.TypeBool: - return EvaluationResult{ - Type: TypeBool, - Value: output, - }, nil - case ast.TypeUnknown: - return EvaluationResult{ - Type: TypeUnknown, - Value: UnknownValue, - }, nil - default: - return InvalidResult, fmt.Errorf("unknown type %s as interpolation output", outputType) - } -} - -// Eval evaluates the given AST tree and returns its output value, the type -// of the output, and any error that occurred. -func internalEval(root ast.Node, config *EvalConfig) (interface{}, ast.Type, error) { - // Copy the scope so we can add our builtins - if config == nil { - config = new(EvalConfig) - } - scope := registerBuiltins(config.GlobalScope) - implicitMap := map[ast.Type]map[ast.Type]string{ - ast.TypeFloat: { - ast.TypeInt: "__builtin_FloatToInt", - ast.TypeString: "__builtin_FloatToString", - }, - ast.TypeInt: { - ast.TypeFloat: "__builtin_IntToFloat", - ast.TypeString: "__builtin_IntToString", - }, - ast.TypeString: { - ast.TypeInt: "__builtin_StringToInt", - ast.TypeFloat: "__builtin_StringToFloat", - ast.TypeBool: "__builtin_StringToBool", - }, - ast.TypeBool: { - ast.TypeString: "__builtin_BoolToString", - }, - } - - // Build our own semantic checks that we always run - tv := &TypeCheck{Scope: scope, Implicit: implicitMap} - ic := &IdentifierCheck{Scope: scope} - - // Build up the semantic checks for execution - checks := make( - []SemanticChecker, - len(config.SemanticChecks), - len(config.SemanticChecks)+2) - copy(checks, config.SemanticChecks) - checks = append(checks, ic.Visit) - checks = append(checks, tv.Visit) - - // Run the semantic checks - for _, check := range checks { - if err := check(root); err != nil { - return nil, ast.TypeInvalid, err - } - } - - // Execute - v := &evalVisitor{Scope: scope} - return v.Visit(root) -} - -// EvalNode is the interface that must be implemented by any ast.Node -// to support evaluation. This will be called in visitor pattern order. -// The result of each call to Eval is automatically pushed onto the -// stack as a LiteralNode. Pop elements off the stack to get child -// values. -type EvalNode interface { - Eval(ast.Scope, *ast.Stack) (interface{}, ast.Type, error) -} - -type evalVisitor struct { - Scope ast.Scope - Stack ast.Stack - - err error - lock sync.Mutex -} - -func (v *evalVisitor) Visit(root ast.Node) (interface{}, ast.Type, error) { - // Run the actual visitor pattern - root.Accept(v.visit) - - // Get our result and clear out everything else - var result *ast.LiteralNode - if v.Stack.Len() > 0 { - result = v.Stack.Pop().(*ast.LiteralNode) - } else { - result = new(ast.LiteralNode) - } - resultErr := v.err - if resultErr == errExitUnknown { - // This means the return value is unknown and we used the error - // as an early exit mechanism. Reset since the value on the stack - // should be the unknown value. - resultErr = nil - } - - // Clear everything else so we aren't just dangling - v.Stack.Reset() - v.err = nil - - t, err := result.Type(v.Scope) - if err != nil { - return nil, ast.TypeInvalid, err - } - - return result.Value, t, resultErr -} - -func (v *evalVisitor) visit(raw ast.Node) ast.Node { - if v.err != nil { - return raw - } - - en, err := evalNode(raw) - if err != nil { - v.err = err - return raw - } - - out, outType, err := en.Eval(v.Scope, &v.Stack) - if err != nil { - v.err = err - return raw - } - - v.Stack.Push(&ast.LiteralNode{ - Value: out, - Typex: outType, - }) - - if outType == ast.TypeUnknown { - // Halt immediately - v.err = errExitUnknown - return raw - } - - return raw -} - -// evalNode is a private function that returns an EvalNode for built-in -// types as well as any other EvalNode implementations. -func evalNode(raw ast.Node) (EvalNode, error) { - switch n := raw.(type) { - case *ast.Index: - return &evalIndex{n}, nil - case *ast.Call: - return &evalCall{n}, nil - case *ast.Conditional: - return &evalConditional{n}, nil - case *ast.Output: - return &evalOutput{n}, nil - case *ast.LiteralNode: - return &evalLiteralNode{n}, nil - case *ast.VariableAccess: - return &evalVariableAccess{n}, nil - default: - en, ok := n.(EvalNode) - if !ok { - return nil, fmt.Errorf("node doesn't support evaluation: %#v", raw) - } - - return en, nil - } -} - -type evalCall struct{ *ast.Call } - -func (v *evalCall) Eval(s ast.Scope, stack *ast.Stack) (interface{}, ast.Type, error) { - // Look up the function in the map - function, ok := s.LookupFunc(v.Func) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "unknown function called: %s", v.Func) - } - - // The arguments are on the stack in reverse order, so pop them off. - args := make([]interface{}, len(v.Args)) - for i, _ := range v.Args { - node := stack.Pop().(*ast.LiteralNode) - if node.IsUnknown() { - // If any arguments are unknown then the result is automatically unknown - return UnknownValue, ast.TypeUnknown, nil - } - args[len(v.Args)-1-i] = node.Value - } - - // Call the function - result, err := function.Callback(args) - if err != nil { - return nil, ast.TypeInvalid, fmt.Errorf("%s: %s", v.Func, err) - } - - return result, function.ReturnType, nil -} - -type evalConditional struct{ *ast.Conditional } - -func (v *evalConditional) Eval(s ast.Scope, stack *ast.Stack) (interface{}, ast.Type, error) { - // On the stack we have literal nodes representing the resulting values - // of the condition, true and false expressions, but they are in reverse - // order. - falseLit := stack.Pop().(*ast.LiteralNode) - trueLit := stack.Pop().(*ast.LiteralNode) - condLit := stack.Pop().(*ast.LiteralNode) - - if condLit.IsUnknown() { - // If our conditional is unknown then our result is also unknown - return UnknownValue, ast.TypeUnknown, nil - } - - if condLit.Value.(bool) { - return trueLit.Value, trueLit.Typex, nil - } else { - return falseLit.Value, trueLit.Typex, nil - } -} - -type evalIndex struct{ *ast.Index } - -func (v *evalIndex) Eval(scope ast.Scope, stack *ast.Stack) (interface{}, ast.Type, error) { - key := stack.Pop().(*ast.LiteralNode) - target := stack.Pop().(*ast.LiteralNode) - - variableName := v.Index.Target.(*ast.VariableAccess).Name - - if key.IsUnknown() { - // If our key is unknown then our result is also unknown - return UnknownValue, ast.TypeUnknown, nil - } - - // For target, we'll accept collections containing unknown values but - // we still need to catch when the collection itself is unknown, shallowly. - if target.Typex == ast.TypeUnknown { - return UnknownValue, ast.TypeUnknown, nil - } - - switch target.Typex { - case ast.TypeList: - return v.evalListIndex(variableName, target.Value, key.Value) - case ast.TypeMap: - return v.evalMapIndex(variableName, target.Value, key.Value) - default: - return nil, ast.TypeInvalid, fmt.Errorf( - "target %q for indexing must be ast.TypeList or ast.TypeMap, is %s", - variableName, target.Typex) - } -} - -func (v *evalIndex) evalListIndex(variableName string, target interface{}, key interface{}) (interface{}, ast.Type, error) { - // We assume type checking was already done and we can assume that target - // is a list and key is an int - list, ok := target.([]ast.Variable) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "cannot cast target to []Variable, is: %T", target) - } - - keyInt, ok := key.(int) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "cannot cast key to int, is: %T", key) - } - - if len(list) == 0 { - return nil, ast.TypeInvalid, fmt.Errorf("list is empty") - } - - if keyInt < 0 || len(list) < keyInt+1 { - return nil, ast.TypeInvalid, fmt.Errorf( - "index %d out of range for list %s (max %d)", - keyInt, variableName, len(list)) - } - - returnVal := list[keyInt].Value - returnType := list[keyInt].Type - return returnVal, returnType, nil -} - -func (v *evalIndex) evalMapIndex(variableName string, target interface{}, key interface{}) (interface{}, ast.Type, error) { - // We assume type checking was already done and we can assume that target - // is a map and key is a string - vmap, ok := target.(map[string]ast.Variable) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "cannot cast target to map[string]Variable, is: %T", target) - } - - keyString, ok := key.(string) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "cannot cast key to string, is: %T", key) - } - - if len(vmap) == 0 { - return nil, ast.TypeInvalid, fmt.Errorf("map is empty") - } - - value, ok := vmap[keyString] - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "key %q does not exist in map %s", keyString, variableName) - } - - return value.Value, value.Type, nil -} - -type evalOutput struct{ *ast.Output } - -func (v *evalOutput) Eval(s ast.Scope, stack *ast.Stack) (interface{}, ast.Type, error) { - // The expressions should all be on the stack in reverse - // order. So pop them off, reverse their order, and concatenate. - nodes := make([]*ast.LiteralNode, 0, len(v.Exprs)) - haveUnknown := false - for range v.Exprs { - n := stack.Pop().(*ast.LiteralNode) - nodes = append(nodes, n) - - // If we have any unknowns then the whole result is unknown - // (we must deal with this first, because the type checker can - // skip type conversions in the presence of unknowns, and thus - // any of our other nodes may be incorrectly typed.) - if n.IsUnknown() { - haveUnknown = true - } - } - - if haveUnknown { - return UnknownValue, ast.TypeUnknown, nil - } - - // Special case the single list and map - if len(nodes) == 1 { - switch t := nodes[0].Typex; t { - case ast.TypeList: - fallthrough - case ast.TypeMap: - fallthrough - case ast.TypeUnknown: - return nodes[0].Value, t, nil - } - } - - // Otherwise concatenate the strings - var buf bytes.Buffer - for i := len(nodes) - 1; i >= 0; i-- { - if nodes[i].Typex != ast.TypeString { - return nil, ast.TypeInvalid, fmt.Errorf( - "invalid output with %s value at index %d: %#v", - nodes[i].Typex, - i, - nodes[i].Value, - ) - } - buf.WriteString(nodes[i].Value.(string)) - } - - return buf.String(), ast.TypeString, nil -} - -type evalLiteralNode struct{ *ast.LiteralNode } - -func (v *evalLiteralNode) Eval(ast.Scope, *ast.Stack) (interface{}, ast.Type, error) { - return v.Value, v.Typex, nil -} - -type evalVariableAccess struct{ *ast.VariableAccess } - -func (v *evalVariableAccess) Eval(scope ast.Scope, _ *ast.Stack) (interface{}, ast.Type, error) { - // Look up the variable in the map - variable, ok := scope.LookupVar(v.Name) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "unknown variable accessed: %s", v.Name) - } - - return variable.Value, variable.Type, nil -} diff --git a/vendor/github.com/hashicorp/hil/eval_type.go b/vendor/github.com/hashicorp/hil/eval_type.go deleted file mode 100644 index 6946ecd23..000000000 --- a/vendor/github.com/hashicorp/hil/eval_type.go +++ /dev/null @@ -1,16 +0,0 @@ -package hil - -//go:generate stringer -type=EvalType eval_type.go - -// EvalType represents the type of the output returned from a HIL -// evaluation. -type EvalType uint32 - -const ( - TypeInvalid EvalType = 0 - TypeString EvalType = 1 << iota - TypeBool - TypeList - TypeMap - TypeUnknown -) diff --git a/vendor/github.com/hashicorp/hil/evaltype_string.go b/vendor/github.com/hashicorp/hil/evaltype_string.go deleted file mode 100644 index b107ddd45..000000000 --- a/vendor/github.com/hashicorp/hil/evaltype_string.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by "stringer -type=EvalType eval_type.go"; DO NOT EDIT - -package hil - -import "fmt" - -const ( - _EvalType_name_0 = "TypeInvalid" - _EvalType_name_1 = "TypeString" - _EvalType_name_2 = "TypeBool" - _EvalType_name_3 = "TypeList" - _EvalType_name_4 = "TypeMap" - _EvalType_name_5 = "TypeUnknown" -) - -var ( - _EvalType_index_0 = [...]uint8{0, 11} - _EvalType_index_1 = [...]uint8{0, 10} - _EvalType_index_2 = [...]uint8{0, 8} - _EvalType_index_3 = [...]uint8{0, 8} - _EvalType_index_4 = [...]uint8{0, 7} - _EvalType_index_5 = [...]uint8{0, 11} -) - -func (i EvalType) String() string { - switch { - case i == 0: - return _EvalType_name_0 - case i == 2: - return _EvalType_name_1 - case i == 4: - return _EvalType_name_2 - case i == 8: - return _EvalType_name_3 - case i == 16: - return _EvalType_name_4 - case i == 32: - return _EvalType_name_5 - default: - return fmt.Sprintf("EvalType(%d)", i) - } -} diff --git a/vendor/github.com/hashicorp/hil/go.mod b/vendor/github.com/hashicorp/hil/go.mod deleted file mode 100644 index 45719a69b..000000000 --- a/vendor/github.com/hashicorp/hil/go.mod +++ /dev/null @@ -1,6 +0,0 @@ -module github.com/hashicorp/hil - -require ( - github.com/mitchellh/mapstructure v1.1.2 - github.com/mitchellh/reflectwalk v1.0.0 -) diff --git a/vendor/github.com/hashicorp/hil/go.sum b/vendor/github.com/hashicorp/hil/go.sum deleted file mode 100644 index 83639b691..000000000 --- a/vendor/github.com/hashicorp/hil/go.sum +++ /dev/null @@ -1,4 +0,0 @@ -github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= diff --git a/vendor/github.com/hashicorp/hil/parse.go b/vendor/github.com/hashicorp/hil/parse.go deleted file mode 100644 index ecbe1fdbf..000000000 --- a/vendor/github.com/hashicorp/hil/parse.go +++ /dev/null @@ -1,29 +0,0 @@ -package hil - -import ( - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/parser" - "github.com/hashicorp/hil/scanner" -) - -// Parse parses the given program and returns an executable AST tree. -// -// Syntax errors are returned with error having the dynamic type -// *parser.ParseError, which gives the caller access to the source position -// where the error was found, which allows (for example) combining it with -// a known source filename to add context to the error message. -func Parse(v string) (ast.Node, error) { - return ParseWithPosition(v, ast.Pos{Line: 1, Column: 1}) -} - -// ParseWithPosition is like Parse except that it overrides the source -// row and column position of the first character in the string, which should -// be 1-based. -// -// This can be used when HIL is embedded in another language and the outer -// parser knows the row and column where the HIL expression started within -// the overall source file. -func ParseWithPosition(v string, pos ast.Pos) (ast.Node, error) { - ch := scanner.Scan(v, pos) - return parser.Parse(ch) -} diff --git a/vendor/github.com/hashicorp/hil/parser/binary_op.go b/vendor/github.com/hashicorp/hil/parser/binary_op.go deleted file mode 100644 index 2e013e01d..000000000 --- a/vendor/github.com/hashicorp/hil/parser/binary_op.go +++ /dev/null @@ -1,45 +0,0 @@ -package parser - -import ( - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/scanner" -) - -var binaryOps []map[scanner.TokenType]ast.ArithmeticOp - -func init() { - // This operation table maps from the operator's scanner token type - // to the AST arithmetic operation. All expressions produced from - // binary operators are *ast.Arithmetic nodes. - // - // Binary operator groups are listed in order of precedence, with - // the *lowest* precedence first. Operators within the same group - // have left-to-right associativity. - binaryOps = []map[scanner.TokenType]ast.ArithmeticOp{ - { - scanner.OR: ast.ArithmeticOpLogicalOr, - }, - { - scanner.AND: ast.ArithmeticOpLogicalAnd, - }, - { - scanner.EQUAL: ast.ArithmeticOpEqual, - scanner.NOTEQUAL: ast.ArithmeticOpNotEqual, - }, - { - scanner.GT: ast.ArithmeticOpGreaterThan, - scanner.GTE: ast.ArithmeticOpGreaterThanOrEqual, - scanner.LT: ast.ArithmeticOpLessThan, - scanner.LTE: ast.ArithmeticOpLessThanOrEqual, - }, - { - scanner.PLUS: ast.ArithmeticOpAdd, - scanner.MINUS: ast.ArithmeticOpSub, - }, - { - scanner.STAR: ast.ArithmeticOpMul, - scanner.SLASH: ast.ArithmeticOpDiv, - scanner.PERCENT: ast.ArithmeticOpMod, - }, - } -} diff --git a/vendor/github.com/hashicorp/hil/parser/error.go b/vendor/github.com/hashicorp/hil/parser/error.go deleted file mode 100644 index bacd69645..000000000 --- a/vendor/github.com/hashicorp/hil/parser/error.go +++ /dev/null @@ -1,38 +0,0 @@ -package parser - -import ( - "fmt" - - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/scanner" -) - -type ParseError struct { - Message string - Pos ast.Pos -} - -func Errorf(pos ast.Pos, format string, args ...interface{}) error { - return &ParseError{ - Message: fmt.Sprintf(format, args...), - Pos: pos, - } -} - -// TokenErrorf is a convenient wrapper around Errorf that uses the -// position of the given token. -func TokenErrorf(token *scanner.Token, format string, args ...interface{}) error { - return Errorf(token.Pos, format, args...) -} - -func ExpectationError(wanted string, got *scanner.Token) error { - return TokenErrorf(got, "expected %s but found %s", wanted, got) -} - -func (e *ParseError) Error() string { - return fmt.Sprintf("parse error at %s: %s", e.Pos, e.Message) -} - -func (e *ParseError) String() string { - return e.Error() -} diff --git a/vendor/github.com/hashicorp/hil/parser/fuzz.go b/vendor/github.com/hashicorp/hil/parser/fuzz.go deleted file mode 100644 index de954f383..000000000 --- a/vendor/github.com/hashicorp/hil/parser/fuzz.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build gofuzz - -package parser - -import ( - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/scanner" -) - -// This is a fuzz testing function designed to be used with go-fuzz: -// https://github.com/dvyukov/go-fuzz -// -// It's not included in a normal build due to the gofuzz build tag above. -// -// There are some input files that you can use as a seed corpus for go-fuzz -// in the directory ./fuzz-corpus . - -func Fuzz(data []byte) int { - str := string(data) - - ch := scanner.Scan(str, ast.Pos{Line: 1, Column: 1}) - _, err := Parse(ch) - if err != nil { - return 0 - } - - return 1 -} diff --git a/vendor/github.com/hashicorp/hil/parser/parser.go b/vendor/github.com/hashicorp/hil/parser/parser.go deleted file mode 100644 index 376f1c49d..000000000 --- a/vendor/github.com/hashicorp/hil/parser/parser.go +++ /dev/null @@ -1,522 +0,0 @@ -package parser - -import ( - "strconv" - "unicode/utf8" - - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/scanner" -) - -func Parse(ch <-chan *scanner.Token) (ast.Node, error) { - peeker := scanner.NewPeeker(ch) - parser := &parser{peeker} - output, err := parser.ParseTopLevel() - peeker.Close() - return output, err -} - -type parser struct { - peeker *scanner.Peeker -} - -func (p *parser) ParseTopLevel() (ast.Node, error) { - return p.parseInterpolationSeq(false) -} - -func (p *parser) ParseQuoted() (ast.Node, error) { - return p.parseInterpolationSeq(true) -} - -// parseInterpolationSeq parses either the top-level sequence of literals -// and interpolation expressions or a similar sequence within a quoted -// string inside an interpolation expression. The latter case is requested -// by setting 'quoted' to true. -func (p *parser) parseInterpolationSeq(quoted bool) (ast.Node, error) { - literalType := scanner.LITERAL - endType := scanner.EOF - if quoted { - // exceptions for quoted sequences - literalType = scanner.STRING - endType = scanner.CQUOTE - } - - startPos := p.peeker.Peek().Pos - - if quoted { - tok := p.peeker.Read() - if tok.Type != scanner.OQUOTE { - return nil, ExpectationError("open quote", tok) - } - } - - var exprs []ast.Node - for { - tok := p.peeker.Read() - - if tok.Type == endType { - break - } - - switch tok.Type { - case literalType: - val, err := p.parseStringToken(tok) - if err != nil { - return nil, err - } - exprs = append(exprs, &ast.LiteralNode{ - Value: val, - Typex: ast.TypeString, - Posx: tok.Pos, - }) - case scanner.BEGIN: - expr, err := p.ParseInterpolation() - if err != nil { - return nil, err - } - exprs = append(exprs, expr) - default: - return nil, ExpectationError(`"${"`, tok) - } - } - - if len(exprs) == 0 { - // If we have no parts at all then the input must've - // been an empty string. - exprs = append(exprs, &ast.LiteralNode{ - Value: "", - Typex: ast.TypeString, - Posx: startPos, - }) - } - - // As a special case, if our "Output" contains only one expression - // and it's a literal string then we'll hoist it up to be our - // direct return value, so callers can easily recognize a string - // that has no interpolations at all. - if len(exprs) == 1 { - if lit, ok := exprs[0].(*ast.LiteralNode); ok { - if lit.Typex == ast.TypeString { - return lit, nil - } - } - } - - return &ast.Output{ - Exprs: exprs, - Posx: startPos, - }, nil -} - -// parseStringToken takes a token of either LITERAL or STRING type and -// returns the interpreted string, after processing any relevant -// escape sequences. -func (p *parser) parseStringToken(tok *scanner.Token) (string, error) { - var backslashes bool - switch tok.Type { - case scanner.LITERAL: - backslashes = false - case scanner.STRING: - backslashes = true - default: - panic("unsupported string token type") - } - - raw := []byte(tok.Content) - buf := make([]byte, 0, len(raw)) - - for i := 0; i < len(raw); i++ { - b := raw[i] - more := len(raw) > (i + 1) - - if b == '$' { - if more && raw[i+1] == '$' { - // skip over the second dollar sign - i++ - } - } else if backslashes && b == '\\' { - if !more { - return "", Errorf( - ast.Pos{ - Column: tok.Pos.Column + utf8.RuneCount(raw[:i]), - Line: tok.Pos.Line, - }, - `unfinished backslash escape sequence`, - ) - } - escapeType := raw[i+1] - switch escapeType { - case '\\': - // skip over the second slash - i++ - case 'n': - b = '\n' - i++ - case '"': - b = '"' - i++ - default: - return "", Errorf( - ast.Pos{ - Column: tok.Pos.Column + utf8.RuneCount(raw[:i]), - Line: tok.Pos.Line, - }, - `invalid backslash escape sequence`, - ) - } - } - - buf = append(buf, b) - } - - return string(buf), nil -} - -func (p *parser) ParseInterpolation() (ast.Node, error) { - // By the time we're called, we're already "inside" the ${ sequence - // because the caller consumed the ${ token. - - expr, err := p.ParseExpression() - if err != nil { - return nil, err - } - - err = p.requireTokenType(scanner.END, `"}"`) - if err != nil { - return nil, err - } - - return expr, nil -} - -func (p *parser) ParseExpression() (ast.Node, error) { - return p.parseTernaryCond() -} - -func (p *parser) parseTernaryCond() (ast.Node, error) { - // The ternary condition operator (.. ? .. : ..) behaves somewhat - // like a binary operator except that the "operator" is itself - // an expression enclosed in two punctuation characters. - // The middle expression is parsed as if the ? and : symbols - // were parentheses. The "rhs" (the "false expression") is then - // treated right-associatively so it behaves similarly to the - // middle in terms of precedence. - - startPos := p.peeker.Peek().Pos - - var cond, trueExpr, falseExpr ast.Node - var err error - - cond, err = p.parseBinaryOps(binaryOps) - if err != nil { - return nil, err - } - - next := p.peeker.Peek() - if next.Type != scanner.QUESTION { - return cond, nil - } - - p.peeker.Read() // eat question mark - - trueExpr, err = p.ParseExpression() - if err != nil { - return nil, err - } - - colon := p.peeker.Read() - if colon.Type != scanner.COLON { - return nil, ExpectationError(":", colon) - } - - falseExpr, err = p.ParseExpression() - if err != nil { - return nil, err - } - - return &ast.Conditional{ - CondExpr: cond, - TrueExpr: trueExpr, - FalseExpr: falseExpr, - Posx: startPos, - }, nil -} - -// parseBinaryOps calls itself recursively to work through all of the -// operator precedence groups, and then eventually calls ParseExpressionTerm -// for each operand. -func (p *parser) parseBinaryOps(ops []map[scanner.TokenType]ast.ArithmeticOp) (ast.Node, error) { - if len(ops) == 0 { - // We've run out of operators, so now we'll just try to parse a term. - return p.ParseExpressionTerm() - } - - thisLevel := ops[0] - remaining := ops[1:] - - startPos := p.peeker.Peek().Pos - - var lhs, rhs ast.Node - operator := ast.ArithmeticOpInvalid - var err error - - // parse a term that might be the first operand of a binary - // expression or it might just be a standalone term, but - // we won't know until we've parsed it and can look ahead - // to see if there's an operator token. - lhs, err = p.parseBinaryOps(remaining) - if err != nil { - return nil, err - } - - // We'll keep eating up arithmetic operators until we run - // out, so that operators with the same precedence will combine in a - // left-associative manner: - // a+b+c => (a+b)+c, not a+(b+c) - // - // Should we later want to have right-associative operators, a way - // to achieve that would be to call back up to ParseExpression here - // instead of iteratively parsing only the remaining operators. - for { - next := p.peeker.Peek() - var newOperator ast.ArithmeticOp - var ok bool - if newOperator, ok = thisLevel[next.Type]; !ok { - break - } - - // Are we extending an expression started on - // the previous iteration? - if operator != ast.ArithmeticOpInvalid { - lhs = &ast.Arithmetic{ - Op: operator, - Exprs: []ast.Node{lhs, rhs}, - Posx: startPos, - } - } - - operator = newOperator - p.peeker.Read() // eat operator token - rhs, err = p.parseBinaryOps(remaining) - if err != nil { - return nil, err - } - } - - if operator != ast.ArithmeticOpInvalid { - return &ast.Arithmetic{ - Op: operator, - Exprs: []ast.Node{lhs, rhs}, - Posx: startPos, - }, nil - } else { - return lhs, nil - } -} - -func (p *parser) ParseExpressionTerm() (ast.Node, error) { - - next := p.peeker.Peek() - - switch next.Type { - - case scanner.OPAREN: - p.peeker.Read() - expr, err := p.ParseExpression() - if err != nil { - return nil, err - } - err = p.requireTokenType(scanner.CPAREN, `")"`) - return expr, err - - case scanner.OQUOTE: - return p.ParseQuoted() - - case scanner.INTEGER: - tok := p.peeker.Read() - val, err := strconv.Atoi(tok.Content) - if err != nil { - return nil, TokenErrorf(tok, "invalid integer: %s", err) - } - return &ast.LiteralNode{ - Value: val, - Typex: ast.TypeInt, - Posx: tok.Pos, - }, nil - - case scanner.FLOAT: - tok := p.peeker.Read() - val, err := strconv.ParseFloat(tok.Content, 64) - if err != nil { - return nil, TokenErrorf(tok, "invalid float: %s", err) - } - return &ast.LiteralNode{ - Value: val, - Typex: ast.TypeFloat, - Posx: tok.Pos, - }, nil - - case scanner.BOOL: - tok := p.peeker.Read() - // the scanner guarantees that tok.Content is either "true" or "false" - var val bool - if tok.Content[0] == 't' { - val = true - } else { - val = false - } - return &ast.LiteralNode{ - Value: val, - Typex: ast.TypeBool, - Posx: tok.Pos, - }, nil - - case scanner.MINUS: - opTok := p.peeker.Read() - // important to use ParseExpressionTerm rather than ParseExpression - // here, otherwise we can capture a following binary expression into - // our negation. - // e.g. -46+5 should parse as (0-46)+5, not 0-(46+5) - operand, err := p.ParseExpressionTerm() - if err != nil { - return nil, err - } - // The AST currently represents negative numbers as - // a binary subtraction of the number from zero. - return &ast.Arithmetic{ - Op: ast.ArithmeticOpSub, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: 0, - Typex: ast.TypeInt, - Posx: opTok.Pos, - }, - operand, - }, - Posx: opTok.Pos, - }, nil - - case scanner.BANG: - opTok := p.peeker.Read() - // important to use ParseExpressionTerm rather than ParseExpression - // here, otherwise we can capture a following binary expression into - // our negation. - operand, err := p.ParseExpressionTerm() - if err != nil { - return nil, err - } - // The AST currently represents binary negation as an equality - // test with "false". - return &ast.Arithmetic{ - Op: ast.ArithmeticOpEqual, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: false, - Typex: ast.TypeBool, - Posx: opTok.Pos, - }, - operand, - }, - Posx: opTok.Pos, - }, nil - - case scanner.IDENTIFIER: - return p.ParseScopeInteraction() - - default: - return nil, ExpectationError("expression", next) - } -} - -// ParseScopeInteraction parses the expression types that interact -// with the evaluation scope: variable access, function calls, and -// indexing. -// -// Indexing should actually be a distinct operator in its own right, -// so that e.g. it can be applied to the result of a function call, -// but for now we're preserving the behavior of the older yacc-based -// parser. -func (p *parser) ParseScopeInteraction() (ast.Node, error) { - first := p.peeker.Read() - startPos := first.Pos - if first.Type != scanner.IDENTIFIER { - return nil, ExpectationError("identifier", first) - } - - next := p.peeker.Peek() - if next.Type == scanner.OPAREN { - // function call - funcName := first.Content - p.peeker.Read() // eat paren - var args []ast.Node - - for { - if p.peeker.Peek().Type == scanner.CPAREN { - break - } - - arg, err := p.ParseExpression() - if err != nil { - return nil, err - } - - args = append(args, arg) - - if p.peeker.Peek().Type == scanner.COMMA { - p.peeker.Read() // eat comma - continue - } else { - break - } - } - - err := p.requireTokenType(scanner.CPAREN, `")"`) - if err != nil { - return nil, err - } - - return &ast.Call{ - Func: funcName, - Args: args, - Posx: startPos, - }, nil - } - - varNode := &ast.VariableAccess{ - Name: first.Content, - Posx: startPos, - } - - if p.peeker.Peek().Type == scanner.OBRACKET { - // index operator - startPos := p.peeker.Read().Pos // eat bracket - indexExpr, err := p.ParseExpression() - if err != nil { - return nil, err - } - err = p.requireTokenType(scanner.CBRACKET, `"]"`) - if err != nil { - return nil, err - } - return &ast.Index{ - Target: varNode, - Key: indexExpr, - Posx: startPos, - }, nil - } - - return varNode, nil -} - -// requireTokenType consumes the next token an returns an error if its -// type does not match the given type. nil is returned if the type matches. -// -// This is a helper around peeker.Read() for situations where the parser just -// wants to assert that a particular token type must be present. -func (p *parser) requireTokenType(wantType scanner.TokenType, wantName string) error { - token := p.peeker.Read() - if token.Type != wantType { - return ExpectationError(wantName, token) - } - return nil -} diff --git a/vendor/github.com/hashicorp/hil/scanner/peeker.go b/vendor/github.com/hashicorp/hil/scanner/peeker.go deleted file mode 100644 index 4de372831..000000000 --- a/vendor/github.com/hashicorp/hil/scanner/peeker.go +++ /dev/null @@ -1,55 +0,0 @@ -package scanner - -// Peeker is a utility that wraps a token channel returned by Scan and -// provides an interface that allows a caller (e.g. the parser) to -// work with the token stream in a mode that allows one token of lookahead, -// and provides utilities for more convenient processing of the stream. -type Peeker struct { - ch <-chan *Token - peeked *Token -} - -func NewPeeker(ch <-chan *Token) *Peeker { - return &Peeker{ - ch: ch, - } -} - -// Peek returns the next token in the stream without consuming it. A -// subsequent call to Read will return the same token. -func (p *Peeker) Peek() *Token { - if p.peeked == nil { - p.peeked = <-p.ch - } - return p.peeked -} - -// Read consumes the next token in the stream and returns it. -func (p *Peeker) Read() *Token { - token := p.Peek() - - // As a special case, we will produce the EOF token forever once - // it is reached. - if token.Type != EOF { - p.peeked = nil - } - - return token -} - -// Close ensures that the token stream has been exhausted, to prevent -// the goroutine in the underlying scanner from leaking. -// -// It's not necessary to call this if the caller reads the token stream -// to EOF, since that implicitly closes the scanner. -func (p *Peeker) Close() { - for _ = range p.ch { - // discard - } - // Install a synthetic EOF token in 'peeked' in case someone - // erroneously calls Peek() or Read() after we've closed. - p.peeked = &Token{ - Type: EOF, - Content: "", - } -} diff --git a/vendor/github.com/hashicorp/hil/scanner/scanner.go b/vendor/github.com/hashicorp/hil/scanner/scanner.go deleted file mode 100644 index 86085de01..000000000 --- a/vendor/github.com/hashicorp/hil/scanner/scanner.go +++ /dev/null @@ -1,556 +0,0 @@ -package scanner - -import ( - "unicode" - "unicode/utf8" - - "github.com/hashicorp/hil/ast" -) - -// Scan returns a channel that recieves Tokens from the given input string. -// -// The scanner's job is just to partition the string into meaningful parts. -// It doesn't do any transformation of the raw input string, so the caller -// must deal with any further interpretation required, such as parsing INTEGER -// tokens into real ints, or dealing with escape sequences in LITERAL or -// STRING tokens. -// -// Strings in the returned tokens are slices from the original string. -// -// startPos should be set to ast.InitPos unless the caller knows that -// this interpolation string is part of a larger file and knows the position -// of the first character in that larger file. -func Scan(s string, startPos ast.Pos) <-chan *Token { - ch := make(chan *Token) - go scan(s, ch, startPos) - return ch -} - -func scan(s string, ch chan<- *Token, pos ast.Pos) { - // 'remain' starts off as the whole string but we gradually - // slice of the front of it as we work our way through. - remain := s - - // nesting keeps track of how many ${ .. } sequences we are - // inside, so we can recognize the minor differences in syntax - // between outer string literals (LITERAL tokens) and quoted - // string literals (STRING tokens). - nesting := 0 - - // We're going to flip back and forth between parsing literals/strings - // and parsing interpolation sequences ${ .. } until we reach EOF or - // some INVALID token. -All: - for { - startPos := pos - // Literal string processing first, since the beginning of - // a string is always outside of an interpolation sequence. - literalVal, terminator := scanLiteral(remain, pos, nesting > 0) - - if len(literalVal) > 0 { - litType := LITERAL - if nesting > 0 { - litType = STRING - } - ch <- &Token{ - Type: litType, - Content: literalVal, - Pos: startPos, - } - remain = remain[len(literalVal):] - } - - ch <- terminator - remain = remain[len(terminator.Content):] - pos = terminator.Pos - // Safe to use len() here because none of the terminator tokens - // can contain UTF-8 sequences. - pos.Column = pos.Column + len(terminator.Content) - - switch terminator.Type { - case INVALID: - // Synthetic EOF after invalid token, since further scanning - // is likely to just produce more garbage. - ch <- &Token{ - Type: EOF, - Content: "", - Pos: pos, - } - break All - case EOF: - // All done! - break All - case BEGIN: - nesting++ - case CQUOTE: - // nothing special to do - default: - // Should never happen - panic("invalid string/literal terminator") - } - - // Now we do the processing of the insides of ${ .. } sequences. - // This loop terminates when we encounter either a closing } or - // an opening ", which will cause us to return to literal processing. - Interpolation: - for { - - token, size, newPos := scanInterpolationToken(remain, pos) - ch <- token - remain = remain[size:] - pos = newPos - - switch token.Type { - case INVALID: - // Synthetic EOF after invalid token, since further scanning - // is likely to just produce more garbage. - ch <- &Token{ - Type: EOF, - Content: "", - Pos: pos, - } - break All - case EOF: - // All done - // (though a syntax error that we'll catch in the parser) - break All - case END: - nesting-- - if nesting < 0 { - // Can happen if there are unbalanced ${ and } sequences - // in the input, which we'll catch in the parser. - nesting = 0 - } - break Interpolation - case OQUOTE: - // Beginning of nested quoted string - break Interpolation - } - } - } - - close(ch) -} - -// Returns the token found at the start of the given string, followed by -// the number of bytes that were consumed from the string and the adjusted -// source position. -// -// Note that the number of bytes consumed can be more than the length of -// the returned token contents if the string begins with whitespace, since -// it will be silently consumed before reading the token. -func scanInterpolationToken(s string, startPos ast.Pos) (*Token, int, ast.Pos) { - pos := startPos - size := 0 - - // Consume whitespace, if any - for len(s) > 0 && byteIsSpace(s[0]) { - if s[0] == '\n' { - pos.Column = 1 - pos.Line++ - } else { - pos.Column++ - } - size++ - s = s[1:] - } - - // Unexpected EOF during sequence - if len(s) == 0 { - return &Token{ - Type: EOF, - Content: "", - Pos: pos, - }, size, pos - } - - next := s[0] - var token *Token - - switch next { - case '(', ')', '[', ']', ',', '.', '+', '-', '*', '/', '%', '?', ':': - // Easy punctuation symbols that don't have any special meaning - // during scanning, and that stand for themselves in the - // TokenType enumeration. - token = &Token{ - Type: TokenType(next), - Content: s[:1], - Pos: pos, - } - case '}': - token = &Token{ - Type: END, - Content: s[:1], - Pos: pos, - } - case '"': - token = &Token{ - Type: OQUOTE, - Content: s[:1], - Pos: pos, - } - case '!': - if len(s) >= 2 && s[:2] == "!=" { - token = &Token{ - Type: NOTEQUAL, - Content: s[:2], - Pos: pos, - } - } else { - token = &Token{ - Type: BANG, - Content: s[:1], - Pos: pos, - } - } - case '<': - if len(s) >= 2 && s[:2] == "<=" { - token = &Token{ - Type: LTE, - Content: s[:2], - Pos: pos, - } - } else { - token = &Token{ - Type: LT, - Content: s[:1], - Pos: pos, - } - } - case '>': - if len(s) >= 2 && s[:2] == ">=" { - token = &Token{ - Type: GTE, - Content: s[:2], - Pos: pos, - } - } else { - token = &Token{ - Type: GT, - Content: s[:1], - Pos: pos, - } - } - case '=': - if len(s) >= 2 && s[:2] == "==" { - token = &Token{ - Type: EQUAL, - Content: s[:2], - Pos: pos, - } - } else { - // A single equals is not a valid operator - token = &Token{ - Type: INVALID, - Content: s[:1], - Pos: pos, - } - } - case '&': - if len(s) >= 2 && s[:2] == "&&" { - token = &Token{ - Type: AND, - Content: s[:2], - Pos: pos, - } - } else { - token = &Token{ - Type: INVALID, - Content: s[:1], - Pos: pos, - } - } - case '|': - if len(s) >= 2 && s[:2] == "||" { - token = &Token{ - Type: OR, - Content: s[:2], - Pos: pos, - } - } else { - token = &Token{ - Type: INVALID, - Content: s[:1], - Pos: pos, - } - } - default: - if next >= '0' && next <= '9' { - num, numType := scanNumber(s) - token = &Token{ - Type: numType, - Content: num, - Pos: pos, - } - } else if stringStartsWithIdentifier(s) { - ident, runeLen := scanIdentifier(s) - tokenType := IDENTIFIER - if ident == "true" || ident == "false" { - tokenType = BOOL - } - token = &Token{ - Type: tokenType, - Content: ident, - Pos: pos, - } - // Skip usual token handling because it doesn't - // know how to deal with UTF-8 sequences. - pos.Column = pos.Column + runeLen - return token, size + len(ident), pos - } else { - _, byteLen := utf8.DecodeRuneInString(s) - token = &Token{ - Type: INVALID, - Content: s[:byteLen], - Pos: pos, - } - // Skip usual token handling because it doesn't - // know how to deal with UTF-8 sequences. - pos.Column = pos.Column + 1 - return token, size + byteLen, pos - } - } - - // Here we assume that the token content contains no UTF-8 sequences, - // because we dealt with UTF-8 characters as a special case where - // necessary above. - size = size + len(token.Content) - pos.Column = pos.Column + len(token.Content) - - return token, size, pos -} - -// Returns the (possibly-empty) prefix of the given string that represents -// a literal, followed by the token that marks the end of the literal. -func scanLiteral(s string, startPos ast.Pos, nested bool) (string, *Token) { - litLen := 0 - pos := startPos - var terminator *Token - for { - - if litLen >= len(s) { - if nested { - // We've ended in the middle of a quoted string, - // which means this token is actually invalid. - return "", &Token{ - Type: INVALID, - Content: s, - Pos: startPos, - } - } - terminator = &Token{ - Type: EOF, - Content: "", - Pos: pos, - } - break - } - - next := s[litLen] - - if next == '$' && len(s) > litLen+1 { - follow := s[litLen+1] - - if follow == '{' { - terminator = &Token{ - Type: BEGIN, - Content: s[litLen : litLen+2], - Pos: pos, - } - pos.Column = pos.Column + 2 - break - } else if follow == '$' { - // Double-$ escapes the special processing of $, - // so we will consume both characters here. - pos.Column = pos.Column + 2 - litLen = litLen + 2 - continue - } - } - - // special handling that applies only to quoted strings - if nested { - if next == '"' { - terminator = &Token{ - Type: CQUOTE, - Content: s[litLen : litLen+1], - Pos: pos, - } - pos.Column = pos.Column + 1 - break - } - - // Escaped quote marks do not terminate the string. - // - // All we do here in the scanner is avoid terminating a string - // due to an escaped quote. The parser is responsible for the - // full handling of escape sequences, since it's able to produce - // better error messages than we can produce in here. - if next == '\\' && len(s) > litLen+1 { - follow := s[litLen+1] - - if follow == '"' { - // \" escapes the special processing of ", - // so we will consume both characters here. - pos.Column = pos.Column + 2 - litLen = litLen + 2 - continue - } else if follow == '\\' { - // \\ escapes \ - // so we will consume both characters here. - pos.Column = pos.Column + 2 - litLen = litLen + 2 - continue - } - } - } - - if next == '\n' { - pos.Column = 1 - pos.Line++ - litLen++ - } else { - pos.Column++ - - // "Column" measures runes, so we need to actually consume - // a valid UTF-8 character here. - _, size := utf8.DecodeRuneInString(s[litLen:]) - litLen = litLen + size - } - - } - - return s[:litLen], terminator -} - -// scanNumber returns the extent of the prefix of the string that represents -// a valid number, along with what type of number it represents: INT or FLOAT. -// -// scanNumber does only basic character analysis: numbers consist of digits -// and periods, with at least one period signalling a FLOAT. It's the parser's -// responsibility to validate the form and range of the number, such as ensuring -// that a FLOAT actually contains only one period, etc. -func scanNumber(s string) (string, TokenType) { - period := -1 - byteLen := 0 - numType := INTEGER - for { - if byteLen >= len(s) { - break - } - - next := s[byteLen] - if next != '.' && (next < '0' || next > '9') { - // If our last value was a period, then we're not a float, - // we're just an integer that ends in a period. - if period == byteLen-1 { - byteLen-- - numType = INTEGER - } - - break - } - - if next == '.' { - // If we've already seen a period, break out - if period >= 0 { - break - } - - period = byteLen - numType = FLOAT - } - - byteLen++ - } - - return s[:byteLen], numType -} - -// scanIdentifier returns the extent of the prefix of the string that -// represents a valid identifier, along with the length of that prefix -// in runes. -// -// Identifiers may contain utf8-encoded non-Latin letters, which will -// cause the returned "rune length" to be shorter than the byte length -// of the returned string. -func scanIdentifier(s string) (string, int) { - byteLen := 0 - runeLen := 0 - for { - if byteLen >= len(s) { - break - } - - nextRune, size := utf8.DecodeRuneInString(s[byteLen:]) - if !(nextRune == '_' || - nextRune == '-' || - nextRune == '.' || - nextRune == '*' || - unicode.IsNumber(nextRune) || - unicode.IsLetter(nextRune) || - unicode.IsMark(nextRune)) { - break - } - - // If we reach a star, it must be between periods to be part - // of the same identifier. - if nextRune == '*' && s[byteLen-1] != '.' { - break - } - - // If our previous character was a star, then the current must - // be period. Otherwise, undo that and exit. - if byteLen > 0 && s[byteLen-1] == '*' && nextRune != '.' { - byteLen-- - if s[byteLen-1] == '.' { - byteLen-- - } - - break - } - - byteLen = byteLen + size - runeLen = runeLen + 1 - } - - return s[:byteLen], runeLen -} - -// byteIsSpace implements a restrictive interpretation of spaces that includes -// only what's valid inside interpolation sequences: spaces, tabs, newlines. -func byteIsSpace(b byte) bool { - switch b { - case ' ', '\t', '\r', '\n': - return true - default: - return false - } -} - -// stringStartsWithIdentifier returns true if the given string begins with -// a character that is a legal start of an identifier: an underscore or -// any character that Unicode considers to be a letter. -func stringStartsWithIdentifier(s string) bool { - if len(s) == 0 { - return false - } - - first := s[0] - - // Easy ASCII cases first - if (first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z') || first == '_' { - return true - } - - // If our first byte begins a UTF-8 sequence then the sequence might - // be a unicode letter. - if utf8.RuneStart(first) { - firstRune, _ := utf8.DecodeRuneInString(s) - if unicode.IsLetter(firstRune) { - return true - } - } - - return false -} diff --git a/vendor/github.com/hashicorp/hil/scanner/token.go b/vendor/github.com/hashicorp/hil/scanner/token.go deleted file mode 100644 index b6c82ae9b..000000000 --- a/vendor/github.com/hashicorp/hil/scanner/token.go +++ /dev/null @@ -1,105 +0,0 @@ -package scanner - -import ( - "fmt" - - "github.com/hashicorp/hil/ast" -) - -type Token struct { - Type TokenType - Content string - Pos ast.Pos -} - -//go:generate stringer -type=TokenType -type TokenType rune - -const ( - // Raw string data outside of ${ .. } sequences - LITERAL TokenType = 'o' - - // STRING is like a LITERAL but it's inside a quoted string - // within a ${ ... } sequence, and so it can contain backslash - // escaping. - STRING TokenType = 'S' - - // Other Literals - INTEGER TokenType = 'I' - FLOAT TokenType = 'F' - BOOL TokenType = 'B' - - BEGIN TokenType = '$' // actually "${" - END TokenType = '}' - OQUOTE TokenType = '“' // Opening quote of a nested quoted sequence - CQUOTE TokenType = '”' // Closing quote of a nested quoted sequence - OPAREN TokenType = '(' - CPAREN TokenType = ')' - OBRACKET TokenType = '[' - CBRACKET TokenType = ']' - COMMA TokenType = ',' - - IDENTIFIER TokenType = 'i' - - PERIOD TokenType = '.' - PLUS TokenType = '+' - MINUS TokenType = '-' - STAR TokenType = '*' - SLASH TokenType = '/' - PERCENT TokenType = '%' - - AND TokenType = '∧' - OR TokenType = '∨' - BANG TokenType = '!' - - EQUAL TokenType = '=' - NOTEQUAL TokenType = '≠' - GT TokenType = '>' - LT TokenType = '<' - GTE TokenType = '≥' - LTE TokenType = '≤' - - QUESTION TokenType = '?' - COLON TokenType = ':' - - EOF TokenType = '␄' - - // Produced for sequences that cannot be understood as valid tokens - // e.g. due to use of unrecognized punctuation. - INVALID TokenType = '�' -) - -func (t *Token) String() string { - switch t.Type { - case EOF: - return "end of string" - case INVALID: - return fmt.Sprintf("invalid sequence %q", t.Content) - case INTEGER: - return fmt.Sprintf("integer %s", t.Content) - case FLOAT: - return fmt.Sprintf("float %s", t.Content) - case STRING: - return fmt.Sprintf("string %q", t.Content) - case LITERAL: - return fmt.Sprintf("literal %q", t.Content) - case OQUOTE: - return fmt.Sprintf("opening quote") - case CQUOTE: - return fmt.Sprintf("closing quote") - case AND: - return "&&" - case OR: - return "||" - case NOTEQUAL: - return "!=" - case GTE: - return ">=" - case LTE: - return "<=" - default: - // The remaining token types have content that - // speaks for itself. - return fmt.Sprintf("%q", t.Content) - } -} diff --git a/vendor/github.com/hashicorp/hil/scanner/tokentype_string.go b/vendor/github.com/hashicorp/hil/scanner/tokentype_string.go deleted file mode 100644 index a602f5fdd..000000000 --- a/vendor/github.com/hashicorp/hil/scanner/tokentype_string.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by "stringer -type=TokenType"; DO NOT EDIT - -package scanner - -import "fmt" - -const _TokenType_name = "BANGBEGINPERCENTOPARENCPARENSTARPLUSCOMMAMINUSPERIODSLASHCOLONLTEQUALGTQUESTIONBOOLFLOATINTEGERSTRINGOBRACKETCBRACKETIDENTIFIERLITERALENDOQUOTECQUOTEANDORNOTEQUALLTEGTEEOFINVALID" - -var _TokenType_map = map[TokenType]string{ - 33: _TokenType_name[0:4], - 36: _TokenType_name[4:9], - 37: _TokenType_name[9:16], - 40: _TokenType_name[16:22], - 41: _TokenType_name[22:28], - 42: _TokenType_name[28:32], - 43: _TokenType_name[32:36], - 44: _TokenType_name[36:41], - 45: _TokenType_name[41:46], - 46: _TokenType_name[46:52], - 47: _TokenType_name[52:57], - 58: _TokenType_name[57:62], - 60: _TokenType_name[62:64], - 61: _TokenType_name[64:69], - 62: _TokenType_name[69:71], - 63: _TokenType_name[71:79], - 66: _TokenType_name[79:83], - 70: _TokenType_name[83:88], - 73: _TokenType_name[88:95], - 83: _TokenType_name[95:101], - 91: _TokenType_name[101:109], - 93: _TokenType_name[109:117], - 105: _TokenType_name[117:127], - 111: _TokenType_name[127:134], - 125: _TokenType_name[134:137], - 8220: _TokenType_name[137:143], - 8221: _TokenType_name[143:149], - 8743: _TokenType_name[149:152], - 8744: _TokenType_name[152:154], - 8800: _TokenType_name[154:162], - 8804: _TokenType_name[162:165], - 8805: _TokenType_name[165:168], - 9220: _TokenType_name[168:171], - 65533: _TokenType_name[171:178], -} - -func (i TokenType) String() string { - if str, ok := _TokenType_map[i]; ok { - return str - } - return fmt.Sprintf("TokenType(%d)", i) -} diff --git a/vendor/github.com/hashicorp/hil/transform_fixed.go b/vendor/github.com/hashicorp/hil/transform_fixed.go deleted file mode 100644 index e69df2943..000000000 --- a/vendor/github.com/hashicorp/hil/transform_fixed.go +++ /dev/null @@ -1,29 +0,0 @@ -package hil - -import ( - "github.com/hashicorp/hil/ast" -) - -// FixedValueTransform transforms an AST to return a fixed value for -// all interpolations. i.e. you can make "hi ${anything}" always -// turn into "hi foo". -// -// The primary use case for this is for config validations where you can -// verify that interpolations result in a certain type of string. -func FixedValueTransform(root ast.Node, Value *ast.LiteralNode) ast.Node { - // We visit the nodes in top-down order - result := root - switch n := result.(type) { - case *ast.Output: - for i, v := range n.Exprs { - n.Exprs[i] = FixedValueTransform(v, Value) - } - case *ast.LiteralNode: - // We keep it as-is - default: - // Anything else we replace - result = Value - } - - return result -} diff --git a/vendor/github.com/hashicorp/hil/walk.go b/vendor/github.com/hashicorp/hil/walk.go deleted file mode 100644 index 0ace83065..000000000 --- a/vendor/github.com/hashicorp/hil/walk.go +++ /dev/null @@ -1,266 +0,0 @@ -package hil - -import ( - "fmt" - "reflect" - "strings" - - "github.com/hashicorp/hil/ast" - "github.com/mitchellh/reflectwalk" -) - -// WalkFn is the type of function to pass to Walk. Modify fields within -// WalkData to control whether replacement happens. -type WalkFn func(*WalkData) error - -// WalkData is the structure passed to the callback of the Walk function. -// -// This structure contains data passed in as well as fields that are expected -// to be written by the caller as a result. Please see the documentation for -// each field for more information. -type WalkData struct { - // Root is the parsed root of this HIL program - Root ast.Node - - // Location is the location within the structure where this - // value was found. This can be used to modify behavior within - // slices and so on. - Location reflectwalk.Location - - // The below two values must be set by the callback to have any effect. - // - // Replace, if true, will replace the value in the structure with - // ReplaceValue. It is up to the caller to make sure this is a string. - Replace bool - ReplaceValue string -} - -// Walk will walk an arbitrary Go structure and parse any string as an -// HIL program and call the callback cb to determine what to replace it -// with. -// -// This function is very useful for arbitrary HIL program interpolation -// across a complex configuration structure. Due to the heavy use of -// reflection in this function, it is recommend to write many unit tests -// with your typical configuration structures to hilp mitigate the risk -// of panics. -func Walk(v interface{}, cb WalkFn) error { - walker := &interpolationWalker{F: cb} - return reflectwalk.Walk(v, walker) -} - -// interpolationWalker implements interfaces for the reflectwalk package -// (github.com/mitchellh/reflectwalk) that can be used to automatically -// execute a callback for an interpolation. -type interpolationWalker struct { - F WalkFn - - key []string - lastValue reflect.Value - loc reflectwalk.Location - cs []reflect.Value - csKey []reflect.Value - csData interface{} - sliceIndex int - unknownKeys []string -} - -func (w *interpolationWalker) Enter(loc reflectwalk.Location) error { - w.loc = loc - return nil -} - -func (w *interpolationWalker) Exit(loc reflectwalk.Location) error { - w.loc = reflectwalk.None - - switch loc { - case reflectwalk.Map: - w.cs = w.cs[:len(w.cs)-1] - case reflectwalk.MapValue: - w.key = w.key[:len(w.key)-1] - w.csKey = w.csKey[:len(w.csKey)-1] - case reflectwalk.Slice: - // Split any values that need to be split - w.splitSlice() - w.cs = w.cs[:len(w.cs)-1] - case reflectwalk.SliceElem: - w.csKey = w.csKey[:len(w.csKey)-1] - } - - return nil -} - -func (w *interpolationWalker) Map(m reflect.Value) error { - w.cs = append(w.cs, m) - return nil -} - -func (w *interpolationWalker) MapElem(m, k, v reflect.Value) error { - w.csData = k - w.csKey = append(w.csKey, k) - w.key = append(w.key, k.String()) - w.lastValue = v - return nil -} - -func (w *interpolationWalker) Slice(s reflect.Value) error { - w.cs = append(w.cs, s) - return nil -} - -func (w *interpolationWalker) SliceElem(i int, elem reflect.Value) error { - w.csKey = append(w.csKey, reflect.ValueOf(i)) - w.sliceIndex = i - return nil -} - -func (w *interpolationWalker) Primitive(v reflect.Value) error { - setV := v - - // We only care about strings - if v.Kind() == reflect.Interface { - setV = v - v = v.Elem() - } - if v.Kind() != reflect.String { - return nil - } - - astRoot, err := Parse(v.String()) - if err != nil { - return err - } - - // If the AST we got is just a literal string value with the same - // value then we ignore it. We have to check if its the same value - // because it is possible to input a string, get out a string, and - // have it be different. For example: "foo-$${bar}" turns into - // "foo-${bar}" - if n, ok := astRoot.(*ast.LiteralNode); ok { - if s, ok := n.Value.(string); ok && s == v.String() { - return nil - } - } - - if w.F == nil { - return nil - } - - data := WalkData{Root: astRoot, Location: w.loc} - if err := w.F(&data); err != nil { - return fmt.Errorf( - "%s in:\n\n%s", - err, v.String()) - } - - if data.Replace { - /* - if remove { - w.removeCurrent() - return nil - } - */ - - resultVal := reflect.ValueOf(data.ReplaceValue) - switch w.loc { - case reflectwalk.MapKey: - m := w.cs[len(w.cs)-1] - - // Delete the old value - var zero reflect.Value - m.SetMapIndex(w.csData.(reflect.Value), zero) - - // Set the new key with the existing value - m.SetMapIndex(resultVal, w.lastValue) - - // Set the key to be the new key - w.csData = resultVal - case reflectwalk.MapValue: - // If we're in a map, then the only way to set a map value is - // to set it directly. - m := w.cs[len(w.cs)-1] - mk := w.csData.(reflect.Value) - m.SetMapIndex(mk, resultVal) - default: - // Otherwise, we should be addressable - setV.Set(resultVal) - } - } - - return nil -} - -func (w *interpolationWalker) removeCurrent() { - // Append the key to the unknown keys - w.unknownKeys = append(w.unknownKeys, strings.Join(w.key, ".")) - - for i := 1; i <= len(w.cs); i++ { - c := w.cs[len(w.cs)-i] - switch c.Kind() { - case reflect.Map: - // Zero value so that we delete the map key - var val reflect.Value - - // Get the key and delete it - k := w.csData.(reflect.Value) - c.SetMapIndex(k, val) - return - } - } - - panic("No container found for removeCurrent") -} - -func (w *interpolationWalker) replaceCurrent(v reflect.Value) { - c := w.cs[len(w.cs)-2] - switch c.Kind() { - case reflect.Map: - // Get the key and delete it - k := w.csKey[len(w.csKey)-1] - c.SetMapIndex(k, v) - } -} - -func (w *interpolationWalker) splitSlice() { - // Get the []interface{} slice so we can do some operations on - // it without dealing with reflection. We'll document each step - // here to be clear. - var s []interface{} - raw := w.cs[len(w.cs)-1] - switch v := raw.Interface().(type) { - case []interface{}: - s = v - case []map[string]interface{}: - return - default: - panic("Unknown kind: " + raw.Kind().String()) - } - - // Check if we have any elements that we need to split. If not, then - // just return since we're done. - split := false - if !split { - return - } - - // Make a new result slice that is twice the capacity to fit our growth. - result := make([]interface{}, 0, len(s)*2) - - // Go over each element of the original slice and start building up - // the resulting slice by splitting where we have to. - for _, v := range s { - sv, ok := v.(string) - if !ok { - // Not a string, so just set it - result = append(result, v) - continue - } - - // Not a string list, so just set it - result = append(result, sv) - } - - // Our slice is now done, we have to replace the slice now - // with this new one that we have. - w.replaceCurrent(reflect.ValueOf(result)) -} diff --git a/vendor/github.com/bmatcuk/doublestar/.gitignore b/vendor/github.com/hashicorp/logutils/.gitignore similarity index 81% rename from vendor/github.com/bmatcuk/doublestar/.gitignore rename to vendor/github.com/hashicorp/logutils/.gitignore index af212ecc2..00268614f 100644 --- a/vendor/github.com/bmatcuk/doublestar/.gitignore +++ b/vendor/github.com/hashicorp/logutils/.gitignore @@ -1,8 +1,3 @@ -# vi -*~ -*.swp -*.swo - # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o *.a @@ -25,8 +20,3 @@ _cgo_export.* _testmain.go *.exe -*.test -*.prof - -# test directory -test/ diff --git a/vendor/github.com/hashicorp/terraform/LICENSE b/vendor/github.com/hashicorp/logutils/LICENSE similarity index 100% rename from vendor/github.com/hashicorp/terraform/LICENSE rename to vendor/github.com/hashicorp/logutils/LICENSE diff --git a/vendor/github.com/hashicorp/logutils/README.md b/vendor/github.com/hashicorp/logutils/README.md new file mode 100644 index 000000000..49490eaeb --- /dev/null +++ b/vendor/github.com/hashicorp/logutils/README.md @@ -0,0 +1,36 @@ +# logutils + +logutils is a Go package that augments the standard library "log" package +to make logging a bit more modern, without fragmenting the Go ecosystem +with new logging packages. + +## The simplest thing that could possibly work + +Presumably your application already uses the default `log` package. To switch, you'll want your code to look like the following: + +```go +package main + +import ( + "log" + "os" + + "github.com/hashicorp/logutils" +) + +func main() { + filter := &logutils.LevelFilter{ + Levels: []logutils.LogLevel{"DEBUG", "WARN", "ERROR"}, + MinLevel: logutils.LogLevel("WARN"), + Writer: os.Stderr, + } + log.SetOutput(filter) + + log.Print("[DEBUG] Debugging") // this will not print + log.Print("[WARN] Warning") // this will + log.Print("[ERROR] Erring") // and so will this + log.Print("Message I haven't updated") // and so will this +} +``` + +This logs to standard error exactly like go's standard logger. Any log messages you haven't converted to have a level will continue to print as before. diff --git a/vendor/github.com/hashicorp/logutils/go.mod b/vendor/github.com/hashicorp/logutils/go.mod new file mode 100644 index 000000000..ba38a4576 --- /dev/null +++ b/vendor/github.com/hashicorp/logutils/go.mod @@ -0,0 +1 @@ +module github.com/hashicorp/logutils diff --git a/vendor/github.com/hashicorp/logutils/level.go b/vendor/github.com/hashicorp/logutils/level.go new file mode 100644 index 000000000..6381bf162 --- /dev/null +++ b/vendor/github.com/hashicorp/logutils/level.go @@ -0,0 +1,81 @@ +// Package logutils augments the standard log package with levels. +package logutils + +import ( + "bytes" + "io" + "sync" +) + +type LogLevel string + +// LevelFilter is an io.Writer that can be used with a logger that +// will filter out log messages that aren't at least a certain level. +// +// Once the filter is in use somewhere, it is not safe to modify +// the structure. +type LevelFilter struct { + // Levels is the list of log levels, in increasing order of + // severity. Example might be: {"DEBUG", "WARN", "ERROR"}. + Levels []LogLevel + + // MinLevel is the minimum level allowed through + MinLevel LogLevel + + // The underlying io.Writer where log messages that pass the filter + // will be set. + Writer io.Writer + + badLevels map[LogLevel]struct{} + once sync.Once +} + +// Check will check a given line if it would be included in the level +// filter. +func (f *LevelFilter) Check(line []byte) bool { + f.once.Do(f.init) + + // Check for a log level + var level LogLevel + x := bytes.IndexByte(line, '[') + if x >= 0 { + y := bytes.IndexByte(line[x:], ']') + if y >= 0 { + level = LogLevel(line[x+1 : x+y]) + } + } + + _, ok := f.badLevels[level] + return !ok +} + +func (f *LevelFilter) Write(p []byte) (n int, err error) { + // Note in general that io.Writer can receive any byte sequence + // to write, but the "log" package always guarantees that we only + // get a single line. We use that as a slight optimization within + // this method, assuming we're dealing with a single, complete line + // of log data. + + if !f.Check(p) { + return len(p), nil + } + + return f.Writer.Write(p) +} + +// SetMinLevel is used to update the minimum log level +func (f *LevelFilter) SetMinLevel(min LogLevel) { + f.MinLevel = min + f.init() +} + +func (f *LevelFilter) init() { + badLevels := make(map[LogLevel]struct{}) + for _, level := range f.Levels { + if level == f.MinLevel { + break + } + badLevels[level] = struct{}{} + } + f.badLevels = badLevels +} diff --git a/vendor/github.com/hashicorp/hcl/v2/LICENSE b/vendor/github.com/hashicorp/terraform-plugin-sdk/LICENSE similarity index 99% rename from vendor/github.com/hashicorp/hcl/v2/LICENSE rename to vendor/github.com/hashicorp/terraform-plugin-sdk/LICENSE index 82b4de97c..c33dcc7c9 100644 --- a/vendor/github.com/hashicorp/hcl/v2/LICENSE +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/LICENSE @@ -351,3 +351,4 @@ Exhibit B - “Incompatible With Secondary Licenses” Notice This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0. + diff --git a/vendor/github.com/hashicorp/terraform/helper/acctest/acctest.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/acctest/acctest.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/acctest/acctest.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/acctest/acctest.go diff --git a/vendor/github.com/hashicorp/terraform/helper/acctest/random.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/acctest/random.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/acctest/random.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/acctest/random.go diff --git a/vendor/github.com/hashicorp/terraform/helper/acctest/remotetests.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/acctest/remotetests.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/acctest/remotetests.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/acctest/remotetests.go diff --git a/vendor/github.com/hashicorp/terraform/helper/hashcode/hashcode.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/hashcode/hashcode.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/hashcode/hashcode.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/hashcode/hashcode.go diff --git a/vendor/github.com/hashicorp/terraform/helper/logging/logging.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/logging/logging.go similarity index 66% rename from vendor/github.com/hashicorp/terraform/helper/logging/logging.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/logging/logging.go index 75627cf02..6bd92f777 100644 --- a/vendor/github.com/hashicorp/terraform/helper/logging/logging.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/logging/logging.go @@ -7,6 +7,8 @@ import ( "os" "strings" "syscall" + + "github.com/hashicorp/logutils" ) // These are the environmental variables that determine if we log, and if @@ -16,14 +18,13 @@ const ( EnvLogFile = "TF_LOG_PATH" // Set to a file ) -// ValidLevels are the log level names that Terraform recognizes. -var ValidLevels = []LogLevel{"TRACE", "DEBUG", "INFO", "WARN", "ERROR"} +var ValidLevels = []logutils.LogLevel{"TRACE", "DEBUG", "INFO", "WARN", "ERROR"} // LogOutput determines where we should send logs (if anywhere) and the log level. func LogOutput() (logOutput io.Writer, err error) { logOutput = ioutil.Discard - logLevel := CurrentLogLevel() + logLevel := LogLevel() if logLevel == "" { return } @@ -37,21 +38,14 @@ func LogOutput() (logOutput io.Writer, err error) { } } - if logLevel == "TRACE" { - // Just pass through logs directly then, without any level filtering at all. - return logOutput, nil - } - - // Otherwise we'll use our level filter, which is a heuristic-based - // best effort thing that is not totally reliable but helps to reduce - // the volume of logs in some cases. - logOutput = &LevelFilter{ + // This was the default since the beginning + logOutput = &logutils.LevelFilter{ Levels: ValidLevels, - MinLevel: LogLevel(logLevel), + MinLevel: logutils.LogLevel(logLevel), Writer: logOutput, } - return logOutput, nil + return } // SetOutput checks for a log destination with LogOutput, and calls @@ -70,8 +64,8 @@ func SetOutput() { log.SetOutput(out) } -// CurrentLogLevel returns the current log level string based the environment vars -func CurrentLogLevel() string { +// LogLevel returns the current log level string based the environment vars +func LogLevel() string { envLevel := os.Getenv(EnvLog) if envLevel == "" { return "" @@ -85,16 +79,13 @@ func CurrentLogLevel() string { log.Printf("[WARN] Invalid log level: %q. Defaulting to level: TRACE. Valid levels are: %+v", envLevel, ValidLevels) } - if logLevel != "TRACE" { - log.Printf("[WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.\n Use TF_LOG=TRACE to see Terraform's internal logs.\n ----") - } return logLevel } // IsDebugOrHigher returns whether or not the current log level is debug or trace func IsDebugOrHigher() bool { - level := string(CurrentLogLevel()) + level := string(LogLevel()) return level == "DEBUG" || level == "TRACE" } diff --git a/vendor/github.com/hashicorp/terraform/helper/logging/transport.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/logging/transport.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/logging/transport.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/logging/transport.go diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/error.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/error.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/resource/error.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/error.go diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/grpc_test_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/grpc_test_provider.go similarity index 75% rename from vendor/github.com/hashicorp/terraform/helper/resource/grpc_test_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/grpc_test_provider.go index 0742e993b..db12cee20 100644 --- a/vendor/github.com/hashicorp/terraform/helper/resource/grpc_test_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/grpc_test_provider.go @@ -5,11 +5,11 @@ import ( "net" "time" - "github.com/hashicorp/terraform/helper/plugin" - proto "github.com/hashicorp/terraform/internal/tfplugin5" - tfplugin "github.com/hashicorp/terraform/plugin" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + proto "github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5" + tfplugin "github.com/hashicorp/terraform-plugin-sdk/plugin" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "google.golang.org/grpc" "google.golang.org/grpc/test/bufconn" ) diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/id.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/id.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/resource/id.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/id.go diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/map.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/map.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/helper/resource/map.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/map.go index a465136f7..02a993d69 100644 --- a/vendor/github.com/hashicorp/terraform/helper/resource/map.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/map.go @@ -4,7 +4,7 @@ import ( "fmt" "sort" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // Map is a map of resources that are supported, and provides helpers for diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/resource.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/resource.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/helper/resource/resource.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/resource.go index 0d9c831a6..80782413b 100644 --- a/vendor/github.com/hashicorp/terraform/helper/resource/resource.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/resource.go @@ -1,8 +1,8 @@ package resource import ( - "github.com/hashicorp/terraform/helper/config" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/internal/helper/config" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) type Resource struct { diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/state.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/resource/state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/state.go diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/state_shim.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/state_shim.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/helper/resource/state_shim.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/state_shim.go index 257109d3b..1e3225933 100644 --- a/vendor/github.com/hashicorp/terraform/helper/resource/state_shim.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/state_shim.go @@ -4,14 +4,14 @@ import ( "encoding/json" "fmt" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // shimState takes a new *states.State and reverts it to a legacy state for the provider ACC tests @@ -50,7 +50,7 @@ func shimNewState(newState *states.State, providers map[string]terraform.Resourc resType := res.Addr.Type providerType := res.ProviderConfig.ProviderConfig.Type - resource := getResource(providers, providerType.LegacyString(), res.Addr) + resource := getResource(providers, providerType, res.Addr) for key, i := range res.Instances { resState := &terraform.ResourceState{ @@ -87,7 +87,7 @@ func shimNewState(newState *states.State, providers map[string]terraform.Resourc resState.Primary.Meta["schema_version"] = i.Current.SchemaVersion } - for _, dep := range i.Current.DependsOn { + for _, dep := range i.Current.Dependencies { resState.Dependencies = append(resState.Dependencies, dep.String()) } diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/testing.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/helper/resource/testing.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing.go index 1119144b4..b2a323cec 100644 --- a/vendor/github.com/hashicorp/terraform/helper/resource/testing.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing.go @@ -18,18 +18,19 @@ import ( "github.com/davecgh/go-spew/spew" "github.com/hashicorp/errwrap" "github.com/hashicorp/go-multierror" + "github.com/hashicorp/logutils" "github.com/mitchellh/colorstring" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/command/format" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/configs/configload" - "github.com/hashicorp/terraform/helper/logging" - "github.com/hashicorp/terraform/internal/initwd" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/terraform" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/helper/logging" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/command/format" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload" + "github.com/hashicorp/terraform-plugin-sdk/internal/initwd" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // flagSweep is a flag available when running tests on the command line. It @@ -395,7 +396,7 @@ const EnvLogPathMask = "TF_LOG_PATH_MASK" func LogOutput(t TestT) (logOutput io.Writer, err error) { logOutput = ioutil.Discard - logLevel := logging.CurrentLogLevel() + logLevel := logging.LogLevel() if logLevel == "" { return } @@ -423,9 +424,9 @@ func LogOutput(t TestT) (logOutput io.Writer, err error) { } // This was the default since the beginning - logOutput = &logging.LevelFilter{ + logOutput = &logutils.LevelFilter{ Levels: logging.ValidLevels, - MinLevel: logging.LogLevel(logLevel), + MinLevel: logutils.LogLevel(logLevel), Writer: logOutput, } @@ -676,11 +677,11 @@ func testProviderResolver(c TestCase) (providers.Resolver, error) { // wrap the old provider factories in the test grpc server so they can be // called from terraform. - newProviders := make(map[addrs.Provider]providers.Factory) + newProviders := make(map[string]providers.Factory) for k, pf := range ctxProviders { factory := pf // must copy to ensure each closure sees its own value - newProviders[addrs.NewLegacyProvider(k)] = func() (providers.Interface, error) { + newProviders[k] = func() (providers.Interface, error) { p, err := factory() if err != nil { return nil, err @@ -727,7 +728,7 @@ func testIDOnlyRefresh(c TestCase, opts terraform.ContextOpts, step TestStep, r AttrsFlat: r.Primary.Attributes, Status: states.ObjectReady, }, - addrs.ProviderConfig{Type: addrs.NewLegacyProvider("placeholder")}.Absolute(addrs.RootModuleInstance), + addrs.ProviderConfig{Type: "placeholder"}.Absolute(addrs.RootModuleInstance), ) // Create the config module. We use the full config because Refresh diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/testing_config.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing_config.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/helper/resource/testing_config.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing_config.go index e3da9bc02..e21525de8 100644 --- a/vendor/github.com/hashicorp/terraform/helper/resource/testing_config.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing_config.go @@ -9,14 +9,14 @@ import ( "sort" "strings" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" "github.com/hashicorp/errwrap" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/terraform" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // testStepConfig runs a config-mode test step diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing_import_state.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing_import_state.go index 9a3ef1be0..9e547e2a0 100644 --- a/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing_import_state.go @@ -7,16 +7,16 @@ import ( "strings" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) -// testStepImportState runs an import state test step +// testStepImportState runs an imort state test step func testStepImportState( opts terraform.ContextOpts, state *terraform.State, @@ -96,6 +96,7 @@ func testStepImportState( if err != nil { return nil, err } + // Go through the new state and verify if step.ImportStateCheck != nil { var states []*terraform.InstanceState @@ -137,7 +138,7 @@ func testStepImportState( // this shouldn't happen in any reasonable case. var rsrcSchema *schema.Resource if providerAddr, diags := addrs.ParseAbsProviderConfigStr(r.Provider); !diags.HasErrors() { - providerType := providerAddr.ProviderConfig.Type.LegacyString() + providerType := providerAddr.ProviderConfig.Type if provider, ok := step.providers[providerType]; ok { if provider, ok := provider.(*schema.Provider); ok { rsrcSchema = provider.ResourcesMap[r.Type] diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/wait.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/wait.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/resource/wait.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/wait.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/README.md b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/README.md similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/README.md rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/README.md diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/backend.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/backend.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/helper/schema/backend.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/backend.go index 42c2bed92..609c208b3 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/backend.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/backend.go @@ -4,12 +4,12 @@ import ( "context" "fmt" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ctyconvert "github.com/zclconf/go-cty/cty/convert" ) diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/core_schema.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/core_schema.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/helper/schema/core_schema.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/core_schema.go index 875677eb3..fa03d8338 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/core_schema.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/core_schema.go @@ -3,7 +3,7 @@ package schema import ( "fmt" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/data_source_resource_shim.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/data_source_resource_shim.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/data_source_resource_shim.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/data_source_resource_shim.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/equal.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/equal.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/equal.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/equal.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/field_reader.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_config.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_config.go index 6ad3f13cb..dc2ae1af5 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_config.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_config.go @@ -7,7 +7,7 @@ import ( "strings" "sync" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/mitchellh/mapstructure" ) diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_diff.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_diff.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/helper/schema/field_reader_diff.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_diff.go index 3e70acf0b..c099029af 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_diff.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_diff.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/mitchellh/mapstructure" ) diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_map.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_map.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/field_reader_map.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_map.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/field_reader_multi.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_multi.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/field_reader_multi.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_reader_multi.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/field_writer.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_writer.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/field_writer.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_writer.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/field_writer_map.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_writer_map.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/field_writer_map.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/field_writer_map.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/getsource_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/getsource_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/getsource_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/getsource_string.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/helper/schema/provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go index 9efc90e7b..bbea5dbd5 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/provider.go @@ -8,8 +8,8 @@ import ( "sync" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) var ReservedProviderFields = []string{ @@ -267,6 +267,11 @@ func (p *Provider) Configure(c *terraform.ResourceConfig) error { return err } + if p.TerraformVersion == "" { + // Terraform 0.12 introduced this field to the protocol + // We can therefore assume that if it's unconfigured at this point, it's 0.10 or 0.11 + p.TerraformVersion = "0.11+compatible" + } meta, err := p.ConfigureFunc(data) if err != nil { return err diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/resource.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/helper/schema/resource.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go index 8cd2703aa..406dcdf71 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/resource.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource.go @@ -6,7 +6,7 @@ import ( "log" "strconv" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_data.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_data.go index 1c390709e..0793524a3 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_data.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // ResourceData is used to query and set the attributes of a resource. diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/resource_data_get_source.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_data_get_source.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/resource_data_get_source.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_data_get_source.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/resource_diff.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_diff.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/helper/schema/resource_diff.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_diff.go index 47b548104..f55a66e14 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/resource_diff.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_diff.go @@ -7,7 +7,7 @@ import ( "strings" "sync" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // newValueWriter is a minor re-implementation of MapFieldWriter to include diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/resource_importer.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_importer.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/resource_importer.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_importer.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/resource_timeout.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_timeout.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/helper/schema/resource_timeout.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_timeout.go index 5ad7aafc8..f12bf7259 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/resource_timeout.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/resource_timeout.go @@ -5,8 +5,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/mitchellh/copystructure" ) diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/schema.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/schema.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/helper/schema/schema.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/schema.go index 089e6b213..033b06843 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/schema.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/schema.go @@ -22,8 +22,8 @@ import ( "strings" "sync" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/mitchellh/copystructure" "github.com/mitchellh/mapstructure" ) diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/serialize.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/serialize.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/serialize.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/serialize.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/set.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/set.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/helper/schema/set.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/set.go index 8ee89e475..daa431ddb 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/set.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/set.go @@ -8,7 +8,7 @@ import ( "strconv" "sync" - "github.com/hashicorp/terraform/helper/hashcode" + "github.com/hashicorp/terraform-plugin-sdk/helper/hashcode" ) // HashString hashes strings. If you want a Set of strings, this is the @@ -235,10 +235,6 @@ func (s *Set) remove(item interface{}) string { return code } -func (s *Set) index(item interface{}) int { - return sort.SearchStrings(s.listCode(), s.hash(item)) -} - func (s *Set) listCode() []string { // Sort the hash codes so the order of the list is deterministic keys := make([]string, 0, len(s.m)) diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/shims.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/shims.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/helper/schema/shims.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/shims.go index d2dbff53c..93c601f80 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/shims.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/shims.go @@ -6,9 +6,9 @@ import ( "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // DiffFromValues takes the current state and desired state as cty.Values and diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/testing.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/testing.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/helper/schema/testing.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/testing.go index 122782174..4d0fd7365 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/testing.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/testing.go @@ -3,7 +3,7 @@ package schema import ( "testing" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // TestResourceDataRaw creates a ResourceData from a raw configuration map. diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/valuetype.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/valuetype.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/valuetype.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/valuetype.go diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/valuetype_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/valuetype_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/schema/valuetype_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/valuetype_string.go diff --git a/vendor/github.com/hashicorp/terraform/helper/structure/expand_json.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/structure/expand_json.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/structure/expand_json.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/structure/expand_json.go diff --git a/vendor/github.com/hashicorp/terraform/helper/structure/flatten_json.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/structure/flatten_json.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/structure/flatten_json.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/structure/flatten_json.go diff --git a/vendor/github.com/hashicorp/terraform/helper/structure/normalize_json.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/structure/normalize_json.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/structure/normalize_json.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/structure/normalize_json.go diff --git a/vendor/github.com/hashicorp/terraform/helper/structure/suppress_json_diff.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/structure/suppress_json_diff.go similarity index 84% rename from vendor/github.com/hashicorp/terraform/helper/structure/suppress_json_diff.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/structure/suppress_json_diff.go index 46f794a71..e23707f57 100644 --- a/vendor/github.com/hashicorp/terraform/helper/structure/suppress_json_diff.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/structure/suppress_json_diff.go @@ -3,7 +3,7 @@ package structure import ( "reflect" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func SuppressJsonDiff(k, old, new string, d *schema.ResourceData) bool { diff --git a/vendor/github.com/hashicorp/terraform/helper/validation/validation.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/validation/validation.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/helper/validation/validation.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/validation/validation.go index efded8928..fd3dbd951 100644 --- a/vendor/github.com/hashicorp/terraform/helper/validation/validation.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/validation/validation.go @@ -9,8 +9,8 @@ import ( "strings" "time" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/structure" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/structure" ) // All returns a SchemaValidateFunc which tests if the provided value diff --git a/vendor/github.com/hashicorp/terraform/addrs/count_attr.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/count_attr.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/count_attr.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/count_attr.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/doc.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/for_each_attr.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/for_each_attr.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/for_each_attr.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/for_each_attr.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/input_variable.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/input_variable.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/input_variable.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/input_variable.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/instance_key.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/instance_key.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/instance_key.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/instance_key.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/local_value.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/local_value.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/local_value.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/local_value.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/module.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/module.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/module.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/module.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/module_call.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/module_call.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/module_call.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/module_call.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/module_instance.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/module_instance.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/addrs/module_instance.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/module_instance.go index d26aee277..1353622a0 100644 --- a/vendor/github.com/hashicorp/terraform/addrs/module_instance.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/module_instance.go @@ -4,12 +4,12 @@ import ( "bytes" "fmt" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/gocty" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // ModuleInstance is an address for a particular module instance within the @@ -57,7 +57,7 @@ func ParseModuleInstance(traversal hcl.Traversal) (ModuleInstance, tfdiags.Diagn // If a reference string is coming from a source that should be identified in // error messages then the caller should instead parse it directly using a // suitable function from the HCL API and pass the traversal itself to -// ParseModuleInstance. +// ParseProviderConfigCompact. // // Error diagnostics are returned if either the parsing fails or the analysis // of the traversal fails. There is no way for the caller to distinguish the diff --git a/vendor/github.com/hashicorp/terraform/addrs/output_value.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/output_value.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/output_value.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/output_value.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/parse_ref.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/parse_ref.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/addrs/parse_ref.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/parse_ref.go index d5142690b..eccbcda4c 100644 --- a/vendor/github.com/hashicorp/terraform/addrs/parse_ref.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/parse_ref.go @@ -3,9 +3,9 @@ package addrs import ( "fmt" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // Reference describes a reference to an address with source location @@ -290,7 +290,7 @@ func parseResourceRef(mode ResourceMode, startRange hcl.Range, traversal hcl.Tra // of the resource, but we don't have enough context here to decide // so we'll let the caller resolve that ambiguity. return &Reference{ - Subject: resourceAddr, + Subject: resourceInstAddr, SourceRange: tfdiags.SourceRangeFromHCL(rng), }, diags } diff --git a/vendor/github.com/hashicorp/terraform/addrs/parse_target.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/parse_target.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/addrs/parse_target.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/parse_target.go index c308525f5..4f0430989 100644 --- a/vendor/github.com/hashicorp/terraform/addrs/parse_target.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/parse_target.go @@ -3,10 +3,10 @@ package addrs import ( "fmt" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // Target describes a targeted address with source location information. diff --git a/vendor/github.com/hashicorp/terraform/addrs/path_attr.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/path_attr.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/path_attr.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/path_attr.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/provider_config.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/provider_config.go similarity index 68% rename from vendor/github.com/hashicorp/terraform/addrs/provider_config.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/provider_config.go index 965cd7d11..4d1ed2557 100644 --- a/vendor/github.com/hashicorp/terraform/addrs/provider_config.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/provider_config.go @@ -3,15 +3,15 @@ package addrs import ( "fmt" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" ) // ProviderConfig is the address of a provider configuration. type ProviderConfig struct { - Type Provider + Type string // If not empty, Alias identifies which non-default (aliased) provider // configuration this address refers to. @@ -22,10 +22,88 @@ type ProviderConfig struct { // configuration for the provider with the given type name. func NewDefaultProviderConfig(typeName string) ProviderConfig { return ProviderConfig{ - Type: NewLegacyProvider(typeName), + Type: typeName, } } +// ParseProviderConfigCompact parses the given absolute traversal as a relative +// provider address in compact form. The following are examples of traversals +// that can be successfully parsed as compact relative provider configuration +// addresses: +// +// aws +// aws.foo +// +// This function will panic if given a relative traversal. +// +// If the returned diagnostics contains errors then the result value is invalid +// and must not be used. +func ParseProviderConfigCompact(traversal hcl.Traversal) (ProviderConfig, tfdiags.Diagnostics) { + var diags tfdiags.Diagnostics + ret := ProviderConfig{ + Type: traversal.RootName(), + } + + if len(traversal) < 2 { + // Just a type name, then. + return ret, diags + } + + aliasStep := traversal[1] + switch ts := aliasStep.(type) { + case hcl.TraverseAttr: + ret.Alias = ts.Name + return ret, diags + default: + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid provider configuration address", + Detail: "The provider type name must either stand alone or be followed by an alias name separated with a dot.", + Subject: aliasStep.SourceRange().Ptr(), + }) + } + + if len(traversal) > 2 { + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid provider configuration address", + Detail: "Extraneous extra operators after provider configuration address.", + Subject: traversal[2:].SourceRange().Ptr(), + }) + } + + return ret, diags +} + +// ParseProviderConfigCompactStr is a helper wrapper around ParseProviderConfigCompact +// that takes a string and parses it with the HCL native syntax traversal parser +// before interpreting it. +// +// This should be used only in specialized situations since it will cause the +// created references to not have any meaningful source location information. +// If a reference string is coming from a source that should be identified in +// error messages then the caller should instead parse it directly using a +// suitable function from the HCL API and pass the traversal itself to +// ParseProviderConfigCompact. +// +// Error diagnostics are returned if either the parsing fails or the analysis +// of the traversal fails. There is no way for the caller to distinguish the +// two kinds of diagnostics programmatically. If error diagnostics are returned +// then the returned address is invalid. +func ParseProviderConfigCompactStr(str string) (ProviderConfig, tfdiags.Diagnostics) { + var diags tfdiags.Diagnostics + + traversal, parseDiags := hclsyntax.ParseTraversalAbs([]byte(str), "", hcl.Pos{Line: 1, Column: 1}) + diags = diags.Append(parseDiags) + if parseDiags.HasErrors() { + return ProviderConfig{}, diags + } + + addr, addrDiags := ParseProviderConfigCompact(traversal) + diags = diags.Append(addrDiags) + return addr, diags +} + // Absolute returns an AbsProviderConfig from the receiver and the given module // instance address. func (pc ProviderConfig) Absolute(module ModuleInstance) AbsProviderConfig { @@ -36,25 +114,25 @@ func (pc ProviderConfig) Absolute(module ModuleInstance) AbsProviderConfig { } func (pc ProviderConfig) String() string { - if pc.Type.LegacyString() == "" { + if pc.Type == "" { // Should never happen; always indicates a bug return "provider." } if pc.Alias != "" { - return fmt.Sprintf("provider.%s.%s", pc.Type.LegacyString(), pc.Alias) + return fmt.Sprintf("provider.%s.%s", pc.Type, pc.Alias) } - return "provider." + pc.Type.LegacyString() + return "provider." + pc.Type } // StringCompact is an alternative to String that returns the form that can // be parsed by ParseProviderConfigCompact, without the "provider." prefix. func (pc ProviderConfig) StringCompact() string { if pc.Alias != "" { - return fmt.Sprintf("%s.%s", pc.Type.LegacyString(), pc.Alias) + return fmt.Sprintf("%s.%s", pc.Type, pc.Alias) } - return pc.Type.LegacyString() + return pc.Type } // AbsProviderConfig is the absolute address of a provider configuration @@ -103,7 +181,7 @@ func ParseAbsProviderConfig(traversal hcl.Traversal) (AbsProviderConfig, tfdiags } if tt, ok := remain[1].(hcl.TraverseAttr); ok { - ret.ProviderConfig.Type = NewLegacyProvider(tt.Name) + ret.ProviderConfig.Type = tt.Name } else { diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, @@ -166,7 +244,7 @@ func (m ModuleInstance) ProviderConfigDefault(name string) AbsProviderConfig { return AbsProviderConfig{ Module: m, ProviderConfig: ProviderConfig{ - Type: NewLegacyProvider(name), + Type: name, }, } } @@ -177,7 +255,7 @@ func (m ModuleInstance) ProviderConfigAliased(name, alias string) AbsProviderCon return AbsProviderConfig{ Module: m, ProviderConfig: ProviderConfig{ - Type: NewLegacyProvider(name), + Type: name, Alias: alias, }, } diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/provider_type.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/provider_type.go new file mode 100644 index 000000000..64b8ac869 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/provider_type.go @@ -0,0 +1,7 @@ +package addrs + +// ProviderType encapsulates a single provider type. In the future this will be +// extended to include additional fields including Namespace and SourceHost +type ProviderType struct { + Name string +} diff --git a/vendor/github.com/hashicorp/terraform/addrs/referenceable.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/referenceable.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/referenceable.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/referenceable.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/resource.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/resource.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/addrs/resource.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/resource.go index bb4831ea6..b075a6d1d 100644 --- a/vendor/github.com/hashicorp/terraform/addrs/resource.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/resource.go @@ -65,9 +65,8 @@ func (r Resource) DefaultProviderConfig() ProviderConfig { if under := strings.Index(typeName, "_"); under != -1 { typeName = typeName[:under] } - return ProviderConfig{ - Type: NewLegacyProvider(typeName), + Type: typeName, } } diff --git a/vendor/github.com/hashicorp/terraform/addrs/resource_phase.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/resource_phase.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/resource_phase.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/resource_phase.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/resourcemode_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/resourcemode_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/resourcemode_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/resourcemode_string.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/self.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/self.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/self.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/self.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/targetable.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/targetable.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/targetable.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/targetable.go diff --git a/vendor/github.com/hashicorp/terraform/addrs/terraform_attr.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/terraform_attr.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/addrs/terraform_attr.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/terraform_attr.go diff --git a/vendor/github.com/hashicorp/terraform/command/format/diagnostic.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/diagnostic.go similarity index 85% rename from vendor/github.com/hashicorp/terraform/command/format/diagnostic.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/diagnostic.go index 6b8232650..6f64f6c92 100644 --- a/vendor/github.com/hashicorp/terraform/command/format/diagnostic.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/diagnostic.go @@ -7,10 +7,10 @@ import ( "sort" "strings" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hcled" - "github.com/hashicorp/hcl/v2/hclparse" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcled" + "github.com/hashicorp/hcl2/hclparse" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/mitchellh/colorstring" wordwrap "github.com/mitchellh/go-wordwrap" "github.com/zclconf/go-cty/cty" @@ -177,51 +177,6 @@ func Diagnostic(diag tfdiags.Diagnostic, sources map[string][]byte, color *color return buf.String() } -// DiagnosticWarningsCompact is an alternative to Diagnostic for when all of -// the given diagnostics are warnings and we want to show them compactly, -// with only two lines per warning and excluding all of the detail information. -// -// The caller may optionally pre-process the given diagnostics with -// ConsolidateWarnings, in which case this function will recognize consolidated -// messages and include an indication that they are consolidated. -// -// Do not pass non-warning diagnostics to this function, or the result will -// be nonsense. -func DiagnosticWarningsCompact(diags tfdiags.Diagnostics, color *colorstring.Colorize) string { - var b strings.Builder - b.WriteString(color.Color("[bold][yellow]Warnings:[reset]\n\n")) - for _, diag := range diags { - sources := tfdiags.WarningGroupSourceRanges(diag) - b.WriteString(fmt.Sprintf("- %s\n", diag.Description().Summary)) - if len(sources) > 0 { - mainSource := sources[0] - if mainSource.Subject != nil { - if len(sources) > 1 { - b.WriteString(fmt.Sprintf( - " on %s line %d (and %d more)\n", - mainSource.Subject.Filename, - mainSource.Subject.Start.Line, - len(sources)-1, - )) - } else { - b.WriteString(fmt.Sprintf( - " on %s line %d\n", - mainSource.Subject.Filename, - mainSource.Subject.Start.Line, - )) - } - } else if len(sources) > 1 { - b.WriteString(fmt.Sprintf( - " (%d occurences of this warning)\n", - len(sources), - )) - } - } - } - - return b.String() -} - func parseRange(src []byte, rng hcl.Range) (*hcl.File, int) { filename := rng.Filename offset := rng.Start.Byte diff --git a/vendor/github.com/hashicorp/terraform/command/format/diff.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/diff.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/command/format/diff.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/diff.go index 2f2258de0..0a2aa7d02 100644 --- a/vendor/github.com/hashicorp/terraform/command/format/diff.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/diff.go @@ -11,11 +11,11 @@ import ( "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/plans/objchange" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // ResourceChange returns a string representation of a change to a particular @@ -70,7 +70,22 @@ func ResourceChange( } buf.WriteString(color.Color("[reset]\n")) - buf.WriteString(color.Color(DiffActionSymbol(change.Action)) + " ") + switch change.Action { + case plans.Create: + buf.WriteString(color.Color("[green] +[reset] ")) + case plans.Read: + buf.WriteString(color.Color("[cyan] <=[reset] ")) + case plans.Update: + buf.WriteString(color.Color("[yellow] ~[reset] ")) + case plans.DeleteThenCreate: + buf.WriteString(color.Color("[red]-[reset]/[green]+[reset] ")) + case plans.CreateThenDelete: + buf.WriteString(color.Color("[green]+[reset]/[red]-[reset] ")) + case plans.Delete: + buf.WriteString(color.Color("[red] -[reset] ")) + default: + buf.WriteString(color.Color("??? ")) + } switch addr.Resource.Resource.Mode { case addrs.ManagedResourceMode: @@ -487,7 +502,7 @@ func (p *blockBodyDiffPrinter) writeValue(val cty.Value, action plans.Action, in ty, err := ctyjson.ImpliedType(src) // check for the special case of "null", which decodes to nil, // and just allow it to be printed out directly - if err == nil && !ty.IsPrimitiveType() && strings.TrimSpace(val.AsString()) != "null" { + if err == nil && !ty.IsPrimitiveType() && val.AsString() != "null" { jv, err := ctyjson.Unmarshal(src, ty) if err == nil { p.buf.WriteString("jsonencode(") @@ -505,21 +520,6 @@ func (p *blockBodyDiffPrinter) writeValue(val cty.Value, action plans.Action, in } } } - - if strings.Contains(val.AsString(), "\n") { - // It's a multi-line string, so we want to use the multi-line - // rendering so it'll be readable. Rather than re-implement - // that here, we'll just re-use the multi-line string diff - // printer with no changes, which ends up producing the - // result we want here. - // The path argument is nil because we don't track path - // information into strings and we know that a string can't - // have any indices or attributes that might need to be marked - // as (requires replacement), which is what that argument is for. - p.writeValueDiff(val, val, indent, nil) - break - } - fmt.Fprintf(p.buf, "%q", val.AsString()) case cty.Bool: if val.True() { @@ -1014,9 +1014,8 @@ func (p *blockBodyDiffPrinter) writeActionSymbol(action plans.Action) { } func (p *blockBodyDiffPrinter) pathForcesNewResource(path cty.Path) bool { - if !p.action.IsReplace() || p.requiredReplace.Empty() { - // "requiredReplace" only applies when the instance is being replaced, - // and we should only inspect that set if it is not empty + if !p.action.IsReplace() { + // "requiredReplace" only applies when the instance is being replaced return false } return p.requiredReplace.Has(path) @@ -1072,8 +1071,8 @@ func ctySequenceDiff(old, new []cty.Value) []*plans.Change { var oldI, newI, lcsI int for oldI < len(old) || newI < len(new) || lcsI < len(lcs) { for oldI < len(old) && (lcsI >= len(lcs) || !old[oldI].RawEquals(lcs[lcsI])) { - isObjectDiff := old[oldI].Type().IsObjectType() && newI < len(new) && new[newI].Type().IsObjectType() && (lcsI >= len(lcs) || !new[newI].RawEquals(lcs[lcsI])) - if isObjectDiff { + isObjectDiff := old[oldI].Type().IsObjectType() && (newI >= len(new) || new[newI].Type().IsObjectType()) + if isObjectDiff && newI < len(new) { ret = append(ret, &plans.Change{ Action: plans.Update, Before: old[oldI], @@ -1191,26 +1190,3 @@ func ctyNullBlockSetAsEmpty(in cty.Value) cty.Value { // sets, so our result here is always a set. return cty.SetValEmpty(in.Type().ElementType()) } - -// DiffActionSymbol returns a string that, once passed through a -// colorstring.Colorize, will produce a result that can be written -// to a terminal to produce a symbol made of three printable -// characters, possibly interspersed with VT100 color codes. -func DiffActionSymbol(action plans.Action) string { - switch action { - case plans.DeleteThenCreate: - return "[red]-[reset]/[green]+[reset]" - case plans.CreateThenDelete: - return "[green]+[reset]/[red]-[reset]" - case plans.Create: - return " [green]+[reset]" - case plans.Delete: - return " [red]-[reset]" - case plans.Read: - return " [cyan]<=[reset]" - case plans.Update: - return " [yellow]~[reset]" - default: - return " ?" - } -} diff --git a/vendor/github.com/hashicorp/terraform/command/format/format.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/format.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/command/format/format.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/format.go diff --git a/vendor/github.com/hashicorp/terraform/command/format/object_id.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/object_id.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/command/format/object_id.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/object_id.go diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/plan.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/plan.go new file mode 100644 index 000000000..7d3030041 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/plan.go @@ -0,0 +1,306 @@ +package format + +import ( + "bytes" + "fmt" + "log" + "sort" + "strings" + + "github.com/mitchellh/colorstring" + + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/terraform" +) + +// Plan is a representation of a plan optimized for display to +// an end-user, as opposed to terraform.Plan which is for internal use. +// +// DisplayPlan excludes implementation details that may otherwise appear +// in the main plan, such as destroy actions on data sources (which are +// there only to clean up the state). +type Plan struct { + Resources []*InstanceDiff +} + +// InstanceDiff is a representation of an instance diff optimized +// for display, in conjunction with DisplayPlan. +type InstanceDiff struct { + Addr *terraform.ResourceAddress + Action plans.Action + + // Attributes describes changes to the attributes of the instance. + // + // For destroy diffs this is always nil. + Attributes []*AttributeDiff + + Tainted bool + Deposed bool +} + +// AttributeDiff is a representation of an attribute diff optimized +// for display, in conjunction with DisplayInstanceDiff. +type AttributeDiff struct { + // Path is a dot-delimited traversal through possibly many levels of list and map structure, + // intended for display purposes only. + Path string + + Action plans.Action + + OldValue string + NewValue string + + NewComputed bool + Sensitive bool + ForcesNew bool +} + +// PlanStats gives summary counts for a Plan. +type PlanStats struct { + ToAdd, ToChange, ToDestroy int +} + +// NewPlan produces a display-oriented Plan from a terraform.Plan. +func NewPlan(changes *plans.Changes) *Plan { + log.Printf("[TRACE] NewPlan for %#v", changes) + ret := &Plan{} + if changes == nil { + // Nothing to do! + return ret + } + + for _, rc := range changes.Resources { + addr := rc.Addr + log.Printf("[TRACE] NewPlan found %s (%s)", addr, rc.Action) + dataSource := addr.Resource.Resource.Mode == addrs.DataResourceMode + + // We create "delete" actions for data resources so we can clean + // up their entries in state, but this is an implementation detail + // that users shouldn't see. + if dataSource && rc.Action == plans.Delete { + continue + } + + if rc.Action == plans.NoOp { + continue + } + + // For now we'll shim this to work with our old types. + // TODO: Update for the new plan types, ideally also switching over to + // a structural diff renderer instead of a flat renderer. + did := &InstanceDiff{ + Addr: terraform.NewLegacyResourceInstanceAddress(addr), + Action: rc.Action, + } + + if rc.DeposedKey != states.NotDeposed { + did.Deposed = true + } + + // Since this is just a temporary stub implementation on the way + // to us replacing this with the structural diff renderer, we currently + // don't include any attributes here. + // FIXME: Implement the structural diff renderer to replace this + // codepath altogether. + + ret.Resources = append(ret.Resources, did) + } + + // Sort the instance diffs by their addresses for display. + sort.Slice(ret.Resources, func(i, j int) bool { + iAddr := ret.Resources[i].Addr + jAddr := ret.Resources[j].Addr + return iAddr.Less(jAddr) + }) + + return ret +} + +// Format produces and returns a text representation of the receiving plan +// intended for display in a terminal. +// +// If color is not nil, it is used to colorize the output. +func (p *Plan) Format(color *colorstring.Colorize) string { + if p.Empty() { + return "This plan does nothing." + } + + if color == nil { + color = &colorstring.Colorize{ + Colors: colorstring.DefaultColors, + Reset: false, + } + } + + // Find the longest path length of all the paths that are changing, + // so we can align them all. + keyLen := 0 + for _, r := range p.Resources { + for _, attr := range r.Attributes { + key := attr.Path + + if len(key) > keyLen { + keyLen = len(key) + } + } + } + + buf := new(bytes.Buffer) + for _, r := range p.Resources { + formatPlanInstanceDiff(buf, r, keyLen, color) + } + + return strings.TrimSpace(buf.String()) +} + +// Stats returns statistics about the plan +func (p *Plan) Stats() PlanStats { + var ret PlanStats + for _, r := range p.Resources { + switch r.Action { + case plans.Create: + ret.ToAdd++ + case plans.Update: + ret.ToChange++ + case plans.DeleteThenCreate, plans.CreateThenDelete: + ret.ToAdd++ + ret.ToDestroy++ + case plans.Delete: + ret.ToDestroy++ + } + } + return ret +} + +// ActionCounts returns the number of diffs for each action type +func (p *Plan) ActionCounts() map[plans.Action]int { + ret := map[plans.Action]int{} + for _, r := range p.Resources { + ret[r.Action]++ + } + return ret +} + +// Empty returns true if there is at least one resource diff in the receiving plan. +func (p *Plan) Empty() bool { + return len(p.Resources) == 0 +} + +// DiffActionSymbol returns a string that, once passed through a +// colorstring.Colorize, will produce a result that can be written +// to a terminal to produce a symbol made of three printable +// characters, possibly interspersed with VT100 color codes. +func DiffActionSymbol(action plans.Action) string { + switch action { + case plans.DeleteThenCreate: + return "[red]-[reset]/[green]+[reset]" + case plans.CreateThenDelete: + return "[green]+[reset]/[red]-[reset]" + case plans.Create: + return " [green]+[reset]" + case plans.Delete: + return " [red]-[reset]" + case plans.Read: + return " [cyan]<=[reset]" + case plans.Update: + return " [yellow]~[reset]" + default: + return " ?" + } +} + +// formatPlanInstanceDiff writes the text representation of the given instance diff +// to the given buffer, using the given colorizer. +func formatPlanInstanceDiff(buf *bytes.Buffer, r *InstanceDiff, keyLen int, colorizer *colorstring.Colorize) { + addrStr := r.Addr.String() + + // Determine the color for the text (green for adding, yellow + // for change, red for delete), and symbol, and output the + // resource header. + color := "yellow" + symbol := DiffActionSymbol(r.Action) + oldValues := true + switch r.Action { + case plans.DeleteThenCreate, plans.CreateThenDelete: + color = "yellow" + case plans.Create: + color = "green" + oldValues = false + case plans.Delete: + color = "red" + case plans.Read: + color = "cyan" + oldValues = false + } + + var extraStr string + if r.Tainted { + extraStr = extraStr + " (tainted)" + } + if r.Deposed { + extraStr = extraStr + " (deposed)" + } + if r.Action.IsReplace() { + extraStr = extraStr + colorizer.Color(" [red][bold](new resource required)") + } + + buf.WriteString( + colorizer.Color(fmt.Sprintf( + "[%s]%s [%s]%s%s\n", + color, symbol, color, addrStr, extraStr, + )), + ) + + for _, attr := range r.Attributes { + + v := attr.NewValue + var dispV string + switch { + case v == "" && attr.NewComputed: + dispV = "" + case attr.Sensitive: + dispV = "" + default: + dispV = fmt.Sprintf("%q", v) + } + + updateMsg := "" + switch { + case attr.ForcesNew && r.Action.IsReplace(): + updateMsg = colorizer.Color(" [red](forces new resource)") + case attr.Sensitive && oldValues: + updateMsg = colorizer.Color(" [yellow](attribute changed)") + } + + if oldValues { + u := attr.OldValue + var dispU string + switch { + case attr.Sensitive: + dispU = "" + default: + dispU = fmt.Sprintf("%q", u) + } + buf.WriteString(fmt.Sprintf( + " %s:%s %s => %s%s\n", + attr.Path, + strings.Repeat(" ", keyLen-len(attr.Path)), + dispU, dispV, + updateMsg, + )) + } else { + buf.WriteString(fmt.Sprintf( + " %s:%s %s%s\n", + attr.Path, + strings.Repeat(" ", keyLen-len(attr.Path)), + dispV, + updateMsg, + )) + } + } + + // Write the reset color so we don't bleed color into later text + buf.WriteString(colorizer.Color("[reset]\n")) +} diff --git a/vendor/github.com/hashicorp/terraform/command/format/state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/state.go similarity index 63% rename from vendor/github.com/hashicorp/terraform/command/format/state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/state.go index be1ea24de..14869ad3c 100644 --- a/vendor/github.com/hashicorp/terraform/command/format/state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/state.go @@ -6,14 +6,13 @@ import ( "sort" "strings" - "github.com/zclconf/go-cty/cty" - - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/mitchellh/colorstring" + "github.com/zclconf/go-cty/cty" ) // StateOpts are the options for formatting a state. @@ -207,116 +206,3 @@ func formatStateModule(p blockBodyDiffPrinter, m *states.Module, schemas *terraf } p.buf.WriteString("\n") } - -func formatNestedList(indent string, outputList []interface{}) string { - outputBuf := new(bytes.Buffer) - outputBuf.WriteString(fmt.Sprintf("%s[", indent)) - - lastIdx := len(outputList) - 1 - - for i, value := range outputList { - outputBuf.WriteString(fmt.Sprintf("\n%s%s%s", indent, " ", value)) - if i != lastIdx { - outputBuf.WriteString(",") - } - } - - outputBuf.WriteString(fmt.Sprintf("\n%s]", indent)) - return strings.TrimPrefix(outputBuf.String(), "\n") -} - -func formatListOutput(indent, outputName string, outputList []interface{}) string { - keyIndent := "" - - outputBuf := new(bytes.Buffer) - - if outputName != "" { - outputBuf.WriteString(fmt.Sprintf("%s%s = [", indent, outputName)) - keyIndent = " " - } - - lastIdx := len(outputList) - 1 - - for i, value := range outputList { - switch typedValue := value.(type) { - case string: - outputBuf.WriteString(fmt.Sprintf("\n%s%s%s", indent, keyIndent, value)) - case []interface{}: - outputBuf.WriteString(fmt.Sprintf("\n%s%s", indent, - formatNestedList(indent+keyIndent, typedValue))) - case map[string]interface{}: - outputBuf.WriteString(fmt.Sprintf("\n%s%s", indent, - formatNestedMap(indent+keyIndent, typedValue))) - } - - if lastIdx != i { - outputBuf.WriteString(",") - } - } - - if outputName != "" { - if len(outputList) > 0 { - outputBuf.WriteString(fmt.Sprintf("\n%s]", indent)) - } else { - outputBuf.WriteString("]") - } - } - - return strings.TrimPrefix(outputBuf.String(), "\n") -} - -func formatNestedMap(indent string, outputMap map[string]interface{}) string { - ks := make([]string, 0, len(outputMap)) - for k := range outputMap { - ks = append(ks, k) - } - sort.Strings(ks) - - outputBuf := new(bytes.Buffer) - outputBuf.WriteString(fmt.Sprintf("%s{", indent)) - - lastIdx := len(outputMap) - 1 - for i, k := range ks { - v := outputMap[k] - outputBuf.WriteString(fmt.Sprintf("\n%s%s = %v", indent+" ", k, v)) - - if lastIdx != i { - outputBuf.WriteString(",") - } - } - - outputBuf.WriteString(fmt.Sprintf("\n%s}", indent)) - - return strings.TrimPrefix(outputBuf.String(), "\n") -} - -func formatMapOutput(indent, outputName string, outputMap map[string]interface{}) string { - ks := make([]string, 0, len(outputMap)) - for k := range outputMap { - ks = append(ks, k) - } - sort.Strings(ks) - - keyIndent := "" - - outputBuf := new(bytes.Buffer) - if outputName != "" { - outputBuf.WriteString(fmt.Sprintf("%s%s = {", indent, outputName)) - keyIndent = " " - } - - for _, k := range ks { - v := outputMap[k] - outputBuf.WriteString(fmt.Sprintf("\n%s%s%s = %v", indent, keyIndent, k, v)) - } - - if outputName != "" { - if len(outputMap) > 0 { - outputBuf.WriteString(fmt.Sprintf("\n%s}", indent)) - } else { - outputBuf.WriteString("}") - } - } - - return strings.TrimPrefix(outputBuf.String(), "\n") -} diff --git a/vendor/github.com/hashicorp/terraform/configs/backend.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/backend.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/configs/backend.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/backend.go index 5d8b9732a..6c7848d23 100644 --- a/vendor/github.com/hashicorp/terraform/configs/backend.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/backend.go @@ -1,9 +1,9 @@ package configs import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcldec" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/configs/compat_shim.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/compat_shim.go similarity index 50% rename from vendor/github.com/hashicorp/terraform/configs/compat_shim.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/compat_shim.go index b645ac890..66037fcdc 100644 --- a/vendor/github.com/hashicorp/terraform/configs/compat_shim.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/compat_shim.go @@ -1,8 +1,8 @@ package configs import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" "github.com/zclconf/go-cty/cty" ) @@ -69,21 +69,28 @@ func shimTraversalInString(expr hcl.Expression, wantKeyword bool) (hcl.Expressio ) diags = append(diags, tDiags...) - if wantKeyword { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: "Quoted keywords are deprecated", - Detail: "In this context, keywords are expected literally rather than in quotes. Terraform 0.11 and earlier required quotes, but quoted keywords are now deprecated and will be removed in a future version of Terraform. Remove the quotes surrounding this keyword to silence this warning.", - Subject: &srcRange, - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: "Quoted references are deprecated", - Detail: "In this context, references are expected literally rather than in quotes. Terraform 0.11 and earlier required quotes, but quoted references are now deprecated and will be removed in a future version of Terraform. Remove the quotes surrounding this reference to silence this warning.", - Subject: &srcRange, - }) - } + // For initial release our deprecation warnings are disabled to allow + // a period where modules can be compatible with both old and new + // conventions. + // FIXME: Re-enable these deprecation warnings in a release prior to + // Terraform 0.13 and then remove the shims altogether for 0.13. + /* + if wantKeyword { + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagWarning, + Summary: "Quoted keywords are deprecated", + Detail: "In this context, keywords are expected literally rather than in quotes. Previous versions of Terraform required quotes, but that usage is now deprecated. Remove the quotes surrounding this keyword to silence this warning.", + Subject: &srcRange, + }) + } else { + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagWarning, + Summary: "Quoted references are deprecated", + Detail: "In this context, references are expected literally rather than in quotes. Previous versions of Terraform required quotes, but that usage is now deprecated. Remove the quotes surrounding this reference to silence this warning.", + Subject: &srcRange, + }) + } + */ return &hclsyntax.ScopeTraversalExpr{ Traversal: traversal, @@ -107,58 +114,3 @@ func shimIsIgnoreChangesStar(expr hcl.Expression) bool { } return val.AsString() == "*" } - -// warnForDeprecatedInterpolations returns warning diagnostics if the given -// body can be proven to contain attributes whose expressions are native -// syntax expressions consisting entirely of a single template interpolation, -// which is a deprecated way to include a non-literal value in configuration. -// -// This is a best-effort sort of thing which relies on the physical HCL native -// syntax AST, so it might not catch everything. The main goal is to catch the -// "obvious" cases in order to help spread awareness that this old form is -// deprecated, when folks copy it from older examples they've found on the -// internet that were written for Terraform 0.11 or earlier. -func warnForDeprecatedInterpolationsInBody(body hcl.Body) hcl.Diagnostics { - var diags hcl.Diagnostics - - nativeBody, ok := body.(*hclsyntax.Body) - if !ok { - // If it's not native syntax then we've nothing to do here. - return diags - } - - for _, attr := range nativeBody.Attributes { - moreDiags := warnForDeprecatedInterpolationsInExpr(attr.Expr) - diags = append(diags, moreDiags...) - } - - for _, block := range nativeBody.Blocks { - // We'll also go hunting in nested blocks - moreDiags := warnForDeprecatedInterpolationsInBody(block.Body) - diags = append(diags, moreDiags...) - } - - return diags -} - -func warnForDeprecatedInterpolationsInExpr(expr hcl.Expression) hcl.Diagnostics { - var diags hcl.Diagnostics - - if _, ok := expr.(*hclsyntax.TemplateWrapExpr); !ok { - // We're only interested in TemplateWrapExpr, because that's how - // the HCL native syntax parser represents the case of a template - // that consists entirely of a single interpolation expression, which - // is therefore subject to the special case of passing through the - // inner value without conversion to string. - return diags - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: "Interpolation-only expressions are deprecated", - Detail: "Terraform 0.11 and earlier required all non-constant expressions to be provided via interpolation syntax, but this pattern is now deprecated. To silence this warning, remove the \"${ sequence from the start and the }\" sequence from the end of this expression, leaving just the inner expression.\n\nTemplate interpolation syntax is still used to construct strings from expressions when the template includes multiple interpolation sequences or a mixture of literal strings and interpolations. This deprecation applies only to templates that consist entirely of a single interpolation sequence.", - Subject: expr.Range().Ptr(), - }) - - return diags -} diff --git a/vendor/github.com/hashicorp/terraform/configs/config.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/config.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/configs/config.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/config.go index cde0014c9..c90b51a11 100644 --- a/vendor/github.com/hashicorp/terraform/configs/config.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/config.go @@ -4,8 +4,8 @@ import ( "sort" version "github.com/hashicorp/go-version" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // A Config is a node in the tree of modules within a configuration. @@ -191,11 +191,11 @@ func (c *Config) gatherProviderTypes(m map[string]struct{}) { } for _, rc := range c.Module.ManagedResources { providerAddr := rc.ProviderConfigAddr() - m[providerAddr.Type.LegacyString()] = struct{}{} + m[providerAddr.Type] = struct{}{} } for _, rc := range c.Module.DataResources { providerAddr := rc.ProviderConfigAddr() - m[providerAddr.Type.LegacyString()] = struct{}{} + m[providerAddr.Type] = struct{}{} } // Must also visit our child modules, recursively. diff --git a/vendor/github.com/hashicorp/terraform/configs/config_build.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/config_build.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/configs/config_build.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/config_build.go index c38a67926..f1129bc19 100644 --- a/vendor/github.com/hashicorp/terraform/configs/config_build.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/config_build.go @@ -4,8 +4,8 @@ import ( "sort" version "github.com/hashicorp/go-version" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // BuildConfig constructs a Config from a root module by loading all of its diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/copy_dir.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/copy_dir.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/configs/configload/copy_dir.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/copy_dir.go index 840a7aa97..ebbeb3b62 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configload/copy_dir.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/copy_dir.go @@ -4,6 +4,7 @@ import ( "io" "os" "path/filepath" + "strings" ) // copyDir copies the src directory contents into dst. Both directories @@ -23,6 +24,15 @@ func copyDir(dst, src string) error { return nil } + if strings.HasPrefix(filepath.Base(path), ".") { + // Skip any dot files + if info.IsDir() { + return filepath.SkipDir + } else { + return nil + } + } + // The "path" has the src prefixed to it. We need to join our // destination with the path without the src on it. dstPath := filepath.Join(dst, path[len(src):]) diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configload/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/doc.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/inode.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/inode.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configload/inode.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/inode.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/inode_freebsd.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/inode_freebsd.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configload/inode_freebsd.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/inode_freebsd.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/inode_windows.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/inode_windows.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configload/inode_windows.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/inode_windows.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/loader.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/loader.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/configs/configload/loader.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/loader.go index a09b80c8c..302b6b5d7 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configload/loader.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/loader.go @@ -4,9 +4,9 @@ import ( "fmt" "path/filepath" - "github.com/hashicorp/terraform-svchost/disco" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/registry" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco" "github.com/spf13/afero" ) diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/loader_load.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/loader_load.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/configs/configload/loader_load.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/loader_load.go index 80b2de1b5..64219bb77 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configload/loader_load.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/loader_load.go @@ -4,8 +4,8 @@ import ( "fmt" version "github.com/hashicorp/go-version" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/configs" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" ) // LoadConfig reads the Terraform module in the given directory and uses it as the diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/loader_snapshot.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/loader_snapshot.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/configs/configload/loader_snapshot.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/loader_snapshot.go index 9e83895cf..0eb2c376d 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configload/loader_snapshot.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/loader_snapshot.go @@ -9,9 +9,9 @@ import ( "time" version "github.com/hashicorp/go-version" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/internal/modsdir" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/modsdir" "github.com/spf13/afero" ) diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/module_mgr.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/module_mgr.go similarity index 75% rename from vendor/github.com/hashicorp/terraform/configs/configload/module_mgr.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/module_mgr.go index 16871e310..170320266 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configload/module_mgr.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/module_mgr.go @@ -4,9 +4,9 @@ import ( "os" "path/filepath" - "github.com/hashicorp/terraform-svchost/disco" - "github.com/hashicorp/terraform/internal/modsdir" - "github.com/hashicorp/terraform/registry" + "github.com/hashicorp/terraform-plugin-sdk/internal/modsdir" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco" "github.com/spf13/afero" ) @@ -60,17 +60,3 @@ func (m *moduleMgr) readModuleManifestSnapshot() error { m.manifest, err = modsdir.ReadManifestSnapshot(r) return err } - -// writeModuleManifestSnapshot writes a snapshot of the current manifest -// to the filesystem. -// -// The caller must guarantee no concurrent modifications of the manifest for -// the duration of a call to this function, or the behavior is undefined. -func (m *moduleMgr) writeModuleManifestSnapshot() error { - w, err := m.FS.Create(m.manifestSnapshotPath()) - if err != nil { - return err - } - - return m.manifest.WriteSnapshot(w) -} diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/testing.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/testing.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configload/testing.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload/testing.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/coerce_value.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/coerce_value.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configschema/coerce_value.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/coerce_value.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/decoder_spec.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/decoder_spec.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/configs/configschema/decoder_spec.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/decoder_spec.go index 2c21ca5e5..c4bc3be03 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configschema/decoder_spec.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/decoder_spec.go @@ -1,7 +1,7 @@ package configschema import ( - "github.com/hashicorp/hcl/v2/hcldec" + "github.com/hashicorp/hcl2/hcldec" ) var mapLabelNames = []string{"key"} diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configschema/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/doc.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/empty_value.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/empty_value.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configschema/empty_value.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/empty_value.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/implied_type.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/implied_type.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/configs/configschema/implied_type.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/implied_type.go index a81b7eab4..c0ee8419d 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configschema/implied_type.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/implied_type.go @@ -1,7 +1,7 @@ package configschema import ( - "github.com/hashicorp/hcl/v2/hcldec" + "github.com/hashicorp/hcl2/hcldec" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/internal_validate.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/internal_validate.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configschema/internal_validate.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/internal_validate.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/nestingmode_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/nestingmode_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configschema/nestingmode_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/nestingmode_string.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/none_required.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/none_required.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configschema/none_required.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/none_required.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/schema.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/schema.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/configschema/schema.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/schema.go diff --git a/vendor/github.com/hashicorp/terraform/configs/configschema/validate_traversal.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/validate_traversal.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/configs/configschema/validate_traversal.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/validate_traversal.go index 9fc2de38c..2873830c2 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configschema/validate_traversal.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/validate_traversal.go @@ -4,12 +4,12 @@ import ( "fmt" "sort" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/helper/didyoumean" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/helper/didyoumean" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // StaticValidateTraversal checks whether the given traversal (which must be diff --git a/vendor/github.com/hashicorp/terraform/configs/depends_on.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/depends_on.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/configs/depends_on.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/depends_on.go index 036c2d6c3..b1984768f 100644 --- a/vendor/github.com/hashicorp/terraform/configs/depends_on.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/depends_on.go @@ -1,7 +1,7 @@ package configs import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) func decodeDependsOn(attr *hcl.Attribute) ([]hcl.Traversal, hcl.Diagnostics) { diff --git a/vendor/github.com/hashicorp/terraform/configs/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/doc.go diff --git a/vendor/github.com/hashicorp/terraform/configs/hcl2shim/flatmap.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/flatmap.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/hcl2shim/flatmap.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/flatmap.go diff --git a/vendor/github.com/hashicorp/terraform/configs/hcl2shim/paths.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/paths.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/hcl2shim/paths.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/paths.go diff --git a/vendor/github.com/hashicorp/terraform/configs/hcl2shim/single_attr_body.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/single_attr_body.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/configs/hcl2shim/single_attr_body.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/single_attr_body.go index 68f48da8f..19651c81c 100644 --- a/vendor/github.com/hashicorp/terraform/configs/hcl2shim/single_attr_body.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/single_attr_body.go @@ -3,7 +3,7 @@ package hcl2shim import ( "fmt" - hcl2 "github.com/hashicorp/hcl/v2" + hcl2 "github.com/hashicorp/hcl2/hcl" ) // SingleAttrBody is a weird implementation of hcl2.Body that acts as if diff --git a/vendor/github.com/hashicorp/terraform/configs/hcl2shim/values.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/values.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/configs/hcl2shim/values.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/values.go index daeb0b8e0..c0c816418 100644 --- a/vendor/github.com/hashicorp/terraform/configs/hcl2shim/values.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/values.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/hil/ast" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" ) // UnknownVariableValue is a sentinel value that can be used diff --git a/vendor/github.com/hashicorp/terraform/configs/hcl2shim/values_equiv.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/values_equiv.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/hcl2shim/values_equiv.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim/values_equiv.go diff --git a/vendor/github.com/hashicorp/terraform/configs/module.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/configs/module.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module.go index a3afcd9fb..d45ed8a9c 100644 --- a/vendor/github.com/hashicorp/terraform/configs/module.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module.go @@ -3,10 +3,9 @@ package configs import ( "fmt" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/experiments" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // Module is a container for a set of configuration constructs that are @@ -26,8 +25,6 @@ type Module struct { CoreVersionConstraints []VersionConstraint - ActiveExperiments experiments.Set - Backend *Backend ProviderConfigs map[string]*Provider ProviderRequirements map[string][]VersionConstraint @@ -56,8 +53,6 @@ type Module struct { type File struct { CoreVersionConstraints []VersionConstraint - ActiveExperiments experiments.Set - Backends []*Backend ProviderConfigs []*Provider ProviderRequirements []*ProviderRequirement @@ -103,8 +98,6 @@ func NewModule(primaryFiles, overrideFiles []*File) (*Module, hcl.Diagnostics) { diags = append(diags, fileDiags...) } - diags = append(diags, checkModuleExperiments(mod)...) - return mod, diags } @@ -131,8 +124,6 @@ func (m *Module) appendFile(file *File) hcl.Diagnostics { m.CoreVersionConstraints = append(m.CoreVersionConstraints, constraint) } - m.ActiveExperiments = experiments.SetUnion(m.ActiveExperiments, file.ActiveExperiments) - for _, b := range file.Backends { if m.Backend != nil { diags = append(diags, &hcl.Diagnostic{ diff --git a/vendor/github.com/hashicorp/terraform/configs/module_call.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module_call.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/configs/module_call.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module_call.go index a484ffef9..8c3ba67ce 100644 --- a/vendor/github.com/hashicorp/terraform/configs/module_call.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module_call.go @@ -3,9 +3,9 @@ package configs import ( "fmt" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/gohcl" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/gohcl" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" ) // ModuleCall represents a "module" block in a module or file. diff --git a/vendor/github.com/hashicorp/terraform/configs/module_merge.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module_merge.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/configs/module_merge.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module_merge.go index 401b1c0a8..12916ef8c 100644 --- a/vendor/github.com/hashicorp/terraform/configs/module_merge.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module_merge.go @@ -3,9 +3,9 @@ package configs import ( "fmt" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" ) diff --git a/vendor/github.com/hashicorp/terraform/configs/module_merge_body.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module_merge_body.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/configs/module_merge_body.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module_merge_body.go index 7b51eae85..0ed561eee 100644 --- a/vendor/github.com/hashicorp/terraform/configs/module_merge_body.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module_merge_body.go @@ -1,7 +1,7 @@ package configs import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) // MergeBodies creates a new HCL body that contains a combination of the diff --git a/vendor/github.com/hashicorp/terraform/configs/named_values.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/named_values.go similarity index 84% rename from vendor/github.com/hashicorp/terraform/configs/named_values.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/named_values.go index 280b70692..66468c3bd 100644 --- a/vendor/github.com/hashicorp/terraform/configs/named_values.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/named_values.go @@ -3,18 +3,18 @@ package configs import ( "fmt" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/ext/typeexpr" - "github.com/hashicorp/hcl/v2/gohcl" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/ext/typeexpr" + "github.com/hashicorp/hcl2/gohcl" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // A consistent detail message for all "not a valid identifier" diagnostics. -const badIdentifierDetail = "A name must start with a letter or underscore and may contain only letters, digits, underscores, and dashes." +const badIdentifierDetail = "A name must start with a letter and may contain only letters, digits, underscores, and dashes." // Variable represents a "variable" block in a module or file. type Variable struct { @@ -138,28 +138,10 @@ func decodeVariableType(expr hcl.Expression) (cty.Type, VariableParsingMode, hcl str := val.AsString() switch str { case "string": - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: "Quoted type constraints are deprecated", - Detail: "Terraform 0.11 and earlier required type constraints to be given in quotes, but that form is now deprecated and will be removed in a future version of Terraform. To silence this warning, remove the quotes around \"string\".", - Subject: expr.Range().Ptr(), - }) return cty.String, VariableParseLiteral, diags case "list": - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: "Quoted type constraints are deprecated", - Detail: "Terraform 0.11 and earlier required type constraints to be given in quotes, but that form is now deprecated and will be removed in a future version of Terraform. To silence this warning, remove the quotes around \"list\" and write list(string) instead to explicitly indicate that the list elements are strings.", - Subject: expr.Range().Ptr(), - }) return cty.List(cty.DynamicPseudoType), VariableParseHCL, diags case "map": - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: "Quoted type constraints are deprecated", - Detail: "Terraform 0.11 and earlier required type constraints to be given in quotes, but that form is now deprecated and will be removed in a future version of Terraform. To silence this warning, remove the quotes around \"map\" and write map(string) instead to explicitly indicate that the map elements are strings.", - Subject: expr.Range().Ptr(), - }) return cty.Map(cty.DynamicPseudoType), VariableParseHCL, diags default: return cty.DynamicPseudoType, VariableParseHCL, hcl.Diagnostics{{ @@ -197,12 +179,6 @@ func decodeVariableType(expr hcl.Expression) (cty.Type, VariableParsingMode, hcl } } -// Required returns true if this variable is required to be set by the caller, -// or false if there is a default value that will be used when it isn't set. -func (v *Variable) Required() bool { - return v.Default == cty.NilVal -} - // VariableParsingMode defines how values of a particular variable given by // text-only mechanisms (command line arguments and environment variables) // should be parsed to produce the final value. diff --git a/vendor/github.com/hashicorp/terraform/configs/parser.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/configs/parser.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser.go index 2a621b577..8176fa1b7 100644 --- a/vendor/github.com/hashicorp/terraform/configs/parser.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclparse" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hclparse" "github.com/spf13/afero" ) diff --git a/vendor/github.com/hashicorp/terraform/configs/parser_config.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser_config.go similarity index 85% rename from vendor/github.com/hashicorp/terraform/configs/parser_config.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser_config.go index c592dfa45..7f2ff2714 100644 --- a/vendor/github.com/hashicorp/terraform/configs/parser_config.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser_config.go @@ -1,7 +1,7 @@ package configs import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) // LoadConfigFile reads the file at the given path and parses it as a config @@ -42,12 +42,6 @@ func (p *Parser) loadConfigFile(path string, override bool) (*File, hcl.Diagnost file.CoreVersionConstraints, reqDiags = sniffCoreVersionRequirements(body) diags = append(diags, reqDiags...) - // We'll load the experiments first because other decoding logic in the - // loop below might depend on these experiments. - var expDiags hcl.Diagnostics - file.ActiveExperiments, expDiags = sniffActiveExperiments(body) - diags = append(diags, expDiags...) - content, contentDiags := body.Content(configFileSchema) diags = append(diags, contentDiags...) @@ -58,9 +52,8 @@ func (p *Parser) loadConfigFile(path string, override bool) (*File, hcl.Diagnost content, contentDiags := block.Body.Content(terraformBlockSchema) diags = append(diags, contentDiags...) - // We ignore the "terraform_version" and "experiments" attributes - // here because sniffCoreVersionRequirements and - // sniffActiveExperiments already dealt with those above. + // We ignore the "terraform_version" attribute here because + // sniffCoreVersionRequirements already dealt with that above. for _, innerBlock := range content.Blocks { switch innerBlock.Type { @@ -155,7 +148,7 @@ func (p *Parser) loadConfigFile(path string, override bool) (*File, hcl.Diagnost // able to find, but may return no constraints at all if the given body is // so invalid that it cannot be decoded at all. func sniffCoreVersionRequirements(body hcl.Body) ([]VersionConstraint, hcl.Diagnostics) { - rootContent, _, diags := body.PartialContent(configFileTerraformBlockSniffRootSchema) + rootContent, _, diags := body.PartialContent(configFileVersionSniffRootSchema) var constraints []VersionConstraint @@ -220,8 +213,9 @@ var configFileSchema = &hcl.BodySchema{ // a configuration file. var terraformBlockSchema = &hcl.BodySchema{ Attributes: []hcl.AttributeSchema{ - {Name: "required_version"}, - {Name: "experiments"}, + { + Name: "required_version", + }, }, Blocks: []hcl.BlockHeaderSchema{ { @@ -234,9 +228,8 @@ var terraformBlockSchema = &hcl.BodySchema{ }, } -// configFileTerraformBlockSniffRootSchema is a schema for -// sniffCoreVersionRequirements and sniffActiveExperiments. -var configFileTerraformBlockSniffRootSchema = &hcl.BodySchema{ +// configFileVersionSniffRootSchema is a schema for sniffCoreVersionRequirements +var configFileVersionSniffRootSchema = &hcl.BodySchema{ Blocks: []hcl.BlockHeaderSchema{ { Type: "terraform", @@ -252,13 +245,3 @@ var configFileVersionSniffBlockSchema = &hcl.BodySchema{ }, }, } - -// configFileExperimentsSniffBlockSchema is a schema for sniffActiveExperiments, -// to decode a single attribute from inside a "terraform" block. -var configFileExperimentsSniffBlockSchema = &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "experiments", - }, - }, -} diff --git a/vendor/github.com/hashicorp/terraform/configs/parser_config_dir.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser_config_dir.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/configs/parser_config_dir.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser_config_dir.go index 2923af93a..752d6d9ca 100644 --- a/vendor/github.com/hashicorp/terraform/configs/parser_config_dir.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser_config_dir.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) // LoadConfigDir reads the .tf and .tf.json files in the given directory @@ -154,9 +154,9 @@ func IsEmptyDir(path string) (bool, error) { } p := NewParser(nil) - fs, os, diags := p.dirFiles(path) - if diags.HasErrors() { - return false, diags + fs, os, err := p.dirFiles(path) + if err != nil { + return false, err } return len(fs) == 0 && len(os) == 0, nil diff --git a/vendor/github.com/hashicorp/terraform/configs/parser_values.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser_values.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/configs/parser_values.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser_values.go index 10d98e5b0..b7f1c1c5d 100644 --- a/vendor/github.com/hashicorp/terraform/configs/parser_values.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser_values.go @@ -1,7 +1,7 @@ package configs import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provider.go new file mode 100644 index 000000000..99f0f26de --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provider.go @@ -0,0 +1,144 @@ +package configs + +import ( + "fmt" + + "github.com/hashicorp/hcl2/gohcl" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" + + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" +) + +// Provider represents a "provider" block in a module or file. A provider +// block is a provider configuration, and there can be zero or more +// configurations for each actual provider. +type Provider struct { + Name string + NameRange hcl.Range + Alias string + AliasRange *hcl.Range // nil if no alias set + + Version VersionConstraint + + Config hcl.Body + + DeclRange hcl.Range +} + +func decodeProviderBlock(block *hcl.Block) (*Provider, hcl.Diagnostics) { + content, config, diags := block.Body.PartialContent(providerBlockSchema) + + provider := &Provider{ + Name: block.Labels[0], + NameRange: block.LabelRanges[0], + Config: config, + DeclRange: block.DefRange, + } + + if attr, exists := content.Attributes["alias"]; exists { + valDiags := gohcl.DecodeExpression(attr.Expr, nil, &provider.Alias) + diags = append(diags, valDiags...) + provider.AliasRange = attr.Expr.Range().Ptr() + + if !hclsyntax.ValidIdentifier(provider.Alias) { + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid provider configuration alias", + Detail: fmt.Sprintf("An alias must be a valid name. %s", badIdentifierDetail), + }) + } + } + + if attr, exists := content.Attributes["version"]; exists { + var versionDiags hcl.Diagnostics + provider.Version, versionDiags = decodeVersionConstraint(attr) + diags = append(diags, versionDiags...) + } + + // Reserved attribute names + for _, name := range []string{"count", "depends_on", "for_each", "source"} { + if attr, exists := content.Attributes[name]; exists { + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Reserved argument name in provider block", + Detail: fmt.Sprintf("The provider argument name %q is reserved for use by Terraform in a future version.", name), + Subject: &attr.NameRange, + }) + } + } + + // Reserved block types (all of them) + for _, block := range content.Blocks { + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Reserved block type name in provider block", + Detail: fmt.Sprintf("The block type name %q is reserved for use by Terraform in a future version.", block.Type), + Subject: &block.TypeRange, + }) + } + + return provider, diags +} + +// Addr returns the address of the receiving provider configuration, relative +// to its containing module. +func (p *Provider) Addr() addrs.ProviderConfig { + return addrs.ProviderConfig{ + Type: p.Name, + Alias: p.Alias, + } +} + +func (p *Provider) moduleUniqueKey() string { + if p.Alias != "" { + return fmt.Sprintf("%s.%s", p.Name, p.Alias) + } + return p.Name +} + +// ProviderRequirement represents a declaration of a dependency on a particular +// provider version without actually configuring that provider. This is used in +// child modules that expect a provider to be passed in from their parent. +type ProviderRequirement struct { + Name string + Requirement VersionConstraint +} + +func decodeRequiredProvidersBlock(block *hcl.Block) ([]*ProviderRequirement, hcl.Diagnostics) { + attrs, diags := block.Body.JustAttributes() + var reqs []*ProviderRequirement + for name, attr := range attrs { + req, reqDiags := decodeVersionConstraint(attr) + diags = append(diags, reqDiags...) + if !diags.HasErrors() { + reqs = append(reqs, &ProviderRequirement{ + Name: name, + Requirement: req, + }) + } + } + return reqs, diags +} + +var providerBlockSchema = &hcl.BodySchema{ + Attributes: []hcl.AttributeSchema{ + { + Name: "alias", + }, + { + Name: "version", + }, + + // Attribute names reserved for future expansion. + {Name: "count"}, + {Name: "depends_on"}, + {Name: "for_each"}, + {Name: "source"}, + }, + Blocks: []hcl.BlockHeaderSchema{ + // _All_ of these are reserved for future expansion. + {Type: "lifecycle"}, + {Type: "locals"}, + }, +} diff --git a/vendor/github.com/hashicorp/terraform/configs/provisioner.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provisioner.go similarity index 69% rename from vendor/github.com/hashicorp/terraform/configs/provisioner.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provisioner.go index bbc6de993..311f107f8 100644 --- a/vendor/github.com/hashicorp/terraform/configs/provisioner.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provisioner.go @@ -3,7 +3,7 @@ package configs import ( "fmt" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) // Provisioner represents a "provisioner" block when used within a @@ -50,11 +50,6 @@ func decodeProvisionerBlock(block *hcl.Block) (*Provisioner, hcl.Diagnostics) { } } - // destroy provisioners can only refer to self - if pv.When == ProvisionerWhenDestroy { - diags = append(diags, onlySelfRefs(config)...) - } - if attr, exists := content.Attributes["on_failure"]; exists { expr, shimDiags := shimTraversalInString(attr.Expr, true) diags = append(diags, shimDiags...) @@ -90,11 +85,8 @@ func decodeProvisionerBlock(block *hcl.Block) (*Provisioner, hcl.Diagnostics) { } seenConnection = block - // destroy provisioners can only refer to self - if pv.When == ProvisionerWhenDestroy { - diags = append(diags, onlySelfRefs(block.Body)...) - } - + //conn, connDiags := decodeConnectionBlock(block) + //diags = append(diags, connDiags...) pv.Connection = &Connection{ Config: block.Body, DeclRange: block.DefRange, @@ -115,52 +107,6 @@ func decodeProvisionerBlock(block *hcl.Block) (*Provisioner, hcl.Diagnostics) { return pv, diags } -func onlySelfRefs(body hcl.Body) hcl.Diagnostics { - var diags hcl.Diagnostics - - // Provisioners currently do not use any blocks in their configuration. - // Blocks are likely to remain solely for meta parameters, but in the case - // that blocks are supported for provisioners, we will want to extend this - // to find variables in nested blocks. - attrs, _ := body.JustAttributes() - for _, attr := range attrs { - for _, v := range attr.Expr.Variables() { - valid := false - switch v.RootName() { - case "self": - valid = true - case "count": - // count must use "index" - if len(v) == 2 { - if t, ok := v[1].(hcl.TraverseAttr); ok && t.Name == "index" { - valid = true - } - } - - case "each": - if len(v) == 2 { - if t, ok := v[1].(hcl.TraverseAttr); ok && t.Name == "key" { - valid = true - } - } - } - - if !valid { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: "External references from destroy provisioners are deprecated", - Detail: "Destroy-time provisioners and their connection configurations may only " + - "reference attributes of the related resource, via 'self', 'count.index', " + - "or 'each.key'.\n\nReferences to other resources during the destroy phase " + - "can cause dependency cycles and interact poorly with create_before_destroy.", - Subject: attr.Expr.Range().Ptr(), - }) - } - } - } - return diags -} - // Connection represents a "connection" block when used within either a // "resource" or "provisioner" block in a module or file. type Connection struct { diff --git a/vendor/github.com/hashicorp/terraform/configs/provisioneronfailure_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provisioneronfailure_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/provisioneronfailure_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provisioneronfailure_string.go diff --git a/vendor/github.com/hashicorp/terraform/configs/provisionerwhen_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provisionerwhen_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/provisionerwhen_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provisionerwhen_string.go diff --git a/vendor/github.com/hashicorp/terraform/configs/resource.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/resource.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/configs/resource.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/resource.go index 7ca73ff1a..22657fad0 100644 --- a/vendor/github.com/hashicorp/terraform/configs/resource.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/resource.go @@ -3,11 +3,11 @@ package configs import ( "fmt" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/gohcl" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/gohcl" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // Resource represents a "resource" or "data" block in a module or file. @@ -70,13 +70,12 @@ func (r *Resource) ProviderConfigAddr() addrs.ProviderConfig { } return addrs.ProviderConfig{ - Type: addrs.NewLegacyProvider(r.ProviderConfigRef.Name), + Type: r.ProviderConfigRef.Name, Alias: r.ProviderConfigRef.Alias, } } func decodeResourceBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) { - var diags hcl.Diagnostics r := &Resource{ Mode: addrs.ManagedResourceMode, Type: block.Labels[0], @@ -86,15 +85,7 @@ func decodeResourceBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) { Managed: &ManagedResource{}, } - // Produce deprecation messages for any pre-0.12-style - // single-interpolation-only expressions. We do this up front here because - // then we can also catch instances inside special blocks like "connection", - // before PartialContent extracts them. - moreDiags := warnForDeprecatedInterpolationsInBody(block.Body) - diags = append(diags, moreDiags...) - - content, remain, moreDiags := block.Body.PartialContent(resourceBlockSchema) - diags = append(diags, moreDiags...) + content, remain, diags := block.Body.PartialContent(resourceBlockSchema) r.Config = remain if !hclsyntax.ValidIdentifier(r.Type) { @@ -273,17 +264,6 @@ func decodeResourceBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) { } } - // Now we can validate the connection block references if there are any destroy provisioners. - // TODO: should we eliminate standalone connection blocks? - if r.Managed.Connection != nil { - for _, p := range r.Managed.Provisioners { - if p.When == ProvisionerWhenDestroy { - diags = append(diags, onlySelfRefs(r.Managed.Connection.Config)...) - break - } - } - } - return r, diags } @@ -447,7 +427,7 @@ func decodeProviderConfigRef(expr hcl.Expression, argName string) (*ProviderConf // location information and keeping just the addressing information. func (r *ProviderConfigRef) Addr() addrs.ProviderConfig { return addrs.ProviderConfig{ - Type: addrs.NewLegacyProvider(r.Name), + Type: r.Name, Alias: r.Alias, } } diff --git a/vendor/github.com/hashicorp/terraform/configs/synth_body.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/synth_body.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/configs/synth_body.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/synth_body.go index cd914e5db..3ae1bff6a 100644 --- a/vendor/github.com/hashicorp/terraform/configs/synth_body.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/synth_body.go @@ -3,8 +3,8 @@ package configs import ( "fmt" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/configs/util.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/util.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/configs/util.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/util.go index e135546fb..5fbde4310 100644 --- a/vendor/github.com/hashicorp/terraform/configs/util.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/util.go @@ -1,8 +1,8 @@ package configs import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" ) // exprIsNativeQuotedString determines whether the given expression looks like diff --git a/vendor/github.com/hashicorp/terraform/configs/variable_type_hint.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/variable_type_hint.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/variable_type_hint.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/variable_type_hint.go diff --git a/vendor/github.com/hashicorp/terraform/configs/variabletypehint_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/variabletypehint_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/configs/variabletypehint_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/variabletypehint_string.go diff --git a/vendor/github.com/hashicorp/terraform/configs/version_constraint.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/version_constraint.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/configs/version_constraint.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/version_constraint.go index 0f541dc71..e40ce1639 100644 --- a/vendor/github.com/hashicorp/terraform/configs/version_constraint.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/version_constraint.go @@ -4,7 +4,7 @@ import ( "fmt" version "github.com/hashicorp/go-version" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" ) diff --git a/vendor/github.com/hashicorp/terraform/dag/dag.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/dag.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/dag/dag.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/dag.go index 77c67eff9..a150af961 100644 --- a/vendor/github.com/hashicorp/terraform/dag/dag.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/dag.go @@ -5,7 +5,7 @@ import ( "sort" "strings" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/hashicorp/go-multierror" ) diff --git a/vendor/github.com/hashicorp/terraform/dag/dot.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/dot.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/dag/dot.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/dot.go diff --git a/vendor/github.com/hashicorp/terraform/dag/edge.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/edge.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/dag/edge.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/edge.go diff --git a/vendor/github.com/hashicorp/terraform/dag/graph.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/graph.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/dag/graph.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/graph.go diff --git a/vendor/github.com/hashicorp/terraform/dag/marshal.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/marshal.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/dag/marshal.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/marshal.go diff --git a/vendor/github.com/hashicorp/terraform/dag/set.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/set.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/dag/set.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/set.go diff --git a/vendor/github.com/hashicorp/terraform/dag/tarjan.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/tarjan.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/dag/tarjan.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/tarjan.go diff --git a/vendor/github.com/hashicorp/terraform/dag/walk.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/walk.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/dag/walk.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/walk.go index 1c926c2c2..5ddf8ef34 100644 --- a/vendor/github.com/hashicorp/terraform/dag/walk.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/dag/walk.go @@ -6,7 +6,7 @@ import ( "sync" "time" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // Walker is used to walk every vertex of a graph in parallel. @@ -97,11 +97,6 @@ type walkerVertex struct { depsCancelCh chan struct{} } -// errWalkUpstream is used in the errMap of a walk to note that an upstream -// dependency failed so this vertex wasn't run. This is not shown in the final -// user-returned error. -var errWalkUpstream = errors.New("upstream dependency failed") - // Wait waits for the completion of the walk and returns diagnostics describing // any problems that arose. Update should be called to populate the walk with // vertices and edges prior to calling this. diff --git a/vendor/github.com/hashicorp/terraform/internal/earlyconfig/config.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/config.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/internal/earlyconfig/config.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/config.go index a9b8f9883..98b159b47 100644 --- a/vendor/github.com/hashicorp/terraform/internal/earlyconfig/config.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/config.go @@ -6,10 +6,10 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-config-inspect/tfconfig" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/moduledeps" - "github.com/hashicorp/terraform/plugin/discovery" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps" + "github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // A Config is a node in the tree of modules within a configuration. diff --git a/vendor/github.com/hashicorp/terraform/internal/earlyconfig/config_build.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/config_build.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/internal/earlyconfig/config_build.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/config_build.go index 770d5dfbe..3707f2738 100644 --- a/vendor/github.com/hashicorp/terraform/internal/earlyconfig/config_build.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/config_build.go @@ -7,8 +7,8 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-config-inspect/tfconfig" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // BuildConfig constructs a Config from a root module by loading all of its diff --git a/vendor/github.com/hashicorp/terraform/internal/earlyconfig/diagnostics.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/diagnostics.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/internal/earlyconfig/diagnostics.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/diagnostics.go index 9b2fd7f71..b2e1807eb 100644 --- a/vendor/github.com/hashicorp/terraform/internal/earlyconfig/diagnostics.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/diagnostics.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/terraform-config-inspect/tfconfig" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) func wrapDiagnostics(diags tfconfig.Diagnostics) tfdiags.Diagnostics { diff --git a/vendor/github.com/hashicorp/terraform/internal/earlyconfig/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/earlyconfig/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/doc.go diff --git a/vendor/github.com/hashicorp/terraform/internal/earlyconfig/module.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/module.go similarity index 83% rename from vendor/github.com/hashicorp/terraform/internal/earlyconfig/module.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/module.go index d2d628797..11eff2eb6 100644 --- a/vendor/github.com/hashicorp/terraform/internal/earlyconfig/module.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig/module.go @@ -2,7 +2,7 @@ package earlyconfig import ( "github.com/hashicorp/terraform-config-inspect/tfconfig" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // LoadModule loads some top-level metadata for the module in the given diff --git a/vendor/github.com/hashicorp/terraform/flatmap/expand.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/flatmap/expand.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/flatmap/expand.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/flatmap/expand.go index b9d15461e..1bb7b9f2f 100644 --- a/vendor/github.com/hashicorp/terraform/flatmap/expand.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/flatmap/expand.go @@ -6,7 +6,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/terraform/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" ) // Expand takes a map and a key (prefix) and expands that value into diff --git a/vendor/github.com/hashicorp/terraform/flatmap/flatten.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/flatmap/flatten.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/flatmap/flatten.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/flatmap/flatten.go diff --git a/vendor/github.com/hashicorp/terraform/flatmap/map.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/flatmap/map.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/flatmap/map.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/flatmap/map.go diff --git a/vendor/github.com/hashicorp/terraform/helper/config/decode.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/config/decode.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/config/decode.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/config/decode.go diff --git a/vendor/github.com/hashicorp/terraform/helper/config/validator.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/config/validator.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/helper/config/validator.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/config/validator.go index 1a6e023b6..35a3e7a49 100644 --- a/vendor/github.com/hashicorp/terraform/helper/config/validator.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/config/validator.go @@ -5,8 +5,8 @@ import ( "strconv" "strings" - "github.com/hashicorp/terraform/flatmap" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/internal/flatmap" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // Validator is a helper that helps you validate the configuration diff --git a/vendor/github.com/hashicorp/terraform/helper/didyoumean/name_suggestion.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/didyoumean/name_suggestion.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/didyoumean/name_suggestion.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/didyoumean/name_suggestion.go diff --git a/vendor/github.com/hashicorp/terraform/helper/plugin/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/helper/plugin/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/doc.go diff --git a/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go index f32610c6c..388f1ed59 100644 --- a/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/grpc_provider.go @@ -11,13 +11,13 @@ import ( "github.com/zclconf/go-cty/cty/msgpack" context "golang.org/x/net/context" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/helper/schema" - proto "github.com/hashicorp/terraform/internal/tfplugin5" - "github.com/hashicorp/terraform/plans/objchange" - "github.com/hashicorp/terraform/plugin/convert" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange" + "github.com/hashicorp/terraform-plugin-sdk/internal/plugin/convert" + proto "github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) const newExtraKey = "_new_extra_shim" diff --git a/vendor/github.com/hashicorp/terraform/helper/plugin/unknown.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/unknown.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/helper/plugin/unknown.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/unknown.go index 64a6784e8..a22a264fa 100644 --- a/vendor/github.com/hashicorp/terraform/helper/plugin/unknown.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin/unknown.go @@ -3,7 +3,7 @@ package plugin import ( "fmt" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/httpclient/useragent.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/httpclient/client.go similarity index 66% rename from vendor/github.com/hashicorp/terraform/httpclient/useragent.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/httpclient/client.go index 536703c6b..ad8d626c6 100644 --- a/vendor/github.com/hashicorp/terraform/httpclient/useragent.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/httpclient/client.go @@ -7,25 +7,22 @@ import ( "os" "strings" - "github.com/hashicorp/terraform/version" + cleanhttp "github.com/hashicorp/go-cleanhttp" + "github.com/hashicorp/terraform-plugin-sdk/internal/version" ) -const userAgentFormat = "Terraform/%s" const uaEnvVar = "TF_APPEND_USER_AGENT" +const userAgentFormat = "Terraform/%s" -// Deprecated: Use UserAgent(version) instead -func UserAgentString() string { - ua := fmt.Sprintf(userAgentFormat, version.Version) - - if add := os.Getenv(uaEnvVar); add != "" { - add = strings.TrimSpace(add) - if len(add) > 0 { - ua += " " + add - log.Printf("[DEBUG] Using modified User-Agent: %s", ua) - } +// New returns the DefaultPooledClient from the cleanhttp +// package that will also send a Terraform User-Agent string. +func New() *http.Client { + cli := cleanhttp.DefaultPooledClient() + cli.Transport = &userAgentRoundTripper{ + userAgent: UserAgentString(), + inner: cli.Transport, } - - return ua + return cli } type userAgentRoundTripper struct { @@ -41,8 +38,8 @@ func (rt *userAgentRoundTripper) RoundTrip(req *http.Request) (*http.Response, e return rt.inner.RoundTrip(req) } -func TerraformUserAgent(version string) string { - ua := fmt.Sprintf("HashiCorp Terraform/%s (+https://www.terraform.io)", version) +func UserAgentString() string { + ua := fmt.Sprintf(userAgentFormat, version.Version) if add := os.Getenv(uaEnvVar); add != "" { add = strings.TrimSpace(add) diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/copy_dir.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/copy_dir.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/initwd/copy_dir.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/copy_dir.go diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/initwd/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/doc.go diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/from_module.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/from_module.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/internal/initwd/from_module.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/from_module.go index 6b40d08d6..641e71dec 100644 --- a/vendor/github.com/hashicorp/terraform/internal/initwd/from_module.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/from_module.go @@ -2,7 +2,7 @@ package initwd import ( "fmt" - "github.com/hashicorp/terraform/internal/earlyconfig" + "github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig" "io/ioutil" "log" "os" @@ -12,9 +12,9 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-config-inspect/tfconfig" - "github.com/hashicorp/terraform/internal/modsdir" - "github.com/hashicorp/terraform/registry" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/modsdir" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) const initFromModuleRootCallName = "root" diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/getter.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/getter.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/internal/initwd/getter.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/getter.go index 2f306be73..8dc0374b1 100644 --- a/vendor/github.com/hashicorp/terraform/internal/initwd/getter.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/getter.go @@ -9,7 +9,7 @@ import ( cleanhttp "github.com/hashicorp/go-cleanhttp" getter "github.com/hashicorp/go-getter" - "github.com/hashicorp/terraform/registry/regsrc" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc" ) // We configure our own go-getter detector and getter sets here, because @@ -19,14 +19,6 @@ import ( // any meddling that might be done by other go-getter callers linked into our // executable. -var goGetterDetectors = []getter.Detector{ - new(getter.GitHubDetector), - new(getter.BitBucketDetector), - new(getter.GCSDetector), - new(getter.S3Detector), - new(getter.FileDetector), -} - var goGetterNoDetectors = []getter.Detector{} var goGetterDecompressors = map[string]getter.Decompressor{ diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/inode.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/inode.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/initwd/inode.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/inode.go diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/inode_freebsd.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/inode_freebsd.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/initwd/inode_freebsd.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/inode_freebsd.go diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/inode_windows.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/inode_windows.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/initwd/inode_windows.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/inode_windows.go diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/load_config.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/load_config.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/internal/initwd/load_config.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/load_config.go index 6f77dcd84..02c3c6f70 100644 --- a/vendor/github.com/hashicorp/terraform/internal/initwd/load_config.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/load_config.go @@ -5,9 +5,9 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-config-inspect/tfconfig" - "github.com/hashicorp/terraform/internal/earlyconfig" - "github.com/hashicorp/terraform/internal/modsdir" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig" + "github.com/hashicorp/terraform-plugin-sdk/internal/modsdir" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // LoadConfig loads a full configuration tree that has previously had all of diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/module_install.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/module_install.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/internal/initwd/module_install.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/module_install.go index 531310ab8..8e0557567 100644 --- a/vendor/github.com/hashicorp/terraform/internal/initwd/module_install.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/module_install.go @@ -9,12 +9,12 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-config-inspect/tfconfig" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/internal/earlyconfig" - "github.com/hashicorp/terraform/internal/modsdir" - "github.com/hashicorp/terraform/registry" - "github.com/hashicorp/terraform/registry/regsrc" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig" + "github.com/hashicorp/terraform-plugin-sdk/internal/modsdir" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) type ModuleInstaller struct { diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/module_install_hooks.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/module_install_hooks.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/initwd/module_install_hooks.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/module_install_hooks.go diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/testing.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/testing.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/internal/initwd/testing.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/testing.go index 8cef80a35..c4c67fd18 100644 --- a/vendor/github.com/hashicorp/terraform/internal/initwd/testing.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/testing.go @@ -1,12 +1,12 @@ package initwd import ( - "github.com/hashicorp/terraform/registry" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry" "testing" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/configs/configload" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // LoadConfigForTests is a convenience wrapper around configload.NewLoaderForTests, diff --git a/vendor/github.com/hashicorp/terraform/internal/initwd/version_required.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/version_required.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/internal/initwd/version_required.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/version_required.go index 104840b93..803fb4b52 100644 --- a/vendor/github.com/hashicorp/terraform/internal/initwd/version_required.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/initwd/version_required.go @@ -4,9 +4,9 @@ import ( "fmt" version "github.com/hashicorp/go-version" - "github.com/hashicorp/terraform/internal/earlyconfig" - "github.com/hashicorp/terraform/tfdiags" - tfversion "github.com/hashicorp/terraform/version" + "github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" + tfversion "github.com/hashicorp/terraform-plugin-sdk/internal/version" ) // CheckCoreVersionRequirements visits each of the modules in the given diff --git a/vendor/github.com/hashicorp/terraform/lang/blocktoattr/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/lang/blocktoattr/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/doc.go diff --git a/vendor/github.com/hashicorp/terraform/lang/blocktoattr/fixup.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/fixup.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/lang/blocktoattr/fixup.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/fixup.go index 0af708ec4..18db20185 100644 --- a/vendor/github.com/hashicorp/terraform/lang/blocktoattr/fixup.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/fixup.go @@ -1,9 +1,9 @@ package blocktoattr import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcldec" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/lang/blocktoattr/schema.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/schema.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/lang/blocktoattr/schema.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/schema.go index 31e010cc7..d6048cf13 100644 --- a/vendor/github.com/hashicorp/terraform/lang/blocktoattr/schema.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/schema.go @@ -1,8 +1,8 @@ package blocktoattr import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/lang/blocktoattr/variables.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/variables.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/lang/blocktoattr/variables.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/variables.go index ae5c609df..065139b9a 100644 --- a/vendor/github.com/hashicorp/terraform/lang/blocktoattr/variables.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/variables.go @@ -1,10 +1,10 @@ package blocktoattr import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/ext/dynblock" - "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/hcl2/ext/dynblock" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcldec" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" ) // ExpandedVariables finds all of the global variables referenced in the diff --git a/vendor/github.com/hashicorp/terraform/lang/data.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/data.go similarity index 88% rename from vendor/github.com/hashicorp/terraform/lang/data.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/data.go index ebc008e35..f7d0246ff 100644 --- a/vendor/github.com/hashicorp/terraform/lang/data.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/data.go @@ -1,8 +1,8 @@ package lang import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" ) @@ -24,7 +24,7 @@ type Data interface { GetCountAttr(addrs.CountAttr, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) GetForEachAttr(addrs.ForEachAttr, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) - GetResource(addrs.Resource, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) + GetResourceInstance(addrs.ResourceInstance, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) GetLocalValue(addrs.LocalValue, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) GetModuleInstance(addrs.ModuleCallInstance, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) GetModuleInstanceOutput(addrs.ModuleCallOutput, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) diff --git a/vendor/github.com/hashicorp/terraform/lang/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/lang/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/doc.go diff --git a/vendor/github.com/hashicorp/terraform/lang/eval.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/eval.go similarity index 88% rename from vendor/github.com/hashicorp/terraform/lang/eval.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/eval.go index bfacd671a..28552bb50 100644 --- a/vendor/github.com/hashicorp/terraform/lang/eval.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/eval.go @@ -5,13 +5,13 @@ import ( "log" "strconv" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/ext/dynblock" - "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/lang/blocktoattr" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/ext/dynblock" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcldec" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" ) @@ -194,8 +194,8 @@ func (s *Scope) evalContext(refs []*addrs.Reference, selfAddr addrs.Referenceabl // it, since that allows us to gather a full set of any errors and // warnings, but once we've gathered all the data we'll then skip anything // that's redundant in the process of populating our values map. - dataResources := map[string]map[string]cty.Value{} - managedResources := map[string]map[string]cty.Value{} + dataResources := map[string]map[string]map[addrs.InstanceKey]cty.Value{} + managedResources := map[string]map[string]map[addrs.InstanceKey]cty.Value{} wholeModules := map[string]map[addrs.InstanceKey]cty.Value{} moduleOutputs := map[string]map[addrs.InstanceKey]map[string]cty.Value{} inputVariables := map[string]cty.Value{} @@ -208,6 +208,7 @@ func (s *Scope) evalContext(refs []*addrs.Reference, selfAddr addrs.Referenceabl for _, ref := range refs { rng := ref.SourceRange + isSelf := false rawSubj := ref.Subject if rawSubj == addrs.Self { @@ -225,64 +226,45 @@ func (s *Scope) evalContext(refs []*addrs.Reference, selfAddr addrs.Referenceabl continue } - if selfAddr == addrs.Self { + // Treat "self" as an alias for the configured self address. + rawSubj = selfAddr + isSelf = true + + if rawSubj == addrs.Self { // Programming error: the self address cannot alias itself. panic("scope SelfAddr attempting to alias itself") } - - // self can only be used within a resource instance - subj := selfAddr.(addrs.ResourceInstance) - - val, valDiags := normalizeRefValue(s.Data.GetResource(subj.ContainingResource(), rng)) - - diags = diags.Append(valDiags) - - // Self is an exception in that it must always resolve to a - // particular instance. We will still insert the full resource into - // the context below. - var hclDiags hcl.Diagnostics - // We should always have a valid self index by this point, but in - // the case of an error, self may end up as a cty.DynamicValue. - switch k := subj.Key.(type) { - case addrs.IntKey: - self, hclDiags = hcl.Index(val, cty.NumberIntVal(int64(k)), ref.SourceRange.ToHCL().Ptr()) - diags.Append(hclDiags) - case addrs.StringKey: - self, hclDiags = hcl.Index(val, cty.StringVal(string(k)), ref.SourceRange.ToHCL().Ptr()) - diags.Append(hclDiags) - default: - self = val - } - continue } // This type switch must cover all of the "Referenceable" implementations - // in package addrs, however we are removing the possibility of - // ResourceInstance beforehand. - if addr, ok := rawSubj.(addrs.ResourceInstance); ok { - rawSubj = addr.ContainingResource() - } - + // in package addrs. switch subj := rawSubj.(type) { - case addrs.Resource: - var into map[string]map[string]cty.Value - switch subj.Mode { + + case addrs.ResourceInstance: + var into map[string]map[string]map[addrs.InstanceKey]cty.Value + switch subj.Resource.Mode { case addrs.ManagedResourceMode: into = managedResources case addrs.DataResourceMode: into = dataResources default: - panic(fmt.Errorf("unsupported ResourceMode %s", subj.Mode)) + panic(fmt.Errorf("unsupported ResourceMode %s", subj.Resource.Mode)) } - val, valDiags := normalizeRefValue(s.Data.GetResource(subj, rng)) + val, valDiags := normalizeRefValue(s.Data.GetResourceInstance(subj, rng)) diags = diags.Append(valDiags) - r := subj + r := subj.Resource if into[r.Type] == nil { - into[r.Type] = make(map[string]cty.Value) + into[r.Type] = make(map[string]map[addrs.InstanceKey]cty.Value) + } + if into[r.Type][r.Name] == nil { + into[r.Type][r.Name] = make(map[addrs.InstanceKey]cty.Value) + } + into[r.Type][r.Name][subj.Key] = val + if isSelf { + self = val } - into[r.Type][r.Name] = val case addrs.ModuleCallInstance: val, valDiags := normalizeRefValue(s.Data.GetModuleInstance(subj, rng)) @@ -292,6 +274,9 @@ func (s *Scope) evalContext(refs []*addrs.Reference, selfAddr addrs.Referenceabl wholeModules[subj.Call.Name] = make(map[addrs.InstanceKey]cty.Value) } wholeModules[subj.Call.Name][subj.Key] = val + if isSelf { + self = val + } case addrs.ModuleCallOutput: val, valDiags := normalizeRefValue(s.Data.GetModuleInstanceOutput(subj, rng)) @@ -306,36 +291,57 @@ func (s *Scope) evalContext(refs []*addrs.Reference, selfAddr addrs.Referenceabl moduleOutputs[callName][callKey] = make(map[string]cty.Value) } moduleOutputs[callName][callKey][subj.Name] = val + if isSelf { + self = val + } case addrs.InputVariable: val, valDiags := normalizeRefValue(s.Data.GetInputVariable(subj, rng)) diags = diags.Append(valDiags) inputVariables[subj.Name] = val + if isSelf { + self = val + } case addrs.LocalValue: val, valDiags := normalizeRefValue(s.Data.GetLocalValue(subj, rng)) diags = diags.Append(valDiags) localValues[subj.Name] = val + if isSelf { + self = val + } case addrs.PathAttr: val, valDiags := normalizeRefValue(s.Data.GetPathAttr(subj, rng)) diags = diags.Append(valDiags) pathAttrs[subj.Name] = val + if isSelf { + self = val + } case addrs.TerraformAttr: val, valDiags := normalizeRefValue(s.Data.GetTerraformAttr(subj, rng)) diags = diags.Append(valDiags) terraformAttrs[subj.Name] = val + if isSelf { + self = val + } case addrs.CountAttr: val, valDiags := normalizeRefValue(s.Data.GetCountAttr(subj, rng)) diags = diags.Append(valDiags) countAttrs[subj.Name] = val + if isSelf { + self = val + } case addrs.ForEachAttr: val, valDiags := normalizeRefValue(s.Data.GetForEachAttr(subj, rng)) diags = diags.Append(valDiags) forEachAttrs[subj.Name] = val + if isSelf { + self = val + } default: // Should never happen @@ -361,9 +367,13 @@ func (s *Scope) evalContext(refs []*addrs.Reference, selfAddr addrs.Referenceabl return ctx, diags } -func buildResourceObjects(resources map[string]map[string]cty.Value) map[string]cty.Value { +func buildResourceObjects(resources map[string]map[string]map[addrs.InstanceKey]cty.Value) map[string]cty.Value { vals := make(map[string]cty.Value) - for typeName, nameVals := range resources { + for typeName, names := range resources { + nameVals := make(map[string]cty.Value) + for name, keys := range names { + nameVals[name] = buildInstanceObjects(keys) + } vals[typeName] = cty.ObjectVal(nameVals) } return vals diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/cidr.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/cidr.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/lang/funcs/cidr.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/cidr.go diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/collection.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/collection.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/lang/funcs/collection.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/collection.go index 2ea416875..e6898457b 100644 --- a/vendor/github.com/hashicorp/terraform/lang/funcs/collection.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/collection.go @@ -940,7 +940,7 @@ var ReverseFunc = function.New(&function.Spec{ }, }) -// SetProductFunc calculates the Cartesian product of two or more sets or +// SetProductFunc calculates the cartesian product of two or more sets or // sequences. If the arguments are all lists then the result is a list of tuples, // preserving the ordering of all of the input lists. Otherwise the result is a // set of tuples. @@ -1179,6 +1179,7 @@ func sliceIndexes(args []cty.Value) (int, int, bool, error) { return startIndex, endIndex, startKnown && endKnown, nil } +// TransposeFunc contructs a function that takes a map of lists of strings and // TransposeFunc constructs a function that takes a map of lists of strings and // swaps the keys and values to produce a new map of lists of strings. var TransposeFunc = function.New(&function.Spec{ @@ -1225,10 +1226,6 @@ var TransposeFunc = function.New(&function.Spec{ outputMap[outKey] = cty.ListVal(values) } - if len(outputMap) == 0 { - return cty.MapValEmpty(cty.List(cty.String)), nil - } - return cty.MapVal(outputMap), nil }, }) @@ -1494,7 +1491,7 @@ func Reverse(list cty.Value) (cty.Value, error) { return ReverseFunc.Call([]cty.Value{list}) } -// SetProduct computes the Cartesian product of sets or sequences. +// SetProduct computes the cartesian product of sets or sequences. func SetProduct(sets ...cty.Value) (cty.Value, error) { return SetProductFunc.Call(sets) } diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/conversion.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/conversion.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/lang/funcs/conversion.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/conversion.go diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/crypto.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/crypto.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/lang/funcs/crypto.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/crypto.go diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/datetime.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/datetime.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/lang/funcs/datetime.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/datetime.go diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/encoding.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/encoding.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/lang/funcs/encoding.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/encoding.go diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/filesystem.go similarity index 83% rename from vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/filesystem.go index 4b899cbc4..016b102d9 100644 --- a/vendor/github.com/hashicorp/terraform/lang/funcs/filesystem.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/filesystem.go @@ -8,9 +8,8 @@ import ( "path/filepath" "unicode/utf8" - "github.com/bmatcuk/doublestar" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" homedir "github.com/mitchellh/go-homedir" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/function" @@ -208,74 +207,6 @@ func MakeFileExistsFunc(baseDir string) function.Function { }) } -// MakeFileSetFunc constructs a function that takes a glob pattern -// and enumerates a file set from that pattern -func MakeFileSetFunc(baseDir string) function.Function { - return function.New(&function.Spec{ - Params: []function.Parameter{ - { - Name: "path", - Type: cty.String, - }, - { - Name: "pattern", - Type: cty.String, - }, - }, - Type: function.StaticReturnType(cty.Set(cty.String)), - Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { - path := args[0].AsString() - pattern := args[1].AsString() - - if !filepath.IsAbs(path) { - path = filepath.Join(baseDir, path) - } - - // Join the path to the glob pattern, while ensuring the full - // pattern is canonical for the host OS. The joined path is - // automatically cleaned during this operation. - pattern = filepath.Join(path, pattern) - - matches, err := doublestar.Glob(pattern) - if err != nil { - return cty.UnknownVal(cty.Set(cty.String)), fmt.Errorf("failed to glob pattern (%s): %s", pattern, err) - } - - var matchVals []cty.Value - for _, match := range matches { - fi, err := os.Stat(match) - - if err != nil { - return cty.UnknownVal(cty.Set(cty.String)), fmt.Errorf("failed to stat (%s): %s", match, err) - } - - if !fi.Mode().IsRegular() { - continue - } - - // Remove the path and file separator from matches. - match, err = filepath.Rel(path, match) - - if err != nil { - return cty.UnknownVal(cty.Set(cty.String)), fmt.Errorf("failed to trim path of match (%s): %s", match, err) - } - - // Replace any remaining file separators with forward slash (/) - // separators for cross-system compatibility. - match = filepath.ToSlash(match) - - matchVals = append(matchVals, cty.StringVal(match)) - } - - if len(matchVals) == 0 { - return cty.SetValEmpty(cty.String), nil - } - - return cty.SetVal(matchVals), nil - }, - }) -} - // BasenameFunc constructs a function that takes a string containing a filesystem path // and removes all except the last portion from it. var BasenameFunc = function.New(&function.Spec{ @@ -385,16 +316,6 @@ func FileExists(baseDir string, path cty.Value) (cty.Value, error) { return fn.Call([]cty.Value{path}) } -// FileSet enumerates a set of files given a glob pattern -// -// The underlying function implementation works relative to a particular base -// directory, so this wrapper takes a base directory string and uses it to -// construct the underlying function before calling it. -func FileSet(baseDir string, path, pattern cty.Value) (cty.Value, error) { - fn := MakeFileSetFunc(baseDir) - return fn.Call([]cty.Value{path, pattern}) -} - // FileBase64 reads the contents of the file at the given path. // // The bytes from the file are encoded as base64 before returning. diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/number.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/number.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/lang/funcs/number.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/number.go diff --git a/vendor/github.com/hashicorp/terraform/lang/funcs/string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/string.go similarity index 73% rename from vendor/github.com/hashicorp/terraform/lang/funcs/string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/string.go index 2e66be451..c9ddf19e3 100644 --- a/vendor/github.com/hashicorp/terraform/lang/funcs/string.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/string.go @@ -71,7 +71,7 @@ var SortFunc = function.New(&function.Spec{ if !listVal.IsWhollyKnown() { // If some of the element values aren't known yet then we - // can't yet predict the order of the result. + // can't yet preduct the order of the result. return cty.UnknownVal(retType), nil } if listVal.LengthInt() == 0 { // Easy path @@ -123,7 +123,7 @@ var SplitFunc = function.New(&function.Spec{ }, }) -// ChompFunc constructs a function that removes newline characters at the end of a string. +// ChompFunc constructions a function that removes newline characters at the end of a string. var ChompFunc = function.New(&function.Spec{ Params: []function.Parameter{ { @@ -138,7 +138,7 @@ var ChompFunc = function.New(&function.Spec{ }, }) -// IndentFunc constructs a function that adds a given number of spaces to the +// IndentFunc constructions a function that adds a given number of spaces to the // beginnings of all but the first line in a given multi-line string. var IndentFunc = function.New(&function.Spec{ Params: []function.Parameter{ @@ -163,7 +163,7 @@ var IndentFunc = function.New(&function.Spec{ }, }) -// ReplaceFunc constructs a function that searches a given string for another +// ReplaceFunc constructions a function that searches a given string for another // given substring, and replaces each occurence with a given replacement string. var ReplaceFunc = function.New(&function.Spec{ Params: []function.Parameter{ @@ -201,7 +201,7 @@ var ReplaceFunc = function.New(&function.Spec{ }, }) -// TitleFunc constructs a function that converts the first letter of each word +// TitleFunc constructions a function that converts the first letter of each word // in the given string to uppercase. var TitleFunc = function.New(&function.Spec{ Params: []function.Parameter{ @@ -216,7 +216,7 @@ var TitleFunc = function.New(&function.Spec{ }, }) -// TrimSpaceFunc constructs a function that removes any space characters from +// TrimSpaceFunc constructions a function that removes any space characters from // the start and end of the given string. var TrimSpaceFunc = function.New(&function.Spec{ Params: []function.Parameter{ @@ -231,69 +231,6 @@ var TrimSpaceFunc = function.New(&function.Spec{ }, }) -// TrimFunc constructs a function that removes the specified characters from -// the start and end of the given string. -var TrimFunc = function.New(&function.Spec{ - Params: []function.Parameter{ - { - Name: "str", - Type: cty.String, - }, - { - Name: "cutset", - Type: cty.String, - }, - }, - Type: function.StaticReturnType(cty.String), - Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { - str := args[0].AsString() - cutset := args[1].AsString() - return cty.StringVal(strings.Trim(str, cutset)), nil - }, -}) - -// TrimPrefixFunc constructs a function that removes the specified characters from -// the start the given string. -var TrimPrefixFunc = function.New(&function.Spec{ - Params: []function.Parameter{ - { - Name: "str", - Type: cty.String, - }, - { - Name: "prefix", - Type: cty.String, - }, - }, - Type: function.StaticReturnType(cty.String), - Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { - str := args[0].AsString() - prefix := args[1].AsString() - return cty.StringVal(strings.TrimPrefix(str, prefix)), nil - }, -}) - -// TrimSuffixFunc constructs a function that removes the specified characters from -// the end of the given string. -var TrimSuffixFunc = function.New(&function.Spec{ - Params: []function.Parameter{ - { - Name: "str", - Type: cty.String, - }, - { - Name: "suffix", - Type: cty.String, - }, - }, - Type: function.StaticReturnType(cty.String), - Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { - str := args[0].AsString() - cutset := args[1].AsString() - return cty.StringVal(strings.TrimSuffix(str, cutset)), nil - }, -}) - // Join concatenates together the string elements of one or more lists with a // given separator. func Join(sep cty.Value, lists ...cty.Value) (cty.Value, error) { @@ -341,18 +278,3 @@ func Title(str cty.Value) (cty.Value, error) { func TrimSpace(str cty.Value) (cty.Value, error) { return TrimSpaceFunc.Call([]cty.Value{str}) } - -// Trim removes the specified characters from the start and end of the given string. -func Trim(str, cutset cty.Value) (cty.Value, error) { - return TrimFunc.Call([]cty.Value{str, cutset}) -} - -// TrimPrefix removes the specified prefix from the start of the given string. -func TrimPrefix(str, prefix cty.Value) (cty.Value, error) { - return TrimPrefixFunc.Call([]cty.Value{str, prefix}) -} - -// TrimSuffix removes the specified suffix from the end of the given string. -func TrimSuffix(str, suffix cty.Value) (cty.Value, error) { - return TrimSuffixFunc.Call([]cty.Value{str, suffix}) -} diff --git a/vendor/github.com/hashicorp/terraform/lang/functions.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/functions.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/lang/functions.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/functions.go index fd820df04..a3c490664 100644 --- a/vendor/github.com/hashicorp/terraform/lang/functions.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/functions.go @@ -1,14 +1,12 @@ package lang import ( - "fmt" - ctyyaml "github.com/zclconf/go-cty-yaml" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/function" "github.com/zclconf/go-cty/cty/function/stdlib" - "github.com/hashicorp/terraform/lang/funcs" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs" ) var impureFunctions = []string{ @@ -57,7 +55,6 @@ func (s *Scope) Functions() map[string]function.Function { "chunklist": funcs.ChunklistFunc, "file": funcs.MakeFileFunc(s.BaseDir, false), "fileexists": funcs.MakeFileExistsFunc(s.BaseDir), - "fileset": funcs.MakeFileSetFunc(s.BaseDir), "filebase64": funcs.MakeFileFunc(s.BaseDir, true), "filebase64sha256": funcs.MakeFileBase64Sha256Func(s.BaseDir), "filebase64sha512": funcs.MakeFileBase64Sha512Func(s.BaseDir), @@ -118,10 +115,7 @@ func (s *Scope) Functions() map[string]function.Function { "tolist": funcs.MakeToFunc(cty.List(cty.DynamicPseudoType)), "tomap": funcs.MakeToFunc(cty.Map(cty.DynamicPseudoType)), "transpose": funcs.TransposeFunc, - "trim": funcs.TrimFunc, - "trimprefix": funcs.TrimPrefixFunc, "trimspace": funcs.TrimSpaceFunc, - "trimsuffix": funcs.TrimSuffixFunc, "upper": stdlib.UpperFunc, "urlencode": funcs.URLEncodeFunc, "uuid": funcs.UUIDFunc, @@ -150,12 +144,3 @@ func (s *Scope) Functions() map[string]function.Function { return s.funcs } - -var unimplFunc = function.New(&function.Spec{ - Type: func([]cty.Value) (cty.Type, error) { - return cty.DynamicPseudoType, fmt.Errorf("function not yet implemented") - }, - Impl: func([]cty.Value, cty.Type) (cty.Value, error) { - return cty.DynamicVal, fmt.Errorf("function not yet implemented") - }, -}) diff --git a/vendor/github.com/hashicorp/terraform/lang/references.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/references.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/lang/references.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/references.go index 569251cb8..8df09e9a8 100644 --- a/vendor/github.com/hashicorp/terraform/lang/references.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/references.go @@ -1,11 +1,11 @@ package lang import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/lang/blocktoattr" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // References finds all of the references in the given set of traversals, diff --git a/vendor/github.com/hashicorp/terraform/lang/scope.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/scope.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/lang/scope.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/scope.go index 98fca6baa..a720cca68 100644 --- a/vendor/github.com/hashicorp/terraform/lang/scope.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/scope.go @@ -5,7 +5,7 @@ import ( "github.com/zclconf/go-cty/cty/function" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // Scope is the main type in this package, allowing dynamic evaluation of diff --git a/vendor/github.com/hashicorp/terraform/internal/modsdir/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/modsdir/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/modsdir/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/modsdir/doc.go diff --git a/vendor/github.com/hashicorp/terraform/internal/modsdir/manifest.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/modsdir/manifest.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/internal/modsdir/manifest.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/modsdir/manifest.go index 36f6c033f..2d45c8520 100644 --- a/vendor/github.com/hashicorp/terraform/internal/modsdir/manifest.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/modsdir/manifest.go @@ -11,7 +11,7 @@ import ( version "github.com/hashicorp/go-version" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // Record represents some metadata about an installed module, as part diff --git a/vendor/github.com/hashicorp/terraform/internal/modsdir/paths.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/modsdir/paths.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/modsdir/paths.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/modsdir/paths.go diff --git a/vendor/github.com/hashicorp/terraform/moduledeps/dependencies.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps/dependencies.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/moduledeps/dependencies.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps/dependencies.go index 87c8431ea..c80588718 100644 --- a/vendor/github.com/hashicorp/terraform/moduledeps/dependencies.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps/dependencies.go @@ -1,7 +1,7 @@ package moduledeps import ( - "github.com/hashicorp/terraform/plugin/discovery" + "github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery" ) // Providers describes a set of provider dependencies for a given module. diff --git a/vendor/github.com/hashicorp/terraform/moduledeps/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/moduledeps/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps/doc.go diff --git a/vendor/github.com/hashicorp/terraform/moduledeps/module.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps/module.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/moduledeps/module.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps/module.go index d6cbaf5c5..388a2ce1f 100644 --- a/vendor/github.com/hashicorp/terraform/moduledeps/module.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps/module.go @@ -4,7 +4,7 @@ import ( "sort" "strings" - "github.com/hashicorp/terraform/plugin/discovery" + "github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery" ) // Module represents the dependencies of a single module, as well being diff --git a/vendor/github.com/hashicorp/terraform/moduledeps/provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps/provider.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/moduledeps/provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps/provider.go diff --git a/vendor/github.com/hashicorp/terraform/plans/action.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/action.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plans/action.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/action.go diff --git a/vendor/github.com/hashicorp/terraform/plans/action_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/action_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plans/action_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/action_string.go diff --git a/vendor/github.com/hashicorp/terraform/plans/changes.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/plans/changes.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes.go index d7e0dcdb8..5c2028c83 100644 --- a/vendor/github.com/hashicorp/terraform/plans/changes.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes.go @@ -1,8 +1,8 @@ package plans import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/plans/changes_src.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes_src.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/plans/changes_src.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes_src.go index 90153ea7b..97bc8da7c 100644 --- a/vendor/github.com/hashicorp/terraform/plans/changes_src.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes_src.go @@ -3,8 +3,8 @@ package plans import ( "fmt" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/plans/changes_state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes_state.go similarity index 88% rename from vendor/github.com/hashicorp/terraform/plans/changes_state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes_state.go index 543e6c2bd..c4fd3b0f4 100644 --- a/vendor/github.com/hashicorp/terraform/plans/changes_state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes_state.go @@ -1,7 +1,7 @@ package plans import ( - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // PlannedState merges the set of changes described by the receiver into the diff --git a/vendor/github.com/hashicorp/terraform/plans/changes_sync.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes_sync.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/plans/changes_sync.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes_sync.go index 6b4ff98ff..89cc1ab22 100644 --- a/vendor/github.com/hashicorp/terraform/plans/changes_sync.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/changes_sync.go @@ -4,8 +4,8 @@ import ( "fmt" "sync" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // ChangesSync is a wrapper around a Changes that provides a concurrency-safe diff --git a/vendor/github.com/hashicorp/terraform/plans/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plans/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/doc.go diff --git a/vendor/github.com/hashicorp/terraform/plans/dynamic_value.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/dynamic_value.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plans/dynamic_value.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/dynamic_value.go diff --git a/vendor/github.com/hashicorp/terraform/plans/objchange/all_null.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/all_null.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/plans/objchange/all_null.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/all_null.go index 18a7e99a3..ba9cc9611 100644 --- a/vendor/github.com/hashicorp/terraform/plans/objchange/all_null.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/all_null.go @@ -1,7 +1,7 @@ package objchange import ( - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/plans/objchange/compatible.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/compatible.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/plans/objchange/compatible.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/compatible.go index d85086c97..36a7d496c 100644 --- a/vendor/github.com/hashicorp/terraform/plans/objchange/compatible.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/compatible.go @@ -7,7 +7,7 @@ import ( "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" ) // AssertObjectCompatible checks whether the given "actual" value is a valid diff --git a/vendor/github.com/hashicorp/terraform/plans/objchange/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plans/objchange/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/doc.go diff --git a/vendor/github.com/hashicorp/terraform/plans/objchange/lcs.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/lcs.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plans/objchange/lcs.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/lcs.go diff --git a/vendor/github.com/hashicorp/terraform/plans/objchange/normalize_obj.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/normalize_obj.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/plans/objchange/normalize_obj.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/normalize_obj.go index c23f44dac..a8629046c 100644 --- a/vendor/github.com/hashicorp/terraform/plans/objchange/normalize_obj.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/normalize_obj.go @@ -1,7 +1,7 @@ package objchange import ( - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/plans/objchange/objchange.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/objchange.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/plans/objchange/objchange.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/objchange.go index 5a8af1481..879fc93a1 100644 --- a/vendor/github.com/hashicorp/terraform/plans/objchange/objchange.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/objchange.go @@ -5,7 +5,7 @@ import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" ) // ProposedNewObject constructs a proposed new object value by combining the diff --git a/vendor/github.com/hashicorp/terraform/plans/objchange/plan_valid.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/plan_valid.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/plans/objchange/plan_valid.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/plan_valid.go index 69acb8979..905a91142 100644 --- a/vendor/github.com/hashicorp/terraform/plans/objchange/plan_valid.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange/plan_valid.go @@ -5,7 +5,7 @@ import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" ) // AssertPlanValid checks checks whether a planned new state returned by a diff --git a/vendor/github.com/hashicorp/terraform/plans/plan.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/plan.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/plans/plan.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/plan.go index 5a3e4548e..0abed56a0 100644 --- a/vendor/github.com/hashicorp/terraform/plans/plan.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/plan.go @@ -3,8 +3,8 @@ package plans import ( "sort" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/plugin/convert/diagnostics.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/convert/diagnostics.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/plugin/convert/diagnostics.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/convert/diagnostics.go index 51cb2fe2f..f20f0507e 100644 --- a/vendor/github.com/hashicorp/terraform/plugin/convert/diagnostics.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/convert/diagnostics.go @@ -1,8 +1,8 @@ package convert import ( - proto "github.com/hashicorp/terraform/internal/tfplugin5" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" + proto "github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/plugin/convert/schema.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/convert/schema.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/plugin/convert/schema.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/convert/schema.go index 6a45f54c9..105c32c6f 100644 --- a/vendor/github.com/hashicorp/terraform/plugin/convert/schema.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/convert/schema.go @@ -5,9 +5,9 @@ import ( "reflect" "sort" - "github.com/hashicorp/terraform/configs/configschema" - proto "github.com/hashicorp/terraform/internal/tfplugin5" - "github.com/hashicorp/terraform/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + proto "github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5" ) // ConfigSchemaToProto takes a *configschema.Block and converts it to a diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/error.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/error.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/error.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/error.go diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/find.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/find.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/find.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/find.go diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/get.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/get.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/get.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/get.go index 9aaf50fc9..ff90a266a 100644 --- a/vendor/github.com/hashicorp/terraform/plugin/discovery/get.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/get.go @@ -16,25 +16,21 @@ import ( "github.com/hashicorp/errwrap" getter "github.com/hashicorp/go-getter" multierror "github.com/hashicorp/go-multierror" - "github.com/hashicorp/terraform-svchost/disco" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/httpclient" - "github.com/hashicorp/terraform/registry" - "github.com/hashicorp/terraform/registry/regsrc" - "github.com/hashicorp/terraform/registry/response" - "github.com/hashicorp/terraform/tfdiags" - tfversion "github.com/hashicorp/terraform/version" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/httpclient" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry/response" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" + tfversion "github.com/hashicorp/terraform-plugin-sdk/internal/version" "github.com/mitchellh/cli" ) // Releases are located by querying the terraform registry. -const protocolVersionHeader = "x-terraform-protocol-version" - var httpClient *http.Client -var errVersionNotFound = errors.New("version not found") - func init() { httpClient = httpclient.New() @@ -50,7 +46,7 @@ func init() { // An Installer maintains a local cache of plugins by downloading plugins // from an online repository. type Installer interface { - Get(provider addrs.Provider, req Constraints) (PluginMeta, tfdiags.Diagnostics, error) + Get(provider addrs.ProviderType, req Constraints) (PluginMeta, tfdiags.Diagnostics, error) PurgeUnused(used map[string]PluginMeta) (removed PluginMetaSet, err error) } @@ -107,7 +103,7 @@ type ProviderInstaller struct { // are produced under the assumption that if presented to the user they will // be presented alongside context about what is being installed, and thus the // error messages do not redundantly include such information. -func (i *ProviderInstaller) Get(provider addrs.Provider, req Constraints) (PluginMeta, tfdiags.Diagnostics, error) { +func (i *ProviderInstaller) Get(provider addrs.ProviderType, req Constraints) (PluginMeta, tfdiags.Diagnostics, error) { var diags tfdiags.Diagnostics // a little bit of initialization. @@ -232,7 +228,7 @@ func (i *ProviderInstaller) Get(provider addrs.Provider, req Constraints) (Plugi } } - printedProviderName := fmt.Sprintf("%q (%s)", provider.LegacyString(), providerSource) + printedProviderName := fmt.Sprintf("%q (%s)", provider.Name, providerSource) i.Ui.Info(fmt.Sprintf("- Downloading plugin for provider %s %s...", printedProviderName, versionMeta.Version)) log.Printf("[DEBUG] getting provider %s version %q", printedProviderName, versionMeta.Version) err = i.install(provider, v, providerURL) @@ -244,11 +240,11 @@ func (i *ProviderInstaller) Get(provider addrs.Provider, req Constraints) (Plugi // (This is weird, because go-getter doesn't directly return // information about what was extracted, and we just extracted // the archive directly into a shared dir here.) - log.Printf("[DEBUG] looking for the %s %s plugin we just installed", provider.LegacyString(), versionMeta.Version) + log.Printf("[DEBUG] looking for the %s %s plugin we just installed", provider.Name, versionMeta.Version) metas := FindPlugins("provider", []string{i.Dir}) log.Printf("[DEBUG] all plugins found %#v", metas) metas, _ = metas.ValidateVersions() - metas = metas.WithName(provider.Type).WithVersion(v) + metas = metas.WithName(provider.Name).WithVersion(v) log.Printf("[DEBUG] filtered plugins %#v", metas) if metas.Count() == 0 { // This should never happen. Suggests that the release archive @@ -276,18 +272,18 @@ func (i *ProviderInstaller) Get(provider addrs.Provider, req Constraints) (Plugi return metas.Newest(), diags, nil } -func (i *ProviderInstaller) install(provider addrs.Provider, version Version, url string) error { +func (i *ProviderInstaller) install(provider addrs.ProviderType, version Version, url string) error { if i.Cache != nil { - log.Printf("[DEBUG] looking for provider %s %s in plugin cache", provider.LegacyString(), version) - cached := i.Cache.CachedPluginPath("provider", provider.Type, version) + log.Printf("[DEBUG] looking for provider %s %s in plugin cache", provider.Name, version) + cached := i.Cache.CachedPluginPath("provider", provider.Name, version) if cached == "" { - log.Printf("[DEBUG] %s %s not yet in cache, so downloading %s", provider.LegacyString(), version, url) + log.Printf("[DEBUG] %s %s not yet in cache, so downloading %s", provider.Name, version, url) err := getter.Get(i.Cache.InstallDir(), url) if err != nil { return err } // should now be in cache - cached = i.Cache.CachedPluginPath("provider", provider.Type, version) + cached = i.Cache.CachedPluginPath("provider", provider.Name, version) if cached == "" { // should never happen if the getter is behaving properly // and the plugins are packaged properly. @@ -308,7 +304,7 @@ func (i *ProviderInstaller) install(provider addrs.Provider, version Version, ur return err } - log.Printf("[DEBUG] installing %s %s to %s from local cache %s", provider.LegacyString(), version, targetPath, cached) + log.Printf("[DEBUG] installing %s %s to %s from local cache %s", provider.Name, version, targetPath, cached) // Delete if we can. If there's nothing there already then no harm done. // This is important because we can't create a link if there's @@ -366,7 +362,7 @@ func (i *ProviderInstaller) install(provider addrs.Provider, version Version, ur // One way or another, by the time we get here we should have either // a link or a copy of the cached plugin within i.Dir, as expected. } else { - log.Printf("[DEBUG] plugin cache is disabled, so downloading %s %s from %s", provider.LegacyString(), version, url) + log.Printf("[DEBUG] plugin cache is disabled, so downloading %s %s from %s", provider.Name, version, url) err := getter.Get(i.Dir, url) if err != nil { return err @@ -472,8 +468,8 @@ func (i *ProviderInstaller) hostname() (string, error) { } // list all versions available for the named provider -func (i *ProviderInstaller) listProviderVersions(provider addrs.Provider) (*response.TerraformProviderVersions, error) { - req := regsrc.NewTerraformProvider(provider.Type, i.OS, i.Arch) +func (i *ProviderInstaller) listProviderVersions(provider addrs.ProviderType) (*response.TerraformProviderVersions, error) { + req := regsrc.NewTerraformProvider(provider.Name, i.OS, i.Arch) versions, err := i.registry.TerraformProviderVersions(req) return versions, err } @@ -570,19 +566,6 @@ func (i *ProviderInstaller) checkPluginProtocol(versionMeta *response.TerraformP return ErrorNoVersionCompatible } -// REVIEWER QUESTION (again): this ends up swallowing a bunch of errors from -// checkPluginProtocol. Do they need to be percolated up better, or would -// debug messages would suffice in these situations? -func (i *ProviderInstaller) findPlatformCompatibleVersion(versions []*response.TerraformProviderVersion) (*response.TerraformProviderVersion, error) { - for _, version := range versions { - if err := i.checkPlatformCompatibility(version); err == nil { - return version, nil - } - } - - return nil, ErrorNoVersionCompatibleWithPlatform -} - // platformCompatibleVersions returns a list of provider versions that are // compatible with the requested platform. func (i *ProviderInstaller) platformCompatibleVersions(versions []*response.TerraformProviderVersion) []*response.TerraformProviderVersion { diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/get_cache.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/get_cache.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/get_cache.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/get_cache.go diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/hashicorp.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/hashicorp.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/hashicorp.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/hashicorp.go diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/meta.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/meta.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/meta.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/meta.go diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/meta_set.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/meta_set.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/meta_set.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/meta_set.go diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/requirements.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/requirements.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/requirements.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/requirements.go diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/signature.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/signature.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/signature.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/signature.go diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/version.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/version.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/version.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/version.go diff --git a/vendor/github.com/hashicorp/terraform/plugin/discovery/version_set.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/version_set.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/discovery/version_set.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery/version_set.go diff --git a/vendor/github.com/hashicorp/terraform/providers/addressed_types.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/addressed_types.go similarity index 88% rename from vendor/github.com/hashicorp/terraform/providers/addressed_types.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/addressed_types.go index 46bb80b60..0f48f2447 100644 --- a/vendor/github.com/hashicorp/terraform/providers/addressed_types.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/addressed_types.go @@ -3,7 +3,7 @@ package providers import ( "sort" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // AddressedTypes is a helper that extracts all of the distinct provider @@ -14,7 +14,7 @@ func AddressedTypes(providerAddrs []addrs.ProviderConfig) []string { } m := map[string]struct{}{} for _, addr := range providerAddrs { - m[addr.Type.LegacyString()] = struct{}{} + m[addr.Type] = struct{}{} } names := make([]string, 0, len(m)) @@ -34,7 +34,7 @@ func AddressedTypesAbs(providerAddrs []addrs.AbsProviderConfig) []string { } m := map[string]struct{}{} for _, addr := range providerAddrs { - m[addr.ProviderConfig.Type.LegacyString()] = struct{}{} + m[addr.ProviderConfig.Type] = struct{}{} } names := make([]string, 0, len(m)) diff --git a/vendor/github.com/hashicorp/terraform/providers/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/providers/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/doc.go diff --git a/vendor/github.com/hashicorp/terraform/providers/provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/provider.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/providers/provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/provider.go index 7e0a74c58..3d0aa8ec9 100644 --- a/vendor/github.com/hashicorp/terraform/providers/provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/provider.go @@ -3,9 +3,9 @@ package providers import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // Interface represents the set of methods required for a complete resource diff --git a/vendor/github.com/hashicorp/terraform/providers/resolver.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/resolver.go similarity index 86% rename from vendor/github.com/hashicorp/terraform/providers/resolver.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/resolver.go index 2ef387e46..f5529ff32 100644 --- a/vendor/github.com/hashicorp/terraform/providers/resolver.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/resolver.go @@ -3,8 +3,7 @@ package providers import ( "fmt" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/plugin/discovery" + "github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery" ) // Resolver is an interface implemented by objects that are able to resolve @@ -14,17 +13,17 @@ type Resolver interface { // Given a constraint map, return a Factory for each requested provider. // If some or all of the constraints cannot be satisfied, return a non-nil // slice of errors describing the problems. - ResolveProviders(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) + ResolveProviders(reqd discovery.PluginRequirements) (map[string]Factory, []error) } // ResolverFunc wraps a callback function and turns it into a Resolver // implementation, for convenience in situations where a function and its // associated closure are sufficient as a resolver implementation. -type ResolverFunc func(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) +type ResolverFunc func(reqd discovery.PluginRequirements) (map[string]Factory, []error) // ResolveProviders implements Resolver by calling the // wrapped function. -func (f ResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) { +func (f ResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[string]Factory, []error) { return f(reqd) } @@ -35,14 +34,13 @@ func (f ResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[a // // This function is primarily used in tests, to provide mock providers or // in-process providers under test. -func ResolverFixed(factories map[addrs.Provider]Factory) Resolver { - return ResolverFunc(func(reqd discovery.PluginRequirements) (map[addrs.Provider]Factory, []error) { - ret := make(map[addrs.Provider]Factory, len(reqd)) +func ResolverFixed(factories map[string]Factory) Resolver { + return ResolverFunc(func(reqd discovery.PluginRequirements) (map[string]Factory, []error) { + ret := make(map[string]Factory, len(reqd)) var errs []error for name := range reqd { - fqn := addrs.NewLegacyProvider(name) - if factory, exists := factories[fqn]; exists { - ret[fqn] = factory + if factory, exists := factories[name]; exists { + ret[name] = factory } else { errs = append(errs, fmt.Errorf("provider %q is not available", name)) } diff --git a/vendor/github.com/hashicorp/terraform/provisioners/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/provisioners/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/provisioners/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/provisioners/doc.go diff --git a/vendor/github.com/hashicorp/terraform/provisioners/factory.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/provisioners/factory.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/provisioners/factory.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/provisioners/factory.go diff --git a/vendor/github.com/hashicorp/terraform/provisioners/provisioner.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/provisioners/provisioner.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/provisioners/provisioner.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/provisioners/provisioner.go index e53c88488..7d8f4076b 100644 --- a/vendor/github.com/hashicorp/terraform/provisioners/provisioner.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/provisioners/provisioner.go @@ -1,8 +1,8 @@ package provisioners import ( - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/registry/client.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/client.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/registry/client.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/client.go index e8f7ac111..313951b38 100644 --- a/vendor/github.com/hashicorp/terraform/registry/client.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/client.go @@ -11,12 +11,12 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-svchost" - "github.com/hashicorp/terraform-svchost/disco" - "github.com/hashicorp/terraform/httpclient" - "github.com/hashicorp/terraform/registry/regsrc" - "github.com/hashicorp/terraform/registry/response" - "github.com/hashicorp/terraform/version" + "github.com/hashicorp/terraform-plugin-sdk/internal/httpclient" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry/response" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco" + "github.com/hashicorp/terraform-plugin-sdk/internal/version" ) const ( @@ -52,8 +52,6 @@ func NewClient(services *disco.Disco, client *http.Client) *Client { services.Transport = client.Transport - services.SetUserAgent(httpclient.TerraformUserAgent(version.String())) - return &Client{ client: client, services: services, diff --git a/vendor/github.com/hashicorp/terraform/registry/errors.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/errors.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/registry/errors.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/errors.go index 3b99b34d8..8b22ec142 100644 --- a/vendor/github.com/hashicorp/terraform/registry/errors.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/errors.go @@ -3,8 +3,8 @@ package registry import ( "fmt" - "github.com/hashicorp/terraform-svchost/disco" - "github.com/hashicorp/terraform/registry/regsrc" + "github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco" ) type errModuleNotFound struct { diff --git a/vendor/github.com/hashicorp/terraform/registry/regsrc/friendly_host.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/friendly_host.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/registry/regsrc/friendly_host.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/friendly_host.go index c9bc40bee..e67942a71 100644 --- a/vendor/github.com/hashicorp/terraform/registry/regsrc/friendly_host.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/friendly_host.go @@ -4,7 +4,7 @@ import ( "regexp" "strings" - "github.com/hashicorp/terraform-svchost" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost" ) var ( diff --git a/vendor/github.com/hashicorp/terraform/registry/regsrc/module.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/module.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/registry/regsrc/module.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/module.go index c3edd7d87..4c83afadb 100644 --- a/vendor/github.com/hashicorp/terraform/registry/regsrc/module.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/module.go @@ -6,7 +6,7 @@ import ( "regexp" "strings" - "github.com/hashicorp/terraform-svchost" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost" ) var ( diff --git a/vendor/github.com/hashicorp/terraform/registry/regsrc/regsrc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/regsrc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/registry/regsrc/regsrc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/regsrc.go diff --git a/vendor/github.com/hashicorp/terraform/registry/regsrc/terraform_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/terraform_provider.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/registry/regsrc/terraform_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/terraform_provider.go index 7205d03b8..42ab3f77c 100644 --- a/vendor/github.com/hashicorp/terraform/registry/regsrc/terraform_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc/terraform_provider.go @@ -5,7 +5,7 @@ import ( "runtime" "strings" - "github.com/hashicorp/terraform-svchost" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost" ) var ( diff --git a/vendor/github.com/hashicorp/terraform/registry/response/module.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/module.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/registry/response/module.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/module.go diff --git a/vendor/github.com/hashicorp/terraform/registry/response/module_list.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/module_list.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/registry/response/module_list.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/module_list.go diff --git a/vendor/github.com/hashicorp/terraform/registry/response/module_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/module_provider.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/registry/response/module_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/module_provider.go diff --git a/vendor/github.com/hashicorp/terraform/registry/response/module_versions.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/module_versions.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/registry/response/module_versions.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/module_versions.go diff --git a/vendor/github.com/hashicorp/terraform/registry/response/pagination.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/pagination.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/registry/response/pagination.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/pagination.go diff --git a/vendor/github.com/hashicorp/terraform/registry/response/provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/provider.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/registry/response/provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/provider.go diff --git a/vendor/github.com/hashicorp/terraform/registry/response/provider_list.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/provider_list.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/registry/response/provider_list.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/provider_list.go diff --git a/vendor/github.com/hashicorp/terraform/registry/response/redirect.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/redirect.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/registry/response/redirect.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/redirect.go diff --git a/vendor/github.com/hashicorp/terraform/registry/response/terraform_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/terraform_provider.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/registry/response/terraform_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/registry/response/terraform_provider.go diff --git a/vendor/github.com/hashicorp/terraform/states/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/states/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/doc.go diff --git a/vendor/github.com/hashicorp/terraform/states/eachmode_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/eachmode_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/states/eachmode_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/eachmode_string.go diff --git a/vendor/github.com/hashicorp/terraform/states/instance_generation.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/instance_generation.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/states/instance_generation.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/instance_generation.go index 617ad4ea6..891adc003 100644 --- a/vendor/github.com/hashicorp/terraform/states/instance_generation.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/instance_generation.go @@ -18,7 +18,3 @@ type Generation interface { // CurrentGen is the Generation representing the currently-active object for // a resource instance. var CurrentGen Generation - -type currentGen struct{} - -func (g currentGen) generation() {} diff --git a/vendor/github.com/hashicorp/terraform/states/instance_object.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/instance_object.go similarity index 87% rename from vendor/github.com/hashicorp/terraform/states/instance_object.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/instance_object.go index 78e1dda93..3bb717d33 100644 --- a/vendor/github.com/hashicorp/terraform/states/instance_object.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/instance_object.go @@ -4,7 +4,7 @@ import ( "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // ResourceInstanceObject is the local representation of a specific remote @@ -29,17 +29,12 @@ type ResourceInstanceObject struct { // it was updated. Status ObjectStatus - // Dependencies is a set of absolute address to other resources this - // instance dependeded on when it was applied. This is used to construct - // the dependency relationships for an object whose configuration is no - // longer available, such as if it has been removed from configuration - // altogether, or is now deposed. - Dependencies []addrs.AbsResource - - // DependsOn corresponds to the deprecated `depends_on` field in the state. - // This field contained the configuration `depends_on` values, and some of - // the references from within a single module. - DependsOn []addrs.Referenceable + // Dependencies is a set of other addresses in the same module which + // this instance depended on when the given attributes were evaluated. + // This is used to construct the dependency relationships for an object + // whose configuration is no longer available, such as if it has been + // removed from configuration altogether, or is now deposed. + Dependencies []addrs.Referenceable } // ObjectStatus represents the status of a RemoteObject. diff --git a/vendor/github.com/hashicorp/terraform/states/instance_object_src.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/instance_object_src.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/states/instance_object_src.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/instance_object_src.go index a18cf313c..728ad80d1 100644 --- a/vendor/github.com/hashicorp/terraform/states/instance_object_src.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/instance_object_src.go @@ -4,8 +4,8 @@ import ( "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" ) // ResourceInstanceObjectSrc is a not-fully-decoded version of @@ -53,9 +53,7 @@ type ResourceInstanceObjectSrc struct { // ResourceInstanceObject. Private []byte Status ObjectStatus - Dependencies []addrs.AbsResource - // deprecated - DependsOn []addrs.Referenceable + Dependencies []addrs.Referenceable } // Decode unmarshals the raw representation of the object attributes. Pass the @@ -88,7 +86,6 @@ func (os *ResourceInstanceObjectSrc) Decode(ty cty.Type) (*ResourceInstanceObjec Value: val, Status: os.Status, Dependencies: os.Dependencies, - DependsOn: os.DependsOn, Private: os.Private, }, nil } diff --git a/vendor/github.com/hashicorp/terraform/states/module.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/module.go similarity index 82% rename from vendor/github.com/hashicorp/terraform/states/module.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/module.go index ec177edf3..8c89278c5 100644 --- a/vendor/github.com/hashicorp/terraform/states/module.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/module.go @@ -3,7 +3,7 @@ package states import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // Module is a container for the states of objects within a particular module. @@ -76,7 +76,7 @@ func (ms *Module) RemoveResource(addr addrs.Resource) { } // SetResourceInstanceCurrent saves the given instance object as the current -// generation of the resource instance with the given address, simultaneously +// generation of the resource instance with the given address, simulataneously // updating the recorded provider configuration address, dependencies, and // resource EachMode. // @@ -88,58 +88,23 @@ func (ms *Module) RemoveResource(addr addrs.Resource) { // are updated for all other instances of the same resource as a side-effect of // this call. func (ms *Module) SetResourceInstanceCurrent(addr addrs.ResourceInstance, obj *ResourceInstanceObjectSrc, provider addrs.AbsProviderConfig) { + ms.SetResourceMeta(addr.Resource, eachModeForInstanceKey(addr.Key), provider) + rs := ms.Resource(addr.Resource) - // if the resource is nil and the object is nil, don't do anything! - // you'll probably just cause issues - if obj == nil && rs == nil { - return - } - if obj == nil && rs != nil { - // does the resource have any other objects? - // if not then delete the whole resource - // When deleting the resource, ensure that its EachMode is NoEach, - // as a resource with EachList or EachMap can have 0 instances and be valid - if rs.EachMode == NoEach && len(rs.Instances) == 0 { - delete(ms.Resources, addr.Resource.String()) - return - } - // check for an existing resource, now that we've ensured that rs.Instances is more than 0/not nil - is := rs.Instance(addr.Key) - if is == nil { - // if there is no instance on the resource with this address and obj is nil, return and change nothing - return - } - // if we have an instance, update the current - is.Current = obj - if !is.HasObjects() { - // If we have no objects at all then we'll clean up. - delete(rs.Instances, addr.Key) - // Delete the resource if it has no instances, but only if NoEach - if rs.EachMode == NoEach && len(rs.Instances) == 0 { - delete(ms.Resources, addr.Resource.String()) - return - } - } - // Nothing more to do here, so return! - return - } - if rs == nil && obj != nil { - // We don't have have a resource so make one, which is a side effect of setResourceMeta - ms.SetResourceMeta(addr.Resource, eachModeForInstanceKey(addr.Key), provider) - // now we have a resource! so update the rs value to point to it - rs = ms.Resource(addr.Resource) + is := rs.EnsureInstance(addr.Key) + + is.Current = obj + + if !is.HasObjects() { + // If we have no objects at all then we'll clean up. + delete(rs.Instances, addr.Key) } - // Get our instance from the resource; it could be there or not at this point - is := rs.Instance(addr.Key) - if is == nil { - // if we don't have a resource, create one and add to the instances - is = rs.CreateInstance(addr.Key) - // update the resource meta because we have a new instance, so EachMode may have changed - ms.SetResourceMeta(addr.Resource, eachModeForInstanceKey(addr.Key), provider) + if rs.EachMode == NoEach && len(rs.Instances) == 0 { + // Also clean up if we only expect to have one instance anyway + // and there are none. We leave the resource behind if an each mode + // is active because an empty list or map of instances is a valid state. + delete(ms.Resources, addr.Resource.String()) } - // Update the resource's ProviderConfig, in case the provider has updated - rs.ProviderConfig = provider - is.Current = obj } // SetResourceInstanceDeposed saves the given instance object as a deposed diff --git a/vendor/github.com/hashicorp/terraform/states/objectstatus_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/objectstatus_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/states/objectstatus_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/objectstatus_string.go diff --git a/vendor/github.com/hashicorp/terraform/states/output_value.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/output_value.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/states/output_value.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/output_value.go diff --git a/vendor/github.com/hashicorp/terraform/states/resource.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/resource.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/states/resource.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/resource.go index da883ddab..aacdb9d2d 100644 --- a/vendor/github.com/hashicorp/terraform/states/resource.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/resource.go @@ -5,7 +5,7 @@ import ( "math/rand" "time" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // Resource represents the state of a resource. @@ -39,13 +39,6 @@ func (rs *Resource) Instance(key addrs.InstanceKey) *ResourceInstance { return rs.Instances[key] } -// CreateInstance creates an instance and adds it to the resource -func (rs *Resource) CreateInstance(key addrs.InstanceKey) *ResourceInstance { - is := NewResourceInstance() - rs.Instances[key] = is - return is -} - // EnsureInstance returns the state for the instance with the given key, // creating a new empty state for it if one doesn't already exist. // diff --git a/vendor/github.com/hashicorp/terraform/states/state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/states/state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state.go index 1f842359e..328dd53d5 100644 --- a/vendor/github.com/hashicorp/terraform/states/state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state.go @@ -5,7 +5,7 @@ import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // State is the top-level type of a Terraform state. diff --git a/vendor/github.com/hashicorp/terraform/states/state_deepcopy.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state_deepcopy.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/states/state_deepcopy.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state_deepcopy.go index 7d7a7ef10..6266aca79 100644 --- a/vendor/github.com/hashicorp/terraform/states/state_deepcopy.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state_deepcopy.go @@ -1,7 +1,7 @@ package states import ( - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" "github.com/zclconf/go-cty/cty" ) @@ -153,17 +153,8 @@ func (obj *ResourceInstanceObjectSrc) DeepCopy() *ResourceInstanceObjectSrc { // Some addrs.Referencable implementations are technically mutable, but // we treat them as immutable by convention and so we don't deep-copy here. - var dependencies []addrs.AbsResource - if obj.Dependencies != nil { - dependencies = make([]addrs.AbsResource, len(obj.Dependencies)) - copy(dependencies, obj.Dependencies) - } - - var dependsOn []addrs.Referenceable - if obj.DependsOn != nil { - dependsOn = make([]addrs.Referenceable, len(obj.DependsOn)) - copy(dependsOn, obj.DependsOn) - } + dependencies := make([]addrs.Referenceable, len(obj.Dependencies)) + copy(dependencies, obj.Dependencies) return &ResourceInstanceObjectSrc{ Status: obj.Status, @@ -172,7 +163,6 @@ func (obj *ResourceInstanceObjectSrc) DeepCopy() *ResourceInstanceObjectSrc { AttrsFlat: attrsFlat, AttrsJSON: attrsJSON, Dependencies: dependencies, - DependsOn: dependsOn, } } @@ -197,9 +187,9 @@ func (obj *ResourceInstanceObject) DeepCopy() *ResourceInstanceObject { // Some addrs.Referenceable implementations are technically mutable, but // we treat them as immutable by convention and so we don't deep-copy here. - var dependencies []addrs.AbsResource + var dependencies []addrs.Referenceable if obj.Dependencies != nil { - dependencies = make([]addrs.AbsResource, len(obj.Dependencies)) + dependencies = make([]addrs.Referenceable, len(obj.Dependencies)) copy(dependencies, obj.Dependencies) } diff --git a/vendor/github.com/hashicorp/terraform/states/state_equal.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state_equal.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/states/state_equal.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state_equal.go diff --git a/vendor/github.com/hashicorp/terraform/states/state_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state_string.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/states/state_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state_string.go index 8be3d01a0..dffd650d6 100644 --- a/vendor/github.com/hashicorp/terraform/states/state_string.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/state_string.go @@ -10,8 +10,8 @@ import ( ctyjson "github.com/zclconf/go-cty/cty/json" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" ) // String returns a rather-odd string representation of the entire state. diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/diagnostics.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/diagnostics.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/states/statefile/diagnostics.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/diagnostics.go index a6d88ecd5..042ce51c1 100644 --- a/vendor/github.com/hashicorp/terraform/states/statefile/diagnostics.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/diagnostics.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) const invalidFormat = "Invalid state file format" diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/states/statefile/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/doc.go diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/file.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/file.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/states/statefile/file.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/file.go index 6e2024019..9f7ae00e4 100644 --- a/vendor/github.com/hashicorp/terraform/states/statefile/file.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/file.go @@ -3,8 +3,8 @@ package statefile import ( version "github.com/hashicorp/go-version" - "github.com/hashicorp/terraform/states" - tfversion "github.com/hashicorp/terraform/version" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + tfversion "github.com/hashicorp/terraform-plugin-sdk/internal/version" ) // File is the in-memory representation of a state file. It includes the state diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/marshal_equal.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/marshal_equal.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/states/statefile/marshal_equal.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/marshal_equal.go index 4948b39b9..41f485d17 100644 --- a/vendor/github.com/hashicorp/terraform/states/statefile/marshal_equal.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/marshal_equal.go @@ -3,7 +3,7 @@ package statefile import ( "bytes" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // StatesMarshalEqual returns true if and only if the two given states have diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/read.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/read.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/states/statefile/read.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/read.go index d691c0290..f1899cd22 100644 --- a/vendor/github.com/hashicorp/terraform/states/statefile/read.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/read.go @@ -10,8 +10,8 @@ import ( version "github.com/hashicorp/go-version" - "github.com/hashicorp/terraform/tfdiags" - tfversion "github.com/hashicorp/terraform/version" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" + tfversion "github.com/hashicorp/terraform-plugin-sdk/internal/version" ) // ErrNoState is returned by ReadState when the state file is empty. diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/version0.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version0.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/states/statefile/version0.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version0.go diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/version1.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version1.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/states/statefile/version1.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version1.go index 80d711bc8..85b422ad2 100644 --- a/vendor/github.com/hashicorp/terraform/states/statefile/version1.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version1.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) func readStateV1(src []byte) (*File, tfdiags.Diagnostics) { @@ -165,10 +165,3 @@ type instanceStateV1 struct { // external client code. Meta map[string]string `json:"meta,omitempty"` } - -type ephemeralStateV1 struct { - // ConnInfo is used for the providers to export information which is - // used to connect to the resource for provisioning. For example, - // this could contain SSH or WinRM credentials. - ConnInfo map[string]string `json:"-"` -} diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/version1_upgrade.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version1_upgrade.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/states/statefile/version1_upgrade.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version1_upgrade.go diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/version2.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version2.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/states/statefile/version2.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version2.go index be93924a7..6d10166b2 100644 --- a/vendor/github.com/hashicorp/terraform/states/statefile/version2.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version2.go @@ -3,9 +3,8 @@ package statefile import ( "encoding/json" "fmt" - "sync" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) func readStateV2(src []byte) (*File, tfdiags.Diagnostics) { @@ -95,8 +94,6 @@ type outputStateV2 struct { // Value contains the value of the output, in the structure described // by the Type field. Value interface{} `json:"value"` - - mu sync.Mutex } type moduleStateV2 struct { @@ -178,8 +175,6 @@ type resourceStateV2 struct { // e.g. "aws_instance" goes with the "aws" provider. // If the resource block contained a "provider" key, that value will be set here. Provider string `json:"provider"` - - mu sync.Mutex } type instanceStateV2 struct { diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/version2_upgrade.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version2_upgrade.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/states/statefile/version2_upgrade.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version2_upgrade.go diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/version3.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version3.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/states/statefile/version3.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version3.go index ab6414b0a..1c81e7169 100644 --- a/vendor/github.com/hashicorp/terraform/states/statefile/version3.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version3.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) func readStateV3(src []byte) (*File, tfdiags.Diagnostics) { diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/version3_upgrade.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version3_upgrade.go similarity index 79% rename from vendor/github.com/hashicorp/terraform/states/statefile/version3_upgrade.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version3_upgrade.go index 4e38aca34..f08a62b2d 100644 --- a/vendor/github.com/hashicorp/terraform/states/statefile/version3_upgrade.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version3_upgrade.go @@ -3,18 +3,15 @@ package statefile import ( "encoding/json" "fmt" - "log" "strconv" "strings" - "github.com/hashicorp/hcl/v2/hclsyntax" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) func upgradeStateV3ToV4(old *stateV3) (*stateV4, error) { @@ -53,13 +50,6 @@ func upgradeStateV3ToV4(old *stateV3) (*stateV4, error) { // all of the modules are unkeyed. moduleAddr := make(addrs.ModuleInstance, len(msOld.Path)-1) for i, name := range msOld.Path[1:] { - if !hclsyntax.ValidIdentifier(name) { - // If we don't fail here then we'll produce an invalid state - // version 4 which subsequent operations will reject, so we'll - // fail early here for safety to make sure we can never - // inadvertently commit an invalid snapshot to a backend. - return nil, fmt.Errorf("state contains invalid module path %#v: %q is not a valid identifier; rename it in Terraform 0.11 before upgrading to Terraform 0.12", msOld.Path, name) - } moduleAddr[i] = addrs.ModuleInstanceStep{ Name: name, InstanceKey: addrs.NoKey, @@ -108,13 +98,6 @@ func upgradeStateV3ToV4(old *stateV3) (*stateV4, error) { var diags tfdiags.Diagnostics providerAddr, diags = addrs.ParseAbsProviderConfigStr(oldProviderAddr) if diags.HasErrors() { - if strings.Contains(oldProviderAddr, "${") { - // There seems to be a common misconception that - // interpolation was valid in provider aliases - // in 0.11, so we'll use a specialized error - // message for that case. - return nil, fmt.Errorf("invalid provider config reference %q for %s: this alias seems to contain a template interpolation sequence, which was not supported but also not error-checked in Terraform 0.11. To proceed, rename the associated provider alias to a valid identifier and apply the change with Terraform 0.11 before upgrading to Terraform 0.12", oldProviderAddr, instAddr) - } return nil, fmt.Errorf("invalid provider config reference %q for %s: %s", oldProviderAddr, instAddr, diags.Err()) } } else { @@ -124,15 +107,8 @@ func upgradeStateV3ToV4(old *stateV3) (*stateV4, error) { // incorrect but it'll get fixed up next time any updates // are made to an instance. if oldProviderAddr != "" { - localAddr, diags := configs.ParseProviderConfigCompactStr(oldProviderAddr) + localAddr, diags := addrs.ParseProviderConfigCompactStr(oldProviderAddr) if diags.HasErrors() { - if strings.Contains(oldProviderAddr, "${") { - // There seems to be a common misconception that - // interpolation was valid in provider aliases - // in 0.11, so we'll use a specialized error - // message for that case. - return nil, fmt.Errorf("invalid legacy provider config reference %q for %s: this alias seems to contain a template interpolation sequence, which was not supported but also not error-checked in Terraform 0.11. To proceed, rename the associated provider alias to a valid identifier and apply the change with Terraform 0.11 before upgrading to Terraform 0.12", oldProviderAddr, instAddr) - } return nil, fmt.Errorf("invalid legacy provider config reference %q for %s: %s", oldProviderAddr, instAddr, diags.Err()) } providerAddr = localAddr.Absolute(moduleAddr) @@ -323,33 +299,13 @@ func upgradeInstanceObjectV3ToV4(rsOld *resourceStateV2, isOld *instanceStateV2, } } - dependencies := make([]string, 0, len(rsOld.Dependencies)) - for _, v := range rsOld.Dependencies { + dependencies := make([]string, len(rsOld.Dependencies)) + for i, v := range rsOld.Dependencies { depStr, err := parseLegacyDependency(v) if err != nil { - // We just drop invalid dependencies on the floor here, because - // they tend to get left behind in Terraform 0.11 when resources - // are renamed or moved between modules and there's no automatic - // way to fix them here. In practice it shouldn't hurt to miss - // a few dependency edges in the state because a subsequent plan - // will run a refresh walk first and re-synchronize the - // dependencies with the configuration. - // - // There is one rough edges where this can cause an incorrect - // result, though: If the first command the user runs after - // upgrading to Terraform 0.12 uses -refresh=false and thus - // prevents the dependency reorganization from occurring _and_ - // that initial plan discovered "orphaned" resources (not present - // in configuration any longer) then when the plan is applied the - // destroy ordering will be incorrect for the instances of those - // resources. We expect that is a rare enough situation that it - // isn't a big deal, and even when it _does_ occur it's common for - // the apply to succeed anyway unless many separate resources with - // complex inter-dependencies are all orphaned at once. - log.Printf("statefile: ignoring invalid dependency address %q while upgrading from state version 3 to version 4: %s", v, err) - continue + return nil, fmt.Errorf("invalid dependency reference %q: %s", v, err) } - dependencies = append(dependencies, depStr) + dependencies[i] = depStr } return &instanceObjectStateV4{ @@ -357,7 +313,7 @@ func upgradeInstanceObjectV3ToV4(rsOld *resourceStateV2, isOld *instanceStateV2, Status: status, Deposed: string(deposedKey), AttributesFlat: attributes, - DependsOn: dependencies, + Dependencies: dependencies, SchemaVersion: schemaVersion, PrivateRaw: privateJSON, }, nil diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/version4.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version4.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/states/statefile/version4.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version4.go index 2cc0677ab..164b57f82 100644 --- a/vendor/github.com/hashicorp/terraform/states/statefile/version4.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/version4.go @@ -9,9 +9,9 @@ import ( version "github.com/hashicorp/go-version" ctyjson "github.com/zclconf/go-cty/cty/json" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) func readStateV4(src []byte) (*File, tfdiags.Diagnostics) { @@ -181,10 +181,7 @@ func prepareStateV4(sV4 *stateV4) (*File, tfdiags.Diagnostics) { } { - // Allow both the deprecated `depends_on` and new - // `dependencies` to coexist for now so resources can be - // upgraded as they are refreshed. - depsRaw := isV4.DependsOn + depsRaw := isV4.Dependencies deps := make([]addrs.Referenceable, 0, len(depsRaw)) for _, depRaw := range depsRaw { ref, refDiags := addrs.ParseRefStr(depRaw) @@ -205,20 +202,6 @@ func prepareStateV4(sV4 *stateV4) (*File, tfdiags.Diagnostics) { } deps = append(deps, ref.Subject) } - obj.DependsOn = deps - } - - { - depsRaw := isV4.Dependencies - deps := make([]addrs.AbsResource, 0, len(depsRaw)) - for _, depRaw := range depsRaw { - addr, addrDiags := addrs.ParseAbsResourceStr(depRaw) - diags = diags.Append(addrDiags) - if addrDiags.HasErrors() { - continue - } - deps = append(deps, addr) - } obj.Dependencies = deps } @@ -483,11 +466,6 @@ func appendInstanceObjectStateV4(rs *states.Resource, is *states.ResourceInstanc deps[i] = depAddr.String() } - depOn := make([]string, len(obj.DependsOn)) - for i, depAddr := range obj.DependsOn { - depOn[i] = depAddr.String() - } - var rawKey interface{} switch tk := key.(type) { case addrs.IntKey: @@ -513,7 +491,6 @@ func appendInstanceObjectStateV4(rs *states.Resource, is *states.ResourceInstanc AttributesRaw: obj.AttrsJSON, PrivateRaw: privateRaw, Dependencies: deps, - DependsOn: depOn, }), diags } @@ -563,8 +540,7 @@ type instanceObjectStateV4 struct { PrivateRaw []byte `json:"private,omitempty"` - Dependencies []string `json:"dependencies,omitempty"` - DependsOn []string `json:"depends_on,omitempty"` + Dependencies []string `json:"depends_on,omitempty"` } // stateVersionV4 is a weird special type we use to produce our hard-coded diff --git a/vendor/github.com/hashicorp/terraform/states/statefile/write.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/write.go similarity index 82% rename from vendor/github.com/hashicorp/terraform/states/statefile/write.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/write.go index 548ba8a8b..8fdca4580 100644 --- a/vendor/github.com/hashicorp/terraform/states/statefile/write.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile/write.go @@ -3,7 +3,7 @@ package statefile import ( "io" - tfversion "github.com/hashicorp/terraform/version" + tfversion "github.com/hashicorp/terraform-plugin-sdk/internal/version" ) // Write writes the given state to the given writer in the current state diff --git a/vendor/github.com/hashicorp/terraform/states/sync.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/sync.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/states/sync.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/sync.go index 47fb16d6e..8675efc3c 100644 --- a/vendor/github.com/hashicorp/terraform/states/sync.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/sync.go @@ -4,7 +4,7 @@ import ( "log" "sync" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform-svchost/auth/cache.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/cache.go similarity index 63% rename from vendor/github.com/hashicorp/terraform-svchost/auth/cache.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/cache.go index 0dae567db..99e2c0306 100644 --- a/vendor/github.com/hashicorp/terraform-svchost/auth/cache.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/cache.go @@ -1,7 +1,7 @@ package auth import ( - "github.com/hashicorp/terraform-svchost" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost" ) // CachingCredentialsSource creates a new credentials source that wraps another @@ -43,19 +43,3 @@ func (s *cachingCredentialsSource) ForHost(host svchost.Hostname) (HostCredentia s.cache[host] = result return result, nil } - -func (s *cachingCredentialsSource) StoreForHost(host svchost.Hostname, credentials HostCredentialsWritable) error { - // We'll delete the cache entry even if the store fails, since that just - // means that the next read will go to the real store and get a chance to - // see which object (old or new) is actually present. - delete(s.cache, host) - return s.source.StoreForHost(host, credentials) -} - -func (s *cachingCredentialsSource) ForgetForHost(host svchost.Hostname) error { - // We'll delete the cache entry even if the store fails, since that just - // means that the next read will go to the real store and get a chance to - // see if the object is still present. - delete(s.cache, host) - return s.source.ForgetForHost(host) -} diff --git a/vendor/github.com/hashicorp/terraform-svchost/auth/credentials.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/credentials.go similarity index 52% rename from vendor/github.com/hashicorp/terraform-svchost/auth/credentials.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/credentials.go index 36441cd11..00042a0a5 100644 --- a/vendor/github.com/hashicorp/terraform-svchost/auth/credentials.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/credentials.go @@ -3,12 +3,9 @@ package auth import ( - "fmt" "net/http" - "github.com/zclconf/go-cty/cty" - - "github.com/hashicorp/terraform-svchost" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost" ) // Credentials is a list of CredentialsSource objects that can be tried in @@ -17,9 +14,6 @@ import ( // A Credentials is itself a CredentialsSource, wrapping its members. // In principle one CredentialsSource can be nested inside another, though // there is no good reason to do so. -// -// The write operations on a Credentials are tried only on the first object, -// under the assumption that it is the primary store. type Credentials []CredentialsSource // NoCredentials is an empty CredentialsSource that always returns nil @@ -39,19 +33,6 @@ type CredentialsSource interface { // If an error is returned, progress through a list of CredentialsSources // is halted and the error is returned to the user. ForHost(host svchost.Hostname) (HostCredentials, error) - - // StoreForHost takes a HostCredentialsWritable and saves it as the - // credentials for the given host. - // - // If credentials are already stored for the given host, it will try to - // replace those credentials but may produce an error if such replacement - // is not possible. - StoreForHost(host svchost.Hostname, credentials HostCredentialsWritable) error - - // ForgetForHost discards any stored credentials for the given host. It - // does nothing and returns successfully if no credentials are saved - // for that host. - ForgetForHost(host svchost.Hostname) error } // HostCredentials represents a single set of credentials for a particular @@ -66,22 +47,6 @@ type HostCredentials interface { Token() string } -// HostCredentialsWritable is an extension of HostCredentials for credentials -// objects that can be serialized as a JSON-compatible object value for -// storage. -type HostCredentialsWritable interface { - HostCredentials - - // ToStore returns a cty.Value, always of an object type, - // representing data that can be serialized to represent this object - // in persistent storage. - // - // The resulting value may uses only cty values that can be accepted - // by the cty JSON encoder, though the caller may elect to instead store - // it in some other format that has a JSON-compatible type system. - ToStore() cty.Value -} - // ForHost iterates over the contained CredentialsSource objects and // tries to obtain credentials for the given host from each one in turn. // @@ -96,23 +61,3 @@ func (c Credentials) ForHost(host svchost.Hostname) (HostCredentials, error) { } return nil, nil } - -// StoreForHost passes the given arguments to the same operation on the -// first CredentialsSource in the receiver. -func (c Credentials) StoreForHost(host svchost.Hostname, credentials HostCredentialsWritable) error { - if len(c) == 0 { - return fmt.Errorf("no credentials store is available") - } - - return c[0].StoreForHost(host, credentials) -} - -// ForgetForHost passes the given arguments to the same operation on the -// first CredentialsSource in the receiver. -func (c Credentials) ForgetForHost(host svchost.Hostname) error { - if len(c) == 0 { - return fmt.Errorf("no credentials store is available") - } - - return c[0].ForgetForHost(host) -} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/from_map.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/from_map.go new file mode 100644 index 000000000..f91006aec --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/from_map.go @@ -0,0 +1,18 @@ +package auth + +// HostCredentialsFromMap converts a map of key-value pairs from a credentials +// definition provided by the user (e.g. in a config file, or via a credentials +// helper) into a HostCredentials object if possible, or returns nil if +// no credentials could be extracted from the map. +// +// This function ignores map keys it is unfamiliar with, to allow for future +// expansion of the credentials map format for new credential types. +func HostCredentialsFromMap(m map[string]interface{}) HostCredentials { + if m == nil { + return nil + } + if token, ok := m["token"].(string); ok { + return HostCredentialsToken(token) + } + return nil +} diff --git a/vendor/github.com/hashicorp/terraform-svchost/auth/helper_program.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/helper_program.go similarity index 54% rename from vendor/github.com/hashicorp/terraform-svchost/auth/helper_program.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/helper_program.go index 76505f209..93f52604a 100644 --- a/vendor/github.com/hashicorp/terraform-svchost/auth/helper_program.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/helper_program.go @@ -7,9 +7,7 @@ import ( "os/exec" "path/filepath" - ctyjson "github.com/zclconf/go-cty/cty/json" - - "github.com/hashicorp/terraform-svchost" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost" ) type helperProgramCredentialsSource struct { @@ -80,70 +78,3 @@ func (s *helperProgramCredentialsSource) ForHost(host svchost.Hostname) (HostCre return HostCredentialsFromMap(m), nil } - -func (s *helperProgramCredentialsSource) StoreForHost(host svchost.Hostname, credentials HostCredentialsWritable) error { - args := make([]string, len(s.args), len(s.args)+2) - copy(args, s.args) - args = append(args, "store") - args = append(args, string(host)) - - toStore := credentials.ToStore() - toStoreRaw, err := ctyjson.Marshal(toStore, toStore.Type()) - if err != nil { - return fmt.Errorf("can't serialize credentials to store: %s", err) - } - - inReader := bytes.NewReader(toStoreRaw) - errBuf := bytes.Buffer{} - - cmd := exec.Cmd{ - Path: s.executable, - Args: args, - Stdin: inReader, - Stderr: &errBuf, - Stdout: nil, - } - err = cmd.Run() - if _, isExitErr := err.(*exec.ExitError); isExitErr { - errText := errBuf.String() - if errText == "" { - // Shouldn't happen for a well-behaved helper program - return fmt.Errorf("error in %s, but it produced no error message", s.executable) - } - return fmt.Errorf("error in %s: %s", s.executable, errText) - } else if err != nil { - return fmt.Errorf("failed to run %s: %s", s.executable, err) - } - - return nil -} - -func (s *helperProgramCredentialsSource) ForgetForHost(host svchost.Hostname) error { - args := make([]string, len(s.args), len(s.args)+2) - copy(args, s.args) - args = append(args, "forget") - args = append(args, string(host)) - - errBuf := bytes.Buffer{} - - cmd := exec.Cmd{ - Path: s.executable, - Args: args, - Stdin: nil, - Stderr: &errBuf, - Stdout: nil, - } - err := cmd.Run() - if _, isExitErr := err.(*exec.ExitError); isExitErr { - errText := errBuf.String() - if errText == "" { - // Shouldn't happen for a well-behaved helper program - return fmt.Errorf("error in %s, but it produced no error message", s.executable) - } - return fmt.Errorf("error in %s: %s", s.executable, errText) - } else if err != nil { - return fmt.Errorf("failed to run %s: %s", s.executable, err) - } - - return nil -} diff --git a/vendor/github.com/hashicorp/terraform-svchost/auth/static.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/static.go similarity index 63% rename from vendor/github.com/hashicorp/terraform-svchost/auth/static.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/static.go index f8b0b076e..b5108a4a2 100644 --- a/vendor/github.com/hashicorp/terraform-svchost/auth/static.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/static.go @@ -1,9 +1,7 @@ package auth import ( - "fmt" - - "github.com/hashicorp/terraform-svchost" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost" ) // StaticCredentialsSource is a credentials source that retrieves credentials @@ -28,11 +26,3 @@ func (s staticCredentialsSource) ForHost(host svchost.Hostname) (HostCredentials return nil, nil } - -func (s staticCredentialsSource) StoreForHost(host svchost.Hostname, credentials HostCredentialsWritable) error { - return fmt.Errorf("can't store new credentials in a static credentials source") -} - -func (s staticCredentialsSource) ForgetForHost(host svchost.Hostname) error { - return fmt.Errorf("can't discard credentials from a static credentials source") -} diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/token_credentials.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/token_credentials.go new file mode 100644 index 000000000..9358bcb64 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth/token_credentials.go @@ -0,0 +1,25 @@ +package auth + +import ( + "net/http" +) + +// HostCredentialsToken is a HostCredentials implementation that represents a +// single "bearer token", to be sent to the server via an Authorization header +// with the auth type set to "Bearer" +type HostCredentialsToken string + +// PrepareRequest alters the given HTTP request by setting its Authorization +// header to the string "Bearer " followed by the encapsulated authentication +// token. +func (tc HostCredentialsToken) PrepareRequest(req *http.Request) { + if req.Header == nil { + req.Header = http.Header{} + } + req.Header.Set("Authorization", "Bearer "+string(tc)) +} + +// Token returns the authentication token. +func (tc HostCredentialsToken) Token() string { + return string(tc) +} diff --git a/vendor/github.com/hashicorp/terraform-svchost/disco/disco.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco/disco.go similarity index 91% rename from vendor/github.com/hashicorp/terraform-svchost/disco/disco.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco/disco.go index 978313633..c770338be 100644 --- a/vendor/github.com/hashicorp/terraform-svchost/disco/disco.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco/disco.go @@ -17,8 +17,10 @@ import ( "net/url" "time" - "github.com/hashicorp/terraform-svchost" - "github.com/hashicorp/terraform-svchost/auth" + cleanhttp "github.com/hashicorp/go-cleanhttp" + "github.com/hashicorp/terraform-plugin-sdk/internal/httpclient" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost" + "github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth" ) const ( @@ -36,7 +38,7 @@ const ( ) // httpTransport is overridden during tests, to skip TLS verification. -var httpTransport = defaultHttpTransport() +var httpTransport = cleanhttp.DefaultPooledTransport() // Disco is the main type in this package, which allows discovery on given // hostnames and caches the results by hostname to avoid repeated requests @@ -64,13 +66,6 @@ func NewWithCredentialsSource(credsSrc auth.CredentialsSource) *Disco { } } -func (d *Disco) SetUserAgent(uaString string) { - d.Transport = &userAgentRoundTripper{ - innerRt: d.Transport, - userAgent: uaString, - } -} - // SetCredentialsSource provides a credentials source that will be used to // add credentials to outgoing discovery requests, where available. // @@ -80,18 +75,6 @@ func (d *Disco) SetCredentialsSource(src auth.CredentialsSource) { d.credsSrc = src } -// CredentialsSource returns the credentials source associated with the receiver, -// or an empty credentials source if none is associated. -func (d *Disco) CredentialsSource() auth.CredentialsSource { - if d.credsSrc == nil { - // We'll return an empty one just to save the caller from having to - // protect against the nil case, since this interface already allows - // for the possibility of there being no credentials at all. - return auth.StaticCredentialsSource(nil) - } - return d.credsSrc -} - // CredentialsForHost returns a non-nil HostCredentials if the embedded source has // credentials available for the host, and a nil HostCredentials if it does not. func (d *Disco) CredentialsForHost(hostname svchost.Hostname) (auth.HostCredentials, error) { @@ -190,6 +173,7 @@ func (d *Disco) discover(hostname svchost.Hostname) (*Host, error) { URL: discoURL, } req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", httpclient.UserAgentString()) creds, err := d.CredentialsForHost(hostname) if err != nil { diff --git a/vendor/github.com/hashicorp/terraform-svchost/disco/host.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco/host.go similarity index 59% rename from vendor/github.com/hashicorp/terraform-svchost/disco/host.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco/host.go index 2d0fc9f12..0d6ef0383 100644 --- a/vendor/github.com/hashicorp/terraform-svchost/disco/host.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco/host.go @@ -12,6 +12,7 @@ import ( "time" "github.com/hashicorp/go-version" + "github.com/hashicorp/terraform-plugin-sdk/internal/httpclient" ) const versionServiceID = "versions.v1" @@ -110,159 +111,9 @@ func (h *Host) ServiceURL(id string) (*url.URL, error) { return nil, &ErrServiceNotProvided{hostname: h.hostname, service: svc} } - u, err := h.parseURL(urlStr) - if err != nil { - return nil, fmt.Errorf("Failed to parse service URL: %v", err) - } - - return u, nil -} - -// ServiceOAuthClient returns the OAuth client configuration associated with the -// given service identifier, which should be of the form "servicename.vN". -// -// This is an alternative to ServiceURL for unusual services that require -// a full OAuth2 client definition rather than just a URL. Use this only -// for services whose specification calls for this sort of definition. -func (h *Host) ServiceOAuthClient(id string) (*OAuthClient, error) { - svc, ver, err := parseServiceID(id) - if err != nil { - return nil, err - } - - // No services supported for an empty Host. - if h == nil || h.services == nil { - return nil, &ErrServiceNotProvided{service: svc} - } - - if _, ok := h.services[id]; !ok { - // See if we have a matching service as that would indicate - // the service is supported, but not the requested version. - for serviceID := range h.services { - if strings.HasPrefix(serviceID, svc+".") { - return nil, &ErrVersionNotSupported{ - hostname: h.hostname, - service: svc, - version: ver.Original(), - } - } - } - - // No discovered services match the requested service. - return nil, &ErrServiceNotProvided{hostname: h.hostname, service: svc} - } - - var raw map[string]interface{} - switch v := h.services[id].(type) { - case map[string]interface{}: - raw = v // Great! - case []map[string]interface{}: - // An absolutely infuriating legacy HCL ambiguity. - raw = v[0] - default: - // Debug message because raw Go types don't belong in our UI. - log.Printf("[DEBUG] The definition for %s has Go type %T", id, h.services[id]) - return nil, fmt.Errorf("Service %s must be declared with an object value in the service discovery document", id) - } - - var grantTypes OAuthGrantTypeSet - if rawGTs, ok := raw["grant_types"]; ok { - if gts, ok := rawGTs.([]interface{}); ok { - var kws []string - for _, gtI := range gts { - gt, ok := gtI.(string) - if !ok { - // We'll ignore this so that we can potentially introduce - // other types into this array later if we need to. - continue - } - kws = append(kws, gt) - } - grantTypes = NewOAuthGrantTypeSet(kws...) - } else { - return nil, fmt.Errorf("Service %s is defined with invalid grant_types property: must be an array of grant type strings", id) - } - } else { - grantTypes = NewOAuthGrantTypeSet("authz_code") - } - - ret := &OAuthClient{ - SupportedGrantTypes: grantTypes, - } - if clientIDStr, ok := raw["client"].(string); ok { - ret.ID = clientIDStr - } else { - return nil, fmt.Errorf("Service %s definition is missing required property \"client\"", id) - } - if urlStr, ok := raw["authz"].(string); ok { - u, err := h.parseURL(urlStr) - if err != nil { - return nil, fmt.Errorf("Failed to parse authorization URL: %v", err) - } - ret.AuthorizationURL = u - } else { - if grantTypes.RequiresAuthorizationEndpoint() { - return nil, fmt.Errorf("Service %s definition is missing required property \"authz\"", id) - } - } - if urlStr, ok := raw["token"].(string); ok { - u, err := h.parseURL(urlStr) - if err != nil { - return nil, fmt.Errorf("Failed to parse token URL: %v", err) - } - ret.TokenURL = u - } else { - if grantTypes.RequiresTokenEndpoint() { - return nil, fmt.Errorf("Service %s definition is missing required property \"token\"", id) - } - } - if portsRaw, ok := raw["ports"].([]interface{}); ok { - if len(portsRaw) != 2 { - return nil, fmt.Errorf("Invalid \"ports\" definition for service %s: must be a two-element array", id) - } - invalidPortsErr := fmt.Errorf("Invalid \"ports\" definition for service %s: both ports must be whole numbers between 1024 and 65535", id) - ports := make([]uint16, 2) - for i := range ports { - switch v := portsRaw[i].(type) { - case float64: - // JSON unmarshaling always produces float64. HCL 2 might, if - // an invalid fractional number were given. - if float64(uint16(v)) != v || v < 1024 { - return nil, invalidPortsErr - } - ports[i] = uint16(v) - case int: - // Legacy HCL produces int. HCL 2 will too, if the given number - // is a whole number. - if v < 1024 || v > 65535 { - return nil, invalidPortsErr - } - ports[i] = uint16(v) - default: - // Debug message because raw Go types don't belong in our UI. - log.Printf("[DEBUG] Port value %d has Go type %T", i, portsRaw[i]) - return nil, invalidPortsErr - } - } - if ports[1] < ports[0] { - return nil, fmt.Errorf("Invalid \"ports\" definition for service %s: minimum port cannot be greater than maximum port", id) - } - ret.MinPort = ports[0] - ret.MaxPort = ports[1] - } else { - // Default is to accept any port in the range, for a client that is - // able to call back to any localhost port. - ret.MinPort = 1024 - ret.MaxPort = 65535 - } - - return ret, nil -} - -func (h *Host) parseURL(urlStr string) (*url.URL, error) { u, err := url.Parse(urlStr) if err != nil { - return nil, err + return nil, fmt.Errorf("Failed to parse service URL: %v", err) } // Make relative URLs absolute using our discovery URL. @@ -271,16 +122,16 @@ func (h *Host) parseURL(urlStr string) (*url.URL, error) { } if u.Scheme != "https" && u.Scheme != "http" { - return nil, fmt.Errorf("unsupported scheme %s", u.Scheme) + return nil, fmt.Errorf("Service URL is using an unsupported scheme: %s", u.Scheme) } if u.User != nil { - return nil, fmt.Errorf("embedded username/password information is not permitted") + return nil, fmt.Errorf("Embedded username/password information is not permitted") } // Fragment part is irrelevant, since we're not a browser. u.Fragment = "" - return u, nil + return h.discoURL.ResolveReference(u), nil } // VersionConstraints returns the contraints for a given service identifier @@ -371,6 +222,7 @@ func (h *Host) VersionConstraints(id, product string) (*Constraints, error) { return nil, fmt.Errorf("Failed to create version constraints request: %v", err) } req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", httpclient.UserAgentString()) log.Printf("[DEBUG] Retrieve version constraints for service %s and product %s", id, product) diff --git a/vendor/github.com/hashicorp/terraform-svchost/label_iter.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/label_iter.go similarity index 78% rename from vendor/github.com/hashicorp/terraform-svchost/label_iter.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/label_iter.go index af8ccbab2..6e0e47b73 100644 --- a/vendor/github.com/hashicorp/terraform-svchost/label_iter.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/label_iter.go @@ -17,23 +17,10 @@ type labelIter struct { i int } -func (l *labelIter) reset() { - l.curStart = 0 - l.curEnd = 0 - l.i = 0 -} - func (l *labelIter) done() bool { return l.curStart >= len(l.orig) } -func (l *labelIter) result() string { - if l.slice != nil { - return strings.Join(l.slice, ".") - } - return l.orig -} - func (l *labelIter) label() string { if l.slice != nil { return l.slice[l.i] @@ -60,10 +47,3 @@ func (l *labelIter) next() { } } } - -func (l *labelIter) set(s string) { - if l.slice == nil { - l.slice = strings.Split(l.orig, ".") - } - l.slice[l.i] = s -} diff --git a/vendor/github.com/hashicorp/terraform-svchost/svchost.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/svchost.go similarity index 100% rename from vendor/github.com/hashicorp/terraform-svchost/svchost.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/svchost.go diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/config_traversals.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/config_traversals.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/config_traversals.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/config_traversals.go diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/contextual.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/contextual.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/tfdiags/contextual.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/contextual.go index d55bc2f0c..25b214037 100644 --- a/vendor/github.com/hashicorp/terraform/tfdiags/contextual.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/contextual.go @@ -1,7 +1,7 @@ package tfdiags import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/gocty" ) @@ -308,8 +308,8 @@ func hclRangeFromIndexStepAndAttribute(idxStep cty.IndexStep, attr *hcl.Attribut } stepKey := idxStep.Key.AsString() for _, kvPair := range pairs { - key, diags := kvPair.Key.Value(nil) - if diags.HasErrors() { + key, err := kvPair.Key.Value(nil) + if err != nil { return attr.Expr.Range() } if key.AsString() == stepKey { diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/diagnostic.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostic.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/tfdiags/diagnostic.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostic.go index a7699cf01..f3b0ea1e4 100644 --- a/vendor/github.com/hashicorp/terraform/tfdiags/diagnostic.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostic.go @@ -1,7 +1,7 @@ package tfdiags import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) type Diagnostic interface { diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/diagnostic_base.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostic_base.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/diagnostic_base.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostic_base.go diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/diagnostics.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostics.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/tfdiags/diagnostics.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostics.go index 30476ee26..465b230f6 100644 --- a/vendor/github.com/hashicorp/terraform/tfdiags/diagnostics.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostics.go @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/errwrap" multierror "github.com/hashicorp/go-multierror" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) // Diagnostics is a list of diagnostics. Diagnostics is intended to be used diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/doc.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/doc.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/doc.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/doc.go diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/error.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/error.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/error.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/error.go diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/hcl.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/hcl.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/tfdiags/hcl.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/hcl.go index 8c781611a..f9aec41c9 100644 --- a/vendor/github.com/hashicorp/terraform/tfdiags/hcl.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/hcl.go @@ -1,7 +1,7 @@ package tfdiags import ( - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" ) // hclDiagnostic is a Diagnostic implementation that wraps a HCL Diagnostic diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/rpc_friendly.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/rpc_friendly.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/rpc_friendly.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/rpc_friendly.go diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/severity_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/severity_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/severity_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/severity_string.go diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/simple_warning.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/simple_warning.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/simple_warning.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/simple_warning.go diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/source_range.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/source_range.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/source_range.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/source_range.go diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/sourceless.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/sourceless.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/sourceless.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/sourceless.go diff --git a/vendor/github.com/hashicorp/terraform/internal/tfplugin5/generate.sh b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/generate.sh similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/tfplugin5/generate.sh rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/generate.sh diff --git a/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.proto b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.proto new file mode 100644 index 000000000..9875d9ba6 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.proto @@ -0,0 +1,353 @@ +// Terraform Plugin RPC protocol version 5.1 +// +// This file defines version 5.1 of the RPC protocol. To implement a plugin +// against this protocol, copy this definition into your own codebase and +// use protoc to generate stubs for your target language. +// +// This file will be updated in-place in the source Terraform repository for +// any minor versions of protocol 5, but later minor versions will always be +// backwards compatible. Breaking changes, if any are required, will come +// in a subsequent major version with its own separate proto definition. +// +// Note that only the proto files included in a release tag of Terraform are +// official protocol releases. Proto files taken from other commits may include +// incomplete changes or features that did not make it into a final release. +// In all reasonable cases, plugin developers should take the proto file from +// the tag of the most recent release of Terraform, and not from the master +// branch or any other development branch. +// +syntax = "proto3"; + +package tfplugin5; + +// DynamicValue is an opaque encoding of terraform data, with the field name +// indicating the encoding scheme used. +message DynamicValue { + bytes msgpack = 1; + bytes json = 2; +} + +message Diagnostic { + enum Severity { + INVALID = 0; + ERROR = 1; + WARNING = 2; + } + Severity severity = 1; + string summary = 2; + string detail = 3; + AttributePath attribute = 4; +} + +message AttributePath { + message Step { + oneof selector { + // Set "attribute_name" to represent looking up an attribute + // in the current object value. + string attribute_name = 1; + // Set "element_key_*" to represent looking up an element in + // an indexable collection type. + string element_key_string = 2; + int64 element_key_int = 3; + } + } + repeated Step steps = 1; +} + +message Stop { + message Request { + } + message Response { + string Error = 1; + } +} + +// RawState holds the stored state for a resource to be upgraded by the +// provider. It can be in one of two formats, the current json encoded format +// in bytes, or the legacy flatmap format as a map of strings. +message RawState { + bytes json = 1; + map flatmap = 2; +} + +// Schema is the configuration schema for a Resource, Provider, or Provisioner. +message Schema { + message Block { + int64 version = 1; + repeated Attribute attributes = 2; + repeated NestedBlock block_types = 3; + } + + message Attribute { + string name = 1; + bytes type = 2; + string description = 3; + bool required = 4; + bool optional = 5; + bool computed = 6; + bool sensitive = 7; + } + + message NestedBlock { + enum NestingMode { + INVALID = 0; + SINGLE = 1; + LIST = 2; + SET = 3; + MAP = 4; + GROUP = 5; + } + + string type_name = 1; + Block block = 2; + NestingMode nesting = 3; + int64 min_items = 4; + int64 max_items = 5; + } + + // The version of the schema. + // Schemas are versioned, so that providers can upgrade a saved resource + // state when the schema is changed. + int64 version = 1; + + // Block is the top level configuration block for this schema. + Block block = 2; +} + +service Provider { + //////// Information about what a provider supports/expects + rpc GetSchema(GetProviderSchema.Request) returns (GetProviderSchema.Response); + rpc PrepareProviderConfig(PrepareProviderConfig.Request) returns (PrepareProviderConfig.Response); + rpc ValidateResourceTypeConfig(ValidateResourceTypeConfig.Request) returns (ValidateResourceTypeConfig.Response); + rpc ValidateDataSourceConfig(ValidateDataSourceConfig.Request) returns (ValidateDataSourceConfig.Response); + rpc UpgradeResourceState(UpgradeResourceState.Request) returns (UpgradeResourceState.Response); + + //////// One-time initialization, called before other functions below + rpc Configure(Configure.Request) returns (Configure.Response); + + //////// Managed Resource Lifecycle + rpc ReadResource(ReadResource.Request) returns (ReadResource.Response); + rpc PlanResourceChange(PlanResourceChange.Request) returns (PlanResourceChange.Response); + rpc ApplyResourceChange(ApplyResourceChange.Request) returns (ApplyResourceChange.Response); + rpc ImportResourceState(ImportResourceState.Request) returns (ImportResourceState.Response); + + rpc ReadDataSource(ReadDataSource.Request) returns (ReadDataSource.Response); + + //////// Graceful Shutdown + rpc Stop(Stop.Request) returns (Stop.Response); +} + +message GetProviderSchema { + message Request { + } + message Response { + Schema provider = 1; + map resource_schemas = 2; + map data_source_schemas = 3; + repeated Diagnostic diagnostics = 4; + } +} + +message PrepareProviderConfig { + message Request { + DynamicValue config = 1; + } + message Response { + DynamicValue prepared_config = 1; + repeated Diagnostic diagnostics = 2; + } +} + +message UpgradeResourceState { + message Request { + string type_name = 1; + + // version is the schema_version number recorded in the state file + int64 version = 2; + + // raw_state is the raw states as stored for the resource. Core does + // not have access to the schema of prior_version, so it's the + // provider's responsibility to interpret this value using the + // appropriate older schema. The raw_state will be the json encoded + // state, or a legacy flat-mapped format. + RawState raw_state = 3; + } + message Response { + // new_state is a msgpack-encoded data structure that, when interpreted with + // the _current_ schema for this resource type, is functionally equivalent to + // that which was given in prior_state_raw. + DynamicValue upgraded_state = 1; + + // diagnostics describes any errors encountered during migration that could not + // be safely resolved, and warnings about any possibly-risky assumptions made + // in the upgrade process. + repeated Diagnostic diagnostics = 2; + } +} + +message ValidateResourceTypeConfig { + message Request { + string type_name = 1; + DynamicValue config = 2; + } + message Response { + repeated Diagnostic diagnostics = 1; + } +} + +message ValidateDataSourceConfig { + message Request { + string type_name = 1; + DynamicValue config = 2; + } + message Response { + repeated Diagnostic diagnostics = 1; + } +} + +message Configure { + message Request { + string terraform_version = 1; + DynamicValue config = 2; + } + message Response { + repeated Diagnostic diagnostics = 1; + } +} + +message ReadResource { + message Request { + string type_name = 1; + DynamicValue current_state = 2; + bytes private = 3; + } + message Response { + DynamicValue new_state = 1; + repeated Diagnostic diagnostics = 2; + bytes private = 3; + } +} + +message PlanResourceChange { + message Request { + string type_name = 1; + DynamicValue prior_state = 2; + DynamicValue proposed_new_state = 3; + DynamicValue config = 4; + bytes prior_private = 5; + } + + message Response { + DynamicValue planned_state = 1; + repeated AttributePath requires_replace = 2; + bytes planned_private = 3; + repeated Diagnostic diagnostics = 4; + + + // This may be set only by the helper/schema "SDK" in the main Terraform + // repository, to request that Terraform Core >=0.12 permit additional + // inconsistencies that can result from the legacy SDK type system + // and its imprecise mapping to the >=0.12 type system. + // The change in behavior implied by this flag makes sense only for the + // specific details of the legacy SDK type system, and are not a general + // mechanism to avoid proper type handling in providers. + // + // ==== DO NOT USE THIS ==== + // ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ==== + // ==== DO NOT USE THIS ==== + bool legacy_type_system = 5; + } +} + +message ApplyResourceChange { + message Request { + string type_name = 1; + DynamicValue prior_state = 2; + DynamicValue planned_state = 3; + DynamicValue config = 4; + bytes planned_private = 5; + } + message Response { + DynamicValue new_state = 1; + bytes private = 2; + repeated Diagnostic diagnostics = 3; + + // This may be set only by the helper/schema "SDK" in the main Terraform + // repository, to request that Terraform Core >=0.12 permit additional + // inconsistencies that can result from the legacy SDK type system + // and its imprecise mapping to the >=0.12 type system. + // The change in behavior implied by this flag makes sense only for the + // specific details of the legacy SDK type system, and are not a general + // mechanism to avoid proper type handling in providers. + // + // ==== DO NOT USE THIS ==== + // ==== THIS MUST BE LEFT UNSET IN ALL OTHER SDKS ==== + // ==== DO NOT USE THIS ==== + bool legacy_type_system = 4; + } +} + +message ImportResourceState { + message Request { + string type_name = 1; + string id = 2; + } + + message ImportedResource { + string type_name = 1; + DynamicValue state = 2; + bytes private = 3; + } + + message Response { + repeated ImportedResource imported_resources = 1; + repeated Diagnostic diagnostics = 2; + } +} + +message ReadDataSource { + message Request { + string type_name = 1; + DynamicValue config = 2; + } + message Response { + DynamicValue state = 1; + repeated Diagnostic diagnostics = 2; + } +} + +service Provisioner { + rpc GetSchema(GetProvisionerSchema.Request) returns (GetProvisionerSchema.Response); + rpc ValidateProvisionerConfig(ValidateProvisionerConfig.Request) returns (ValidateProvisionerConfig.Response); + rpc ProvisionResource(ProvisionResource.Request) returns (stream ProvisionResource.Response); + rpc Stop(Stop.Request) returns (Stop.Response); +} + +message GetProvisionerSchema { + message Request { + } + message Response { + Schema provisioner = 1; + repeated Diagnostic diagnostics = 2; + } +} + +message ValidateProvisionerConfig { + message Request { + DynamicValue config = 1; + } + message Response { + repeated Diagnostic diagnostics = 1; + } +} + +message ProvisionResource { + message Request { + DynamicValue config = 1; + DynamicValue connection = 2; + } + message Response { + string output = 1; + repeated Diagnostic diagnostics = 2; + } +} diff --git a/vendor/github.com/hashicorp/terraform/version/version.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/version/version.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/version/version.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/version/version.go index 8921c3a74..7341b5339 100644 --- a/vendor/github.com/hashicorp/terraform/version/version.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/version/version.go @@ -11,12 +11,12 @@ import ( ) // The main version number that is being run at the moment. -var Version = "0.12.18" +var Version = "0.12.7" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release // such as "dev" (in development), "beta", "rc1", etc. -var Prerelease = "" +var Prerelease = "sdk" // SemVer is an instance of version.Version. This has the secondary // benefit of verifying during tests and init time that our version is a diff --git a/vendor/github.com/hashicorp/terraform/plugin/client.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/client.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/plugin/client.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/client.go index 0eab5385b..5a99e9006 100644 --- a/vendor/github.com/hashicorp/terraform/plugin/client.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/client.go @@ -6,7 +6,7 @@ import ( hclog "github.com/hashicorp/go-hclog" plugin "github.com/hashicorp/go-plugin" - "github.com/hashicorp/terraform/plugin/discovery" + "github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery" ) // ClientConfig returns a configuration object that can be used to instantiate diff --git a/vendor/github.com/hashicorp/terraform/plugin/grpc_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/grpc_provider.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/plugin/grpc_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/grpc_provider.go index 1abdbe297..e4520975c 100644 --- a/vendor/github.com/hashicorp/terraform/plugin/grpc_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/grpc_provider.go @@ -9,9 +9,9 @@ import ( "github.com/zclconf/go-cty/cty" plugin "github.com/hashicorp/go-plugin" - proto "github.com/hashicorp/terraform/internal/tfplugin5" - "github.com/hashicorp/terraform/plugin/convert" - "github.com/hashicorp/terraform/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/plugin/convert" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + proto "github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5" "github.com/zclconf/go-cty/cty/msgpack" "google.golang.org/grpc" ) diff --git a/vendor/github.com/hashicorp/terraform/plugin/grpc_provisioner.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/grpc_provisioner.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/plugin/grpc_provisioner.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/grpc_provisioner.go index 136c88d68..c0e6f549a 100644 --- a/vendor/github.com/hashicorp/terraform/plugin/grpc_provisioner.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/grpc_provisioner.go @@ -8,10 +8,10 @@ import ( "sync" plugin "github.com/hashicorp/go-plugin" - "github.com/hashicorp/terraform/configs/configschema" - proto "github.com/hashicorp/terraform/internal/tfplugin5" - "github.com/hashicorp/terraform/plugin/convert" - "github.com/hashicorp/terraform/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/plugin/convert" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" + proto "github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/msgpack" "google.golang.org/grpc" diff --git a/vendor/github.com/hashicorp/terraform/plugin/plugin.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/plugin.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/plugin/plugin.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/plugin.go diff --git a/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/resource_provider.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/plugin/resource_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/resource_provider.go index 459661a55..bfd62e2e9 100644 --- a/vendor/github.com/hashicorp/terraform/plugin/resource_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/resource_provider.go @@ -4,7 +4,7 @@ import ( "net/rpc" "github.com/hashicorp/go-plugin" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // ResourceProviderPlugin is the plugin.Plugin implementation. diff --git a/vendor/github.com/hashicorp/terraform/plugin/serve.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/serve.go similarity index 74% rename from vendor/github.com/hashicorp/terraform/plugin/serve.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/serve.go index 8d056c591..cbe9fc636 100644 --- a/vendor/github.com/hashicorp/terraform/plugin/serve.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/serve.go @@ -2,16 +2,15 @@ package plugin import ( "github.com/hashicorp/go-plugin" - grpcplugin "github.com/hashicorp/terraform/helper/plugin" - proto "github.com/hashicorp/terraform/internal/tfplugin5" - "github.com/hashicorp/terraform/terraform" + grpcplugin "github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin" + proto "github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) const ( // The constants below are the names of the plugins that can be dispensed // from the plugin server. - ProviderPluginName = "provider" - ProvisionerPluginName = "provisioner" + ProviderPluginName = "provider" // DefaultProtocolVersion is the protocol version assumed for legacy clients that don't specify // a particular version during their handshake. This is the version used when Terraform 0.10 @@ -36,19 +35,15 @@ var Handshake = plugin.HandshakeConfig{ } type ProviderFunc func() terraform.ResourceProvider -type ProvisionerFunc func() terraform.ResourceProvisioner type GRPCProviderFunc func() proto.ProviderServer -type GRPCProvisionerFunc func() proto.ProvisionerServer // ServeOpts are the configurations to serve a plugin. type ServeOpts struct { - ProviderFunc ProviderFunc - ProvisionerFunc ProvisionerFunc + ProviderFunc ProviderFunc // Wrapped versions of the above plugins will automatically shimmed and // added to the GRPC functions when possible. - GRPCProviderFunc GRPCProviderFunc - GRPCProvisionerFunc GRPCProvisionerFunc + GRPCProviderFunc GRPCProviderFunc } // Serve serves a plugin. This function never returns and should be the final @@ -66,14 +61,6 @@ func Serve(opts *ServeOpts) { } } } - if opts.GRPCProvisionerFunc == nil && opts.ProvisionerFunc != nil { - provisioner := grpcplugin.NewGRPCProvisionerServerShim(opts.ProvisionerFunc()) - if provisioner != nil { - opts.GRPCProvisionerFunc = func() proto.ProvisionerServer { - return provisioner - } - } - } plugin.Serve(&plugin.ServeConfig{ HandshakeConfig: Handshake, @@ -89,9 +76,6 @@ func legacyPluginMap(opts *ServeOpts) map[string]plugin.Plugin { "provider": &ResourceProviderPlugin{ ResourceProvider: opts.ProviderFunc, }, - "provisioner": &ResourceProvisionerPlugin{ - ResourceProvisioner: opts.ProvisionerFunc, - }, } } @@ -104,18 +88,13 @@ func pluginSet(opts *ServeOpts) map[int]plugin.PluginSet { } // add the new protocol versions if they're configured - if opts.GRPCProviderFunc != nil || opts.GRPCProvisionerFunc != nil { + if opts.GRPCProviderFunc != nil { plugins[5] = plugin.PluginSet{} if opts.GRPCProviderFunc != nil { plugins[5]["provider"] = &GRPCProviderPlugin{ GRPCProvider: opts.GRPCProviderFunc, } } - if opts.GRPCProvisionerFunc != nil { - plugins[5]["provisioner"] = &GRPCProvisionerPlugin{ - GRPCProvisioner: opts.GRPCProvisionerFunc, - } - } } return plugins } diff --git a/vendor/github.com/hashicorp/terraform/plugin/ui_input.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/ui_input.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/plugin/ui_input.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/ui_input.go index 3469e6a96..b24b03ebf 100644 --- a/vendor/github.com/hashicorp/terraform/plugin/ui_input.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/ui_input.go @@ -5,7 +5,7 @@ import ( "net/rpc" "github.com/hashicorp/go-plugin" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // UIInput is an implementation of terraform.UIInput that communicates diff --git a/vendor/github.com/hashicorp/terraform/plugin/ui_output.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/ui_output.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/plugin/ui_output.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/ui_output.go index c222b00cd..07c13d03a 100644 --- a/vendor/github.com/hashicorp/terraform/plugin/ui_output.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/plugin/ui_output.go @@ -3,7 +3,7 @@ package plugin import ( "net/rpc" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // UIOutput is an implementatin of terraform.UIOutput that communicates diff --git a/vendor/github.com/hashicorp/terraform/terraform/context.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/context.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context.go index 5637083ce..eb05c68ae 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/context.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context.go @@ -7,15 +7,15 @@ import ( "log" "sync" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/lang" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/provisioners" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/states/statefile" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" ) @@ -24,23 +24,19 @@ import ( type InputMode byte const ( + // InputModeVar asks for all variables + InputModeVar InputMode = 1 << iota + + // InputModeVarUnset asks for variables which are not set yet. + // InputModeVar must be set for this to have an effect. + InputModeVarUnset + // InputModeProvider asks for provider variables - InputModeProvider InputMode = 1 << iota + InputModeProvider // InputModeStd is the standard operating mode and asks for both variables // and providers. - InputModeStd = InputModeProvider -) - -var ( - // contextFailOnShadowError will cause Context operations to return - // errors when shadow operations fail. This is only used for testing. - contextFailOnShadowError = false - - // contextTestDeepCopyOnPlan will perform a Diff DeepCopy on every - // Plan operation, effectively testing the Diff DeepCopy whenever - // a Plan occurs. This is enabled for tests. - contextTestDeepCopyOnPlan = false + InputModeStd = InputModeVar | InputModeProvider ) // ContextOpts are the user-configurable options to create a context with @@ -97,7 +93,6 @@ type Context struct { parallelSem Semaphore providerInputConfig map[string]map[string]cty.Value providerSHA256s map[string][]byte - runLock sync.Mutex runCond *sync.Cond runContext context.Context runContextCancel context.CancelFunc @@ -159,7 +154,7 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) { variables = variables.Override(opts.Variables) // Bind available provider plugins to the constraints in config - var providerFactories map[addrs.Provider]providers.Factory + var providerFactories map[string]providers.Factory if opts.ProviderResolver != nil { deps := ConfigTreeDependencies(opts.Config, state) reqd := deps.AllPluginRequirements() @@ -167,6 +162,7 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) { reqd.LockExecutables(opts.ProviderSHA256s) } log.Printf("[TRACE] terraform.NewContext: resolving provider version selections") + var providerDiags tfdiags.Diagnostics providerFactories, providerDiags = resourceProviderFactories(opts.ProviderResolver, reqd) diags = diags.Append(providerDiags) @@ -175,7 +171,7 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) { return nil, diags } } else { - providerFactories = make(map[addrs.Provider]providers.Factory) + providerFactories = make(map[string]providers.Factory) } components := &basicComponentFactory{ @@ -202,18 +198,6 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) { log.Printf("[TRACE] terraform.NewContext: complete") - // By the time we get here, we should have values defined for all of - // the root module variables, even if some of them are "unknown". It's the - // caller's responsibility to have already handled the decoding of these - // from the various ways the CLI allows them to be set and to produce - // user-friendly error messages if they are not all present, and so - // the error message from checkInputVariables should never be seen and - // includes language asking the user to report a bug. - if config != nil { - varDiags := checkInputVariables(config.Module.Variables, variables) - diags = diags.Append(varDiags) - } - return &Context{ components: components, schemas: schemas, @@ -231,7 +215,7 @@ func NewContext(opts *ContextOpts) (*Context, tfdiags.Diagnostics) { providerInputConfig: make(map[string]map[string]cty.Value), providerSHA256s: opts.ProviderSHA256s, sh: sh, - }, diags + }, nil } func (c *Context) Schemas() *Schemas { @@ -662,6 +646,14 @@ func (c *Context) Validate() tfdiags.Diagnostics { var diags tfdiags.Diagnostics + // Validate input variables. We do this only for the values supplied + // by the root module, since child module calls are validated when we + // visit their graph nodes. + if c.config != nil { + varDiags := checkInputVariables(c.config.Module.Variables, c.variables) + diags = diags.Append(varDiags) + } + // If we have errors at this point then we probably won't be able to // construct a graph without producing redundant errors, so we'll halt early. if diags.HasErrors() { diff --git a/vendor/github.com/hashicorp/terraform/terraform/context_components.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_components.go similarity index 84% rename from vendor/github.com/hashicorp/terraform/terraform/context_components.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_components.go index 74ab50137..a627996e3 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/context_components.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_components.go @@ -3,9 +3,8 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" ) // contextComponentFactory is the interface that Context uses @@ -28,20 +27,21 @@ type contextComponentFactory interface { // basicComponentFactory just calls a factory from a map directly. type basicComponentFactory struct { - providers map[addrs.Provider]providers.Factory + providers map[string]providers.Factory provisioners map[string]ProvisionerFactory } func (c *basicComponentFactory) ResourceProviders() []string { - var result []string + result := make([]string, len(c.providers)) for k := range c.providers { - result = append(result, k.LegacyString()) + result = append(result, k) } + return result } func (c *basicComponentFactory) ResourceProvisioners() []string { - var result []string + result := make([]string, len(c.provisioners)) for k := range c.provisioners { result = append(result, k) } @@ -50,7 +50,7 @@ func (c *basicComponentFactory) ResourceProvisioners() []string { } func (c *basicComponentFactory) ResourceProvider(typ, uid string) (providers.Interface, error) { - f, ok := c.providers[addrs.NewLegacyProvider(typ)] + f, ok := c.providers[typ] if !ok { return nil, fmt.Errorf("unknown provider %q", typ) } diff --git a/vendor/github.com/hashicorp/terraform/terraform/context_graph_type.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_graph_type.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/context_graph_type.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_graph_type.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/context_import.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_import.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/terraform/context_import.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_import.go index 313e9094f..9a9cd9626 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/context_import.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_import.go @@ -1,10 +1,10 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // ImportOpts are used as the configuration for Import. diff --git a/vendor/github.com/hashicorp/terraform/terraform/context_input.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_input.go similarity index 68% rename from vendor/github.com/hashicorp/terraform/terraform/context_input.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_input.go index acc42ae9b..b92fce120 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/context_input.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_input.go @@ -2,34 +2,23 @@ package terraform import ( "context" + "fmt" "log" "sort" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hcldec" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcldec" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) -// Input asks for input to fill unset required arguments in provider -// configurations. -// +// Input asks for input to fill variables and provider configurations. // This modifies the configuration in-place, so asking for Input twice // may result in different UI output showing different current values. func (c *Context) Input(mode InputMode) tfdiags.Diagnostics { - // This function used to be responsible for more than it is now, so its - // interface is more general than its current functionality requires. - // It now exists only to handle interactive prompts for provider - // configurations, with other prompts the responsibility of the CLI - // layer prior to calling in to this package. - // - // (Hopefully in future the remaining functionality here can move to the - // CLI layer too in order to avoid this odd situation where core code - // produces UI input prompts.) - var diags tfdiags.Diagnostics defer c.acquireRun("input")() @@ -40,6 +29,85 @@ func (c *Context) Input(mode InputMode) tfdiags.Diagnostics { ctx := context.Background() + if mode&InputModeVar != 0 { + log.Printf("[TRACE] Context.Input: Prompting for variables") + + // Walk the variables first for the root module. We walk them in + // alphabetical order for UX reasons. + configs := c.config.Module.Variables + names := make([]string, 0, len(configs)) + for name := range configs { + names = append(names, name) + } + sort.Strings(names) + Variables: + for _, n := range names { + v := configs[n] + + // If we only care about unset variables, then we should set any + // variable that is already set. + if mode&InputModeVarUnset != 0 { + if _, isSet := c.variables[n]; isSet { + continue + } + } + + // this should only happen during tests + if c.uiInput == nil { + log.Println("[WARN] Context.uiInput is nil during input walk") + continue + } + + // Ask the user for a value for this variable + var rawValue string + retry := 0 + for { + var err error + rawValue, err = c.uiInput.Input(ctx, &InputOpts{ + Id: fmt.Sprintf("var.%s", n), + Query: fmt.Sprintf("var.%s", n), + Description: v.Description, + }) + if err != nil { + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Error, + "Failed to request interactive input", + fmt.Sprintf("Terraform attempted to request a value for var.%s interactively, but encountered an error: %s.", n, err), + )) + return diags + } + + if rawValue == "" && v.Default == cty.NilVal { + // Redo if it is required, but abort if we keep getting + // blank entries + if retry > 2 { + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Error, + "Required variable not assigned", + fmt.Sprintf("The variable %q is required, so Terraform cannot proceed without a defined value for it.", n), + )) + continue Variables + } + retry++ + continue + } + + break + } + + val, valDiags := v.ParsingMode.Parse(n, rawValue) + diags = diags.Append(valDiags) + if diags.HasErrors() { + continue + } + + c.variables[n] = &InputValue{ + Value: val, + SourceType: ValueFromInput, + } + } + } + if mode&InputModeProvider != 0 { log.Printf("[TRACE] Context.Input: Prompting for provider arguments") @@ -96,7 +164,7 @@ func (c *Context) Input(mode InputMode) tfdiags.Diagnostics { UIInput: c.uiInput, } - schema := c.schemas.ProviderConfig(pa.Type.LegacyString()) + schema := c.schemas.ProviderConfig(pa.Type) if schema == nil { // Could either be an incorrect config or just an incomplete // mock in tests. We'll let a later pass decide, and just diff --git a/vendor/github.com/hashicorp/terraform/terraform/diff.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/diff.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/terraform/diff.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/diff.go index 4e834204d..e2f54883b 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/diff.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/diff.go @@ -12,9 +12,9 @@ import ( "strings" "sync" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" "github.com/zclconf/go-cty/cty" "github.com/mitchellh/copystructure" @@ -218,16 +218,6 @@ func (d *Diff) String() string { return strings.TrimSpace(buf.String()) } -func (d *Diff) init() { - if d.Modules == nil { - rootDiff := &ModuleDiff{Path: rootModulePath} - d.Modules = []*ModuleDiff{rootDiff} - } - for _, m := range d.Modules { - m.init() - } -} - // ModuleDiff tracks the differences between resources to apply within // a single module. type ModuleDiff struct { diff --git a/vendor/github.com/hashicorp/terraform/terraform/edge_destroy.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/edge_destroy.go similarity index 88% rename from vendor/github.com/hashicorp/terraform/terraform/edge_destroy.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/edge_destroy.go index bc9d638aa..17464bc06 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/edge_destroy.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/edge_destroy.go @@ -3,7 +3,7 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // DestroyEdge is an edge that represents a standard "destroy" relationship: diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/eval.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval.go index 48ed3533a..c490c3bcf 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval.go @@ -3,7 +3,7 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalNode is the interface that must be implemented by graph nodes to diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_apply.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_apply.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/terraform/eval_apply.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_apply.go index 215b9b657..eb0d4fea2 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_apply.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_apply.go @@ -6,17 +6,17 @@ import ( "strings" "github.com/hashicorp/go-multierror" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/plans/objchange" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/provisioners" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalApply is an EvalNode implementation that writes the diff to @@ -24,6 +24,7 @@ import ( type EvalApply struct { Addr addrs.ResourceInstance Config *configs.Resource + Dependencies []addrs.Referenceable State **states.ResourceInstanceObject Change **plans.ResourceInstanceChange ProviderAddr addrs.AbsProviderConfig @@ -69,13 +70,6 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) { } } - if !configVal.IsWhollyKnown() { - return nil, fmt.Errorf( - "configuration for %s still contains unknown values during apply (this is a bug in Terraform; please report it!)", - absAddr, - ) - } - log.Printf("[DEBUG] %s: applying the planned %s change", n.Addr.Absolute(ctx.Path()), change.Action) resp := provider.ApplyResourceChange(providers.ApplyResourceChangeRequest{ TypeName: n.Addr.Resource.Type, @@ -253,8 +247,6 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) { } } - newStatus := states.ObjectReady - // Sometimes providers return a null value when an operation fails for some // reason, but we'd rather keep the prior state so that the error can be // corrected on a subsequent run. We must only do this for null new value @@ -267,20 +259,15 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) { // If change.Action is Create then change.Before will also be null, // which is fine. newVal = change.Before - - // If we're recovering the previous state, we also want to restore the - // the tainted status of the object. - if state.Status == states.ObjectTainted { - newStatus = states.ObjectTainted - } } var newState *states.ResourceInstanceObject if !newVal.IsNull() { // null value indicates that the object is deleted, so we won't set a new state in that case newState = &states.ResourceInstanceObject{ - Status: newStatus, - Value: newVal, - Private: resp.Private, + Status: states.ObjectReady, + Value: newVal, + Private: resp.Private, + Dependencies: n.Dependencies, // Should be populated by the caller from the StateDependencies method on the resource instance node } } @@ -384,39 +371,40 @@ type EvalMaybeTainted struct { Change **plans.ResourceInstanceChange State **states.ResourceInstanceObject Error *error + + // If StateOutput is not nil, its referent will be assigned either the same + // pointer as State or a new object with its status set as Tainted, + // depending on whether an error is given and if this was a create action. + StateOutput **states.ResourceInstanceObject } +// TODO: test func (n *EvalMaybeTainted) Eval(ctx EvalContext) (interface{}, error) { - if n.State == nil || n.Change == nil || n.Error == nil { - return nil, nil - } - state := *n.State change := *n.Change err := *n.Error - // nothing to do if everything went as planned - if err == nil { - return nil, nil - } - if state != nil && state.Status == states.ObjectTainted { log.Printf("[TRACE] EvalMaybeTainted: %s was already tainted, so nothing to do", n.Addr.Absolute(ctx.Path())) return nil, nil } - if change.Action == plans.Create { - // If there are errors during a _create_ then the object is - // in an undefined state, and so we'll mark it as tainted so - // we can try again on the next run. - // - // We don't do this for other change actions because errors - // during updates will often not change the remote object at all. - // If there _were_ changes prior to the error, it's the provider's - // responsibility to record the effect of those changes in the - // object value it returned. - log.Printf("[TRACE] EvalMaybeTainted: %s encountered an error during creation, so it is now marked as tainted", n.Addr.Absolute(ctx.Path())) - *n.State = state.AsTainted() + if n.StateOutput != nil { + if err != nil && change.Action == plans.Create { + // If there are errors during a _create_ then the object is + // in an undefined state, and so we'll mark it as tainted so + // we can try again on the next run. + // + // We don't do this for other change actions because errors + // during updates will often not change the remote object at all. + // If there _were_ changes prior to the error, it's the provider's + // responsibility to record the effect of those changes in the + // object value it returned. + log.Printf("[TRACE] EvalMaybeTainted: %s encountered an error during creation, so it is now marked as tainted", n.Addr.Absolute(ctx.Path())) + *n.StateOutput = state.AsTainted() + } else { + *n.StateOutput = state + } } return nil, nil @@ -569,11 +557,6 @@ func (n *EvalApplyProvisioners) apply(ctx EvalContext, provs []*configs.Provisio config, _, configDiags := ctx.EvaluateBlock(prov.Config, schema, instanceAddr, keyData) diags = diags.Append(configDiags) - // we can't apply the provisioner if the config has errors - if diags.HasErrors() { - return diags.Err() - } - // If the provisioner block contains a connection block of its own then // it can override the base connection configuration, if any. var localConn hcl.Body diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_check_prevent_destroy.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_check_prevent_destroy.go similarity index 72% rename from vendor/github.com/hashicorp/terraform/terraform/eval_check_prevent_destroy.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_check_prevent_destroy.go index 3272a8e88..bcc3c531b 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_check_prevent_destroy.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_check_prevent_destroy.go @@ -3,13 +3,13 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalPreventDestroy is an EvalNode implementation that returns an @@ -45,5 +45,3 @@ func (n *EvalCheckPreventDestroy) Eval(ctx EvalContext) (interface{}, error) { return nil, nil } - -const preventDestroyErrStr = `%s: the plan would destroy this resource, but it currently has lifecycle.prevent_destroy set to true. To avoid this error and continue with the plan, either disable lifecycle.prevent_destroy or adjust the scope of the plan using the -target flag.` diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_context.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_context.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/eval_context.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_context.go index e36805e90..ac3543504 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_context.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_context.go @@ -1,15 +1,15 @@ package terraform import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/lang" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/provisioners" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_context_builtin.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_context_builtin.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/terraform/eval_context_builtin.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_context_builtin.go index f7e9973fe..7347a80df 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_context_builtin.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_context_builtin.go @@ -6,19 +6,19 @@ import ( "log" "sync" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/provisioners" - "github.com/hashicorp/terraform/version" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/version" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/lang" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" "github.com/zclconf/go-cty/cty" ) @@ -142,7 +142,7 @@ func (ctx *BuiltinEvalContext) Provider(addr addrs.AbsProviderConfig) providers. func (ctx *BuiltinEvalContext) ProviderSchema(addr addrs.AbsProviderConfig) *ProviderSchema { ctx.once.Do(ctx.init) - return ctx.Schemas.ProviderSchema(addr.ProviderConfig.Type.LegacyString()) + return ctx.Schemas.ProviderSchema(addr.ProviderConfig.Type) } func (ctx *BuiltinEvalContext) CloseProvider(addr addrs.ProviderConfig) error { @@ -225,12 +225,14 @@ func (ctx *BuiltinEvalContext) InitProvisioner(n string) (provisioners.Interface ctx.ProvisionerLock.Lock() defer ctx.ProvisionerLock.Unlock() - p, err := ctx.Components.ResourceProvisioner(n, "") + key := PathObjectCacheKey(ctx.Path(), n) + + p, err := ctx.Components.ResourceProvisioner(n, key) if err != nil { return nil, err } - ctx.ProvisionerCache[n] = p + ctx.ProvisionerCache[key] = p return p, nil } @@ -241,7 +243,8 @@ func (ctx *BuiltinEvalContext) Provisioner(n string) provisioners.Interface { ctx.ProvisionerLock.Lock() defer ctx.ProvisionerLock.Unlock() - return ctx.ProvisionerCache[n] + key := PathObjectCacheKey(ctx.Path(), n) + return ctx.ProvisionerCache[key] } func (ctx *BuiltinEvalContext) ProvisionerSchema(n string) *configschema.Block { @@ -256,7 +259,9 @@ func (ctx *BuiltinEvalContext) CloseProvisioner(n string) error { ctx.ProvisionerLock.Lock() defer ctx.ProvisionerLock.Unlock() - prov := ctx.ProvisionerCache[n] + key := PathObjectCacheKey(ctx.Path(), n) + + prov := ctx.ProvisionerCache[key] if prov != nil { return prov.Close() } diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_context_mock.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_context_mock.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/eval_context_mock.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_context_mock.go index 26ed4be1f..b7b8722de 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_context_mock.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_context_mock.go @@ -1,16 +1,16 @@ package terraform import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hcldec" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/lang" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/provisioners" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcldec" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" ) diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_count.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_count.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/eval_count.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_count.go index f3b07ef0d..52205fec0 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_count.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_count.go @@ -4,9 +4,9 @@ import ( "fmt" "log" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/gocty" ) diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_count_boundary.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_count_boundary.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/eval_count_boundary.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_count_boundary.go index 647c58d1e..aac380632 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_count_boundary.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_count_boundary.go @@ -4,8 +4,8 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" ) // EvalCountFixZeroOneBoundaryGlobal is an EvalNode that fixes up the state diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_diff.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/eval_diff.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_diff.go index cc9046c20..afab57909 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_diff.go @@ -5,16 +5,16 @@ import ( "log" "strings" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/plans/objchange" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalCheckPlannedChange is an EvalNode implementation that produces errors @@ -120,7 +120,7 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) { if providerSchema == nil { return nil, fmt.Errorf("provider schema is unavailable for %s", n.Addr) } - if n.ProviderAddr.ProviderConfig.Type.LegacyString() == "" { + if n.ProviderAddr.ProviderConfig.Type == "" { panic(fmt.Sprintf("EvalDiff for %s does not have ProviderAddr set", n.Addr.Absolute(ctx.Path()))) } @@ -566,26 +566,6 @@ func processIgnoreChangesIndividual(prior, proposed cty.Value, ignoreChanges []h return ret, diags } -// a group of key-*ResourceAttrDiff pairs from the same flatmapped container -type flatAttrDiff map[string]*ResourceAttrDiff - -// we need to keep all keys if any of them have a diff that's not ignored -func (f flatAttrDiff) keepDiff(ignoreChanges map[string]bool) bool { - for k, v := range f { - ignore := false - for attr := range ignoreChanges { - if strings.HasPrefix(k, attr) { - ignore = true - } - } - - if !v.Empty() && !v.NewComputed && !ignore { - return true - } - } - return false -} - // EvalDiffDestroy is an EvalNode implementation that returns a plain // destroy diff. type EvalDiffDestroy struct { @@ -603,7 +583,7 @@ func (n *EvalDiffDestroy) Eval(ctx EvalContext) (interface{}, error) { absAddr := n.Addr.Absolute(ctx.Path()) state := *n.State - if n.ProviderAddr.ProviderConfig.Type.LegacyString() == "" { + if n.ProviderAddr.ProviderConfig.Type == "" { if n.DeposedKey == "" { panic(fmt.Sprintf("EvalDiffDestroy for %s does not have ProviderAddr set", absAddr)) } else { diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_error.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_error.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/eval_error.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_error.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_filter.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_filter.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/eval_filter.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_filter.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_filter_operation.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_filter_operation.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/eval_filter_operation.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_filter_operation.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_for_each.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_for_each.go similarity index 88% rename from vendor/github.com/hashicorp/terraform/terraform/eval_for_each.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_for_each.go index efe0dd919..4f7c340d2 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_for_each.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_for_each.go @@ -3,8 +3,8 @@ package terraform import ( "fmt" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" ) @@ -19,7 +19,7 @@ func evaluateResourceForEachExpression(expr hcl.Expression, ctx EvalContext) (fo // Attach a diag as we do with count, with the same downsides diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, - Summary: "Invalid for_each argument", + Summary: "Invalid forEach argument", Detail: `The "for_each" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the resources that the for_each depends on.`, Subject: expr.Range().Ptr(), }) @@ -81,14 +81,6 @@ func evaluateResourceForEachExpressionKnown(expr hcl.Expression, ctx EvalContext }) return nil, true, diags } - - // A set may contain unknown values that must be - // discovered by checking with IsWhollyKnown (which iterates through the - // structure), while for maps in cty, keys can never be unknown or null, - // thus the earlier IsKnown check suffices for maps - if !forEachVal.IsWhollyKnown() { - return map[string]cty.Value{}, false, diags - } } return forEachVal.AsValueMap(), true, nil diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_if.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_if.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/eval_if.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_if.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_import_state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_import_state.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/terraform/eval_import_state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_import_state.go index a60f4a0a2..25a2aae06 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_import_state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_import_state.go @@ -4,10 +4,10 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalImportState is an EvalNode implementation that performs an diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_lang.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_lang.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/terraform/eval_lang.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_lang.go index d3a4f5b44..fe99847b2 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_lang.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_lang.go @@ -3,10 +3,10 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_local.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_local.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/terraform/eval_local.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_local.go index f30286e2f..28eaf5fd9 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_local.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_local.go @@ -3,12 +3,12 @@ package terraform import ( "fmt" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/lang" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalLocal is an EvalNode implementation that evaluates the diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_noop.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_noop.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/eval_noop.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_noop.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_output.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_output.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/eval_output.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_output.go index 181e55635..6d2db068c 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_output.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_output.go @@ -4,12 +4,12 @@ import ( "fmt" "log" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // EvalDeleteOutput is an EvalNode implementation that deletes an output diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_provider.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/terraform/eval_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_provider.go index 2ff3745d1..9c29aafd8 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_provider.go @@ -4,12 +4,12 @@ import ( "fmt" "log" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) func buildProviderConfig(ctx EvalContext, addr addrs.ProviderConfig, config *configs.Provider) hcl.Body { @@ -125,7 +125,7 @@ type EvalGetProvider struct { } func (n *EvalGetProvider) Eval(ctx EvalContext) (interface{}, error) { - if n.Addr.ProviderConfig.Type.LegacyString() == "" { + if n.Addr.ProviderConfig.Type == "" { // Should never happen panic("EvalGetProvider used with uninitialized provider configuration address") } diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_provisioner.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_provisioner.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/terraform/eval_provisioner.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_provisioner.go index bc6b5cc76..405ce9d0b 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_provisioner.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_provisioner.go @@ -3,8 +3,8 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" ) // EvalInitProvisioner is an EvalNode implementation that initializes a provisioner diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_read_data.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_read_data.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/eval_read_data.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_read_data.go index e58ec7c6e..0b734b793 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_read_data.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_read_data.go @@ -6,13 +6,13 @@ import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/plans/objchange" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalReadData is an EvalNode implementation that deals with the main part @@ -21,6 +21,7 @@ import ( type EvalReadData struct { Addr addrs.ResourceInstance Config *configs.Resource + Dependencies []addrs.Referenceable Provider *providers.Interface ProviderAddr addrs.AbsProviderConfig ProviderSchema **ProviderSchema @@ -160,8 +161,9 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) { } if n.OutputState != nil { state := &states.ResourceInstanceObject{ - Value: change.After, - Status: states.ObjectPlanned, // because the partial value in the plan must be used for now + Value: change.After, + Status: states.ObjectPlanned, // because the partial value in the plan must be used for now + Dependencies: n.Dependencies, } *n.OutputState = state } @@ -273,8 +275,9 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) { }, } state := &states.ResourceInstanceObject{ - Value: change.After, - Status: states.ObjectReady, // because we completed the read from the provider + Value: change.After, + Status: states.ObjectReady, // because we completed the read from the provider + Dependencies: n.Dependencies, } err = ctx.Hook(func(h Hook) (HookAction, error) { @@ -303,13 +306,14 @@ func (n *EvalReadData) Eval(ctx EvalContext) (interface{}, error) { // EvalReadDataApply is an EvalNode implementation that executes a data // resource's ReadDataApply method to read data from the data source. type EvalReadDataApply struct { - Addr addrs.ResourceInstance - Provider *providers.Interface - ProviderAddr addrs.AbsProviderConfig - ProviderSchema **ProviderSchema - Output **states.ResourceInstanceObject - Config *configs.Resource - Change **plans.ResourceInstanceChange + Addr addrs.ResourceInstance + Provider *providers.Interface + ProviderAddr addrs.AbsProviderConfig + ProviderSchema **ProviderSchema + Output **states.ResourceInstanceObject + Config *configs.Resource + Change **plans.ResourceInstanceChange + StateReferences []addrs.Referenceable } func (n *EvalReadDataApply) Eval(ctx EvalContext) (interface{}, error) { @@ -381,8 +385,9 @@ func (n *EvalReadDataApply) Eval(ctx EvalContext) (interface{}, error) { if n.Output != nil { *n.Output = &states.ResourceInstanceObject{ - Value: newVal, - Status: states.ObjectReady, + Value: newVal, + Status: states.ObjectReady, + Dependencies: n.StateReferences, } } diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_refresh.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_refresh.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/eval_refresh.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_refresh.go index fd50f873a..6a834445c 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_refresh.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_refresh.go @@ -6,10 +6,10 @@ import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalRefresh is an EvalNode implementation that does a refresh for @@ -89,7 +89,6 @@ func (n *EvalRefresh) Eval(ctx EvalContext) (interface{}, error) { newState := state.DeepCopy() newState.Value = resp.NewState newState.Private = resp.Private - newState.Dependencies = state.Dependencies // Call post-refresh hook err = ctx.Hook(func(h Hook) (HookAction, error) { diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_sequence.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_sequence.go index 3485e4f14..7d6bb6603 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_sequence.go @@ -1,7 +1,7 @@ package terraform import ( - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalSequence is an EvalNode that evaluates in sequence. diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_state.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/terraform/eval_state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_state.go index fddc62bf2..70a72bbdb 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_state.go @@ -3,13 +3,12 @@ package terraform import ( "fmt" "log" - "sort" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalReadState is an EvalNode implementation that reads the @@ -201,10 +200,6 @@ type EvalWriteState struct { // ProviderAddr is the address of the provider configuration that // produced the given object. ProviderAddr addrs.AbsProviderConfig - - // Dependencies are the inter-resource dependencies to be stored in the - // state. - Dependencies *[]addrs.AbsResource } func (n *EvalWriteState) Eval(ctx EvalContext) (interface{}, error) { @@ -217,9 +212,10 @@ func (n *EvalWriteState) Eval(ctx EvalContext) (interface{}, error) { absAddr := n.Addr.Absolute(ctx.Path()) state := ctx.State() - if n.ProviderAddr.ProviderConfig.Type.LegacyString() == "" { + if n.ProviderAddr.ProviderConfig.Type == "" { return nil, fmt.Errorf("failed to write state for %s, missing provider type", absAddr) } + obj := *n.State if obj == nil || obj.Value.IsNull() { // No need to encode anything: we'll just write it directly. @@ -227,13 +223,6 @@ func (n *EvalWriteState) Eval(ctx EvalContext) (interface{}, error) { log.Printf("[TRACE] EvalWriteState: removing state object for %s", absAddr) return nil, nil } - - // store the new deps in the state - if n.Dependencies != nil { - log.Printf("[TRACE] EvalWriteState: recording %d dependencies for %s", len(*n.Dependencies), absAddr) - obj.Dependencies = *n.Dependencies - } - if n.ProviderSchema == nil || *n.ProviderSchema == nil { // Should never happen, unless our state object is nil panic("EvalWriteState used with pointer to nil ProviderSchema object") @@ -484,49 +473,3 @@ func (n *EvalForgetResourceState) Eval(ctx EvalContext) (interface{}, error) { return nil, nil } - -// EvalRefreshDependencies is an EvalNode implementation that appends any newly -// found dependencies to those saved in the state. The existing dependencies -// are retained, as they may be missing from the config, and will be required -// for the updates and destroys during the next apply. -type EvalRefreshDependencies struct { - // Prior State - State **states.ResourceInstanceObject - // Dependencies to write to the new state - Dependencies *[]addrs.AbsResource -} - -func (n *EvalRefreshDependencies) Eval(ctx EvalContext) (interface{}, error) { - state := *n.State - if state == nil { - // no existing state to append - return nil, nil - } - - depMap := make(map[string]addrs.AbsResource) - for _, d := range *n.Dependencies { - depMap[d.String()] = d - } - - // We have already dependencies in state, so we need to trust those for - // refresh. We can't write out new dependencies until apply time in case - // the configuration has been changed in a manner the conflicts with the - // stored dependencies. - if len(state.Dependencies) > 0 { - *n.Dependencies = state.Dependencies - return nil, nil - } - - deps := make([]addrs.AbsResource, 0, len(depMap)) - for _, d := range depMap { - deps = append(deps, d) - } - - sort.Slice(deps, func(i, j int) bool { - return deps[i].String() < deps[j].String() - }) - - *n.Dependencies = deps - - return nil, nil -} diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_state_upgrade.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_state_upgrade.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/terraform/eval_state_upgrade.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_state_upgrade.go index e1940005e..27d5f212e 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_state_upgrade.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_state_upgrade.go @@ -4,11 +4,11 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // UpgradeResourceState will, if necessary, run the provider-defined upgrade diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_validate.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_validate.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/terraform/eval_validate.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_validate.go index 5b2146a58..e11cac7fa 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_validate.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_validate.go @@ -4,13 +4,13 @@ import ( "fmt" "log" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/provisioners" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" "github.com/zclconf/go-cty/cty/gocty" diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_validate_selfref.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_validate_selfref.go similarity index 86% rename from vendor/github.com/hashicorp/terraform/terraform/eval_validate_selfref.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_validate_selfref.go index dd5e4018d..ae883b422 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_validate_selfref.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_validate_selfref.go @@ -3,12 +3,12 @@ package terraform import ( "fmt" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/lang" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalValidateSelfRef is an EvalNode implementation that checks to ensure that diff --git a/vendor/github.com/hashicorp/terraform/terraform/eval_variable.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_variable.go similarity index 75% rename from vendor/github.com/hashicorp/terraform/terraform/eval_variable.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_variable.go index 7f6651c4c..0df4a4afc 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_variable.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_variable.go @@ -3,11 +3,10 @@ package terraform import ( "fmt" "log" - "reflect" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" ) @@ -95,26 +94,3 @@ func (n *EvalModuleCallArgument) Eval(ctx EvalContext) (interface{}, error) { } return nil, diags.ErrWithWarnings() } - -// hclTypeName returns the name of the type that would represent this value in -// a config file, or falls back to the Go type name if there's no corresponding -// HCL type. This is used for formatted output, not for comparing types. -func hclTypeName(i interface{}) string { - switch k := reflect.Indirect(reflect.ValueOf(i)).Kind(); k { - case reflect.Bool: - return "boolean" - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, - reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64: - return "number" - case reflect.Array, reflect.Slice: - return "list" - case reflect.Map: - return "map" - case reflect.String: - return "string" - default: - // fall back to the Go type if there's no match - return k.String() - } -} diff --git a/vendor/github.com/hashicorp/terraform/terraform/evaltree_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaltree_provider.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/terraform/evaltree_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaltree_provider.go index f163a727c..d4a8d3cf7 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/evaltree_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaltree_provider.go @@ -1,9 +1,9 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" ) // ProviderEvalTree returns the evaluation tree for initializing and @@ -16,7 +16,7 @@ func ProviderEvalTree(n *NodeApplyableProvider, config *configs.Provider) EvalNo seq := make([]EvalNode, 0, 5) seq = append(seq, &EvalInitProvider{ - TypeName: relAddr.Type.LegacyString(), + TypeName: relAddr.Type, Addr: addr.ProviderConfig, }) diff --git a/vendor/github.com/hashicorp/terraform/terraform/evaluate.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaluate.go similarity index 77% rename from vendor/github.com/hashicorp/terraform/terraform/evaluate.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaluate.go index ae171ed01..81645d7d3 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/evaluate.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaluate.go @@ -2,23 +2,24 @@ package terraform import ( "fmt" + "log" "os" "path/filepath" "strconv" "sync" "github.com/agext/levenshtein" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/lang" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // Evaluator provides the necessary contextual data for evaluating expressions @@ -185,16 +186,6 @@ func (d *evaluationStateData) GetForEachAttr(addr addrs.ForEachAttr, rng tfdiags returnVal = d.InstanceKeyData.EachKey case "value": returnVal = d.InstanceKeyData.EachValue - - if returnVal == cty.NilVal { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: `each.value cannot be used in this context`, - Detail: fmt.Sprintf(`A reference to "each.value" has been used in a context in which it unavailable, such as when the configuration no longer contains the value in its "for_each" expression. Remove this reference to each.value in your configuration to work around this error.`), - Subject: rng.ToHCL().Ptr(), - }) - return cty.UnknownVal(cty.DynamicPseudoType), diags - } default: diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, @@ -516,8 +507,14 @@ func (d *evaluationStateData) GetPathAttr(addr addrs.PathAttr, rng tfdiags.Sourc } } -func (d *evaluationStateData) GetResource(addr addrs.Resource, rng tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) { +func (d *evaluationStateData) GetResourceInstance(addr addrs.ResourceInstance, rng tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) { var diags tfdiags.Diagnostics + + // Although we are giving a ResourceInstance address here, if it has + // a key of addrs.NoKey then it might actually be a request for all of + // the instances of a particular resource. The reference resolver can't + // resolve the ambiguity itself, so we must do it in here. + // First we'll consult the configuration to see if an resource of this // name is declared at all. moduleAddr := d.ModulePath @@ -528,21 +525,36 @@ func (d *evaluationStateData) GetResource(addr addrs.Resource, rng tfdiags.Sourc panic(fmt.Sprintf("resource value read from %s, which has no configuration", moduleAddr)) } - config := moduleConfig.Module.ResourceByAddr(addr) + config := moduleConfig.Module.ResourceByAddr(addr.ContainingResource()) if config == nil { diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, Summary: `Reference to undeclared resource`, - Detail: fmt.Sprintf(`A resource %q %q has not been declared in %s`, addr.Type, addr.Name, moduleDisplayAddr(moduleAddr)), + Detail: fmt.Sprintf(`A resource %q %q has not been declared in %s`, addr.Resource.Type, addr.Resource.Name, moduleDisplayAddr(moduleAddr)), Subject: rng.ToHCL().Ptr(), }) return cty.DynamicVal, diags } - rs := d.Evaluator.State.Resource(addr.Absolute(d.ModulePath)) + // First we'll find the state for the resource as a whole, and decide + // from there whether we're going to interpret the given address as a + // resource or a resource instance address. + rs := d.Evaluator.State.Resource(addr.ContainingResource().Absolute(d.ModulePath)) if rs == nil { - // we must return DynamicVal so that both interpretations + schema := d.getResourceSchema(addr.ContainingResource(), config.ProviderConfigAddr().Absolute(d.ModulePath)) + + // If it doesn't exist at all then we can't reliably determine whether + // single-instance or whole-resource interpretation was intended, but + // we can decide this partially... + if addr.Key != addrs.NoKey { + // If there's an instance key then the user must be intending + // single-instance interpretation, and so we can return a + // properly-typed unknown value to help with type checking. + return cty.UnknownVal(schema.ImpliedType()), diags + } + + // otherwise we must return DynamicVal so that both interpretations // can proceed without generating errors, and we'll deal with this // in a later step where more information is gathered. // (In practice we should only end up here during the validate walk, @@ -557,15 +569,69 @@ func (d *evaluationStateData) GetResource(addr addrs.Resource, rng tfdiags.Sourc return cty.DynamicVal, diags } - return d.getResourceInstancesAll(addr, rng, config, rs, rs.ProviderConfig) + schema := d.getResourceSchema(addr.ContainingResource(), rs.ProviderConfig) + + // If we are able to automatically convert to the "right" type of instance + // key for this each mode then we'll do so, to match with how we generally + // treat values elsewhere in the language. This allows code below to + // assume that any possible conversions have already been dealt with and + // just worry about validation. + key := d.coerceInstanceKey(addr.Key, rs.EachMode) + + multi := false + + switch rs.EachMode { + case states.NoEach: + if key != addrs.NoKey { + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid resource index", + Detail: fmt.Sprintf("Resource %s does not have either \"count\" or \"for_each\" set, so it cannot be indexed.", addr.ContainingResource()), + Subject: rng.ToHCL().Ptr(), + }) + return cty.DynamicVal, diags + } + case states.EachList: + multi = key == addrs.NoKey + if _, ok := addr.Key.(addrs.IntKey); !multi && !ok { + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid resource index", + Detail: fmt.Sprintf("Resource %s must be indexed with a number value.", addr.ContainingResource()), + Subject: rng.ToHCL().Ptr(), + }) + return cty.DynamicVal, diags + } + case states.EachMap: + multi = key == addrs.NoKey + if _, ok := addr.Key.(addrs.StringKey); !multi && !ok { + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid resource index", + Detail: fmt.Sprintf("Resource %s must be indexed with a string value.", addr.ContainingResource()), + Subject: rng.ToHCL().Ptr(), + }) + return cty.DynamicVal, diags + } + } + + if !multi { + log.Printf("[TRACE] GetResourceInstance: %s is a single instance", addr) + is := rs.Instance(key) + if is == nil { + return cty.UnknownVal(schema.ImpliedType()), diags + } + return d.getResourceInstanceSingle(addr, rng, is, config, rs.ProviderConfig) + } + + log.Printf("[TRACE] GetResourceInstance: %s has multiple keyed instances", addr) + return d.getResourceInstancesAll(addr.ContainingResource(), rng, config, rs, rs.ProviderConfig) } -func (d *evaluationStateData) getResourceInstancesAll(addr addrs.Resource, rng tfdiags.SourceRange, config *configs.Resource, rs *states.Resource, providerAddr addrs.AbsProviderConfig) (cty.Value, tfdiags.Diagnostics) { +func (d *evaluationStateData) getResourceInstanceSingle(addr addrs.ResourceInstance, rng tfdiags.SourceRange, is *states.ResourceInstance, config *configs.Resource, providerAddr addrs.AbsProviderConfig) (cty.Value, tfdiags.Diagnostics) { var diags tfdiags.Diagnostics - instAddr := addrs.ResourceInstance{Resource: addr, Key: addrs.NoKey} - - schema := d.getResourceSchema(addr, providerAddr) + schema := d.getResourceSchema(addr.ContainingResource(), providerAddr) if schema == nil { // This shouldn't happen, since validation before we get here should've // taken care of it, but we'll show a reasonable error message anyway. @@ -578,59 +644,75 @@ func (d *evaluationStateData) getResourceInstancesAll(addr addrs.Resource, rng t return cty.DynamicVal, diags } - switch rs.EachMode { - case states.NoEach: - ty := schema.ImpliedType() - is := rs.Instances[addrs.NoKey] - if is == nil || is.Current == nil { - // Assume we're dealing with an instance that hasn't been created yet. - return cty.UnknownVal(ty), diags - } + ty := schema.ImpliedType() + if is == nil || is.Current == nil { + // Assume we're dealing with an instance that hasn't been created yet. + return cty.UnknownVal(ty), diags + } - if is.Current.Status == states.ObjectPlanned { - // If there's a pending change for this instance in our plan, we'll prefer - // that. This is important because the state can't represent unknown values - // and so its data is inaccurate when changes are pending. - if change := d.Evaluator.Changes.GetResourceInstanceChange(instAddr.Absolute(d.ModulePath), states.CurrentGen); change != nil { - val, err := change.After.Decode(ty) - if err != nil { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid resource instance data in plan", - Detail: fmt.Sprintf("Instance %s data could not be decoded from the plan: %s.", addr.Absolute(d.ModulePath), err), - Subject: &config.DeclRange, - }) - return cty.UnknownVal(ty), diags - } - return val, diags - } else { - // If the object is in planned status then we should not - // get here, since we should've found a pending value - // in the plan above instead. + if is.Current.Status == states.ObjectPlanned { + // If there's a pending change for this instance in our plan, we'll prefer + // that. This is important because the state can't represent unknown values + // and so its data is inaccurate when changes are pending. + if change := d.Evaluator.Changes.GetResourceInstanceChange(addr.Absolute(d.ModulePath), states.CurrentGen); change != nil { + val, err := change.After.Decode(ty) + if err != nil { diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, - Summary: "Missing pending object in plan", - Detail: fmt.Sprintf("Instance %s is marked as having a change pending but that change is not recorded in the plan. This is a bug in Terraform; please report it.", addr), + Summary: "Invalid resource instance data in plan", + Detail: fmt.Sprintf("Instance %s data could not be decoded from the plan: %s.", addr.Absolute(d.ModulePath), err), Subject: &config.DeclRange, }) return cty.UnknownVal(ty), diags } - } - - ios, err := is.Current.Decode(ty) - if err != nil { - // This shouldn't happen, since by the time we get here - // we should've upgraded the state data already. + return val, diags + } else { + // If the object is in planned status then we should not + // get here, since we should've found a pending value + // in the plan above instead. diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, - Summary: "Invalid resource instance data in state", - Detail: fmt.Sprintf("Instance %s data could not be decoded from the state: %s.", addr.Absolute(d.ModulePath), err), + Summary: "Missing pending object in plan", + Detail: fmt.Sprintf("Instance %s is marked as having a change pending but that change is not recorded in the plan. This is a bug in Terraform; please report it.", addr), Subject: &config.DeclRange, }) return cty.UnknownVal(ty), diags } + } - return ios.Value, diags + ios, err := is.Current.Decode(ty) + if err != nil { + // This shouldn't happen, since by the time we get here + // we should've upgraded the state data already. + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid resource instance data in state", + Detail: fmt.Sprintf("Instance %s data could not be decoded from the state: %s.", addr.Absolute(d.ModulePath), err), + Subject: &config.DeclRange, + }) + return cty.UnknownVal(ty), diags + } + + return ios.Value, diags +} + +func (d *evaluationStateData) getResourceInstancesAll(addr addrs.Resource, rng tfdiags.SourceRange, config *configs.Resource, rs *states.Resource, providerAddr addrs.AbsProviderConfig) (cty.Value, tfdiags.Diagnostics) { + var diags tfdiags.Diagnostics + + schema := d.getResourceSchema(addr, providerAddr) + if schema == nil { + // This shouldn't happen, since validation before we get here should've + // taken care of it, but we'll show a reasonable error message anyway. + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: `Missing resource type schema`, + Detail: fmt.Sprintf("No schema is available for %s in %s. This is a bug in Terraform and should be reported.", addr, providerAddr), + Subject: rng.ToHCL().Ptr(), + }) + return cty.DynamicVal, diags + } + + switch rs.EachMode { case states.EachList: // We need to infer the length of our resulting tuple by searching @@ -648,59 +730,60 @@ func (d *evaluationStateData) getResourceInstancesAll(addr addrs.Resource, rng t for i := 0; i < length; i++ { ty := schema.ImpliedType() key := addrs.IntKey(i) - is := rs.Instances[key] - if is == nil || is.Current == nil { - // There shouldn't normally be "gaps" in our list but we'll - // allow it under the assumption that we're in a weird situation - // where e.g. someone has run "terraform state mv" to reorder - // a list and left a hole behind. - vals[i] = cty.UnknownVal(schema.ImpliedType()) - continue - } - - instAddr := addr.Instance(key).Absolute(d.ModulePath) + is, exists := rs.Instances[key] + if exists && is.Current != nil { + instAddr := addr.Instance(key).Absolute(d.ModulePath) - if is.Current.Status == states.ObjectPlanned { - if change := d.Evaluator.Changes.GetResourceInstanceChange(instAddr, states.CurrentGen); change != nil { - val, err := change.After.Decode(ty) - if err != nil { + // Prefer pending value in plan if present. See getResourceInstanceSingle + // comment for the rationale. + if is.Current.Status == states.ObjectPlanned { + if change := d.Evaluator.Changes.GetResourceInstanceChange(instAddr, states.CurrentGen); change != nil { + val, err := change.After.Decode(ty) + if err != nil { + diags = diags.Append(&hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid resource instance data in plan", + Detail: fmt.Sprintf("Instance %s data could not be decoded from the plan: %s.", instAddr, err), + Subject: &config.DeclRange, + }) + continue + } + vals[i] = val + continue + } else { + // If the object is in planned status then we should not + // get here, since we should've found a pending value + // in the plan above instead. diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, - Summary: "Invalid resource instance data in plan", - Detail: fmt.Sprintf("Instance %s data could not be decoded from the plan: %s.", instAddr, err), + Summary: "Missing pending object in plan", + Detail: fmt.Sprintf("Instance %s is marked as having a change pending but that change is not recorded in the plan. This is a bug in Terraform; please report it.", instAddr), Subject: &config.DeclRange, }) continue } - vals[i] = val - continue - } else { - // If the object is in planned status then we should not - // get here, since we should've found a pending value - // in the plan above instead. + } + + ios, err := is.Current.Decode(ty) + if err != nil { + // This shouldn't happen, since by the time we get here + // we should've upgraded the state data already. diags = diags.Append(&hcl.Diagnostic{ Severity: hcl.DiagError, - Summary: "Missing pending object in plan", - Detail: fmt.Sprintf("Instance %s is marked as having a change pending but that change is not recorded in the plan. This is a bug in Terraform; please report it.", instAddr), + Summary: "Invalid resource instance data in state", + Detail: fmt.Sprintf("Instance %s data could not be decoded from the state: %s.", instAddr, err), Subject: &config.DeclRange, }) continue } + vals[i] = ios.Value + } else { + // There shouldn't normally be "gaps" in our list but we'll + // allow it under the assumption that we're in a weird situation + // where e.g. someone has run "terraform state mv" to reorder + // a list and left a hole behind. + vals[i] = cty.UnknownVal(schema.ImpliedType()) } - - ios, err := is.Current.Decode(ty) - if err != nil { - // This shouldn't happen, since by the time we get here - // we should've upgraded the state data already. - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid resource instance data in state", - Detail: fmt.Sprintf("Instance %s data could not be decoded from the state: %s.", instAddr, err), - Subject: &config.DeclRange, - }) - continue - } - vals[i] = ios.Value } // We use a tuple rather than a list here because resource schemas may @@ -714,14 +797,12 @@ func (d *evaluationStateData) getResourceInstancesAll(addr addrs.Resource, rng t vals := make(map[string]cty.Value, len(rs.Instances)) for k, is := range rs.Instances { if sk, ok := k.(addrs.StringKey); ok { - if is == nil || is.Current == nil { - // Assume we're dealing with an instance that hasn't been created yet. - vals[string(sk)] = cty.UnknownVal(schema.ImpliedType()) - continue - } - instAddr := addr.Instance(k).Absolute(d.ModulePath) + // Prefer pending value in plan if present. See getResourceInstanceSingle + // comment for the rationale. + // Prefer pending value in plan if present. See getResourceInstanceSingle + // comment for the rationale. if is.Current.Status == states.ObjectPlanned { if change := d.Evaluator.Changes.GetResourceInstanceChange(instAddr, states.CurrentGen); change != nil { val, err := change.After.Decode(ty) @@ -779,7 +860,7 @@ func (d *evaluationStateData) getResourceInstancesAll(addr addrs.Resource, rng t } func (d *evaluationStateData) getResourceSchema(addr addrs.Resource, providerAddr addrs.AbsProviderConfig) *configschema.Block { - providerType := providerAddr.ProviderConfig.Type.LegacyString() + providerType := providerAddr.ProviderConfig.Type schemas := d.Evaluator.Schemas schema, _ := schemas.ResourceTypeConfig(providerType, addr.Mode, addr.Type) return schema diff --git a/vendor/github.com/hashicorp/terraform/terraform/evaluate_valid.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaluate_valid.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/terraform/evaluate_valid.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaluate_valid.go index 01f5ca1db..6badb1543 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/evaluate_valid.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaluate_valid.go @@ -4,12 +4,12 @@ import ( "fmt" "sort" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/helper/didyoumean" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/helper/didyoumean" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // StaticValidateReferences checks the given references against schemas and @@ -215,7 +215,7 @@ func (d *evaluationStateData) staticValidateResourceReference(modCfg *configs.Co // Normally accessing this directly is wrong because it doesn't take into // account provider inheritance, etc but it's okay here because we're only // paying attention to the type anyway. - providerType := cfg.ProviderConfigAddr().Type.LegacyString() + providerType := cfg.ProviderConfigAddr().Type schema, _ := d.Evaluator.Schemas.ResourceTypeConfig(providerType, addr.Mode, addr.Type) if schema == nil { diff --git a/vendor/github.com/hashicorp/terraform/terraform/features.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/features.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/features.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/features.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/graph.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph.go index 58d45a7b6..36e295b6f 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph.go @@ -4,11 +4,11 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // Graph represents the graph that Terraform uses to represent resources diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_builder.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/graph_builder.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder.go index 71b71b752..ee2c5857a 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_builder.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder.go @@ -5,9 +5,9 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/helper/logging" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" + + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // GraphBuilder is an interface that can be implemented and used with @@ -56,7 +56,7 @@ func (b *BasicGraphBuilder) Build(path addrs.ModuleInstance) (*Graph, tfdiags.Di debugOp.End(errMsg) if thisStepStr := g.StringWithNodeTypes(); thisStepStr != lastStepStr { - log.Printf("[TRACE] Completed graph transform %T with new graph:\n%s ------", step, logging.Indent(thisStepStr)) + log.Printf("[TRACE] Completed graph transform %T with new graph:\n%s------", step, thisStepStr) lastStepStr = thisStepStr } else { log.Printf("[TRACE] Completed graph transform %T (no changes)", step) diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_apply.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_apply.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/graph_builder_apply.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_apply.go index 615731328..a4041d133 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_apply.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_apply.go @@ -1,12 +1,12 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // ApplyGraphBuilder implements GraphBuilder and is responsible for building @@ -127,6 +127,21 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer { // Attach the state &AttachStateTransformer{State: b.State}, + // Destruction ordering + &DestroyEdgeTransformer{ + Config: b.Config, + State: b.State, + Schemas: b.Schemas, + }, + GraphTransformIf( + func() bool { return !b.Destroy }, + &CBDEdgeTransformer{ + Config: b.Config, + State: b.State, + Schemas: b.Schemas, + }, + ), + // Provisioner-related transformations &MissingProvisionerTransformer{Provisioners: b.Components.ResourceProvisioners()}, &ProvisionerTransformer{}, @@ -155,21 +170,6 @@ func (b *ApplyGraphBuilder) Steps() []GraphTransformer { // Connect references so ordering is correct &ReferenceTransformer{}, - &AttachDependenciesTransformer{}, - - // Destruction ordering - &DestroyEdgeTransformer{ - Config: b.Config, - State: b.State, - Schemas: b.Schemas, - }, - - &CBDEdgeTransformer{ - Config: b.Config, - State: b.State, - Schemas: b.Schemas, - Destroy: b.Destroy, - }, // Handle destroy time transformations for output and local values. // Reverse the edges from outputs and locals, so that diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_destroy_plan.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_destroy_plan.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/terraform/graph_builder_destroy_plan.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_destroy_plan.go index a6047a9b4..32fe5f973 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_destroy_plan.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_destroy_plan.go @@ -1,11 +1,11 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // DestroyPlanGraphBuilder implements GraphBuilder and is responsible for diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_eval.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_eval.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/graph_builder_eval.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_eval.go index eb6c897bf..8a0bcf5ba 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_eval.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_eval.go @@ -1,11 +1,11 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // EvalGraphBuilder implements GraphBuilder and constructs a graph suitable diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_import.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_import.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/graph_builder_import.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_import.go index 49879e4eb..dcbb10e60 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_import.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_import.go @@ -1,10 +1,10 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // ImportGraphBuilder implements GraphBuilder and is responsible for building diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_plan.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_plan.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/graph_builder_plan.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_plan.go index 17adfd279..bcd119b39 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_plan.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_plan.go @@ -3,11 +3,11 @@ package terraform import ( "sync" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // PlanGraphBuilder implements GraphBuilder and is responsible for building diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_refresh.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_refresh.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/graph_builder_refresh.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_refresh.go index 1c7ae4898..fad7bf161 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_refresh.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_refresh.go @@ -3,12 +3,12 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // RefreshGraphBuilder implements GraphBuilder and is responsible for building @@ -165,7 +165,6 @@ func (b *RefreshGraphBuilder) Steps() []GraphTransformer { // Connect so that the references are ready for targeting. We'll // have to connect again later for providers and so on. &ReferenceTransformer{}, - &AttachDependenciesTransformer{}, // Target &TargetsTransformer{ diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_validate.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_validate.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/graph_builder_validate.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_validate.go index 1881f95f2..0aa8b915a 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_builder_validate.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_builder_validate.go @@ -1,7 +1,7 @@ package terraform import ( - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // ValidateGraphBuilder creates the graph for the validate operation. diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_dot.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_dot.go similarity index 77% rename from vendor/github.com/hashicorp/terraform/terraform/graph_dot.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_dot.go index 73e3821fb..5dbf415ff 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_dot.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_dot.go @@ -1,6 +1,6 @@ package terraform -import "github.com/hashicorp/terraform/dag" +import "github.com/hashicorp/terraform-plugin-sdk/internal/dag" // GraphDot returns the dot formatting of a visual representation of // the given Terraform graph. diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_interface_subgraph.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_interface_subgraph.go similarity index 79% rename from vendor/github.com/hashicorp/terraform/terraform/graph_interface_subgraph.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_interface_subgraph.go index 768590fb0..a005ea5a0 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_interface_subgraph.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_interface_subgraph.go @@ -1,7 +1,7 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // GraphNodeSubPath says that a node is part of a graph with a diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_walk.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_walk.go similarity index 86% rename from vendor/github.com/hashicorp/terraform/terraform/graph_walk.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_walk.go index e980e0c6d..d699376f2 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_walk.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_walk.go @@ -1,9 +1,9 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // GraphWalker is an interface that can be implemented that when used diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_walk_context.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_walk_context.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/terraform/graph_walk_context.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_walk_context.go index 03c192a86..11fb2fd01 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_walk_context.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_walk_context.go @@ -7,14 +7,14 @@ import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/provisioners" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // ContextGraphWalker is the GraphWalker implementation used with the diff --git a/vendor/github.com/hashicorp/terraform/terraform/graph_walk_operation.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_walk_operation.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/graph_walk_operation.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_walk_operation.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/graphtype_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graphtype_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/graphtype_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graphtype_string.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/hook.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/hook.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/terraform/hook.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/hook.go index c0bb23ab2..b5be94824 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/hook.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/hook.go @@ -3,10 +3,10 @@ package terraform import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // HookAction is an enum of actions that can be taken as a result of a hook @@ -143,19 +143,3 @@ func (*NilHook) PostImportState(addr addrs.AbsResourceInstance, imported []provi func (*NilHook) PostStateUpdate(new *states.State) (HookAction, error) { return HookActionContinue, nil } - -// handleHook turns hook actions into panics. This lets you use the -// panic/recover mechanism in Go as a flow control mechanism for hook -// actions. -func handleHook(a HookAction, err error) { - if err != nil { - // TODO: handle errors - } - - switch a { - case HookActionContinue: - return - case HookActionHalt: - panic(HookActionHalt) - } -} diff --git a/vendor/github.com/hashicorp/terraform/terraform/hook_mock.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/hook_mock.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/terraform/hook_mock.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/hook_mock.go index 6efa31963..74a29bde0 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/hook_mock.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/hook_mock.go @@ -5,10 +5,10 @@ import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // MockHook is an implementation of Hook that can be used for tests. diff --git a/vendor/github.com/hashicorp/terraform/terraform/hook_stop.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/hook_stop.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/terraform/hook_stop.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/hook_stop.go index 811fb337c..42c3d20cb 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/hook_stop.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/hook_stop.go @@ -5,10 +5,10 @@ import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // stopHook is a private Hook implementation that Terraform uses to diff --git a/vendor/github.com/hashicorp/terraform/terraform/instancetype.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/instancetype.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/instancetype.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/instancetype.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/instancetype_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/instancetype_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/instancetype_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/instancetype_string.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/module_dependencies.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/module_dependencies.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/module_dependencies.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/module_dependencies.go index 66a68c7de..f1434e625 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/module_dependencies.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/module_dependencies.go @@ -3,11 +3,11 @@ package terraform import ( version "github.com/hashicorp/go-version" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/moduledeps" - "github.com/hashicorp/terraform/plugin/discovery" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps" + "github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // ConfigTreeDependencies returns the dependencies of the tree of modules diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_count_boundary.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_count_boundary.go similarity index 88% rename from vendor/github.com/hashicorp/terraform/terraform/node_count_boundary.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_count_boundary.go index e4952039c..acd8262b0 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_count_boundary.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_count_boundary.go @@ -1,7 +1,7 @@ package terraform import ( - "github.com/hashicorp/terraform/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" ) // NodeCountBoundary fixes up any transitions between "each modes" in objects diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_data_destroy.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_data_destroy.go similarity index 87% rename from vendor/github.com/hashicorp/terraform/terraform/node_data_destroy.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_data_destroy.go index 6ba39904d..56a33bce2 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_data_destroy.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_data_destroy.go @@ -1,8 +1,8 @@ package terraform import ( - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // NodeDestroyableDataResourceInstance represents a resource that is "destroyable": diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_data_refresh.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_data_refresh.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/node_data_refresh.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_data_refresh.go index 7133d42bf..60bcdb74c 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_data_refresh.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_data_refresh.go @@ -1,11 +1,11 @@ package terraform import ( - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" ) @@ -39,7 +39,6 @@ func (n *NodeRefreshableDataResource) DynamicExpand(ctx EvalContext) (*Graph, er } forEachMap, forEachKnown, forEachDiags := evaluateResourceForEachExpressionKnown(n.Config.ForEach, ctx) - diags = diags.Append(forEachDiags) if forEachDiags.HasErrors() { return nil, diags.Err() } @@ -169,6 +168,7 @@ func (n *NodeRefreshableDataResourceInstance) EvalTree() EvalNode { &EvalReadData{ Addr: addr.Resource, Config: n.Config, + Dependencies: n.StateReferences(), Provider: &provider, ProviderAddr: n.ResolvedProvider, ProviderSchema: &providerSchema, diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_local.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_local.go similarity index 86% rename from vendor/github.com/hashicorp/terraform/terraform/node_local.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_local.go index 591eb305a..38681d83d 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_local.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_local.go @@ -1,10 +1,10 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" ) // NodeLocal represents a named local value in a particular module. diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_module_removed.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_module_removed.go similarity index 88% rename from vendor/github.com/hashicorp/terraform/terraform/node_module_removed.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_module_removed.go index 99e440903..441d2632a 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_module_removed.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_module_removed.go @@ -3,7 +3,7 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // NodeModuleRemoved represents a module that is no longer in the @@ -14,7 +14,6 @@ type NodeModuleRemoved struct { var ( _ GraphNodeSubPath = (*NodeModuleRemoved)(nil) - _ RemovableIfNotTargeted = (*NodeModuleRemoved)(nil) _ GraphNodeEvalable = (*NodeModuleRemoved)(nil) _ GraphNodeReferencer = (*NodeModuleRemoved)(nil) _ GraphNodeReferenceOutside = (*NodeModuleRemoved)(nil) @@ -64,13 +63,6 @@ func (n *NodeModuleRemoved) References() []*addrs.Reference { } } -// RemovableIfNotTargeted -func (n *NodeModuleRemoved) RemoveIfNotTargeted() bool { - // We need to add this so that this node will be removed if - // it isn't targeted or a dependency of a target. - return true -} - // EvalCheckModuleRemoved is an EvalNode implementation that verifies that // a module has been removed from the state as expected. type EvalCheckModuleRemoved struct { diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_module_variable.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_module_variable.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/terraform/node_module_variable.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_module_variable.go index 6b675e570..03653359c 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_module_variable.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_module_variable.go @@ -1,11 +1,11 @@ package terraform import ( - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/lang" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_output.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_output.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/node_output.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_output.go index bb3d06531..753057123 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_output.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_output.go @@ -3,10 +3,10 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" ) // NodeApplyableOutput represents an output that is "applyable": diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_output_orphan.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_output_orphan.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/node_output_orphan.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_output_orphan.go index 518b8aa09..a76d1742c 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_output_orphan.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_output_orphan.go @@ -3,7 +3,7 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // NodeOutputOrphan represents an output that is an orphan. diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/node_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_provider_abstract.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider_abstract.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/terraform/node_provider_abstract.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider_abstract.go index a0cdcfe01..afdd4741d 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_provider_abstract.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider_abstract.go @@ -1,11 +1,11 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // ConcreteProviderNodeFunc is a callback type used to convert an diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_provider_disabled.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider_disabled.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/terraform/node_provider_disabled.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider_disabled.go index 30d8813a4..51335654b 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_provider_disabled.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider_disabled.go @@ -3,7 +3,7 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // NodeDisabledProvider represents a provider that is disabled. A disabled diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_provider_eval.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider_eval.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/terraform/node_provider_eval.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider_eval.go index 1e4daabb9..580e60cb7 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_provider_eval.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provider_eval.go @@ -14,7 +14,7 @@ func (n *NodeEvalableProvider) EvalTree() EvalNode { relAddr := addr.ProviderConfig return &EvalInitProvider{ - TypeName: relAddr.Type.LegacyString(), + TypeName: relAddr.Type, Addr: addr.ProviderConfig, } } diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_provisioner.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provisioner.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/node_provisioner.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provisioner.go index cf51cf06c..573f030d7 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_provisioner.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_provisioner.go @@ -3,7 +3,7 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // NodeProvisioner represents a provider that has no associated operations. diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_abstract.go similarity index 78% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_abstract.go index 8d6f01832..c7b0e3c8e 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_abstract.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_abstract.go @@ -3,14 +3,15 @@ package terraform import ( "fmt" "log" - - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/lang" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "sort" + + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // ConcreteResourceNodeFunc is a callback type used to convert an @@ -34,10 +35,6 @@ type ConcreteResourceInstanceNodeFunc func(*NodeAbstractResourceInstance) dag.Ve // configuration. type GraphNodeResourceInstance interface { ResourceInstanceAddr() addrs.AbsResourceInstance - - // StateDependencies returns any inter-resource dependencies that are - // stored in the state. - StateDependencies() []addrs.AbsResource } // NodeAbstractResource represents a resource that has no associated @@ -96,8 +93,8 @@ type NodeAbstractResourceInstance struct { // The fields below will be automatically set using the Attach // interfaces if you're running those transforms, but also be explicitly // set if you already have that information. + ResourceState *states.Resource - Dependencies []addrs.AbsResource } var ( @@ -170,12 +167,12 @@ func (n *NodeAbstractResource) References() []*addrs.Reference { var result []*addrs.Reference for _, traversal := range c.DependsOn { - ref, diags := addrs.ParseRef(traversal) - if diags.HasErrors() { + ref, err := addrs.ParseRef(traversal) + if err != nil { // We ignore this here, because this isn't a suitable place to return // errors. This situation should be caught and rejected during // validation. - log.Printf("[ERROR] Can't parse %#v from depends_on as reference: %s", traversal, diags.Err()) + log.Printf("[ERROR] Can't parse %#v from depends_on as reference: %s", traversal, err) continue } @@ -223,8 +220,7 @@ func (n *NodeAbstractResource) References() []*addrs.Reference { func (n *NodeAbstractResourceInstance) References() []*addrs.Reference { // If we have a configuration attached then we'll delegate to our // embedded abstract resource, which knows how to extract dependencies - // from configuration. If there is no config, then the dependencies will - // be connected during destroy from those stored in the state. + // from configuration. if n.Config != nil { if n.Schema == nil { // We'll produce a log message about this out here so that @@ -236,10 +232,8 @@ func (n *NodeAbstractResourceInstance) References() []*addrs.Reference { return n.NodeAbstractResource.References() } - // FIXME: remove once the deprecated DependsOn values have been removed from state - // The state dependencies are now connected in a separate transformation as - // absolute addresses, but we need to keep this here until we can be sure - // that no state will need to use the old depends_on references. + // Otherwise, if we have state then we'll use the values stored in state + // as a fallback. if rs := n.ResourceState; rs != nil { if s := rs.Instance(n.InstanceKey); s != nil { // State is still storing dependencies as old-style strings, so we'll @@ -251,26 +245,26 @@ func (n *NodeAbstractResourceInstance) References() []*addrs.Reference { // difficult to reproduce, so we will fix the symptom here and hope // to find the root cause another time. // - // https://github.com/hashicorp/terraform/issues/21407 + // https://github.com/hashicorp/terraform-plugin-sdk/issues/21407 if s.Current == nil { log.Printf("[WARN] no current state found for %s", n.Name()) - return nil - } - for _, addr := range s.Current.DependsOn { - if addr == nil { - // Should never happen; indicates a bug in the state loader - panic(fmt.Sprintf("dependencies for current object on %s contains nil address", n.ResourceInstanceAddr())) + } else { + for _, addr := range s.Current.Dependencies { + if addr == nil { + // Should never happen; indicates a bug in the state loader + panic(fmt.Sprintf("dependencies for current object on %s contains nil address", n.ResourceInstanceAddr())) + } + + // This is a little weird: we need to manufacture an addrs.Reference + // with a fake range here because the state isn't something we can + // make source references into. + result = append(result, &addrs.Reference{ + Subject: addr, + SourceRange: tfdiags.SourceRange{ + Filename: "(state file)", + }, + }) } - - // This is a little weird: we need to manufacture an addrs.Reference - // with a fake range here because the state isn't something we can - // make source references into. - result = append(result, &addrs.Reference{ - Subject: addr, - SourceRange: tfdiags.SourceRange{ - Filename: "(state file)", - }, - }) } return result } @@ -280,31 +274,67 @@ func (n *NodeAbstractResourceInstance) References() []*addrs.Reference { return nil } -// converts an instance address to the legacy dotted notation -func dottedInstanceAddr(tr addrs.ResourceInstance) string { - // The legacy state format uses dot-separated instance keys, - // rather than bracketed as in our modern syntax. - var suffix string - switch tk := tr.Key.(type) { - case addrs.IntKey: - suffix = fmt.Sprintf(".%d", int(tk)) - case addrs.StringKey: - suffix = fmt.Sprintf(".%s", string(tk)) +// StateReferences returns the dependencies to put into the state for +// this resource. +func (n *NodeAbstractResourceInstance) StateReferences() []addrs.Referenceable { + selfAddrs := n.ReferenceableAddrs() + + // Since we don't include the source location references in our + // results from this method, we'll also filter out duplicates: + // there's no point in listing the same object twice without + // that additional context. + seen := map[string]struct{}{} + + // Pretend that we've already "seen" all of our own addresses so that we + // won't record self-references in the state. This can arise if, for + // example, a provisioner for a resource refers to the resource itself, + // which is valid (since provisioners always run after apply) but should + // not create an explicit dependency edge. + for _, selfAddr := range selfAddrs { + seen[selfAddr.String()] = struct{}{} + if riAddr, ok := selfAddr.(addrs.ResourceInstance); ok { + seen[riAddr.ContainingResource().String()] = struct{}{} + } } - return tr.Resource.String() + suffix -} -// StateDependencies returns the dependencies saved in the state. -func (n *NodeAbstractResourceInstance) StateDependencies() []addrs.AbsResource { - if rs := n.ResourceState; rs != nil { - if s := rs.Instance(n.InstanceKey); s != nil { - if s.Current != nil { - return s.Current.Dependencies - } + depsRaw := n.References() + deps := make([]addrs.Referenceable, 0, len(depsRaw)) + for _, d := range depsRaw { + subj := d.Subject + if mco, isOutput := subj.(addrs.ModuleCallOutput); isOutput { + // For state dependencies, we simplify outputs to just refer + // to the module as a whole. It's not really clear why we do this, + // but this logic is preserved from before the 0.12 rewrite of + // this function. + subj = mco.Call + } + + k := subj.String() + if _, exists := seen[k]; exists { + continue + } + seen[k] = struct{}{} + switch tr := subj.(type) { + case addrs.ResourceInstance: + deps = append(deps, tr) + case addrs.Resource: + deps = append(deps, tr) + case addrs.ModuleCallInstance: + deps = append(deps, tr) + default: + // No other reference types are recorded in the state. } } - return nil + // We'll also sort them, since that'll avoid creating changes in the + // serialized state that make no semantic difference. + sort.Slice(deps, func(i, j int) bool { + // Simple string-based sort because we just care about consistency, + // not user-friendliness. + return deps[i].String() < deps[j].String() + }) + + return deps } func (n *NodeAbstractResource) SetProvider(p addrs.AbsProviderConfig) { diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_apply.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_apply.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_apply.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_apply.go index 3e2fff3a0..68d438d7b 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_apply.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_apply.go @@ -3,9 +3,9 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/lang" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" ) // NodeApplyableResource represents a resource that is "applyable": diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_apply_instance.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_apply_instance.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_apply_instance.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_apply_instance.go index 8fa9b1283..acdda45e4 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_apply_instance.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_apply_instance.go @@ -5,12 +5,12 @@ import ( "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // NodeApplyableResourceInstance represents a resource instance that is @@ -28,13 +28,12 @@ type NodeApplyableResourceInstance struct { } var ( - _ GraphNodeResource = (*NodeApplyableResourceInstance)(nil) - _ GraphNodeResourceInstance = (*NodeApplyableResourceInstance)(nil) - _ GraphNodeCreator = (*NodeApplyableResourceInstance)(nil) - _ GraphNodeReferencer = (*NodeApplyableResourceInstance)(nil) - _ GraphNodeDeposer = (*NodeApplyableResourceInstance)(nil) - _ GraphNodeEvalable = (*NodeApplyableResourceInstance)(nil) - _ GraphNodeAttachDependencies = (*NodeApplyableResourceInstance)(nil) + _ GraphNodeResource = (*NodeApplyableResourceInstance)(nil) + _ GraphNodeResourceInstance = (*NodeApplyableResourceInstance)(nil) + _ GraphNodeCreator = (*NodeApplyableResourceInstance)(nil) + _ GraphNodeReferencer = (*NodeApplyableResourceInstance)(nil) + _ GraphNodeDeposer = (*NodeApplyableResourceInstance)(nil) + _ GraphNodeEvalable = (*NodeApplyableResourceInstance)(nil) ) // GraphNodeAttachDestroyer @@ -98,11 +97,6 @@ func (n *NodeApplyableResourceInstance) References() []*addrs.Reference { return ret } -// GraphNodeAttachDependencies -func (n *NodeApplyableResourceInstance) AttachDependencies(deps []addrs.AbsResource) { - n.Dependencies = deps -} - // GraphNodeEvalable func (n *NodeApplyableResourceInstance) EvalTree() EvalNode { addr := n.ResourceInstanceAddr() @@ -110,7 +104,7 @@ func (n *NodeApplyableResourceInstance) EvalTree() EvalNode { if n.Config == nil { // This should not be possible, but we've got here in at least one // case as discussed in the following issue: - // https://github.com/hashicorp/terraform/issues/21258 + // https://github.com/hashicorp/terraform-plugin-sdk/issues/21258 // To avoid an outright crash here, we'll instead return an explicit // error. var diags tfdiags.Diagnostics @@ -177,6 +171,7 @@ func (n *NodeApplyableResourceInstance) evalTreeDataResource(addr addrs.AbsResou &EvalReadData{ Addr: addr.Resource, Config: n.Config, + Dependencies: n.StateReferences(), Planned: &change, // setting this indicates that the result must be complete Provider: &provider, ProviderAddr: n.ResolvedProvider, @@ -346,6 +341,7 @@ func (n *NodeApplyableResourceInstance) evalTreeManagedResource(addr addrs.AbsRe &EvalApply{ Addr: addr.Resource, Config: n.Config, + Dependencies: n.StateReferences(), State: &state, Change: &diffApply, Provider: &provider, @@ -356,17 +352,17 @@ func (n *NodeApplyableResourceInstance) evalTreeManagedResource(addr addrs.AbsRe CreateNew: &createNew, }, &EvalMaybeTainted{ - Addr: addr.Resource, - State: &state, - Change: &diffApply, - Error: &err, + Addr: addr.Resource, + State: &state, + Change: &diffApply, + Error: &err, + StateOutput: &state, }, &EvalWriteState{ Addr: addr.Resource, ProviderAddr: n.ResolvedProvider, ProviderSchema: &providerSchema, State: &state, - Dependencies: &n.Dependencies, }, &EvalApplyProvisioners{ Addr: addr.Resource, @@ -377,17 +373,17 @@ func (n *NodeApplyableResourceInstance) evalTreeManagedResource(addr addrs.AbsRe When: configs.ProvisionerWhenCreate, }, &EvalMaybeTainted{ - Addr: addr.Resource, - State: &state, - Change: &diffApply, - Error: &err, + Addr: addr.Resource, + State: &state, + Change: &diffApply, + Error: &err, + StateOutput: &state, }, &EvalWriteState{ Addr: addr.Resource, ProviderAddr: n.ResolvedProvider, ProviderSchema: &providerSchema, State: &state, - Dependencies: &n.Dependencies, }, &EvalIf{ If: func(ctx EvalContext) (bool, error) { diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_destroy.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_destroy.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_destroy.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_destroy.go index ca2267e47..049e5e990 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_destroy.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_destroy.go @@ -4,12 +4,12 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // NodeDestroyResourceInstance represents a resource instance that is to be diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_destroy_deposed.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_destroy_deposed.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_destroy_deposed.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_destroy_deposed.go index e0d5db836..269c79808 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_destroy_deposed.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_destroy_deposed.go @@ -3,11 +3,11 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // ConcreteResourceInstanceDeposedNodeFunc is a callback type used to convert @@ -178,7 +178,7 @@ var ( ) func (n *NodeDestroyDeposedResourceInstanceObject) Name() string { - return fmt.Sprintf("%s (destroy deposed %s)", n.ResourceInstanceAddr(), n.DeposedKey) + return fmt.Sprintf("%s (destroy deposed %s)", n.Addr.String(), n.DeposedKey) } func (n *NodeDestroyDeposedResourceInstanceObject) DeposedInstanceObjectKey() states.DeposedKey { diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_plan.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan.go index ec4aa9322..2dc0df908 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan.go @@ -3,8 +3,8 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // NodePlannableResource represents a resource that is "plannable": diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_destroy.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan_destroy.go similarity index 87% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_destroy.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan_destroy.go index decc372a5..2c3a7012b 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_destroy.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan_destroy.go @@ -3,11 +3,11 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // NodePlanDestroyableResourceInstance represents a resource that is ready @@ -47,7 +47,7 @@ func (n *NodePlanDestroyableResourceInstance) EvalTree() EvalNode { var change *plans.ResourceInstanceChange var state *states.ResourceInstanceObject - if n.ResolvedProvider.ProviderConfig.Type.String() == "" { + if n.ResolvedProvider.ProviderConfig.Type == "" { // Should never happen; indicates that the graph was not constructed // correctly since we didn't get our provider attached. panic(fmt.Sprintf("%T %q was not assigned a resolved provider", n, dag.VertexName(n))) diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_instance.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan_instance.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_instance.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan_instance.go index 05ccefc34..ac4b24cf2 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_instance.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan_instance.go @@ -3,11 +3,11 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" "github.com/zclconf/go-cty/cty" ) @@ -78,8 +78,8 @@ func (n *NodePlannableResourceInstance) evalTreeDataResource(addr addrs.AbsResou // Check and see if any of our dependencies have changes. changes := ctx.Changes() - for _, d := range n.References() { - ri, ok := d.Subject.(addrs.ResourceInstance) + for _, d := range n.StateReferences() { + ri, ok := d.(addrs.ResourceInstance) if !ok { continue } @@ -114,6 +114,7 @@ func (n *NodePlannableResourceInstance) evalTreeDataResource(addr addrs.AbsResou &EvalReadData{ Addr: addr.Resource, Config: n.Config, + Dependencies: n.StateReferences(), Provider: &provider, ProviderAddr: n.ResolvedProvider, ProviderSchema: &providerSchema, diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_orphan.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan_orphan.go similarity index 93% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_orphan.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan_orphan.go index 841669491..8e4f7148f 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_plan_orphan.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_plan_orphan.go @@ -1,9 +1,9 @@ package terraform import ( - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // NodePlannableResourceInstanceOrphan represents a resource that is "applyable": diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_refresh.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_refresh.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_refresh.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_refresh.go index 2dd549c0b..dcab37270 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_refresh.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_refresh.go @@ -4,24 +4,20 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // NodeRefreshableManagedResource represents a resource that is expanabled into // NodeRefreshableManagedResourceInstance. Resource count orphans are also added. type NodeRefreshableManagedResource struct { *NodeAbstractResource - - // We attach dependencies to the Resource during refresh, since the - // instances are instantiated during DynamicExpand. - Dependencies []addrs.AbsResource } var ( @@ -31,14 +27,8 @@ var ( _ GraphNodeReferencer = (*NodeRefreshableManagedResource)(nil) _ GraphNodeResource = (*NodeRefreshableManagedResource)(nil) _ GraphNodeAttachResourceConfig = (*NodeRefreshableManagedResource)(nil) - _ GraphNodeAttachDependencies = (*NodeRefreshableManagedResource)(nil) ) -// GraphNodeAttachDependencies -func (n *NodeRefreshableManagedResource) AttachDependencies(deps []addrs.AbsResource) { - n.Dependencies = deps -} - // GraphNodeDynamicExpandable func (n *NodeRefreshableManagedResource) DynamicExpand(ctx EvalContext) (*Graph, error) { var diags tfdiags.Diagnostics @@ -68,7 +58,6 @@ func (n *NodeRefreshableManagedResource) DynamicExpand(ctx EvalContext) (*Graph, // Add the config and state since we don't do that via transforms a.Config = n.Config a.ResolvedProvider = n.ResolvedProvider - a.Dependencies = n.Dependencies return &NodeRefreshableManagedResourceInstance{ NodeAbstractResourceInstance: a, @@ -214,11 +203,6 @@ func (n *NodeRefreshableManagedResourceInstance) evalTreeManagedResource() EvalN Output: &state, }, - &EvalRefreshDependencies{ - State: &state, - Dependencies: &n.Dependencies, - }, - &EvalRefresh{ Addr: addr.Resource, ProviderAddr: n.ResolvedProvider, @@ -233,7 +217,6 @@ func (n *NodeRefreshableManagedResourceInstance) evalTreeManagedResource() EvalN ProviderAddr: n.ResolvedProvider, ProviderSchema: &providerSchema, State: &state, - Dependencies: &n.Dependencies, }, }, } @@ -293,7 +276,6 @@ func (n *NodeRefreshableManagedResourceInstance) evalTreeManagedResourceNoState( ProviderAddr: n.ResolvedProvider, ProviderSchema: &providerSchema, State: &state, - Dependencies: &n.Dependencies, }, // We must also save the planned change, so that expressions in diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_resource_validate.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_validate.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/terraform/node_resource_validate.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_validate.go index efa657bf0..f0eb18a06 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_resource_validate.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_resource_validate.go @@ -1,10 +1,10 @@ package terraform import ( - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/terraform/node_root_variable.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_root_variable.go similarity index 83% rename from vendor/github.com/hashicorp/terraform/terraform/node_root_variable.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_root_variable.go index 1c302903d..844d060c9 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/node_root_variable.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/node_root_variable.go @@ -1,9 +1,9 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // NodeRootVariable represents a root variable input. diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/path.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/path.go new file mode 100644 index 000000000..19e3469cb --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/path.go @@ -0,0 +1,17 @@ +package terraform + +import ( + "fmt" + + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" +) + +// PathObjectCacheKey is like PathCacheKey but includes an additional name +// to be included in the key, for module-namespaced objects. +// +// The result of this function is guaranteed unique for any distinct pair +// of path and name, but is not guaranteed to be in any particular format +// and in particular should never be shown to end-users. +func PathObjectCacheKey(path addrs.ModuleInstance, objectName string) string { + return fmt.Sprintf("%s|%s", path.String(), objectName) +} diff --git a/vendor/github.com/hashicorp/terraform/terraform/plan.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/plan.go similarity index 84% rename from vendor/github.com/hashicorp/terraform/terraform/plan.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/plan.go index af04c6cd4..5c19f6e7c 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/plan.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/plan.go @@ -5,11 +5,9 @@ import ( "encoding/gob" "fmt" "io" - "sync" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" "github.com/zclconf/go-cty/cty" - - "github.com/hashicorp/terraform/configs" ) func init() { @@ -73,8 +71,6 @@ type Plan struct { // Destroy indicates that this plan was created for a full destroy operation Destroy bool - - once sync.Once } func (p *Plan) String() string { @@ -86,30 +82,6 @@ func (p *Plan) String() string { return buf.String() } -func (p *Plan) init() { - p.once.Do(func() { - if p.Diff == nil { - p.Diff = new(Diff) - p.Diff.init() - } - - if p.State == nil { - p.State = new(State) - p.State.init() - } - - if p.Vars == nil { - p.Vars = make(map[string]cty.Value) - } - }) -} - -// The format byte is prefixed into the plan file format so that we have -// the ability in the future to change the file format if we want for any -// reason. -const planFormatMagic = "tfplan" -const planFormatVersion byte = 2 - // ReadPlan reads a plan structure out of a reader in the format that // was written by WritePlan. func ReadPlan(src io.Reader) (*Plan, error) { diff --git a/vendor/github.com/hashicorp/terraform/terraform/provider_mock.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/provider_mock.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/terraform/provider_mock.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/provider_mock.go index d82dc0f4e..7e401f33e 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/provider_mock.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/provider_mock.go @@ -8,9 +8,9 @@ import ( "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) var _ providers.Interface = (*MockProvider)(nil) diff --git a/vendor/github.com/hashicorp/terraform/terraform/provisioner_mock.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/provisioner_mock.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/terraform/provisioner_mock.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/provisioner_mock.go index f59589164..93b19be57 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/provisioner_mock.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/provisioner_mock.go @@ -7,7 +7,7 @@ import ( "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" - "github.com/hashicorp/terraform/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" ) var _ provisioners.Interface = (*MockProvisioner)(nil) diff --git a/vendor/github.com/hashicorp/terraform/terraform/resource.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/resource.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource.go index fcf28aa65..bd5774600 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/resource.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource.go @@ -11,10 +11,9 @@ import ( "github.com/mitchellh/reflectwalk" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" ) // Resource is a legacy way to identify a particular resource instance. @@ -81,12 +80,6 @@ type InstanceInfo struct { // Type is the resource type of this instance Type string - - // uniqueExtra is an internal field that can be populated to supply - // extra metadata that is used to identify a unique instance in - // the graph walk. This will be appended to HumanID when uniqueId - // is called. - uniqueExtra string } // NewInstanceInfo constructs an InstanceInfo from an addrs.AbsResourceInstance. @@ -185,15 +178,6 @@ type ResourceConfig struct { ComputedKeys []string Raw map[string]interface{} Config map[string]interface{} - - raw *config.RawConfig -} - -// NewResourceConfig creates a new ResourceConfig from a config.RawConfig. -func NewResourceConfig(c *config.RawConfig) *ResourceConfig { - result := &ResourceConfig{raw: c} - result.interpolateForce() - return result } // NewResourceConfigRaw constructs a ResourceConfig whose content is exactly @@ -512,31 +496,6 @@ func (c *ResourceConfig) get( return current, true } -// interpolateForce is a temporary thing. We want to get rid of interpolate -// above and likewise this, but it can only be done after the f-ast-graph -// refactor is complete. -func (c *ResourceConfig) interpolateForce() { - if c.raw == nil { - // If we don't have a lowercase "raw" but we _do_ have the uppercase - // Raw populated then this indicates that we're recieving a shim - // ResourceConfig created by NewResourceConfigShimmed, which is already - // fully evaluated and thus this function doesn't need to do anything. - if c.Raw != nil { - return - } - - var err error - c.raw, err = config.NewRawConfig(make(map[string]interface{})) - if err != nil { - panic(err) - } - } - - c.ComputedKeys = c.raw.UnknownKeys() - c.Raw = c.raw.RawMap() - c.Config = c.raw.Config() -} - // unknownCheckWalker type unknownCheckWalker struct { Unknown bool diff --git a/vendor/github.com/hashicorp/terraform/terraform/resource_address.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_address.go similarity index 99% rename from vendor/github.com/hashicorp/terraform/terraform/resource_address.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_address.go index ca833fe13..8a683012d 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/resource_address.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_address.go @@ -7,8 +7,8 @@ import ( "strconv" "strings" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" ) // ResourceAddress is a way of identifying an individual resource (or, diff --git a/vendor/github.com/hashicorp/terraform/terraform/resource_mode.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_mode.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/resource_mode.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_mode.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/resource_mode_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_mode_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/resource_mode_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_mode_string.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/resource_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provider.go similarity index 92% rename from vendor/github.com/hashicorp/terraform/terraform/resource_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provider.go index 27f98c0fe..670bcba20 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/resource_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provider.go @@ -3,11 +3,10 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" - "github.com/hashicorp/terraform/plugin/discovery" - "github.com/hashicorp/terraform/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" ) // ResourceProvider is an interface that must be implemented by any @@ -210,18 +209,18 @@ type ResourceProviderResolver interface { // Given a constraint map, return a ResourceProviderFactory for each // requested provider. If some or all of the constraints cannot be // satisfied, return a non-nil slice of errors describing the problems. - ResolveProviders(reqd discovery.PluginRequirements) (map[addrs.Provider]ResourceProviderFactory, []error) + ResolveProviders(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) } // ResourceProviderResolverFunc wraps a callback function and turns it into // a ResourceProviderResolver implementation, for convenience in situations // where a function and its associated closure are sufficient as a resolver // implementation. -type ResourceProviderResolverFunc func(reqd discovery.PluginRequirements) (map[addrs.Provider]ResourceProviderFactory, []error) +type ResourceProviderResolverFunc func(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) // ResolveProviders implements ResourceProviderResolver by calling the // wrapped function. -func (f ResourceProviderResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[addrs.Provider]ResourceProviderFactory, []error) { +func (f ResourceProviderResolverFunc) ResolveProviders(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) { return f(reqd) } @@ -232,15 +231,13 @@ func (f ResourceProviderResolverFunc) ResolveProviders(reqd discovery.PluginRequ // // This function is primarily used in tests, to provide mock providers or // in-process providers under test. -func ResourceProviderResolverFixed(factories map[addrs.Provider]ResourceProviderFactory) ResourceProviderResolver { - return ResourceProviderResolverFunc(func(reqd discovery.PluginRequirements) (map[addrs.Provider]ResourceProviderFactory, []error) { - ret := make(map[addrs.Provider]ResourceProviderFactory, len(reqd)) +func ResourceProviderResolverFixed(factories map[string]ResourceProviderFactory) ResourceProviderResolver { + return ResourceProviderResolverFunc(func(reqd discovery.PluginRequirements) (map[string]ResourceProviderFactory, []error) { + ret := make(map[string]ResourceProviderFactory, len(reqd)) var errs []error for name := range reqd { - // Provider Source Readiness! - fqn := addrs.NewLegacyProvider(name) - if factory, exists := factories[fqn]; exists { - ret[fqn] = factory + if factory, exists := factories[name]; exists { + ret[name] = factory } else { errs = append(errs, fmt.Errorf("provider %q is not available", name)) } @@ -288,7 +285,7 @@ func ProviderHasDataSource(p ResourceProvider, n string) bool { // This should be called only with configurations that have passed calls // to config.Validate(), which ensures that all of the given version // constraints are valid. It will panic if any invalid constraints are present. -func resourceProviderFactories(resolver providers.Resolver, reqd discovery.PluginRequirements) (map[addrs.Provider]providers.Factory, tfdiags.Diagnostics) { +func resourceProviderFactories(resolver providers.Resolver, reqd discovery.PluginRequirements) (map[string]providers.Factory, tfdiags.Diagnostics) { var diags tfdiags.Diagnostics ret, errs := resolver.ResolveProviders(reqd) if errs != nil { diff --git a/vendor/github.com/hashicorp/terraform/terraform/resource_provider_mock.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provider_mock.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/resource_provider_mock.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provider_mock.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provisioner.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/resource_provisioner.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provisioner.go index 2743dd7e9..74ee2a940 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provisioner.go @@ -1,8 +1,8 @@ package terraform import ( - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/provisioners" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/provisioners" ) // ResourceProvisioner is an interface that must be implemented by any diff --git a/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner_mock.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provisioner_mock.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/resource_provisioner_mock.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provisioner_mock.go index 7b88cf733..ed6f241bc 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/resource_provisioner_mock.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provisioner_mock.go @@ -3,7 +3,7 @@ package terraform import ( "sync" - "github.com/hashicorp/terraform/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" ) // MockResourceProvisioner implements ResourceProvisioner but mocks out all the diff --git a/vendor/github.com/hashicorp/terraform/terraform/schemas.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/schemas.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/schemas.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/schemas.go index 62991c82d..8bc3b017b 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/schemas.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/schemas.go @@ -4,12 +4,12 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // Schemas is a container for various kinds of schema that Terraform needs diff --git a/vendor/github.com/hashicorp/terraform/terraform/state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/terraform/state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state.go index 2f97e5af3..e70e8ab24 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state.go @@ -20,15 +20,15 @@ import ( multierror "github.com/hashicorp/go-multierror" uuid "github.com/hashicorp/go-uuid" version "github.com/hashicorp/go-version" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclsyntax" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/tfdiags" - tfversion "github.com/hashicorp/terraform/version" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/hcl2/hcl/hclsyntax" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" + tfversion "github.com/hashicorp/terraform-plugin-sdk/internal/version" "github.com/mitchellh/copystructure" "github.com/zclconf/go-cty/cty" ctyjson "github.com/zclconf/go-cty/cty/json" @@ -852,20 +852,6 @@ func (r *RemoteState) init() { } } -func (r *RemoteState) deepcopy() *RemoteState { - r.Lock() - defer r.Unlock() - - confCopy := make(map[string]string, len(r.Config)) - for k, v := range r.Config { - confCopy[k] = v - } - return &RemoteState{ - Type: r.Type, - Config: confCopy, - } -} - func (r *RemoteState) Empty() bool { if r == nil { return true @@ -944,19 +930,6 @@ func (s *OutputState) Equal(other *OutputState) bool { return true } -func (s *OutputState) deepcopy() *OutputState { - if s == nil { - return nil - } - - stateCopy, err := copystructure.Config{Lock: true}.Copy(s) - if err != nil { - panic(fmt.Errorf("Error copying output value: %s", err)) - } - - return stateCopy.(*OutputState) -} - // ModuleState is used to track all the state relevant to a single // module. Previous to Terraform 0.3, all state belonged to the "root" // module. @@ -1566,15 +1539,6 @@ func (s *ResourceState) init() { } } -func (s *ResourceState) deepcopy() *ResourceState { - copy, err := copystructure.Config{Lock: true}.Copy(s) - if err != nil { - panic(err) - } - - return copy.(*ResourceState) -} - // prune is used to remove any instances that are no longer required func (s *ResourceState) prune() { s.Lock() diff --git a/vendor/github.com/hashicorp/terraform/terraform/state_filter.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state_filter.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/state_filter.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state_filter.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v1_to_v2.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state_upgrade_v1_to_v2.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v1_to_v2.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state_upgrade_v1_to_v2.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v2_to_v3.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state_upgrade_v2_to_v3.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/state_upgrade_v2_to_v3.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state_upgrade_v2_to_v3.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/state_v1.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state_v1.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/state_v1.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state_v1.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/testing.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/testing.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/testing.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/testing.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/transform.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform.go index d587c89e4..f9559f41b 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform.go @@ -3,8 +3,7 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/helper/logging" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // GraphTransformer is the interface that transformers implement. This @@ -46,7 +45,7 @@ func (t *graphTransformerMulti) Transform(g *Graph) error { return err } if thisStepStr := g.StringWithNodeTypes(); thisStepStr != lastStepStr { - log.Printf("[TRACE] (graphTransformerMulti) Completed graph transform %T with new graph:\n%s ------", t, logging.Indent(thisStepStr)) + log.Printf("[TRACE] (graphTransformerMulti) Completed graph transform %T with new graph:\n%s------", t, thisStepStr) lastStepStr = thisStepStr } else { log.Printf("[TRACE] (graphTransformerMulti) Completed graph transform %T (no changes)", t) diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_attach_config_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_config_provider.go similarity index 78% rename from vendor/github.com/hashicorp/terraform/terraform/transform_attach_config_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_config_provider.go index 897a7e791..cbac13387 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_attach_config_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_config_provider.go @@ -1,8 +1,8 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" ) // GraphNodeAttachProvider is an interface that must be implemented by nodes diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_attach_config_resource.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_config_resource.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/transform_attach_config_resource.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_config_resource.go index 03f8564d7..23578c784 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_attach_config_resource.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_config_resource.go @@ -3,8 +3,8 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // GraphNodeAttachResourceConfig is an interface that must be implemented by nodes diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_attach_schema.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_schema.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/transform_attach_schema.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_schema.go index 2e4c35518..fee220b52 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_attach_schema.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_schema.go @@ -4,8 +4,8 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // GraphNodeAttachResourceSchema is an interface implemented by node types @@ -59,7 +59,7 @@ func (t *AttachSchemaTransformer) Transform(g *Graph) error { mode := addr.Resource.Mode typeName := addr.Resource.Type providerAddr, _ := tv.ProvidedBy() - providerType := providerAddr.ProviderConfig.Type.LegacyString() + providerType := providerAddr.ProviderConfig.Type schema, version := t.Schemas.ResourceTypeConfig(providerType, mode, typeName) if schema == nil { @@ -72,7 +72,7 @@ func (t *AttachSchemaTransformer) Transform(g *Graph) error { if tv, ok := v.(GraphNodeAttachProviderConfigSchema); ok { providerAddr := tv.ProviderAddr() - schema := t.Schemas.ProviderConfig(providerAddr.ProviderConfig.Type.LegacyString()) + schema := t.Schemas.ProviderConfig(providerAddr.ProviderConfig.Type) if schema == nil { log.Printf("[ERROR] AttachSchemaTransformer: No provider config schema available for %s", providerAddr) continue diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_attach_state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_state.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/transform_attach_state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_state.go index 3af7b989d..f87494879 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_attach_state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_attach_state.go @@ -3,8 +3,8 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // GraphNodeAttachResourceState is an interface that can be implemented diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_config.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_config.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/transform_config.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_config.go index 9d3b6f4b4..8920761ea 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_config.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_config.go @@ -4,9 +4,9 @@ import ( "log" "sync" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // ConfigTransformer is a GraphTransformer that adds all the resources diff --git a/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_config_flat.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_config_flat.go new file mode 100644 index 000000000..4dbdcb742 --- /dev/null +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_config_flat.go @@ -0,0 +1,71 @@ +package terraform + +import ( + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" +) + +// FlatConfigTransformer is a GraphTransformer that adds the configuration +// to the graph. The module used to configure this transformer must be +// the root module. +// +// This transform adds the nodes but doesn't connect any of the references. +// The ReferenceTransformer should be used for that. +// +// NOTE: In relation to ConfigTransformer: this is a newer generation config +// transformer. It puts the _entire_ config into the graph (there is no +// "flattening" step as before). +type FlatConfigTransformer struct { + Concrete ConcreteResourceNodeFunc // What to turn resources into + + Config *configs.Config +} + +func (t *FlatConfigTransformer) Transform(g *Graph) error { + // We have nothing to do if there is no configuration. + if t.Config == nil { + return nil + } + + return t.transform(g, t.Config) +} + +func (t *FlatConfigTransformer) transform(g *Graph, config *configs.Config) error { + // If we have no configuration then there's nothing to do. + if config == nil { + return nil + } + + // Transform all the children. + for _, c := range config.Children { + if err := t.transform(g, c); err != nil { + return err + } + } + + module := config.Module + // For now we assume that each module call produces only one module + // instance with no key, since we don't yet support "count" and "for_each" + // on modules. + // FIXME: As part of supporting "count" and "for_each" on modules, rework + // this so that we'll "expand" the module call first and then create graph + // nodes for each module instance separately. + instPath := config.Path.UnkeyedInstanceShim() + + for _, r := range module.ManagedResources { + addr := r.Addr().Absolute(instPath) + abstract := &NodeAbstractResource{ + Addr: addr, + Config: r, + } + // Grab the address for this resource + var node dag.Vertex = abstract + if f := t.Concrete; f != nil { + node = f(abstract) + } + + g.Add(node) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_count_boundary.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_count_boundary.go similarity index 84% rename from vendor/github.com/hashicorp/terraform/terraform/transform_count_boundary.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_count_boundary.go index 01601bdda..892f75ec1 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_count_boundary.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_count_boundary.go @@ -1,8 +1,8 @@ package terraform import ( - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // CountBoundaryTransformer adds a node that depends on everything else diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_destroy_cbd.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_destroy_cbd.go similarity index 81% rename from vendor/github.com/hashicorp/terraform/terraform/transform_destroy_cbd.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_destroy_cbd.go index 410a709ea..44c606407 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_destroy_cbd.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_destroy_cbd.go @@ -4,9 +4,9 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // GraphNodeDestroyerCBD must be implemented by nodes that might be @@ -134,16 +134,9 @@ type CBDEdgeTransformer struct { // obtain schema information from providers and provisioners so we can // properly resolve implicit dependencies. Schemas *Schemas - - // If the operation is a simple destroy, no transformation is done. - Destroy bool } func (t *CBDEdgeTransformer) Transform(g *Graph) error { - if t.Destroy { - return nil - } - // Go through and reverse any destroy edges destroyMap := make(map[string][]dag.Vertex) for _, v := range g.Vertices() { @@ -160,27 +153,22 @@ func (t *CBDEdgeTransformer) Transform(g *Graph) error { continue } - // Find the resource edges + // Find the destroy edge. There should only be one. for _, e := range g.EdgesTo(v) { - switch de := e.(type) { - case *DestroyEdge: - // we need to invert the destroy edge from the create node - log.Printf("[TRACE] CBDEdgeTransformer: inverting edge: %s => %s", - dag.VertexName(de.Source()), dag.VertexName(de.Target())) - - // Found it! Invert. - g.RemoveEdge(de) - applyNode := de.Source() - destroyNode := de.Target() - g.Connect(&DestroyEdge{S: destroyNode, T: applyNode}) - default: - // We cannot have any direct dependencies from creators when - // the node is CBD without inducing a cycle. - if _, ok := e.Source().(GraphNodeCreator); ok { - log.Printf("[TRACE] CBDEdgeTransformer: removing non DestroyEdge to CBD destroy node: %s => %s", dag.VertexName(e.Source()), dag.VertexName(e.Target())) - g.RemoveEdge(e) - } + // Not a destroy edge, ignore it + de, ok := e.(*DestroyEdge) + if !ok { + continue } + + log.Printf("[TRACE] CBDEdgeTransformer: inverting edge: %s => %s", + dag.VertexName(de.Source()), dag.VertexName(de.Target())) + + // Found it! Invert. + g.RemoveEdge(de) + applyNode := de.Source() + destroyNode := de.Target() + g.Connect(&DestroyEdge{S: destroyNode, T: applyNode}) } // If the address has an index, we strip that. Our depMap creation @@ -213,7 +201,12 @@ func (t *CBDEdgeTransformer) Transform(g *Graph) error { // They key here is that B happens before A is destroyed. This is to // facilitate the primary purpose for CBD: making sure that downstreams // are properly updated to avoid downtime before the resource is destroyed. - depMap, err := t.depMap(g, destroyMap) + // + // We can't trust that the resource being destroyed or anything that + // depends on it is actually in our current graph so we make a new + // graph in order to determine those dependencies and add them in. + log.Printf("[TRACE] CBDEdgeTransformer: building graph to find dependencies...") + depMap, err := t.depMap(destroyMap) if err != nil { return err } @@ -255,13 +248,27 @@ func (t *CBDEdgeTransformer) Transform(g *Graph) error { return nil } -func (t *CBDEdgeTransformer) depMap(g *Graph, destroyMap map[string][]dag.Vertex) (map[string][]dag.Vertex, error) { - // Build the list of destroy nodes that each resource address should depend - // on. For example, when we find B, we map the address of B to A_d in the - // "depMap" variable below. +func (t *CBDEdgeTransformer) depMap(destroyMap map[string][]dag.Vertex) (map[string][]dag.Vertex, error) { + // Build the graph of our config, this ensures that all resources + // are present in the graph. + g, diags := (&BasicGraphBuilder{ + Steps: []GraphTransformer{ + &FlatConfigTransformer{Config: t.Config}, + &AttachResourceConfigTransformer{Config: t.Config}, + &AttachStateTransformer{State: t.State}, + &AttachSchemaTransformer{Schemas: t.Schemas}, + &ReferenceTransformer{}, + }, + Name: "CBDEdgeTransformer", + }).Build(nil) + if diags.HasErrors() { + return nil, diags.Err() + } - // Use a nested map to remove duplicate edges. - depMap := make(map[string]map[dag.Vertex]struct{}) + // Using this graph, build the list of destroy nodes that each resource + // address should depend on. For example, when we find B, we map the + // address of B to A_d in the "depMap" variable below. + depMap := make(map[string][]dag.Vertex) for _, v := range g.Vertices() { // We're looking for resources. rn, ok := v.(GraphNodeResource) @@ -282,10 +289,8 @@ func (t *CBDEdgeTransformer) depMap(g *Graph, destroyMap map[string][]dag.Vertex } // Get the nodes that depend on this on. In the example above: - // finding B in A => B. Since dependencies can span modules, walk all - // descendents of the resource. - des, _ := g.Descendents(v) - for _, v := range des.List() { + // finding B in A => B. + for _, v := range g.UpEdges(v).List() { // We're looking for resources. rn, ok := v.(GraphNodeResource) if !ok { @@ -295,25 +300,9 @@ func (t *CBDEdgeTransformer) depMap(g *Graph, destroyMap map[string][]dag.Vertex // Keep track of the destroy nodes that this address // needs to depend on. key := rn.ResourceAddr().String() - - deps, ok := depMap[key] - if !ok { - deps = make(map[dag.Vertex]struct{}) - } - - for _, d := range dns { - deps[d] = struct{}{} - } - depMap[key] = deps - } - } - - result := map[string][]dag.Vertex{} - for k, m := range depMap { - for v := range m { - result[k] = append(result[k], v) + depMap[key] = append(depMap[key], dns...) } } - return result, nil + return depMap, nil } diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_destroy_edge.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_destroy_edge.go similarity index 70% rename from vendor/github.com/hashicorp/terraform/terraform/transform_destroy_edge.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_destroy_edge.go index f52429229..ab4ba156d 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_destroy_edge.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_destroy_edge.go @@ -3,11 +3,11 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // GraphNodeDestroyer must be implemented by nodes that destroy resources. @@ -54,39 +54,26 @@ type DestroyEdgeTransformer struct { func (t *DestroyEdgeTransformer) Transform(g *Graph) error { // Build a map of what is being destroyed (by address string) to - // the list of destroyers. + // the list of destroyers. Usually there will be at most one destroyer + // per node, but we allow multiple if present for completeness. destroyers := make(map[string][]GraphNodeDestroyer) destroyerAddrs := make(map[string]addrs.AbsResourceInstance) - - // Record the creators, which will need to depend on the destroyers if they - // are only being updated. - creators := make(map[string]GraphNodeCreator) - - // destroyersByResource records each destroyer by the AbsResourceAddress. - // We use this because dependencies are only referenced as resources, but we - // will want to connect all the individual instances for correct ordering. - destroyersByResource := make(map[string][]GraphNodeDestroyer) for _, v := range g.Vertices() { - switch n := v.(type) { - case GraphNodeDestroyer: - addrP := n.DestroyAddr() - if addrP == nil { - log.Printf("[WARN] DestroyEdgeTransformer: %q (%T) has no destroy address", dag.VertexName(n), v) - continue - } - addr := *addrP + dn, ok := v.(GraphNodeDestroyer) + if !ok { + continue + } - key := addr.String() - log.Printf("[TRACE] DestroyEdgeTransformer: %q (%T) destroys %s", dag.VertexName(n), v, key) - destroyers[key] = append(destroyers[key], n) - destroyerAddrs[key] = addr - - resAddr := addr.Resource.Resource.Absolute(addr.Module).String() - destroyersByResource[resAddr] = append(destroyersByResource[resAddr], n) - case GraphNodeCreator: - addr := n.CreateAddr() - creators[addr.String()] = n + addrP := dn.DestroyAddr() + if addrP == nil { + continue } + addr := *addrP + + key := addr.String() + log.Printf("[TRACE] DestroyEdgeTransformer: %q (%T) destroys %s", dag.VertexName(dn), v, key) + destroyers[key] = append(destroyers[key], dn) + destroyerAddrs[key] = addr } // If we aren't destroying anything, there will be no edges to make @@ -95,40 +82,6 @@ func (t *DestroyEdgeTransformer) Transform(g *Graph) error { return nil } - // Connect destroy despendencies as stored in the state - for _, ds := range destroyers { - for _, des := range ds { - ri, ok := des.(GraphNodeResourceInstance) - if !ok { - continue - } - - for _, resAddr := range ri.StateDependencies() { - for _, desDep := range destroyersByResource[resAddr.String()] { - log.Printf("[TRACE] DestroyEdgeTransformer: %s has stored dependency of %s\n", dag.VertexName(desDep), dag.VertexName(des)) - g.Connect(dag.BasicEdge(desDep, des)) - - } - } - } - } - - // connect creators to any destroyers on which they may depend - for _, c := range creators { - ri, ok := c.(GraphNodeResourceInstance) - if !ok { - continue - } - - for _, resAddr := range ri.StateDependencies() { - for _, desDep := range destroyersByResource[resAddr.String()] { - log.Printf("[TRACE] DestroyEdgeTransformer: %s has stored dependency of %s\n", dag.VertexName(c), dag.VertexName(desDep)) - g.Connect(dag.BasicEdge(c, desDep)) - - } - } - } - // Go through and connect creators to destroyers. Going along with // our example, this makes: A_d => A for _, v := range g.Vertices() { @@ -142,7 +95,13 @@ func (t *DestroyEdgeTransformer) Transform(g *Graph) error { continue } - for _, d := range destroyers[addr.String()] { + key := addr.String() + ds := destroyers[key] + if len(ds) == 0 { + continue + } + + for _, d := range ds { // For illustrating our example a_d := d.(dag.Vertex) a := v @@ -318,47 +277,5 @@ func (t *DestroyEdgeTransformer) Transform(g *Graph) error { } } - return t.pruneResources(g) -} - -// If there are only destroy instances for a particular resource, there's no -// reason for the resource node to prepare the state. Remove Resource nodes so -// that they don't fail by trying to evaluate a resource that is only being -// destroyed along with its dependencies. -func (t *DestroyEdgeTransformer) pruneResources(g *Graph) error { - for _, v := range g.Vertices() { - n, ok := v.(*NodeApplyableResource) - if !ok { - continue - } - - // if there are only destroy dependencies, we don't need this node - des, err := g.Descendents(n) - if err != nil { - return err - } - - descendents := des.List() - nonDestroyInstanceFound := false - for _, v := range descendents { - if _, ok := v.(*NodeApplyableResourceInstance); ok { - nonDestroyInstanceFound = true - break - } - } - - if nonDestroyInstanceFound { - continue - } - - // connect all the through-edges, then delete the node - for _, d := range g.DownEdges(n).List() { - for _, u := range g.UpEdges(n).List() { - g.Connect(dag.BasicEdge(u, d)) - } - } - log.Printf("DestroyEdgeTransformer: pruning unused resource node %s", dag.VertexName(n)) - g.Remove(n) - } return nil } diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_diff.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_diff.go similarity index 90% rename from vendor/github.com/hashicorp/terraform/terraform/transform_diff.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_diff.go index 23b6e2a75..773aad7c4 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_diff.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_diff.go @@ -4,10 +4,10 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/plans" - "github.com/hashicorp/terraform/states" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/plans" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // DiffTransformer is a GraphTransformer that adds graph nodes representing @@ -174,6 +174,14 @@ func (t *DiffTransformer) Transform(g *Graph) error { log.Printf("[TRACE] DiffTransformer: %s deposed object %s will be represented for destruction by %s", addr, dk, dag.VertexName(node)) } g.Add(node) + rsrcAddr := addr.ContainingResource().String() + for _, rsrcNode := range resourceNodes[rsrcAddr] { + // We connect this edge "forwards" (even though destroy dependencies + // are often inverted) because evaluating the resource node + // after the destroy node could cause an unnecessary husk of + // a resource state to be re-added. + g.Connect(dag.BasicEdge(node, rsrcNode)) + } } } diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_expand.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_expand.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/transform_expand.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_expand.go index 982c098b8..03eac685e 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_expand.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_expand.go @@ -3,7 +3,7 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // GraphNodeExapndable is an interface that nodes can implement to diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_import_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_import_provider.go similarity index 87% rename from vendor/github.com/hashicorp/terraform/terraform/transform_import_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_import_provider.go index c801e5c8f..aa00e020d 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_import_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_import_provider.go @@ -3,9 +3,9 @@ package terraform import ( "fmt" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // ImportProviderValidateTransformer is a GraphTransformer that goes through diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_import_state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_import_state.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/transform_import_state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_import_state.go index 7bda3121f..7dd2c4876 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_import_state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_import_state.go @@ -3,9 +3,9 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/providers" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/providers" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // ImportStateTransformer is a GraphTransformer that adds nodes to the @@ -20,7 +20,7 @@ func (t *ImportStateTransformer) Transform(g *Graph) error { // This will be populated if the targets come from the cli, but tests // may not specify implied provider addresses. providerAddr := target.ProviderAddr - if providerAddr.ProviderConfig.Type.Type == "" { + if providerAddr.ProviderConfig.Type == "" { providerAddr = target.Addr.Resource.Resource.DefaultProviderConfig().Absolute(target.Addr.Module) } diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_local.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_local.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/transform_local.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_local.go index 84eb26b26..b97dea2ab 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_local.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_local.go @@ -1,7 +1,7 @@ package terraform import ( - "github.com/hashicorp/terraform/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" ) // LocalTransformer is a GraphTransformer that adds all the local values diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_module_variable.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_module_variable.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/transform_module_variable.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_module_variable.go index 18e0b2d1f..1b6531fe1 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_module_variable.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_module_variable.go @@ -3,12 +3,12 @@ package terraform import ( "fmt" - "github.com/hashicorp/hcl/v2/hclsyntax" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl/hclsyntax" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/configs" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" ) // ModuleVariableTransformer is a GraphTransformer that adds all the variables diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_orphan_count.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_orphan_count.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/transform_orphan_count.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_orphan_count.go index 40163cf91..4d1323fb0 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_orphan_count.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_orphan_count.go @@ -3,9 +3,9 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_orphan_output.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_orphan_output.go similarity index 87% rename from vendor/github.com/hashicorp/terraform/terraform/transform_orphan_output.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_orphan_output.go index c67540934..cab10da12 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_orphan_output.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_orphan_output.go @@ -3,9 +3,9 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // OrphanOutputTransformer finds the outputs that aren't present diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_orphan_resource.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_orphan_resource.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/terraform/transform_orphan_resource.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_orphan_resource.go index 50df1781e..f927b1086 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_orphan_resource.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_orphan_resource.go @@ -3,9 +3,9 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // OrphanResourceInstanceTransformer is a GraphTransformer that adds orphaned diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_output.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_output.go similarity index 95% rename from vendor/github.com/hashicorp/terraform/terraform/transform_output.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_output.go index ed93cdb87..e2979ac5c 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_output.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_output.go @@ -3,8 +3,8 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // OutputTransformer is a GraphTransformer that adds all the outputs diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_provider.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/terraform/transform_provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_provider.go index 8b8dff86f..77af1fbb2 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_provider.go @@ -4,11 +4,11 @@ import ( "fmt" "log" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) func TransformProviders(providers []string, concrete ConcreteProviderNodeFunc, config *configs.Config) GraphTransformer { @@ -295,7 +295,7 @@ func (t *MissingProviderTransformer) Transform(g *Graph) error { // We're going to create an implicit _default_ configuration for the // referenced provider type in the _root_ module, ignoring all other // aspects of the resource's declared provider address. - defaultAddr := addrs.RootModuleInstance.ProviderConfigDefault(p.ProviderConfig.Type.LegacyString()) + defaultAddr := addrs.RootModuleInstance.ProviderConfigDefault(p.ProviderConfig.Type) key := defaultAddr.String() provider := m[key] @@ -397,18 +397,6 @@ func providerVertexMap(g *Graph) map[string]GraphNodeProvider { return m } -func closeProviderVertexMap(g *Graph) map[string]GraphNodeCloseProvider { - m := make(map[string]GraphNodeCloseProvider) - for _, v := range g.Vertices() { - if pv, ok := v.(GraphNodeCloseProvider); ok { - addr := pv.CloseProviderAddr() - m[addr.String()] = pv - } - } - - return m -} - type graphNodeCloseProvider struct { Addr addrs.AbsProviderConfig } @@ -705,7 +693,7 @@ func (t *ProviderConfigTransformer) attachProviderConfigs(g *Graph) error { // Go through the provider configs to find the matching config for _, p := range mc.Module.ProviderConfigs { - if p.Name == addr.ProviderConfig.Type.LegacyString() && p.Alias == addr.ProviderConfig.Alias { + if p.Name == addr.ProviderConfig.Type && p.Alias == addr.ProviderConfig.Alias { log.Printf("[TRACE] ProviderConfigTransformer: attaching to %q provider configuration from %s", dag.VertexName(v), p.DeclRange) apn.AttachProvider(p) break diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_provisioner.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_provisioner.go similarity index 81% rename from vendor/github.com/hashicorp/terraform/terraform/transform_provisioner.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_provisioner.go index b31026655..e6fe25dac 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_provisioner.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_provisioner.go @@ -4,8 +4,10 @@ import ( "fmt" "log" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/go-multierror" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // GraphNodeProvisioner is an interface that nodes that can be a provisioner @@ -41,15 +43,16 @@ func (t *ProvisionerTransformer) Transform(g *Graph) error { for _, v := range g.Vertices() { if pv, ok := v.(GraphNodeProvisionerConsumer); ok { for _, p := range pv.ProvisionedBy() { - if m[p] == nil { + key := provisionerMapKey(p, pv) + if m[key] == nil { err = multierror.Append(err, fmt.Errorf( "%s: provisioner %s couldn't be found", dag.VertexName(v), p)) continue } - log.Printf("[TRACE] ProvisionerTransformer: %s is provisioned by %s (%q)", dag.VertexName(v), p, dag.VertexName(m[p])) - g.Connect(dag.BasicEdge(v, m[p])) + log.Printf("[TRACE] ProvisionerTransformer: %s is provisioned by %s (%q)", dag.VertexName(v), key, dag.VertexName(m[key])) + g.Connect(dag.BasicEdge(v, m[key])) } } } @@ -82,8 +85,18 @@ func (t *MissingProvisionerTransformer) Transform(g *Graph) error { continue } + // If this node has a subpath, then we use that as a prefix + // into our map to check for an existing provider. + path := addrs.RootModuleInstance + if sp, ok := pv.(GraphNodeSubPath); ok { + path = sp.Path() + } + for _, p := range pv.ProvisionedBy() { - if _, ok := m[p]; ok { + // Build the key for storing in the map + key := provisionerMapKey(p, pv) + + if _, ok := m[key]; ok { // This provisioner already exists as a configure node continue } @@ -97,11 +110,12 @@ func (t *MissingProvisionerTransformer) Transform(g *Graph) error { // Build the vertex var newV dag.Vertex = &NodeProvisioner{ NameValue: p, + PathValue: path, } // Add the missing provisioner node to the graph - m[p] = g.Add(newV) - log.Printf("[TRACE] MissingProviderTransformer: added implicit provisioner %s, first implied by %s", p, dag.VertexName(v)) + m[key] = g.Add(newV) + log.Printf("[TRACE] MissingProviderTransformer: added implicit provisioner %s, first implied by %s", key, dag.VertexName(v)) } } @@ -139,11 +153,23 @@ func (t *CloseProvisionerTransformer) Transform(g *Graph) error { return nil } +// provisionerMapKey is a helper that gives us the key to use for the +// maps returned by things such as provisionerVertexMap. +func provisionerMapKey(k string, v dag.Vertex) string { + pathPrefix := "" + if sp, ok := v.(GraphNodeSubPath); ok { + pathPrefix = sp.Path().String() + "." + } + + return pathPrefix + k +} + func provisionerVertexMap(g *Graph) map[string]dag.Vertex { m := make(map[string]dag.Vertex) for _, v := range g.Vertices() { if pv, ok := v.(GraphNodeProvisioner); ok { - m[pv.ProvisionerName()] = v + key := provisionerMapKey(pv.ProvisionerName(), v) + m[key] = v } } diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_reference.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_reference.go similarity index 84% rename from vendor/github.com/hashicorp/terraform/terraform/transform_reference.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_reference.go index 25e544996..8ae1fa75e 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_reference.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_reference.go @@ -3,15 +3,12 @@ package terraform import ( "fmt" "log" - "sort" - - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/dag" - "github.com/hashicorp/terraform/lang" - "github.com/hashicorp/terraform/states" + + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/lang" ) // GraphNodeReferenceable must be implemented by any node that represents @@ -40,11 +37,6 @@ type GraphNodeReferencer interface { References() []*addrs.Reference } -type GraphNodeAttachDependencies interface { - GraphNodeResource - AttachDependencies([]addrs.AbsResource) -} - // GraphNodeReferenceOutside is an interface that can optionally be implemented. // A node that implements it can specify that its own referenceable addresses // and/or the addresses it references are in a different module than the @@ -92,79 +84,6 @@ func (t *ReferenceTransformer) Transform(g *Graph) error { for _, parent := range parents { g.Connect(dag.BasicEdge(v, parent)) } - - if len(parents) > 0 { - continue - } - } - - return nil -} - -// AttachDependenciesTransformer records all resource dependencies for each -// instance, and attaches the addresses to the node itself. Managed resource -// will record these in the state for proper ordering of destroy operations. -type AttachDependenciesTransformer struct { - Config *configs.Config - State *states.State - Schemas *Schemas -} - -func (t AttachDependenciesTransformer) Transform(g *Graph) error { - for _, v := range g.Vertices() { - attacher, ok := v.(GraphNodeAttachDependencies) - if !ok { - continue - } - selfAddr := attacher.ResourceAddr() - - // Data sources don't need to track destroy dependencies - if selfAddr.Resource.Mode == addrs.DataResourceMode { - continue - } - - ans, err := g.Ancestors(v) - if err != nil { - return err - } - - // dedupe addrs when there's multiple instances involved, or - // multiple paths in the un-reduced graph - depMap := map[string]addrs.AbsResource{} - for _, d := range ans.List() { - var addr addrs.AbsResource - - switch d := d.(type) { - case GraphNodeResourceInstance: - instAddr := d.ResourceInstanceAddr() - addr = instAddr.Resource.Resource.Absolute(instAddr.Module) - case GraphNodeResource: - addr = d.ResourceAddr() - default: - continue - } - - // Data sources don't need to track destroy dependencies - if addr.Resource.Mode == addrs.DataResourceMode { - continue - } - - if addr.Equal(selfAddr) { - continue - } - depMap[addr.String()] = addr - } - - deps := make([]addrs.AbsResource, 0, len(depMap)) - for _, d := range depMap { - deps = append(deps, d) - } - sort.Slice(deps, func(i, j int) bool { - return deps[i].String() < deps[j].String() - }) - - log.Printf("[TRACE] AttachDependenciesTransformer: %s depends on %s", attacher.ResourceAddr(), deps) - attacher.AttachDependencies(deps) } return nil @@ -525,17 +444,3 @@ func appendResourceDestroyReferences(refs []*addrs.Reference) []*addrs.Reference } return refs } - -func modulePrefixStr(p addrs.ModuleInstance) string { - return p.String() -} - -func modulePrefixList(result []string, prefix string) []string { - if prefix != "" { - for i, v := range result { - result[i] = fmt.Sprintf("%s.%s", prefix, v) - } - } - - return result -} diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_removed_modules.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_removed_modules.go similarity index 84% rename from vendor/github.com/hashicorp/terraform/terraform/transform_removed_modules.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_removed_modules.go index ee71387e2..327950d88 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_removed_modules.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_removed_modules.go @@ -3,8 +3,8 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // RemovedModuleTransformer implements GraphTransformer to add nodes indicating diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_resource_count.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_resource_count.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/terraform/transform_resource_count.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_resource_count.go index c70a3c144..51d9466a2 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_resource_count.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_resource_count.go @@ -1,9 +1,9 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" "github.com/zclconf/go-cty/cty" ) diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_root.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_root.go similarity index 91% rename from vendor/github.com/hashicorp/terraform/terraform/transform_root.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_root.go index aee053d17..485c1c8a0 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_root.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_root.go @@ -1,6 +1,6 @@ package terraform -import "github.com/hashicorp/terraform/dag" +import "github.com/hashicorp/terraform-plugin-sdk/internal/dag" const rootNodeName = "root" diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_state.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_state.go similarity index 97% rename from vendor/github.com/hashicorp/terraform/terraform/transform_state.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_state.go index 0b52347df..e7d95be97 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_state.go @@ -3,7 +3,7 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/states" + "github.com/hashicorp/terraform-plugin-sdk/internal/states" ) // StateTransformer is a GraphTransformer that adds the elements of diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_targets.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_targets.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/terraform/transform_targets.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_targets.go index d25274e68..beb1eed9e 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_targets.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_targets.go @@ -3,8 +3,8 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // GraphNodeTargetable is an interface for graph nodes to implement when they diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_transitive_reduction.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_transitive_reduction.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/transform_transitive_reduction.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_transitive_reduction.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_variable.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_variable.go similarity index 87% rename from vendor/github.com/hashicorp/terraform/terraform/transform_variable.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_variable.go index 05daa5135..3afce5660 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_variable.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_variable.go @@ -1,8 +1,8 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" ) // RootVariableTransformer is a GraphTransformer that adds all the root diff --git a/vendor/github.com/hashicorp/terraform/terraform/transform_vertex.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_vertex.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/transform_vertex.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_vertex.go index 6b1293fc2..6b3c62d1f 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_vertex.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_vertex.go @@ -3,7 +3,7 @@ package terraform import ( "fmt" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // VertexTransformer is a GraphTransformer that transforms vertices diff --git a/vendor/github.com/hashicorp/terraform/terraform/ui_input.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_input.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/ui_input.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_input.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/ui_input_mock.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_input_mock.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/ui_input_mock.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_input_mock.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/ui_input_prefix.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_input_prefix.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/ui_input_prefix.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_input_prefix.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/ui_output.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_output.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/ui_output.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_output.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/ui_output_callback.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_output_callback.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/ui_output_callback.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_output_callback.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/ui_output_mock.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_output_mock.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/ui_output_mock.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_output_mock.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/ui_output_provisioner.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_output_provisioner.go similarity index 87% rename from vendor/github.com/hashicorp/terraform/terraform/ui_output_provisioner.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_output_provisioner.go index fff964f4b..0d7d4ce03 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/ui_output_provisioner.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/ui_output_provisioner.go @@ -1,7 +1,7 @@ package terraform import ( - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // ProvisionerUIOutput is an implementation of UIOutput that calls a hook diff --git a/vendor/github.com/hashicorp/terraform/terraform/util.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/util.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/util.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/util.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/valuesourcetype_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/valuesourcetype_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/valuesourcetype_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/valuesourcetype_string.go diff --git a/vendor/github.com/hashicorp/terraform/terraform/variables.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/variables.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/terraform/variables.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/variables.go index 14f6a3ccf..0b0c1d28d 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/variables.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/variables.go @@ -3,12 +3,12 @@ package terraform import ( "fmt" - "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // InputValue represents a value for a variable in the root module, provided diff --git a/vendor/github.com/hashicorp/terraform/terraform/version_required.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/version_required.go similarity index 89% rename from vendor/github.com/hashicorp/terraform/terraform/version_required.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/version_required.go index ba9af1d14..d2ee48160 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/version_required.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/version_required.go @@ -3,12 +3,12 @@ package terraform import ( "fmt" - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/hcl2/hcl" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" - "github.com/hashicorp/terraform/configs" + "github.com/hashicorp/terraform-plugin-sdk/internal/configs" - tfversion "github.com/hashicorp/terraform/version" + tfversion "github.com/hashicorp/terraform-plugin-sdk/internal/version" ) // CheckCoreVersionRequirements visits each of the modules in the given diff --git a/vendor/github.com/hashicorp/terraform/terraform/walkoperation_string.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/walkoperation_string.go similarity index 100% rename from vendor/github.com/hashicorp/terraform/terraform/walkoperation_string.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/walkoperation_string.go diff --git a/vendor/github.com/hashicorp/terraform-svchost/auth/from_map.go b/vendor/github.com/hashicorp/terraform-svchost/auth/from_map.go deleted file mode 100644 index 7198c6744..000000000 --- a/vendor/github.com/hashicorp/terraform-svchost/auth/from_map.go +++ /dev/null @@ -1,48 +0,0 @@ -package auth - -import ( - "github.com/zclconf/go-cty/cty" -) - -// HostCredentialsFromMap converts a map of key-value pairs from a credentials -// definition provided by the user (e.g. in a config file, or via a credentials -// helper) into a HostCredentials object if possible, or returns nil if -// no credentials could be extracted from the map. -// -// This function ignores map keys it is unfamiliar with, to allow for future -// expansion of the credentials map format for new credential types. -func HostCredentialsFromMap(m map[string]interface{}) HostCredentials { - if m == nil { - return nil - } - if token, ok := m["token"].(string); ok { - return HostCredentialsToken(token) - } - return nil -} - -// HostCredentialsFromObject converts a cty.Value of an object type into a -// HostCredentials object if possible, or returns nil if no credentials could -// be extracted from the map. -// -// This function ignores object attributes it is unfamiliar with, to allow for -// future expansion of the credentials object structure for new credential types. -// -// If the given value is not of an object type, this function will panic. -func HostCredentialsFromObject(obj cty.Value) HostCredentials { - if !obj.Type().HasAttribute("token") { - return nil - } - - tokenV := obj.GetAttr("token") - if tokenV.IsNull() || !tokenV.IsKnown() { - return nil - } - if !cty.String.Equals(tokenV.Type()) { - // Weird, but maybe some future Terraform version accepts an object - // here for some reason, so we'll be resilient. - return nil - } - - return HostCredentialsToken(tokenV.AsString()) -} diff --git a/vendor/github.com/hashicorp/terraform-svchost/auth/token_credentials.go b/vendor/github.com/hashicorp/terraform-svchost/auth/token_credentials.go deleted file mode 100644 index 1d36553ae..000000000 --- a/vendor/github.com/hashicorp/terraform-svchost/auth/token_credentials.go +++ /dev/null @@ -1,43 +0,0 @@ -package auth - -import ( - "net/http" - - "github.com/zclconf/go-cty/cty" -) - -// HostCredentialsToken is a HostCredentials implementation that represents a -// single "bearer token", to be sent to the server via an Authorization header -// with the auth type set to "Bearer". -// -// To save a token as the credentials for a host, convert the token string to -// this type and use the result as a HostCredentialsWritable implementation. -type HostCredentialsToken string - -// Interface implementation assertions. Compilation will fail here if -// HostCredentialsToken does not fully implement these interfaces. -var _ HostCredentials = HostCredentialsToken("") -var _ HostCredentialsWritable = HostCredentialsToken("") - -// PrepareRequest alters the given HTTP request by setting its Authorization -// header to the string "Bearer " followed by the encapsulated authentication -// token. -func (tc HostCredentialsToken) PrepareRequest(req *http.Request) { - if req.Header == nil { - req.Header = http.Header{} - } - req.Header.Set("Authorization", "Bearer "+string(tc)) -} - -// Token returns the authentication token. -func (tc HostCredentialsToken) Token() string { - return string(tc) -} - -// ToStore returns a credentials object with a single attribute "token" whose -// value is the token string. -func (tc HostCredentialsToken) ToStore() cty.Value { - return cty.ObjectVal(map[string]cty.Value{ - "token": cty.StringVal(string(tc)), - }) -} diff --git a/vendor/github.com/hashicorp/terraform-svchost/disco/http_transport.go b/vendor/github.com/hashicorp/terraform-svchost/disco/http_transport.go deleted file mode 100644 index 7e4a38567..000000000 --- a/vendor/github.com/hashicorp/terraform-svchost/disco/http_transport.go +++ /dev/null @@ -1,30 +0,0 @@ -package disco - -import ( - "net/http" - - "github.com/hashicorp/go-cleanhttp" -) - -const DefaultUserAgent = "terraform-svchost/1.0" - -func defaultHttpTransport() http.RoundTripper { - t := cleanhttp.DefaultPooledTransport() - return &userAgentRoundTripper{ - innerRt: t, - userAgent: DefaultUserAgent, - } -} - -type userAgentRoundTripper struct { - innerRt http.RoundTripper - userAgent string -} - -func (rt *userAgentRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - if _, ok := req.Header["User-Agent"]; !ok { - req.Header.Set("User-Agent", rt.userAgent) - } - - return rt.innerRt.RoundTrip(req) -} diff --git a/vendor/github.com/hashicorp/terraform-svchost/disco/oauth_client.go b/vendor/github.com/hashicorp/terraform-svchost/disco/oauth_client.go deleted file mode 100644 index 9308bbf72..000000000 --- a/vendor/github.com/hashicorp/terraform-svchost/disco/oauth_client.go +++ /dev/null @@ -1,178 +0,0 @@ -package disco - -import ( - "fmt" - "net/url" - "strings" - - "golang.org/x/oauth2" -) - -// OAuthClient represents an OAuth client configuration, which is used for -// unusual services that require an entire OAuth client configuration as part -// of their service discovery, rather than just a URL. -type OAuthClient struct { - // ID is the identifier for the client, to be used as "client_id" in - // OAuth requests. - ID string - - // Authorization URL is the URL of the authorization endpoint that must - // be used for this OAuth client, as defined in the OAuth2 specifications. - // - // Not all grant types use the authorization endpoint, so it may be omitted - // if none of the grant types in SupportedGrantTypes require it. - AuthorizationURL *url.URL - - // Token URL is the URL of the token endpoint that must be used for this - // OAuth client, as defined in the OAuth2 specifications. - // - // Not all grant types use the token endpoint, so it may be omitted - // if none of the grant types in SupportedGrantTypes require it. - TokenURL *url.URL - - // MinPort and MaxPort define a range of TCP ports on localhost that this - // client is able to use as redirect_uri in an authorization request. - // Terraform will select a port from this range for the temporary HTTP - // server it creates to receive the authorization response, giving - // a URL like http://localhost:NNN/ where NNN is the selected port number. - // - // Terraform will reject any port numbers in this range less than 1024, - // to respect the common convention (enforced on some operating systems) - // that lower port numbers are reserved for "privileged" services. - MinPort, MaxPort uint16 - - // SupportedGrantTypes is a set of the grant types that the client may - // choose from. This includes an entry for each distinct type advertised - // by the server, even if a particular keyword is not supported by the - // current version of Terraform. - SupportedGrantTypes OAuthGrantTypeSet -} - -// Endpoint returns an oauth2.Endpoint value ready to be used with the oauth2 -// library, representing the URLs from the receiver. -func (c *OAuthClient) Endpoint() oauth2.Endpoint { - ep := oauth2.Endpoint{ - // We don't actually auth because we're not a server-based OAuth client, - // so this instead just means that we include client_id as an argument - // in our requests. - AuthStyle: oauth2.AuthStyleInParams, - } - - if c.AuthorizationURL != nil { - ep.AuthURL = c.AuthorizationURL.String() - } - if c.TokenURL != nil { - ep.TokenURL = c.TokenURL.String() - } - - return ep -} - -// OAuthGrantType is an enumeration of grant type strings that a host can -// advertise support for. -// -// Values of this type don't necessarily match with a known constant of the -// type, because they may represent grant type keywords defined in a later -// version of Terraform which this version doesn't yet know about. -type OAuthGrantType string - -const ( - // OAuthAuthzCodeGrant represents an authorization code grant, as - // defined in IETF RFC 6749 section 4.1. - OAuthAuthzCodeGrant = OAuthGrantType("authz_code") - - // OAuthOwnerPasswordGrant represents a resource owner password - // credentials grant, as defined in IETF RFC 6749 section 4.3. - OAuthOwnerPasswordGrant = OAuthGrantType("password") -) - -// UsesAuthorizationEndpoint returns true if the receiving grant type makes -// use of the authorization endpoint from the client configuration, and thus -// if the authorization endpoint ought to be required. -func (t OAuthGrantType) UsesAuthorizationEndpoint() bool { - switch t { - case OAuthAuthzCodeGrant: - return true - case OAuthOwnerPasswordGrant: - return false - default: - // We'll default to false so that we don't impose any requirements - // on any grant type keywords that might be defined for future - // versions of Terraform. - return false - } -} - -// UsesTokenEndpoint returns true if the receiving grant type makes -// use of the token endpoint from the client configuration, and thus -// if the authorization endpoint ought to be required. -func (t OAuthGrantType) UsesTokenEndpoint() bool { - switch t { - case OAuthAuthzCodeGrant: - return true - case OAuthOwnerPasswordGrant: - return true - default: - // We'll default to false so that we don't impose any requirements - // on any grant type keywords that might be defined for future - // versions of Terraform. - return false - } -} - -// OAuthGrantTypeSet represents a set of OAuthGrantType values. -type OAuthGrantTypeSet map[OAuthGrantType]struct{} - -// NewOAuthGrantTypeSet constructs a new grant type set from the given list -// of grant type keyword strings. Any duplicates in the list are ignored. -func NewOAuthGrantTypeSet(keywords ...string) OAuthGrantTypeSet { - ret := make(OAuthGrantTypeSet, len(keywords)) - for _, kw := range keywords { - ret[OAuthGrantType(kw)] = struct{}{} - } - return ret -} - -// Has returns true if the given grant type is in the receiving set. -func (s OAuthGrantTypeSet) Has(t OAuthGrantType) bool { - _, ok := s[t] - return ok -} - -// RequiresAuthorizationEndpoint returns true if any of the grant types in -// the set are known to require an authorization endpoint. -func (s OAuthGrantTypeSet) RequiresAuthorizationEndpoint() bool { - for t := range s { - if t.UsesAuthorizationEndpoint() { - return true - } - } - return false -} - -// RequiresTokenEndpoint returns true if any of the grant types in -// the set are known to require a token endpoint. -func (s OAuthGrantTypeSet) RequiresTokenEndpoint() bool { - for t := range s { - if t.UsesTokenEndpoint() { - return true - } - } - return false -} - -// GoString implements fmt.GoStringer. -func (s OAuthGrantTypeSet) GoString() string { - var buf strings.Builder - i := 0 - buf.WriteString("disco.NewOAuthGrantTypeSet(") - for t := range s { - if i > 0 { - buf.WriteString(", ") - } - fmt.Fprintf(&buf, "%q", string(t)) - i++ - } - buf.WriteString(")") - return buf.String() -} diff --git a/vendor/github.com/hashicorp/terraform-svchost/go.mod b/vendor/github.com/hashicorp/terraform-svchost/go.mod deleted file mode 100644 index 8f29e4ac5..000000000 --- a/vendor/github.com/hashicorp/terraform-svchost/go.mod +++ /dev/null @@ -1,12 +0,0 @@ -module github.com/hashicorp/terraform-svchost - -go 1.12 - -require ( - github.com/google/go-cmp v0.3.1 - github.com/hashicorp/go-cleanhttp v0.5.1 - github.com/hashicorp/go-version v1.2.0 - github.com/zclconf/go-cty v1.1.0 - golang.org/x/net v0.0.0-20191009170851-d66e71096ffb - golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 -) diff --git a/vendor/github.com/hashicorp/terraform-svchost/go.sum b/vendor/github.com/hashicorp/terraform-svchost/go.sum deleted file mode 100644 index 9ad1712f8..000000000 --- a/vendor/github.com/hashicorp/terraform-svchost/go.sum +++ /dev/null @@ -1,36 +0,0 @@ -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/zclconf/go-cty v1.1.0 h1:uJwc9HiBOCpoKIObTQaLR+tsEXx1HBHnOsOOpcdhZgw= -github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20191009170851-d66e71096ffb h1:TR699M2v0qoKTOHxeLgp6zPqaQNs74f01a/ob9W0qko= -golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/vendor/github.com/hashicorp/terraform/addrs/provider.go b/vendor/github.com/hashicorp/terraform/addrs/provider.go deleted file mode 100644 index b73cfb5a7..000000000 --- a/vendor/github.com/hashicorp/terraform/addrs/provider.go +++ /dev/null @@ -1,49 +0,0 @@ -package addrs - -import ( - svchost "github.com/hashicorp/terraform-svchost" -) - -// Provider encapsulates a single provider type. In the future this will be -// extended to include additional fields including Namespace and SourceHost -type Provider struct { - Type string - Namespace string - Hostname svchost.Hostname -} - -// String returns an FQN string, indended for use in output. -func (pt Provider) String() string { - return pt.Hostname.ForDisplay() + "/" + pt.Namespace + "/" + pt.Type -} - -// NewDefaultProvider returns the default address of a HashiCorp-maintained, -// Registry-hosted provider. -func NewDefaultProvider(name string) Provider { - return Provider{ - Type: name, - Namespace: "hashicorp", - Hostname: "registry.terraform.io", - } -} - -// NewLegacyProvider returns a mock address for a provider. -// This will be removed when ProviderType is fully integrated. -func NewLegacyProvider(name string) Provider { - return Provider{ - Type: name, - Namespace: "-", - Hostname: "registry.terraform.io", - } -} - -// LegacyString returns the provider type, which is frequently used -// interchangeably with provider name. This function can and should be removed -// when provider type is fully integrated. As a safeguard for future -// refactoring, this function panics if the Provider is not a legacy provider. -func (pt Provider) LegacyString() string { - if pt.Namespace != "-" { - panic("not a legacy Provider") - } - return pt.Type -} diff --git a/vendor/github.com/hashicorp/terraform/config/append.go b/vendor/github.com/hashicorp/terraform/config/append.go deleted file mode 100644 index 9d80c42b7..000000000 --- a/vendor/github.com/hashicorp/terraform/config/append.go +++ /dev/null @@ -1,92 +0,0 @@ -package config - -// Append appends one configuration to another. -// -// Append assumes that both configurations will not have -// conflicting variables, resources, etc. If they do, the -// problems will be caught in the validation phase. -// -// It is possible that c1, c2 on their own are not valid. For -// example, a resource in c2 may reference a variable in c1. But -// together, they would be valid. -func Append(c1, c2 *Config) (*Config, error) { - c := new(Config) - - // Append unknown keys, but keep them unique since it is a set - unknowns := make(map[string]struct{}) - for _, k := range c1.unknownKeys { - _, present := unknowns[k] - if !present { - unknowns[k] = struct{}{} - c.unknownKeys = append(c.unknownKeys, k) - } - } - - for _, k := range c2.unknownKeys { - _, present := unknowns[k] - if !present { - unknowns[k] = struct{}{} - c.unknownKeys = append(c.unknownKeys, k) - } - } - - c.Atlas = c1.Atlas - if c2.Atlas != nil { - c.Atlas = c2.Atlas - } - - // merge Terraform blocks - if c1.Terraform != nil { - c.Terraform = c1.Terraform - if c2.Terraform != nil { - c.Terraform.Merge(c2.Terraform) - } - } else { - c.Terraform = c2.Terraform - } - - if len(c1.Modules) > 0 || len(c2.Modules) > 0 { - c.Modules = make( - []*Module, 0, len(c1.Modules)+len(c2.Modules)) - c.Modules = append(c.Modules, c1.Modules...) - c.Modules = append(c.Modules, c2.Modules...) - } - - if len(c1.Outputs) > 0 || len(c2.Outputs) > 0 { - c.Outputs = make( - []*Output, 0, len(c1.Outputs)+len(c2.Outputs)) - c.Outputs = append(c.Outputs, c1.Outputs...) - c.Outputs = append(c.Outputs, c2.Outputs...) - } - - if len(c1.ProviderConfigs) > 0 || len(c2.ProviderConfigs) > 0 { - c.ProviderConfigs = make( - []*ProviderConfig, - 0, len(c1.ProviderConfigs)+len(c2.ProviderConfigs)) - c.ProviderConfigs = append(c.ProviderConfigs, c1.ProviderConfigs...) - c.ProviderConfigs = append(c.ProviderConfigs, c2.ProviderConfigs...) - } - - if len(c1.Resources) > 0 || len(c2.Resources) > 0 { - c.Resources = make( - []*Resource, - 0, len(c1.Resources)+len(c2.Resources)) - c.Resources = append(c.Resources, c1.Resources...) - c.Resources = append(c.Resources, c2.Resources...) - } - - if len(c1.Variables) > 0 || len(c2.Variables) > 0 { - c.Variables = make( - []*Variable, 0, len(c1.Variables)+len(c2.Variables)) - c.Variables = append(c.Variables, c1.Variables...) - c.Variables = append(c.Variables, c2.Variables...) - } - - if len(c1.Locals) > 0 || len(c2.Locals) > 0 { - c.Locals = make([]*Local, 0, len(c1.Locals)+len(c2.Locals)) - c.Locals = append(c.Locals, c1.Locals...) - c.Locals = append(c.Locals, c2.Locals...) - } - - return c, nil -} diff --git a/vendor/github.com/hashicorp/terraform/config/config.go b/vendor/github.com/hashicorp/terraform/config/config.go deleted file mode 100644 index 497effef5..000000000 --- a/vendor/github.com/hashicorp/terraform/config/config.go +++ /dev/null @@ -1,1171 +0,0 @@ -// The config package is responsible for loading and validating the -// configuration. -package config - -import ( - "fmt" - "regexp" - "strconv" - "strings" - - hcl2 "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/terraform/helper/hilmapstructure" - "github.com/hashicorp/terraform/plugin/discovery" - "github.com/hashicorp/terraform/tfdiags" - "github.com/mitchellh/reflectwalk" -) - -// NameRegexp is the regular expression that all names (modules, providers, -// resources, etc.) must follow. -var NameRegexp = regexp.MustCompile(`(?i)\A[A-Z0-9_][A-Z0-9\-\_]*\z`) - -// Config is the configuration that comes from loading a collection -// of Terraform templates. -type Config struct { - // Dir is the path to the directory where this configuration was - // loaded from. If it is blank, this configuration wasn't loaded from - // any meaningful directory. - Dir string - - Terraform *Terraform - Atlas *AtlasConfig - Modules []*Module - ProviderConfigs []*ProviderConfig - Resources []*Resource - Variables []*Variable - Locals []*Local - Outputs []*Output - - // The fields below can be filled in by loaders for validation - // purposes. - unknownKeys []string -} - -// AtlasConfig is the configuration for building in HashiCorp's Atlas. -type AtlasConfig struct { - Name string - Include []string - Exclude []string -} - -// Module is a module used within a configuration. -// -// This does not represent a module itself, this represents a module -// call-site within an existing configuration. -type Module struct { - Name string - Source string - Version string - Providers map[string]string - RawConfig *RawConfig -} - -// ProviderConfig is the configuration for a resource provider. -// -// For example, Terraform needs to set the AWS access keys for the AWS -// resource provider. -type ProviderConfig struct { - Name string - Alias string - Version string - RawConfig *RawConfig -} - -// A resource represents a single Terraform resource in the configuration. -// A Terraform resource is something that supports some or all of the -// usual "create, read, update, delete" operations, depending on -// the given Mode. -type Resource struct { - Mode ResourceMode // which operations the resource supports - Name string - Type string - RawCount *RawConfig - RawConfig *RawConfig - Provisioners []*Provisioner - Provider string - DependsOn []string - Lifecycle ResourceLifecycle -} - -// Copy returns a copy of this Resource. Helpful for avoiding shared -// config pointers across multiple pieces of the graph that need to do -// interpolation. -func (r *Resource) Copy() *Resource { - n := &Resource{ - Mode: r.Mode, - Name: r.Name, - Type: r.Type, - RawCount: r.RawCount.Copy(), - RawConfig: r.RawConfig.Copy(), - Provisioners: make([]*Provisioner, 0, len(r.Provisioners)), - Provider: r.Provider, - DependsOn: make([]string, len(r.DependsOn)), - Lifecycle: *r.Lifecycle.Copy(), - } - for _, p := range r.Provisioners { - n.Provisioners = append(n.Provisioners, p.Copy()) - } - copy(n.DependsOn, r.DependsOn) - return n -} - -// ResourceLifecycle is used to store the lifecycle tuning parameters -// to allow customized behavior -type ResourceLifecycle struct { - CreateBeforeDestroy bool `mapstructure:"create_before_destroy"` - PreventDestroy bool `mapstructure:"prevent_destroy"` - IgnoreChanges []string `mapstructure:"ignore_changes"` -} - -// Copy returns a copy of this ResourceLifecycle -func (r *ResourceLifecycle) Copy() *ResourceLifecycle { - n := &ResourceLifecycle{ - CreateBeforeDestroy: r.CreateBeforeDestroy, - PreventDestroy: r.PreventDestroy, - IgnoreChanges: make([]string, len(r.IgnoreChanges)), - } - copy(n.IgnoreChanges, r.IgnoreChanges) - return n -} - -// Provisioner is a configured provisioner step on a resource. -type Provisioner struct { - Type string - RawConfig *RawConfig - ConnInfo *RawConfig - - When ProvisionerWhen - OnFailure ProvisionerOnFailure -} - -// Copy returns a copy of this Provisioner -func (p *Provisioner) Copy() *Provisioner { - return &Provisioner{ - Type: p.Type, - RawConfig: p.RawConfig.Copy(), - ConnInfo: p.ConnInfo.Copy(), - When: p.When, - OnFailure: p.OnFailure, - } -} - -// Variable is a module argument defined within the configuration. -type Variable struct { - Name string - DeclaredType string `mapstructure:"type"` - Default interface{} - Description string -} - -// Local is a local value defined within the configuration. -type Local struct { - Name string - RawConfig *RawConfig -} - -// Output is an output defined within the configuration. An output is -// resulting data that is highlighted by Terraform when finished. An -// output marked Sensitive will be output in a masked form following -// application, but will still be available in state. -type Output struct { - Name string - DependsOn []string - Description string - Sensitive bool - RawConfig *RawConfig -} - -// VariableType is the type of value a variable is holding, and returned -// by the Type() function on variables. -type VariableType byte - -const ( - VariableTypeUnknown VariableType = iota - VariableTypeString - VariableTypeList - VariableTypeMap -) - -func (v VariableType) Printable() string { - switch v { - case VariableTypeString: - return "string" - case VariableTypeMap: - return "map" - case VariableTypeList: - return "list" - default: - return "unknown" - } -} - -// ProviderConfigName returns the name of the provider configuration in -// the given mapping that maps to the proper provider configuration -// for this resource. -func ProviderConfigName(t string, pcs []*ProviderConfig) string { - lk := "" - for _, v := range pcs { - k := v.Name - if strings.HasPrefix(t, k) && len(k) > len(lk) { - lk = k - } - } - - return lk -} - -// A unique identifier for this module. -func (r *Module) Id() string { - return fmt.Sprintf("%s", r.Name) -} - -// Count returns the count of this resource. -func (r *Resource) Count() (int, error) { - raw := r.RawCount.Value() - count, ok := r.RawCount.Value().(string) - if !ok { - return 0, fmt.Errorf( - "expected count to be a string or int, got %T", raw) - } - - v, err := strconv.ParseInt(count, 0, 0) - if err != nil { - return 0, fmt.Errorf( - "cannot parse %q as an integer", - count, - ) - } - - return int(v), nil -} - -// A unique identifier for this resource. -func (r *Resource) Id() string { - switch r.Mode { - case ManagedResourceMode: - return fmt.Sprintf("%s.%s", r.Type, r.Name) - case DataResourceMode: - return fmt.Sprintf("data.%s.%s", r.Type, r.Name) - default: - panic(fmt.Errorf("unknown resource mode %s", r.Mode)) - } -} - -// Validate does some basic semantic checking of the configuration. -func (c *Config) Validate() tfdiags.Diagnostics { - if c == nil { - return nil - } - - var diags tfdiags.Diagnostics - - for _, k := range c.unknownKeys { - diags = diags.Append( - fmt.Errorf("Unknown root level key: %s", k), - ) - } - - // Validate the Terraform config - if tf := c.Terraform; tf != nil { - errs := c.Terraform.Validate() - for _, err := range errs { - diags = diags.Append(err) - } - } - - vars := c.InterpolatedVariables() - varMap := make(map[string]*Variable) - for _, v := range c.Variables { - if _, ok := varMap[v.Name]; ok { - diags = diags.Append(fmt.Errorf( - "Variable '%s': duplicate found. Variable names must be unique.", - v.Name, - )) - } - - varMap[v.Name] = v - } - - for k, _ := range varMap { - if !NameRegexp.MatchString(k) { - diags = diags.Append(fmt.Errorf( - "variable %q: variable name must match regular expression %s", - k, NameRegexp, - )) - } - } - - for _, v := range c.Variables { - if v.Type() == VariableTypeUnknown { - diags = diags.Append(fmt.Errorf( - "Variable '%s': must be a string or a map", - v.Name, - )) - continue - } - - interp := false - fn := func(n ast.Node) (interface{}, error) { - // LiteralNode is a literal string (outside of a ${ ... } sequence). - // interpolationWalker skips most of these. but in particular it - // visits those that have escaped sequences (like $${foo}) as a - // signal that *some* processing is required on this string. For - // our purposes here though, this is fine and not an interpolation. - if _, ok := n.(*ast.LiteralNode); !ok { - interp = true - } - return "", nil - } - - w := &interpolationWalker{F: fn} - if v.Default != nil { - if err := reflectwalk.Walk(v.Default, w); err == nil { - if interp { - diags = diags.Append(fmt.Errorf( - "variable %q: default may not contain interpolations", - v.Name, - )) - } - } - } - } - - // Check for references to user variables that do not actually - // exist and record those errors. - for source, vs := range vars { - for _, v := range vs { - uv, ok := v.(*UserVariable) - if !ok { - continue - } - - if _, ok := varMap[uv.Name]; !ok { - diags = diags.Append(fmt.Errorf( - "%s: unknown variable referenced: '%s'; define it with a 'variable' block", - source, - uv.Name, - )) - } - } - } - - // Check that all count variables are valid. - for source, vs := range vars { - for _, rawV := range vs { - switch v := rawV.(type) { - case *CountVariable: - if v.Type == CountValueInvalid { - diags = diags.Append(fmt.Errorf( - "%s: invalid count variable: %s", - source, - v.FullKey(), - )) - } - case *PathVariable: - if v.Type == PathValueInvalid { - diags = diags.Append(fmt.Errorf( - "%s: invalid path variable: %s", - source, - v.FullKey(), - )) - } - } - } - } - - // Check that providers aren't declared multiple times and that their - // version constraints, where present, are syntactically valid. - providerSet := make(map[string]bool) - for _, p := range c.ProviderConfigs { - name := p.FullName() - if _, ok := providerSet[name]; ok { - diags = diags.Append(fmt.Errorf( - "provider.%s: multiple configurations present; only one configuration is allowed per provider", - name, - )) - continue - } - - if p.Version != "" { - _, err := discovery.ConstraintStr(p.Version).Parse() - if err != nil { - diags = diags.Append(&hcl2.Diagnostic{ - Severity: hcl2.DiagError, - Summary: "Invalid provider version constraint", - Detail: fmt.Sprintf( - "The value %q given for provider.%s is not a valid version constraint.", - p.Version, name, - ), - // TODO: include a "Subject" source reference in here, - // once the config loader is able to retain source - // location information. - }) - } - } - - providerSet[name] = true - } - - // Check that all references to modules are valid - modules := make(map[string]*Module) - dupped := make(map[string]struct{}) - for _, m := range c.Modules { - // Check for duplicates - if _, ok := modules[m.Id()]; ok { - if _, ok := dupped[m.Id()]; !ok { - dupped[m.Id()] = struct{}{} - - diags = diags.Append(fmt.Errorf( - "module %q: module repeated multiple times", - m.Id(), - )) - } - - // Already seen this module, just skip it - continue - } - - modules[m.Id()] = m - - // Check that the source has no interpolations - rc, err := NewRawConfig(map[string]interface{}{ - "root": m.Source, - }) - if err != nil { - diags = diags.Append(fmt.Errorf( - "module %q: module source error: %s", - m.Id(), err, - )) - } else if len(rc.Interpolations) > 0 { - diags = diags.Append(fmt.Errorf( - "module %q: module source cannot contain interpolations", - m.Id(), - )) - } - - // Check that the name matches our regexp - if !NameRegexp.Match([]byte(m.Name)) { - diags = diags.Append(fmt.Errorf( - "module %q: module name must be a letter or underscore followed by only letters, numbers, dashes, and underscores", - m.Id(), - )) - } - - // Check that the configuration can all be strings, lists or maps - raw := make(map[string]interface{}) - for k, v := range m.RawConfig.Raw { - var strVal string - if err := hilmapstructure.WeakDecode(v, &strVal); err == nil { - raw[k] = strVal - continue - } - - var mapVal map[string]interface{} - if err := hilmapstructure.WeakDecode(v, &mapVal); err == nil { - raw[k] = mapVal - continue - } - - var sliceVal []interface{} - if err := hilmapstructure.WeakDecode(v, &sliceVal); err == nil { - raw[k] = sliceVal - continue - } - - diags = diags.Append(fmt.Errorf( - "module %q: argument %s must have a string, list, or map value", - m.Id(), k, - )) - } - - // Check for invalid count variables - for _, v := range m.RawConfig.Variables { - switch v.(type) { - case *CountVariable: - diags = diags.Append(fmt.Errorf( - "module %q: count variables are only valid within resources", - m.Name, - )) - case *SelfVariable: - diags = diags.Append(fmt.Errorf( - "module %q: self variables are only valid within resources", - m.Name, - )) - } - } - - // Update the raw configuration to only contain the string values - m.RawConfig, err = NewRawConfig(raw) - if err != nil { - diags = diags.Append(fmt.Errorf( - "%s: can't initialize configuration: %s", - m.Id(), err, - )) - } - - // check that all named providers actually exist - for _, p := range m.Providers { - if !providerSet[p] { - diags = diags.Append(fmt.Errorf( - "module %q: cannot pass non-existent provider %q", - m.Name, p, - )) - } - } - - } - dupped = nil - - // Check that all variables for modules reference modules that - // exist. - for source, vs := range vars { - for _, v := range vs { - mv, ok := v.(*ModuleVariable) - if !ok { - continue - } - - if _, ok := modules[mv.Name]; !ok { - diags = diags.Append(fmt.Errorf( - "%s: unknown module referenced: %s", - source, mv.Name, - )) - } - } - } - - // Check that all references to resources are valid - resources := make(map[string]*Resource) - dupped = make(map[string]struct{}) - for _, r := range c.Resources { - if _, ok := resources[r.Id()]; ok { - if _, ok := dupped[r.Id()]; !ok { - dupped[r.Id()] = struct{}{} - - diags = diags.Append(fmt.Errorf( - "%s: resource repeated multiple times", - r.Id(), - )) - } - } - - resources[r.Id()] = r - } - dupped = nil - - // Validate resources - for n, r := range resources { - // Verify count variables - for _, v := range r.RawCount.Variables { - switch v.(type) { - case *CountVariable: - diags = diags.Append(fmt.Errorf( - "%s: resource count can't reference count variable: %s", - n, v.FullKey(), - )) - case *SimpleVariable: - diags = diags.Append(fmt.Errorf( - "%s: resource count can't reference variable: %s", - n, v.FullKey(), - )) - - // Good - case *ModuleVariable: - case *ResourceVariable: - case *TerraformVariable: - case *UserVariable: - case *LocalVariable: - - default: - diags = diags.Append(fmt.Errorf( - "Internal error. Unknown type in count var in %s: %T", - n, v, - )) - } - } - - if !r.RawCount.couldBeInteger() { - diags = diags.Append(fmt.Errorf( - "%s: resource count must be an integer", n, - )) - } - r.RawCount.init() - - // Validate DependsOn - for _, err := range c.validateDependsOn(n, r.DependsOn, resources, modules) { - diags = diags.Append(err) - } - - // Verify provisioners - for _, p := range r.Provisioners { - // This validation checks that there are no splat variables - // referencing ourself. This currently is not allowed. - - for _, v := range p.ConnInfo.Variables { - rv, ok := v.(*ResourceVariable) - if !ok { - continue - } - - if rv.Multi && rv.Index == -1 && rv.Type == r.Type && rv.Name == r.Name { - diags = diags.Append(fmt.Errorf( - "%s: connection info cannot contain splat variable referencing itself", - n, - )) - break - } - } - - for _, v := range p.RawConfig.Variables { - rv, ok := v.(*ResourceVariable) - if !ok { - continue - } - - if rv.Multi && rv.Index == -1 && rv.Type == r.Type && rv.Name == r.Name { - diags = diags.Append(fmt.Errorf( - "%s: connection info cannot contain splat variable referencing itself", - n, - )) - break - } - } - - // Check for invalid when/onFailure values, though this should be - // picked up by the loader we check here just in case. - if p.When == ProvisionerWhenInvalid { - diags = diags.Append(fmt.Errorf( - "%s: provisioner 'when' value is invalid", n, - )) - } - if p.OnFailure == ProvisionerOnFailureInvalid { - diags = diags.Append(fmt.Errorf( - "%s: provisioner 'on_failure' value is invalid", n, - )) - } - } - - // Verify ignore_changes contains valid entries - for _, v := range r.Lifecycle.IgnoreChanges { - if strings.Contains(v, "*") && v != "*" { - diags = diags.Append(fmt.Errorf( - "%s: ignore_changes does not support using a partial string together with a wildcard: %s", - n, v, - )) - } - } - - // Verify ignore_changes has no interpolations - rc, err := NewRawConfig(map[string]interface{}{ - "root": r.Lifecycle.IgnoreChanges, - }) - if err != nil { - diags = diags.Append(fmt.Errorf( - "%s: lifecycle ignore_changes error: %s", - n, err, - )) - } else if len(rc.Interpolations) > 0 { - diags = diags.Append(fmt.Errorf( - "%s: lifecycle ignore_changes cannot contain interpolations", - n, - )) - } - - // If it is a data source then it can't have provisioners - if r.Mode == DataResourceMode { - if _, ok := r.RawConfig.Raw["provisioner"]; ok { - diags = diags.Append(fmt.Errorf( - "%s: data sources cannot have provisioners", - n, - )) - } - } - } - - for source, vs := range vars { - for _, v := range vs { - rv, ok := v.(*ResourceVariable) - if !ok { - continue - } - - id := rv.ResourceId() - if _, ok := resources[id]; !ok { - diags = diags.Append(fmt.Errorf( - "%s: unknown resource '%s' referenced in variable %s", - source, - id, - rv.FullKey(), - )) - continue - } - } - } - - // Check that all locals are valid - { - found := make(map[string]struct{}) - for _, l := range c.Locals { - if _, ok := found[l.Name]; ok { - diags = diags.Append(fmt.Errorf( - "%s: duplicate local. local value names must be unique", - l.Name, - )) - continue - } - found[l.Name] = struct{}{} - - for _, v := range l.RawConfig.Variables { - if _, ok := v.(*CountVariable); ok { - diags = diags.Append(fmt.Errorf( - "local %s: count variables are only valid within resources", l.Name, - )) - } - } - } - } - - // Check that all outputs are valid - { - found := make(map[string]struct{}) - for _, o := range c.Outputs { - // Verify the output is new - if _, ok := found[o.Name]; ok { - diags = diags.Append(fmt.Errorf( - "output %q: an output of this name was already defined", - o.Name, - )) - continue - } - found[o.Name] = struct{}{} - - var invalidKeys []string - valueKeyFound := false - for k := range o.RawConfig.Raw { - if k == "value" { - valueKeyFound = true - continue - } - if k == "sensitive" { - if sensitive, ok := o.RawConfig.config[k].(bool); ok { - if sensitive { - o.Sensitive = true - } - continue - } - - diags = diags.Append(fmt.Errorf( - "output %q: value for 'sensitive' must be boolean", - o.Name, - )) - continue - } - if k == "description" { - if desc, ok := o.RawConfig.config[k].(string); ok { - o.Description = desc - continue - } - - diags = diags.Append(fmt.Errorf( - "output %q: value for 'description' must be string", - o.Name, - )) - continue - } - invalidKeys = append(invalidKeys, k) - } - if len(invalidKeys) > 0 { - diags = diags.Append(fmt.Errorf( - "output %q: invalid keys: %s", - o.Name, strings.Join(invalidKeys, ", "), - )) - } - if !valueKeyFound { - diags = diags.Append(fmt.Errorf( - "output %q: missing required 'value' argument", o.Name, - )) - } - - for _, v := range o.RawConfig.Variables { - if _, ok := v.(*CountVariable); ok { - diags = diags.Append(fmt.Errorf( - "output %q: count variables are only valid within resources", - o.Name, - )) - } - } - - // Detect a common mistake of using a "count"ed resource in - // an output value without using the splat or index form. - // Prior to 0.11 this error was silently ignored, but outputs - // now have their errors checked like all other contexts. - // - // TODO: Remove this in 0.12. - for _, v := range o.RawConfig.Variables { - rv, ok := v.(*ResourceVariable) - if !ok { - continue - } - - // If the variable seems to be treating the referenced - // resource as a singleton (no count specified) then - // we'll check to make sure it is indeed a singleton. - // It's a warning if not. - - if rv.Multi || rv.Index != 0 { - // This reference is treating the resource as a - // multi-resource, so the warning doesn't apply. - continue - } - - for _, r := range c.Resources { - if r.Id() != rv.ResourceId() { - continue - } - - // We test specifically for the raw string "1" here - // because we _do_ want to generate this warning if - // the user has provided an expression that happens - // to return 1 right now, to catch situations where - // a count might dynamically be set to something - // other than 1 and thus splat syntax is still needed - // to be safe. - if r.RawCount != nil && r.RawCount.Raw != nil && r.RawCount.Raw["count"] != "1" && rv.Field != "count" { - diags = diags.Append(tfdiags.SimpleWarning(fmt.Sprintf( - "output %q: must use splat syntax to access %s attribute %q, because it has \"count\" set; use %s.*.%s to obtain a list of the attributes across all instances", - o.Name, - r.Id(), rv.Field, - r.Id(), rv.Field, - ))) - } - } - } - } - } - - // Validate the self variable - for source, rc := range c.rawConfigs() { - // Ignore provisioners. This is a pretty brittle way to do this, - // but better than also repeating all the resources. - if strings.Contains(source, "provision") { - continue - } - - for _, v := range rc.Variables { - if _, ok := v.(*SelfVariable); ok { - diags = diags.Append(fmt.Errorf( - "%s: cannot contain self-reference %s", - source, v.FullKey(), - )) - } - } - } - - return diags -} - -// InterpolatedVariables is a helper that returns a mapping of all the interpolated -// variables within the configuration. This is used to verify references -// are valid in the Validate step. -func (c *Config) InterpolatedVariables() map[string][]InterpolatedVariable { - result := make(map[string][]InterpolatedVariable) - for source, rc := range c.rawConfigs() { - for _, v := range rc.Variables { - result[source] = append(result[source], v) - } - } - return result -} - -// rawConfigs returns all of the RawConfigs that are available keyed by -// a human-friendly source. -func (c *Config) rawConfigs() map[string]*RawConfig { - result := make(map[string]*RawConfig) - for _, m := range c.Modules { - source := fmt.Sprintf("module '%s'", m.Name) - result[source] = m.RawConfig - } - - for _, pc := range c.ProviderConfigs { - source := fmt.Sprintf("provider config '%s'", pc.Name) - result[source] = pc.RawConfig - } - - for _, rc := range c.Resources { - source := fmt.Sprintf("resource '%s'", rc.Id()) - result[source+" count"] = rc.RawCount - result[source+" config"] = rc.RawConfig - - for i, p := range rc.Provisioners { - subsource := fmt.Sprintf( - "%s provisioner %s (#%d)", - source, p.Type, i+1) - result[subsource] = p.RawConfig - } - } - - for _, o := range c.Outputs { - source := fmt.Sprintf("output '%s'", o.Name) - result[source] = o.RawConfig - } - - return result -} - -func (c *Config) validateDependsOn( - n string, - v []string, - resources map[string]*Resource, - modules map[string]*Module) []error { - // Verify depends on points to resources that all exist - var errs []error - for _, d := range v { - // Check if we contain interpolations - rc, err := NewRawConfig(map[string]interface{}{ - "value": d, - }) - if err == nil && len(rc.Variables) > 0 { - errs = append(errs, fmt.Errorf( - "%s: depends on value cannot contain interpolations: %s", - n, d)) - continue - } - - // If it is a module, verify it is a module - if strings.HasPrefix(d, "module.") { - name := d[len("module."):] - if _, ok := modules[name]; !ok { - errs = append(errs, fmt.Errorf( - "%s: resource depends on non-existent module '%s'", - n, name)) - } - - continue - } - - // Check resources - if _, ok := resources[d]; !ok { - errs = append(errs, fmt.Errorf( - "%s: resource depends on non-existent resource '%s'", - n, d)) - } - } - - return errs -} - -func (m *Module) mergerName() string { - return m.Id() -} - -func (m *Module) mergerMerge(other merger) merger { - m2 := other.(*Module) - - result := *m - result.Name = m2.Name - result.RawConfig = result.RawConfig.merge(m2.RawConfig) - - if m2.Source != "" { - result.Source = m2.Source - } - - return &result -} - -func (o *Output) mergerName() string { - return o.Name -} - -func (o *Output) mergerMerge(m merger) merger { - o2 := m.(*Output) - - result := *o - result.Name = o2.Name - result.Description = o2.Description - result.RawConfig = result.RawConfig.merge(o2.RawConfig) - result.Sensitive = o2.Sensitive - result.DependsOn = o2.DependsOn - - return &result -} - -func (c *ProviderConfig) GoString() string { - return fmt.Sprintf("*%#v", *c) -} - -func (c *ProviderConfig) FullName() string { - if c.Alias == "" { - return c.Name - } - - return fmt.Sprintf("%s.%s", c.Name, c.Alias) -} - -func (c *ProviderConfig) mergerName() string { - return c.Name -} - -func (c *ProviderConfig) mergerMerge(m merger) merger { - c2 := m.(*ProviderConfig) - - result := *c - result.Name = c2.Name - result.RawConfig = result.RawConfig.merge(c2.RawConfig) - - if c2.Alias != "" { - result.Alias = c2.Alias - } - - return &result -} - -func (r *Resource) mergerName() string { - return r.Id() -} - -func (r *Resource) mergerMerge(m merger) merger { - r2 := m.(*Resource) - - result := *r - result.Mode = r2.Mode - result.Name = r2.Name - result.Type = r2.Type - result.RawConfig = result.RawConfig.merge(r2.RawConfig) - - if r2.RawCount.Value() != "1" { - result.RawCount = r2.RawCount - } - - if len(r2.Provisioners) > 0 { - result.Provisioners = r2.Provisioners - } - - return &result -} - -// Merge merges two variables to create a new third variable. -func (v *Variable) Merge(v2 *Variable) *Variable { - // Shallow copy the variable - result := *v - - // The names should be the same, but the second name always wins. - result.Name = v2.Name - - if v2.DeclaredType != "" { - result.DeclaredType = v2.DeclaredType - } - if v2.Default != nil { - result.Default = v2.Default - } - if v2.Description != "" { - result.Description = v2.Description - } - - return &result -} - -var typeStringMap = map[string]VariableType{ - "string": VariableTypeString, - "map": VariableTypeMap, - "list": VariableTypeList, -} - -// Type returns the type of variable this is. -func (v *Variable) Type() VariableType { - if v.DeclaredType != "" { - declaredType, ok := typeStringMap[v.DeclaredType] - if !ok { - return VariableTypeUnknown - } - - return declaredType - } - - return v.inferTypeFromDefault() -} - -// ValidateTypeAndDefault ensures that default variable value is compatible -// with the declared type (if one exists), and that the type is one which is -// known to Terraform -func (v *Variable) ValidateTypeAndDefault() error { - // If an explicit type is declared, ensure it is valid - if v.DeclaredType != "" { - if _, ok := typeStringMap[v.DeclaredType]; !ok { - validTypes := []string{} - for k := range typeStringMap { - validTypes = append(validTypes, k) - } - return fmt.Errorf( - "Variable '%s' type must be one of [%s] - '%s' is not a valid type", - v.Name, - strings.Join(validTypes, ", "), - v.DeclaredType, - ) - } - } - - if v.DeclaredType == "" || v.Default == nil { - return nil - } - - if v.inferTypeFromDefault() != v.Type() { - return fmt.Errorf("'%s' has a default value which is not of type '%s' (got '%s')", - v.Name, v.DeclaredType, v.inferTypeFromDefault().Printable()) - } - - return nil -} - -func (v *Variable) mergerName() string { - return v.Name -} - -func (v *Variable) mergerMerge(m merger) merger { - return v.Merge(m.(*Variable)) -} - -// Required tests whether a variable is required or not. -func (v *Variable) Required() bool { - return v.Default == nil -} - -// inferTypeFromDefault contains the logic for the old method of inferring -// variable types - we can also use this for validating that the declared -// type matches the type of the default value -func (v *Variable) inferTypeFromDefault() VariableType { - if v.Default == nil { - return VariableTypeString - } - - var s string - if err := hilmapstructure.WeakDecode(v.Default, &s); err == nil { - v.Default = s - return VariableTypeString - } - - var m map[string]interface{} - if err := hilmapstructure.WeakDecode(v.Default, &m); err == nil { - v.Default = m - return VariableTypeMap - } - - var l []interface{} - if err := hilmapstructure.WeakDecode(v.Default, &l); err == nil { - v.Default = l - return VariableTypeList - } - - return VariableTypeUnknown -} - -func (m ResourceMode) Taintable() bool { - switch m { - case ManagedResourceMode: - return true - case DataResourceMode: - return false - default: - panic(fmt.Errorf("unsupported ResourceMode value %s", m)) - } -} diff --git a/vendor/github.com/hashicorp/terraform/config/config_string.go b/vendor/github.com/hashicorp/terraform/config/config_string.go deleted file mode 100644 index a6933c2a5..000000000 --- a/vendor/github.com/hashicorp/terraform/config/config_string.go +++ /dev/null @@ -1,378 +0,0 @@ -package config - -import ( - "bytes" - "fmt" - "sort" - "strings" -) - -// TestString is a Stringer-like function that outputs a string that can -// be used to easily compare multiple Config structures in unit tests. -// -// This function has no practical use outside of unit tests and debugging. -func (c *Config) TestString() string { - if c == nil { - return "" - } - - var buf bytes.Buffer - if len(c.Modules) > 0 { - buf.WriteString("Modules:\n\n") - buf.WriteString(modulesStr(c.Modules)) - buf.WriteString("\n\n") - } - - if len(c.Variables) > 0 { - buf.WriteString("Variables:\n\n") - buf.WriteString(variablesStr(c.Variables)) - buf.WriteString("\n\n") - } - - if len(c.ProviderConfigs) > 0 { - buf.WriteString("Provider Configs:\n\n") - buf.WriteString(providerConfigsStr(c.ProviderConfigs)) - buf.WriteString("\n\n") - } - - if len(c.Resources) > 0 { - buf.WriteString("Resources:\n\n") - buf.WriteString(resourcesStr(c.Resources)) - buf.WriteString("\n\n") - } - - if len(c.Outputs) > 0 { - buf.WriteString("Outputs:\n\n") - buf.WriteString(outputsStr(c.Outputs)) - buf.WriteString("\n") - } - - return strings.TrimSpace(buf.String()) -} - -func terraformStr(t *Terraform) string { - result := "" - - if b := t.Backend; b != nil { - result += fmt.Sprintf("backend (%s)\n", b.Type) - - keys := make([]string, 0, len(b.RawConfig.Raw)) - for k, _ := range b.RawConfig.Raw { - keys = append(keys, k) - } - sort.Strings(keys) - - for _, k := range keys { - result += fmt.Sprintf(" %s\n", k) - } - } - - return strings.TrimSpace(result) -} - -func modulesStr(ms []*Module) string { - result := "" - order := make([]int, 0, len(ms)) - ks := make([]string, 0, len(ms)) - mapping := make(map[string]int) - for i, m := range ms { - k := m.Id() - ks = append(ks, k) - mapping[k] = i - } - sort.Strings(ks) - for _, k := range ks { - order = append(order, mapping[k]) - } - - for _, i := range order { - m := ms[i] - result += fmt.Sprintf("%s\n", m.Id()) - - ks := make([]string, 0, len(m.RawConfig.Raw)) - for k, _ := range m.RawConfig.Raw { - ks = append(ks, k) - } - sort.Strings(ks) - - result += fmt.Sprintf(" source = %s\n", m.Source) - - for _, k := range ks { - result += fmt.Sprintf(" %s\n", k) - } - } - - return strings.TrimSpace(result) -} - -func outputsStr(os []*Output) string { - ns := make([]string, 0, len(os)) - m := make(map[string]*Output) - for _, o := range os { - ns = append(ns, o.Name) - m[o.Name] = o - } - sort.Strings(ns) - - result := "" - for _, n := range ns { - o := m[n] - - result += fmt.Sprintf("%s\n", n) - - if len(o.DependsOn) > 0 { - result += fmt.Sprintf(" dependsOn\n") - for _, d := range o.DependsOn { - result += fmt.Sprintf(" %s\n", d) - } - } - - if len(o.RawConfig.Variables) > 0 { - result += fmt.Sprintf(" vars\n") - for _, rawV := range o.RawConfig.Variables { - kind := "unknown" - str := rawV.FullKey() - - switch rawV.(type) { - case *ResourceVariable: - kind = "resource" - case *UserVariable: - kind = "user" - } - - result += fmt.Sprintf(" %s: %s\n", kind, str) - } - } - - if o.Description != "" { - result += fmt.Sprintf(" description\n %s\n", o.Description) - } - } - - return strings.TrimSpace(result) -} - -func localsStr(ls []*Local) string { - ns := make([]string, 0, len(ls)) - m := make(map[string]*Local) - for _, l := range ls { - ns = append(ns, l.Name) - m[l.Name] = l - } - sort.Strings(ns) - - result := "" - for _, n := range ns { - l := m[n] - - result += fmt.Sprintf("%s\n", n) - - if len(l.RawConfig.Variables) > 0 { - result += fmt.Sprintf(" vars\n") - for _, rawV := range l.RawConfig.Variables { - kind := "unknown" - str := rawV.FullKey() - - switch rawV.(type) { - case *ResourceVariable: - kind = "resource" - case *UserVariable: - kind = "user" - } - - result += fmt.Sprintf(" %s: %s\n", kind, str) - } - } - } - - return strings.TrimSpace(result) -} - -// This helper turns a provider configs field into a deterministic -// string value for comparison in tests. -func providerConfigsStr(pcs []*ProviderConfig) string { - result := "" - - ns := make([]string, 0, len(pcs)) - m := make(map[string]*ProviderConfig) - for _, n := range pcs { - ns = append(ns, n.Name) - m[n.Name] = n - } - sort.Strings(ns) - - for _, n := range ns { - pc := m[n] - - result += fmt.Sprintf("%s\n", n) - - keys := make([]string, 0, len(pc.RawConfig.Raw)) - for k, _ := range pc.RawConfig.Raw { - keys = append(keys, k) - } - sort.Strings(keys) - - for _, k := range keys { - result += fmt.Sprintf(" %s\n", k) - } - - if len(pc.RawConfig.Variables) > 0 { - result += fmt.Sprintf(" vars\n") - for _, rawV := range pc.RawConfig.Variables { - kind := "unknown" - str := rawV.FullKey() - - switch rawV.(type) { - case *ResourceVariable: - kind = "resource" - case *UserVariable: - kind = "user" - } - - result += fmt.Sprintf(" %s: %s\n", kind, str) - } - } - } - - return strings.TrimSpace(result) -} - -// This helper turns a resources field into a deterministic -// string value for comparison in tests. -func resourcesStr(rs []*Resource) string { - result := "" - order := make([]int, 0, len(rs)) - ks := make([]string, 0, len(rs)) - mapping := make(map[string]int) - for i, r := range rs { - k := r.Id() - ks = append(ks, k) - mapping[k] = i - } - sort.Strings(ks) - for _, k := range ks { - order = append(order, mapping[k]) - } - - for _, i := range order { - r := rs[i] - result += fmt.Sprintf( - "%s (x%s)\n", - r.Id(), - r.RawCount.Value()) - - ks := make([]string, 0, len(r.RawConfig.Raw)) - for k, _ := range r.RawConfig.Raw { - ks = append(ks, k) - } - sort.Strings(ks) - - for _, k := range ks { - result += fmt.Sprintf(" %s\n", k) - } - - if len(r.Provisioners) > 0 { - result += fmt.Sprintf(" provisioners\n") - for _, p := range r.Provisioners { - when := "" - if p.When != ProvisionerWhenCreate { - when = fmt.Sprintf(" (%s)", p.When.String()) - } - - result += fmt.Sprintf(" %s%s\n", p.Type, when) - - if p.OnFailure != ProvisionerOnFailureFail { - result += fmt.Sprintf(" on_failure = %s\n", p.OnFailure.String()) - } - - ks := make([]string, 0, len(p.RawConfig.Raw)) - for k, _ := range p.RawConfig.Raw { - ks = append(ks, k) - } - sort.Strings(ks) - - for _, k := range ks { - result += fmt.Sprintf(" %s\n", k) - } - } - } - - if len(r.DependsOn) > 0 { - result += fmt.Sprintf(" dependsOn\n") - for _, d := range r.DependsOn { - result += fmt.Sprintf(" %s\n", d) - } - } - - if len(r.RawConfig.Variables) > 0 { - result += fmt.Sprintf(" vars\n") - - ks := make([]string, 0, len(r.RawConfig.Variables)) - for k, _ := range r.RawConfig.Variables { - ks = append(ks, k) - } - sort.Strings(ks) - - for _, k := range ks { - rawV := r.RawConfig.Variables[k] - kind := "unknown" - str := rawV.FullKey() - - switch rawV.(type) { - case *ResourceVariable: - kind = "resource" - case *UserVariable: - kind = "user" - } - - result += fmt.Sprintf(" %s: %s\n", kind, str) - } - } - } - - return strings.TrimSpace(result) -} - -// This helper turns a variables field into a deterministic -// string value for comparison in tests. -func variablesStr(vs []*Variable) string { - result := "" - ks := make([]string, 0, len(vs)) - m := make(map[string]*Variable) - for _, v := range vs { - ks = append(ks, v.Name) - m[v.Name] = v - } - sort.Strings(ks) - - for _, k := range ks { - v := m[k] - - required := "" - if v.Required() { - required = " (required)" - } - - declaredType := "" - if v.DeclaredType != "" { - declaredType = fmt.Sprintf(" (%s)", v.DeclaredType) - } - - if v.Default == nil || v.Default == "" { - v.Default = "<>" - } - if v.Description == "" { - v.Description = "<>" - } - - result += fmt.Sprintf( - "%s%s%s\n %v\n %s\n", - k, - required, - declaredType, - v.Default, - v.Description) - } - - return strings.TrimSpace(result) -} diff --git a/vendor/github.com/hashicorp/terraform/config/config_terraform.go b/vendor/github.com/hashicorp/terraform/config/config_terraform.go deleted file mode 100644 index 8535c9648..000000000 --- a/vendor/github.com/hashicorp/terraform/config/config_terraform.go +++ /dev/null @@ -1,117 +0,0 @@ -package config - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-version" - "github.com/mitchellh/hashstructure" -) - -// Terraform is the Terraform meta-configuration that can be present -// in configuration files for configuring Terraform itself. -type Terraform struct { - RequiredVersion string `hcl:"required_version"` // Required Terraform version (constraint) - Backend *Backend // See Backend struct docs -} - -// Validate performs the validation for just the Terraform configuration. -func (t *Terraform) Validate() []error { - var errs []error - - if raw := t.RequiredVersion; raw != "" { - // Check that the value has no interpolations - rc, err := NewRawConfig(map[string]interface{}{ - "root": raw, - }) - if err != nil { - errs = append(errs, fmt.Errorf( - "terraform.required_version: %s", err)) - } else if len(rc.Interpolations) > 0 { - errs = append(errs, fmt.Errorf( - "terraform.required_version: cannot contain interpolations")) - } else { - // Check it is valid - _, err := version.NewConstraint(raw) - if err != nil { - errs = append(errs, fmt.Errorf( - "terraform.required_version: invalid syntax: %s", err)) - } - } - } - - if t.Backend != nil { - errs = append(errs, t.Backend.Validate()...) - } - - return errs -} - -// Merge t with t2. -// Any conflicting fields are overwritten by t2. -func (t *Terraform) Merge(t2 *Terraform) { - if t2.RequiredVersion != "" { - t.RequiredVersion = t2.RequiredVersion - } - - if t2.Backend != nil { - t.Backend = t2.Backend - } -} - -// Backend is the configuration for the "backend" to use with Terraform. -// A backend is responsible for all major behavior of Terraform's core. -// The abstraction layer above the core (the "backend") allows for behavior -// such as remote operation. -type Backend struct { - Type string - RawConfig *RawConfig - - // Hash is a unique hash code representing the original configuration - // of the backend. This won't be recomputed unless Rehash is called. - Hash uint64 -} - -// Rehash returns a unique content hash for this backend's configuration -// as a uint64 value. -func (b *Backend) Rehash() uint64 { - // If we have no backend, the value is zero - if b == nil { - return 0 - } - - // Use hashstructure to hash only our type with the config. - code, err := hashstructure.Hash(map[string]interface{}{ - "type": b.Type, - "config": b.RawConfig.Raw, - }, nil) - - // This should never happen since we have just some basic primitives - // so panic if there is an error. - if err != nil { - panic(err) - } - - return code -} - -func (b *Backend) Validate() []error { - if len(b.RawConfig.Interpolations) > 0 { - return []error{fmt.Errorf(strings.TrimSpace(errBackendInterpolations))} - } - - return nil -} - -const errBackendInterpolations = ` -terraform.backend: configuration cannot contain interpolations - -The backend configuration is loaded by Terraform extremely early, before -the core of Terraform can be initialized. This is necessary because the backend -dictates the behavior of that core. The core is what handles interpolation -processing. Because of this, interpolations cannot be used in backend -configuration. - -If you'd like to parameterize backend configuration, we recommend using -partial configuration with the "-backend-config" flag to "terraform init". -` diff --git a/vendor/github.com/hashicorp/terraform/config/config_tree.go b/vendor/github.com/hashicorp/terraform/config/config_tree.go deleted file mode 100644 index 08dc0fe90..000000000 --- a/vendor/github.com/hashicorp/terraform/config/config_tree.go +++ /dev/null @@ -1,43 +0,0 @@ -package config - -// configTree represents a tree of configurations where the root is the -// first file and its children are the configurations it has imported. -type configTree struct { - Path string - Config *Config - Children []*configTree -} - -// Flatten flattens the entire tree down to a single merged Config -// structure. -func (t *configTree) Flatten() (*Config, error) { - // No children is easy: we're already merged! - if len(t.Children) == 0 { - return t.Config, nil - } - - // Depth-first, merge all the children first. - childConfigs := make([]*Config, len(t.Children)) - for i, ct := range t.Children { - c, err := ct.Flatten() - if err != nil { - return nil, err - } - - childConfigs[i] = c - } - - // Merge all the children in order - config := childConfigs[0] - childConfigs = childConfigs[1:] - for _, config2 := range childConfigs { - var err error - config, err = Merge(config, config2) - if err != nil { - return nil, err - } - } - - // Merge the final merged child config with our own - return Merge(config, t.Config) -} diff --git a/vendor/github.com/hashicorp/terraform/config/import_tree.go b/vendor/github.com/hashicorp/terraform/config/import_tree.go deleted file mode 100644 index 08cbc7736..000000000 --- a/vendor/github.com/hashicorp/terraform/config/import_tree.go +++ /dev/null @@ -1,151 +0,0 @@ -package config - -import ( - "bufio" - "fmt" - "io" - "os" - - "github.com/hashicorp/errwrap" -) - -// configurable is an interface that must be implemented by any configuration -// formats of Terraform in order to return a *Config. -type configurable interface { - Config() (*Config, error) -} - -// importTree is the result of the first-pass load of the configuration -// files. It is a tree of raw configurables and then any children (their -// imports). -// -// An importTree can be turned into a configTree. -type importTree struct { - Path string - Raw configurable - Children []*importTree -} - -// This is the function type that must be implemented by the configuration -// file loader to turn a single file into a configurable and any additional -// imports. -type fileLoaderFunc func(path string) (configurable, []string, error) - -// Set this to a non-empty value at link time to enable the HCL2 experiment. -// This is not currently enabled for release builds. -// -// For example: -// go install -ldflags="-X github.com/hashicorp/terraform/config.enableHCL2Experiment=true" github.com/hashicorp/terraform -var enableHCL2Experiment = "" - -// loadTree takes a single file and loads the entire importTree for that -// file. This function detects what kind of configuration file it is an -// executes the proper fileLoaderFunc. -func loadTree(root string) (*importTree, error) { - var f fileLoaderFunc - - // HCL2 experiment is currently activated at build time via the linker. - // See the comment on this variable for more information. - if enableHCL2Experiment == "" { - // Main-line behavior: always use the original HCL parser - switch ext(root) { - case ".tf", ".tf.json": - f = loadFileHcl - default: - } - } else { - // Experimental behavior: use the HCL2 parser if the opt-in comment - // is present. - switch ext(root) { - case ".tf": - // We need to sniff the file for the opt-in comment line to decide - // if the file is participating in the HCL2 experiment. - cf, err := os.Open(root) - if err != nil { - return nil, err - } - sc := bufio.NewScanner(cf) - for sc.Scan() { - if sc.Text() == "#terraform:hcl2" { - f = globalHCL2Loader.loadFile - } - } - if f == nil { - f = loadFileHcl - } - case ".tf.json": - f = loadFileHcl - default: - } - } - - if f == nil { - return nil, fmt.Errorf( - "%s: unknown configuration format. Use '.tf' or '.tf.json' extension", - root) - } - - c, imps, err := f(root) - if err != nil { - return nil, err - } - - children := make([]*importTree, len(imps)) - for i, imp := range imps { - t, err := loadTree(imp) - if err != nil { - return nil, err - } - - children[i] = t - } - - return &importTree{ - Path: root, - Raw: c, - Children: children, - }, nil -} - -// Close releases any resources we might be holding open for the importTree. -// -// This can safely be called even while ConfigTree results are alive. The -// importTree is not bound to these. -func (t *importTree) Close() error { - if c, ok := t.Raw.(io.Closer); ok { - c.Close() - } - for _, ct := range t.Children { - ct.Close() - } - - return nil -} - -// ConfigTree traverses the importTree and turns each node into a *Config -// object, ultimately returning a *configTree. -func (t *importTree) ConfigTree() (*configTree, error) { - config, err := t.Raw.Config() - if err != nil { - return nil, errwrap.Wrapf(fmt.Sprintf("Error loading %s: {{err}}", t.Path), err) - } - - // Build our result - result := &configTree{ - Path: t.Path, - Config: config, - } - - // Build the config trees for the children - result.Children = make([]*configTree, len(t.Children)) - for i, ct := range t.Children { - t, err := ct.ConfigTree() - if err != nil { - return nil, err - } - - result.Children[i] = t - } - - return result, nil -} diff --git a/vendor/github.com/hashicorp/terraform/config/interpolate.go b/vendor/github.com/hashicorp/terraform/config/interpolate.go deleted file mode 100644 index 599e5ecdb..000000000 --- a/vendor/github.com/hashicorp/terraform/config/interpolate.go +++ /dev/null @@ -1,439 +0,0 @@ -package config - -import ( - "fmt" - "strconv" - "strings" - - "github.com/hashicorp/terraform/tfdiags" - - "github.com/hashicorp/hil/ast" -) - -// An InterpolatedVariable is a variable reference within an interpolation. -// -// Implementations of this interface represents various sources where -// variables can come from: user variables, resources, etc. -type InterpolatedVariable interface { - FullKey() string - SourceRange() tfdiags.SourceRange -} - -// varRange can be embedded into an InterpolatedVariable implementation to -// implement the SourceRange method. -type varRange struct { - rng tfdiags.SourceRange -} - -func (r varRange) SourceRange() tfdiags.SourceRange { - return r.rng -} - -func makeVarRange(rng tfdiags.SourceRange) varRange { - return varRange{rng} -} - -// CountVariable is a variable for referencing information about -// the count. -type CountVariable struct { - Type CountValueType - key string - varRange -} - -// CountValueType is the type of the count variable that is referenced. -type CountValueType byte - -const ( - CountValueInvalid CountValueType = iota - CountValueIndex -) - -// A ModuleVariable is a variable that is referencing the output -// of a module, such as "${module.foo.bar}" -type ModuleVariable struct { - Name string - Field string - key string - varRange -} - -// A PathVariable is a variable that references path information about the -// module. -type PathVariable struct { - Type PathValueType - key string - varRange -} - -type PathValueType byte - -const ( - PathValueInvalid PathValueType = iota - PathValueCwd - PathValueModule - PathValueRoot -) - -// A ResourceVariable is a variable that is referencing the field -// of a resource, such as "${aws_instance.foo.ami}" -type ResourceVariable struct { - Mode ResourceMode - Type string // Resource type, i.e. "aws_instance" - Name string // Resource name - Field string // Resource field - - Multi bool // True if multi-variable: aws_instance.foo.*.id - Index int // Index for multi-variable: aws_instance.foo.1.id == 1 - - key string - varRange -} - -// SelfVariable is a variable that is referencing the same resource -// it is running on: "${self.address}" -type SelfVariable struct { - Field string - - key string - varRange -} - -// SimpleVariable is an unprefixed variable, which can show up when users have -// strings they are passing down to resources that use interpolation -// internally. The template_file resource is an example of this. -type SimpleVariable struct { - Key string - varRange -} - -// TerraformVariable is a "terraform."-prefixed variable used to access -// metadata about the Terraform run. -type TerraformVariable struct { - Field string - key string - varRange -} - -// A UserVariable is a variable that is referencing a user variable -// that is inputted from outside the configuration. This looks like -// "${var.foo}" -type UserVariable struct { - Name string - Elem string - - key string - varRange -} - -// A LocalVariable is a variable that references a local value defined within -// the current module, via a "locals" block. This looks like "${local.foo}". -type LocalVariable struct { - Name string - varRange -} - -func NewInterpolatedVariable(v string) (InterpolatedVariable, error) { - if strings.HasPrefix(v, "count.") { - return NewCountVariable(v) - } else if strings.HasPrefix(v, "path.") { - return NewPathVariable(v) - } else if strings.HasPrefix(v, "self.") { - return NewSelfVariable(v) - } else if strings.HasPrefix(v, "terraform.") { - return NewTerraformVariable(v) - } else if strings.HasPrefix(v, "var.") { - return NewUserVariable(v) - } else if strings.HasPrefix(v, "local.") { - return NewLocalVariable(v) - } else if strings.HasPrefix(v, "module.") { - return NewModuleVariable(v) - } else if !strings.ContainsRune(v, '.') { - return NewSimpleVariable(v) - } else { - return NewResourceVariable(v) - } -} - -func NewCountVariable(key string) (*CountVariable, error) { - var fieldType CountValueType - parts := strings.SplitN(key, ".", 2) - switch parts[1] { - case "index": - fieldType = CountValueIndex - } - - return &CountVariable{ - Type: fieldType, - key: key, - }, nil -} - -func (c *CountVariable) FullKey() string { - return c.key -} - -func NewModuleVariable(key string) (*ModuleVariable, error) { - parts := strings.SplitN(key, ".", 3) - if len(parts) < 3 { - return nil, fmt.Errorf( - "%s: module variables must be three parts: module.name.attr", - key) - } - - return &ModuleVariable{ - Name: parts[1], - Field: parts[2], - key: key, - }, nil -} - -func (v *ModuleVariable) FullKey() string { - return v.key -} - -func (v *ModuleVariable) GoString() string { - return fmt.Sprintf("*%#v", *v) -} - -func NewPathVariable(key string) (*PathVariable, error) { - var fieldType PathValueType - parts := strings.SplitN(key, ".", 2) - switch parts[1] { - case "cwd": - fieldType = PathValueCwd - case "module": - fieldType = PathValueModule - case "root": - fieldType = PathValueRoot - } - - return &PathVariable{ - Type: fieldType, - key: key, - }, nil -} - -func (v *PathVariable) FullKey() string { - return v.key -} - -func NewResourceVariable(key string) (*ResourceVariable, error) { - var mode ResourceMode - var parts []string - if strings.HasPrefix(key, "data.") { - mode = DataResourceMode - parts = strings.SplitN(key, ".", 4) - if len(parts) < 4 { - return nil, fmt.Errorf( - "%s: data variables must be four parts: data.TYPE.NAME.ATTR", - key) - } - - // Don't actually need the "data." prefix for parsing, since it's - // always constant. - parts = parts[1:] - } else { - mode = ManagedResourceMode - parts = strings.SplitN(key, ".", 3) - if len(parts) < 3 { - return nil, fmt.Errorf( - "%s: resource variables must be three parts: TYPE.NAME.ATTR", - key) - } - } - - field := parts[2] - multi := false - var index int - - if idx := strings.Index(field, "."); idx != -1 { - indexStr := field[:idx] - multi = indexStr == "*" - index = -1 - - if !multi { - indexInt, err := strconv.ParseInt(indexStr, 0, 0) - if err == nil { - multi = true - index = int(indexInt) - } - } - - if multi { - field = field[idx+1:] - } - } - - return &ResourceVariable{ - Mode: mode, - Type: parts[0], - Name: parts[1], - Field: field, - Multi: multi, - Index: index, - key: key, - }, nil -} - -func (v *ResourceVariable) ResourceId() string { - switch v.Mode { - case ManagedResourceMode: - return fmt.Sprintf("%s.%s", v.Type, v.Name) - case DataResourceMode: - return fmt.Sprintf("data.%s.%s", v.Type, v.Name) - default: - panic(fmt.Errorf("unknown resource mode %s", v.Mode)) - } -} - -func (v *ResourceVariable) FullKey() string { - return v.key -} - -func NewSelfVariable(key string) (*SelfVariable, error) { - field := key[len("self."):] - - return &SelfVariable{ - Field: field, - - key: key, - }, nil -} - -func (v *SelfVariable) FullKey() string { - return v.key -} - -func (v *SelfVariable) GoString() string { - return fmt.Sprintf("*%#v", *v) -} - -func NewSimpleVariable(key string) (*SimpleVariable, error) { - return &SimpleVariable{Key: key}, nil -} - -func (v *SimpleVariable) FullKey() string { - return v.Key -} - -func (v *SimpleVariable) GoString() string { - return fmt.Sprintf("*%#v", *v) -} - -func NewTerraformVariable(key string) (*TerraformVariable, error) { - field := key[len("terraform."):] - return &TerraformVariable{ - Field: field, - key: key, - }, nil -} - -func (v *TerraformVariable) FullKey() string { - return v.key -} - -func (v *TerraformVariable) GoString() string { - return fmt.Sprintf("*%#v", *v) -} - -func NewUserVariable(key string) (*UserVariable, error) { - name := key[len("var."):] - elem := "" - if idx := strings.Index(name, "."); idx > -1 { - elem = name[idx+1:] - name = name[:idx] - } - - if len(elem) > 0 { - return nil, fmt.Errorf("Invalid dot index found: 'var.%s.%s'. Values in maps and lists can be referenced using square bracket indexing, like: 'var.mymap[\"key\"]' or 'var.mylist[1]'.", name, elem) - } - - return &UserVariable{ - key: key, - - Name: name, - Elem: elem, - }, nil -} - -func (v *UserVariable) FullKey() string { - return v.key -} - -func (v *UserVariable) GoString() string { - return fmt.Sprintf("*%#v", *v) -} - -func NewLocalVariable(key string) (*LocalVariable, error) { - name := key[len("local."):] - if idx := strings.Index(name, "."); idx > -1 { - return nil, fmt.Errorf("Can't use dot (.) attribute access in local.%s; use square bracket indexing", name) - } - - return &LocalVariable{ - Name: name, - }, nil -} - -func (v *LocalVariable) FullKey() string { - return fmt.Sprintf("local.%s", v.Name) -} - -func (v *LocalVariable) GoString() string { - return fmt.Sprintf("*%#v", *v) -} - -// DetectVariables takes an AST root and returns all the interpolated -// variables that are detected in the AST tree. -func DetectVariables(root ast.Node) ([]InterpolatedVariable, error) { - var result []InterpolatedVariable - var resultErr error - - // Visitor callback - fn := func(n ast.Node) ast.Node { - if resultErr != nil { - return n - } - - switch vn := n.(type) { - case *ast.VariableAccess: - v, err := NewInterpolatedVariable(vn.Name) - if err != nil { - resultErr = err - return n - } - result = append(result, v) - case *ast.Index: - if va, ok := vn.Target.(*ast.VariableAccess); ok { - v, err := NewInterpolatedVariable(va.Name) - if err != nil { - resultErr = err - return n - } - result = append(result, v) - } - if va, ok := vn.Key.(*ast.VariableAccess); ok { - v, err := NewInterpolatedVariable(va.Name) - if err != nil { - resultErr = err - return n - } - result = append(result, v) - } - default: - return n - } - - return n - } - - // Visitor pattern - root.Accept(fn) - - if resultErr != nil { - return nil, resultErr - } - - return result, nil -} diff --git a/vendor/github.com/hashicorp/terraform/config/interpolate_funcs.go b/vendor/github.com/hashicorp/terraform/config/interpolate_funcs.go deleted file mode 100644 index 1f3f67b90..000000000 --- a/vendor/github.com/hashicorp/terraform/config/interpolate_funcs.go +++ /dev/null @@ -1,54 +0,0 @@ -package config - -import ( - "fmt" - - "github.com/hashicorp/hil/ast" -) - -// stringSliceToVariableValue converts a string slice into the value -// required to be returned from interpolation functions which return -// TypeList. -func stringSliceToVariableValue(values []string) []ast.Variable { - output := make([]ast.Variable, len(values)) - for index, value := range values { - output[index] = ast.Variable{ - Type: ast.TypeString, - Value: value, - } - } - return output -} - -// listVariableSliceToVariableValue converts a list of lists into the value -// required to be returned from interpolation functions which return TypeList. -func listVariableSliceToVariableValue(values [][]ast.Variable) []ast.Variable { - output := make([]ast.Variable, len(values)) - - for index, value := range values { - output[index] = ast.Variable{ - Type: ast.TypeList, - Value: value, - } - } - return output -} - -func listVariableValueToStringSlice(values []ast.Variable) ([]string, error) { - output := make([]string, len(values)) - for index, value := range values { - if value.Type != ast.TypeString { - return []string{}, fmt.Errorf("list has non-string element (%T)", value.Type.String()) - } - output[index] = value.Value.(string) - } - return output, nil -} - -// Funcs used to return a mapping of built-in functions for configuration. -// -// However, these function implementations are no longer used. To find the -// current function implementations, refer to ../lang/functions.go instead. -func Funcs() map[string]ast.Function { - return nil -} diff --git a/vendor/github.com/hashicorp/terraform/config/interpolate_walk.go b/vendor/github.com/hashicorp/terraform/config/interpolate_walk.go deleted file mode 100644 index f152d8004..000000000 --- a/vendor/github.com/hashicorp/terraform/config/interpolate_walk.go +++ /dev/null @@ -1,282 +0,0 @@ -package config - -import ( - "fmt" - "reflect" - "strings" - - "github.com/hashicorp/hil" - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/mitchellh/reflectwalk" -) - -// interpolationWalker implements interfaces for the reflectwalk package -// (github.com/mitchellh/reflectwalk) that can be used to automatically -// execute a callback for an interpolation. -type interpolationWalker struct { - // F is the function to call for every interpolation. It can be nil. - // - // If Replace is true, then the return value of F will be used to - // replace the interpolation. - F interpolationWalkerFunc - Replace bool - - // ContextF is an advanced version of F that also receives the - // location of where it is in the structure. This lets you do - // context-aware validation. - ContextF interpolationWalkerContextFunc - - key []string - lastValue reflect.Value - loc reflectwalk.Location - cs []reflect.Value - csKey []reflect.Value - csData interface{} - sliceIndex []int - unknownKeys []string -} - -// interpolationWalkerFunc is the callback called by interpolationWalk. -// It is called with any interpolation found. It should return a value -// to replace the interpolation with, along with any errors. -// -// If Replace is set to false in interpolationWalker, then the replace -// value can be anything as it will have no effect. -type interpolationWalkerFunc func(ast.Node) (interface{}, error) - -// interpolationWalkerContextFunc is called by interpolationWalk if -// ContextF is set. This receives both the interpolation and the location -// where the interpolation is. -// -// This callback can be used to validate the location of the interpolation -// within the configuration. -type interpolationWalkerContextFunc func(reflectwalk.Location, ast.Node) - -func (w *interpolationWalker) Enter(loc reflectwalk.Location) error { - w.loc = loc - return nil -} - -func (w *interpolationWalker) Exit(loc reflectwalk.Location) error { - w.loc = reflectwalk.None - - switch loc { - case reflectwalk.Map: - w.cs = w.cs[:len(w.cs)-1] - case reflectwalk.MapValue: - w.key = w.key[:len(w.key)-1] - w.csKey = w.csKey[:len(w.csKey)-1] - case reflectwalk.Slice: - // Split any values that need to be split - w.splitSlice() - w.cs = w.cs[:len(w.cs)-1] - case reflectwalk.SliceElem: - w.csKey = w.csKey[:len(w.csKey)-1] - w.sliceIndex = w.sliceIndex[:len(w.sliceIndex)-1] - } - - return nil -} - -func (w *interpolationWalker) Map(m reflect.Value) error { - w.cs = append(w.cs, m) - return nil -} - -func (w *interpolationWalker) MapElem(m, k, v reflect.Value) error { - w.csData = k - w.csKey = append(w.csKey, k) - - if l := len(w.sliceIndex); l > 0 { - w.key = append(w.key, fmt.Sprintf("%d.%s", w.sliceIndex[l-1], k.String())) - } else { - w.key = append(w.key, k.String()) - } - - w.lastValue = v - return nil -} - -func (w *interpolationWalker) Slice(s reflect.Value) error { - w.cs = append(w.cs, s) - return nil -} - -func (w *interpolationWalker) SliceElem(i int, elem reflect.Value) error { - w.csKey = append(w.csKey, reflect.ValueOf(i)) - w.sliceIndex = append(w.sliceIndex, i) - return nil -} - -func (w *interpolationWalker) Primitive(v reflect.Value) error { - setV := v - - // We only care about strings - if v.Kind() == reflect.Interface { - setV = v - v = v.Elem() - } - if v.Kind() != reflect.String { - return nil - } - - astRoot, err := hil.Parse(v.String()) - if err != nil { - return err - } - - // If the AST we got is just a literal string value with the same - // value then we ignore it. We have to check if its the same value - // because it is possible to input a string, get out a string, and - // have it be different. For example: "foo-$${bar}" turns into - // "foo-${bar}" - if n, ok := astRoot.(*ast.LiteralNode); ok { - if s, ok := n.Value.(string); ok && s == v.String() { - return nil - } - } - - if w.ContextF != nil { - w.ContextF(w.loc, astRoot) - } - - if w.F == nil { - return nil - } - - replaceVal, err := w.F(astRoot) - if err != nil { - return fmt.Errorf( - "%s in:\n\n%s", - err, v.String()) - } - - if w.Replace { - // We need to determine if we need to remove this element - // if the result contains any "UnknownVariableValue" which is - // set if it is computed. This behavior is different if we're - // splitting (in a SliceElem) or not. - remove := false - if w.loc == reflectwalk.SliceElem { - switch typedReplaceVal := replaceVal.(type) { - case string: - if typedReplaceVal == hcl2shim.UnknownVariableValue { - remove = true - } - case []interface{}: - if hasUnknownValue(typedReplaceVal) { - remove = true - } - } - } else if replaceVal == hcl2shim.UnknownVariableValue { - remove = true - } - - if remove { - w.unknownKeys = append(w.unknownKeys, strings.Join(w.key, ".")) - } - - resultVal := reflect.ValueOf(replaceVal) - switch w.loc { - case reflectwalk.MapKey: - m := w.cs[len(w.cs)-1] - - // Delete the old value - var zero reflect.Value - m.SetMapIndex(w.csData.(reflect.Value), zero) - - // Set the new key with the existing value - m.SetMapIndex(resultVal, w.lastValue) - - // Set the key to be the new key - w.csData = resultVal - case reflectwalk.MapValue: - // If we're in a map, then the only way to set a map value is - // to set it directly. - m := w.cs[len(w.cs)-1] - mk := w.csData.(reflect.Value) - m.SetMapIndex(mk, resultVal) - default: - // Otherwise, we should be addressable - setV.Set(resultVal) - } - } - - return nil -} - -func (w *interpolationWalker) replaceCurrent(v reflect.Value) { - // if we don't have at least 2 values, we're not going to find a map, but - // we could panic. - if len(w.cs) < 2 { - return - } - - c := w.cs[len(w.cs)-2] - switch c.Kind() { - case reflect.Map: - // Get the key and delete it - k := w.csKey[len(w.csKey)-1] - c.SetMapIndex(k, v) - } -} - -func hasUnknownValue(variable []interface{}) bool { - for _, value := range variable { - if strVal, ok := value.(string); ok { - if strVal == hcl2shim.UnknownVariableValue { - return true - } - } - } - return false -} - -func (w *interpolationWalker) splitSlice() { - raw := w.cs[len(w.cs)-1] - - var s []interface{} - switch v := raw.Interface().(type) { - case []interface{}: - s = v - case []map[string]interface{}: - return - } - - split := false - for _, val := range s { - if varVal, ok := val.(ast.Variable); ok && varVal.Type == ast.TypeList { - split = true - } - if _, ok := val.([]interface{}); ok { - split = true - } - } - - if !split { - return - } - - result := make([]interface{}, 0) - for _, v := range s { - switch val := v.(type) { - case ast.Variable: - switch val.Type { - case ast.TypeList: - elements := val.Value.([]ast.Variable) - for _, element := range elements { - result = append(result, element.Value) - } - default: - result = append(result, val.Value) - } - case []interface{}: - result = append(result, val...) - default: - result = append(result, v) - } - } - - w.replaceCurrent(reflect.ValueOf(result)) -} diff --git a/vendor/github.com/hashicorp/terraform/config/lang.go b/vendor/github.com/hashicorp/terraform/config/lang.go deleted file mode 100644 index 890d30beb..000000000 --- a/vendor/github.com/hashicorp/terraform/config/lang.go +++ /dev/null @@ -1,11 +0,0 @@ -package config - -import ( - "github.com/hashicorp/hil/ast" -) - -type noopNode struct{} - -func (n *noopNode) Accept(ast.Visitor) ast.Node { return n } -func (n *noopNode) Pos() ast.Pos { return ast.Pos{} } -func (n *noopNode) Type(ast.Scope) (ast.Type, error) { return ast.TypeString, nil } diff --git a/vendor/github.com/hashicorp/terraform/config/loader.go b/vendor/github.com/hashicorp/terraform/config/loader.go deleted file mode 100644 index 612e25b9e..000000000 --- a/vendor/github.com/hashicorp/terraform/config/loader.go +++ /dev/null @@ -1,212 +0,0 @@ -package config - -import ( - "encoding/json" - "fmt" - "io" - "os" - "path/filepath" - "sort" - "strings" - - "github.com/hashicorp/hcl" -) - -// ErrNoConfigsFound is the error returned by LoadDir if no -// Terraform configuration files were found in the given directory. -type ErrNoConfigsFound struct { - Dir string -} - -func (e ErrNoConfigsFound) Error() string { - return fmt.Sprintf( - "No Terraform configuration files found in directory: %s", - e.Dir) -} - -// LoadJSON loads a single Terraform configuration from a given JSON document. -// -// The document must be a complete Terraform configuration. This function will -// NOT try to load any additional modules so only the given document is loaded. -func LoadJSON(raw json.RawMessage) (*Config, error) { - obj, err := hcl.Parse(string(raw)) - if err != nil { - return nil, fmt.Errorf( - "Error parsing JSON document as HCL: %s", err) - } - - // Start building the result - hclConfig := &hclConfigurable{ - Root: obj, - } - - return hclConfig.Config() -} - -// LoadFile loads the Terraform configuration from a given file. -// -// This file can be any format that Terraform recognizes, and import any -// other format that Terraform recognizes. -func LoadFile(path string) (*Config, error) { - importTree, err := loadTree(path) - if err != nil { - return nil, err - } - - configTree, err := importTree.ConfigTree() - - // Close the importTree now so that we can clear resources as quickly - // as possible. - importTree.Close() - - if err != nil { - return nil, err - } - - return configTree.Flatten() -} - -// LoadDir loads all the Terraform configuration files in a single -// directory and appends them together. -// -// Special files known as "override files" can also be present, which -// are merged into the loaded configuration. That is, the non-override -// files are loaded first to create the configuration. Then, the overrides -// are merged into the configuration to create the final configuration. -// -// Files are loaded in lexical order. -func LoadDir(root string) (*Config, error) { - files, overrides, err := dirFiles(root) - if err != nil { - return nil, err - } - if len(files) == 0 && len(overrides) == 0 { - return nil, &ErrNoConfigsFound{Dir: root} - } - - // Determine the absolute path to the directory. - rootAbs, err := filepath.Abs(root) - if err != nil { - return nil, err - } - - var result *Config - - // Sort the files and overrides so we have a deterministic order - sort.Strings(files) - sort.Strings(overrides) - - // Load all the regular files, append them to each other. - for _, f := range files { - c, err := LoadFile(f) - if err != nil { - return nil, err - } - - if result != nil { - result, err = Append(result, c) - if err != nil { - return nil, err - } - } else { - result = c - } - } - if len(files) == 0 { - result = &Config{} - } - - // Load all the overrides, and merge them into the config - for _, f := range overrides { - c, err := LoadFile(f) - if err != nil { - return nil, err - } - - result, err = Merge(result, c) - if err != nil { - return nil, err - } - } - - // Mark the directory - result.Dir = rootAbs - - return result, nil -} - -// Ext returns the Terraform configuration extension of the given -// path, or a blank string if it is an invalid function. -func ext(path string) string { - if strings.HasSuffix(path, ".tf") { - return ".tf" - } else if strings.HasSuffix(path, ".tf.json") { - return ".tf.json" - } else { - return "" - } -} - -func dirFiles(dir string) ([]string, []string, error) { - f, err := os.Open(dir) - if err != nil { - return nil, nil, err - } - defer f.Close() - - fi, err := f.Stat() - if err != nil { - return nil, nil, err - } - if !fi.IsDir() { - return nil, nil, fmt.Errorf( - "configuration path must be a directory: %s", - dir) - } - - var files, overrides []string - err = nil - for err != io.EOF { - var fis []os.FileInfo - fis, err = f.Readdir(128) - if err != nil && err != io.EOF { - return nil, nil, err - } - - for _, fi := range fis { - // Ignore directories - if fi.IsDir() { - continue - } - - // Only care about files that are valid to load - name := fi.Name() - extValue := ext(name) - if extValue == "" || IsIgnoredFile(name) { - continue - } - - // Determine if we're dealing with an override - nameNoExt := name[:len(name)-len(extValue)] - override := nameNoExt == "override" || - strings.HasSuffix(nameNoExt, "_override") - - path := filepath.Join(dir, name) - if override { - overrides = append(overrides, path) - } else { - files = append(files, path) - } - } - } - - return files, overrides, nil -} - -// IsIgnoredFile returns true or false depending on whether the -// provided file name is a file that should be ignored. -func IsIgnoredFile(name string) bool { - return strings.HasPrefix(name, ".") || // Unix-like hidden files - strings.HasSuffix(name, "~") || // vim - strings.HasPrefix(name, "#") && strings.HasSuffix(name, "#") // emacs -} diff --git a/vendor/github.com/hashicorp/terraform/config/loader_hcl.go b/vendor/github.com/hashicorp/terraform/config/loader_hcl.go deleted file mode 100644 index 68cffe2cc..000000000 --- a/vendor/github.com/hashicorp/terraform/config/loader_hcl.go +++ /dev/null @@ -1,1270 +0,0 @@ -package config - -import ( - "fmt" - "io/ioutil" - - "github.com/hashicorp/go-multierror" - "github.com/hashicorp/hcl" - "github.com/hashicorp/hcl/hcl/ast" - "github.com/mitchellh/mapstructure" -) - -// hclConfigurable is an implementation of configurable that knows -// how to turn HCL configuration into a *Config object. -type hclConfigurable struct { - File string - Root *ast.File -} - -var ReservedDataSourceFields = []string{ - "connection", - "count", - "depends_on", - "lifecycle", - "provider", - "provisioner", -} - -var ReservedResourceFields = []string{ - "connection", - "count", - "depends_on", - "id", - "lifecycle", - "provider", - "provisioner", -} - -var ReservedProviderFields = []string{ - "alias", - "version", -} - -func (t *hclConfigurable) Config() (*Config, error) { - validKeys := map[string]struct{}{ - "atlas": struct{}{}, - "data": struct{}{}, - "locals": struct{}{}, - "module": struct{}{}, - "output": struct{}{}, - "provider": struct{}{}, - "resource": struct{}{}, - "terraform": struct{}{}, - "variable": struct{}{}, - } - - // Top-level item should be the object list - list, ok := t.Root.Node.(*ast.ObjectList) - if !ok { - return nil, fmt.Errorf("error parsing: file doesn't contain a root object") - } - - // Start building up the actual configuration. - config := new(Config) - - // Terraform config - if o := list.Filter("terraform"); len(o.Items) > 0 { - var err error - config.Terraform, err = loadTerraformHcl(o) - if err != nil { - return nil, err - } - } - - // Build the variables - if vars := list.Filter("variable"); len(vars.Items) > 0 { - var err error - config.Variables, err = loadVariablesHcl(vars) - if err != nil { - return nil, err - } - } - - // Build local values - if locals := list.Filter("locals"); len(locals.Items) > 0 { - var err error - config.Locals, err = loadLocalsHcl(locals) - if err != nil { - return nil, err - } - } - - // Get Atlas configuration - if atlas := list.Filter("atlas"); len(atlas.Items) > 0 { - var err error - config.Atlas, err = loadAtlasHcl(atlas) - if err != nil { - return nil, err - } - } - - // Build the modules - if modules := list.Filter("module"); len(modules.Items) > 0 { - var err error - config.Modules, err = loadModulesHcl(modules) - if err != nil { - return nil, err - } - } - - // Build the provider configs - if providers := list.Filter("provider"); len(providers.Items) > 0 { - var err error - config.ProviderConfigs, err = loadProvidersHcl(providers) - if err != nil { - return nil, err - } - } - - // Build the resources - { - var err error - managedResourceConfigs := list.Filter("resource") - dataResourceConfigs := list.Filter("data") - - config.Resources = make( - []*Resource, 0, - len(managedResourceConfigs.Items)+len(dataResourceConfigs.Items), - ) - - managedResources, err := loadManagedResourcesHcl(managedResourceConfigs) - if err != nil { - return nil, err - } - dataResources, err := loadDataResourcesHcl(dataResourceConfigs) - if err != nil { - return nil, err - } - - config.Resources = append(config.Resources, dataResources...) - config.Resources = append(config.Resources, managedResources...) - } - - // Build the outputs - if outputs := list.Filter("output"); len(outputs.Items) > 0 { - var err error - config.Outputs, err = loadOutputsHcl(outputs) - if err != nil { - return nil, err - } - } - - // Check for invalid keys - for _, item := range list.Items { - if len(item.Keys) == 0 { - // Not sure how this would happen, but let's avoid a panic - continue - } - - k := item.Keys[0].Token.Value().(string) - if _, ok := validKeys[k]; ok { - continue - } - - config.unknownKeys = append(config.unknownKeys, k) - } - - return config, nil -} - -// loadFileHcl is a fileLoaderFunc that knows how to read HCL -// files and turn them into hclConfigurables. -func loadFileHcl(root string) (configurable, []string, error) { - // Read the HCL file and prepare for parsing - d, err := ioutil.ReadFile(root) - if err != nil { - return nil, nil, fmt.Errorf( - "Error reading %s: %s", root, err) - } - - // Parse it - hclRoot, err := hcl.Parse(string(d)) - if err != nil { - return nil, nil, fmt.Errorf( - "Error parsing %s: %s", root, err) - } - - // Start building the result - result := &hclConfigurable{ - File: root, - Root: hclRoot, - } - - // Dive in, find the imports. This is disabled for now since - // imports were removed prior to Terraform 0.1. The code is - // remaining here commented for historical purposes. - /* - imports := obj.Get("import") - if imports == nil { - result.Object.Ref() - return result, nil, nil - } - - if imports.Type() != libucl.ObjectTypeString { - imports.Close() - - return nil, nil, fmt.Errorf( - "Error in %s: all 'import' declarations should be in the format\n"+ - "`import \"foo\"` (Got type %s)", - root, - imports.Type()) - } - - // Gather all the import paths - importPaths := make([]string, 0, imports.Len()) - iter := imports.Iterate(false) - for imp := iter.Next(); imp != nil; imp = iter.Next() { - path := imp.ToString() - if !filepath.IsAbs(path) { - // Relative paths are relative to the Terraform file itself - dir := filepath.Dir(root) - path = filepath.Join(dir, path) - } - - importPaths = append(importPaths, path) - imp.Close() - } - iter.Close() - imports.Close() - - result.Object.Ref() - */ - - return result, nil, nil -} - -// Given a handle to a HCL object, this transforms it into the Terraform config -func loadTerraformHcl(list *ast.ObjectList) (*Terraform, error) { - if len(list.Items) > 1 { - return nil, fmt.Errorf("only one 'terraform' block allowed per module") - } - - // Get our one item - item := list.Items[0] - - // This block should have an empty top level ObjectItem. If there are keys - // here, it's likely because we have a flattened JSON object, and we can - // lift this into a nested ObjectList to decode properly. - if len(item.Keys) > 0 { - item = &ast.ObjectItem{ - Val: &ast.ObjectType{ - List: &ast.ObjectList{ - Items: []*ast.ObjectItem{item}, - }, - }, - } - } - - // We need the item value as an ObjectList - var listVal *ast.ObjectList - if ot, ok := item.Val.(*ast.ObjectType); ok { - listVal = ot.List - } else { - return nil, fmt.Errorf("terraform block: should be an object") - } - - // NOTE: We purposely don't validate unknown HCL keys here so that - // we can potentially read _future_ Terraform version config (to - // still be able to validate the required version). - // - // We should still keep track of unknown keys to validate later, but - // HCL doesn't currently support that. - - var config Terraform - if err := hcl.DecodeObject(&config, item.Val); err != nil { - return nil, fmt.Errorf( - "Error reading terraform config: %s", - err) - } - - // If we have provisioners, then parse those out - if os := listVal.Filter("backend"); len(os.Items) > 0 { - var err error - config.Backend, err = loadTerraformBackendHcl(os) - if err != nil { - return nil, fmt.Errorf( - "Error reading backend config for terraform block: %s", - err) - } - } - - return &config, nil -} - -// Loads the Backend configuration from an object list. -func loadTerraformBackendHcl(list *ast.ObjectList) (*Backend, error) { - if len(list.Items) > 1 { - return nil, fmt.Errorf("only one 'backend' block allowed") - } - - // Get our one item - item := list.Items[0] - - // Verify the keys - if len(item.Keys) != 1 { - return nil, fmt.Errorf( - "position %s: 'backend' must be followed by exactly one string: a type", - item.Pos()) - } - - typ := item.Keys[0].Token.Value().(string) - - // Decode the raw config - var config map[string]interface{} - if err := hcl.DecodeObject(&config, item.Val); err != nil { - return nil, fmt.Errorf( - "Error reading backend config: %s", - err) - } - - rawConfig, err := NewRawConfig(config) - if err != nil { - return nil, fmt.Errorf( - "Error reading backend config: %s", - err) - } - - b := &Backend{ - Type: typ, - RawConfig: rawConfig, - } - b.Hash = b.Rehash() - - return b, nil -} - -// Given a handle to a HCL object, this transforms it into the Atlas -// configuration. -func loadAtlasHcl(list *ast.ObjectList) (*AtlasConfig, error) { - if len(list.Items) > 1 { - return nil, fmt.Errorf("only one 'atlas' block allowed") - } - - // Get our one item - item := list.Items[0] - - var config AtlasConfig - if err := hcl.DecodeObject(&config, item.Val); err != nil { - return nil, fmt.Errorf( - "Error reading atlas config: %s", - err) - } - - return &config, nil -} - -// Given a handle to a HCL object, this recurses into the structure -// and pulls out a list of modules. -// -// The resulting modules may not be unique, but each module -// represents exactly one module definition in the HCL configuration. -// We leave it up to another pass to merge them together. -func loadModulesHcl(list *ast.ObjectList) ([]*Module, error) { - if err := assertAllBlocksHaveNames("module", list); err != nil { - return nil, err - } - - list = list.Children() - if len(list.Items) == 0 { - return nil, nil - } - - // Where all the results will go - var result []*Module - - // Now go over all the types and their children in order to get - // all of the actual resources. - for _, item := range list.Items { - k := item.Keys[0].Token.Value().(string) - - var listVal *ast.ObjectList - if ot, ok := item.Val.(*ast.ObjectType); ok { - listVal = ot.List - } else { - return nil, fmt.Errorf("module '%s': should be an object", k) - } - - var config map[string]interface{} - if err := hcl.DecodeObject(&config, item.Val); err != nil { - return nil, fmt.Errorf( - "Error reading config for %s: %s", - k, - err) - } - - rawConfig, err := NewRawConfig(config) - if err != nil { - return nil, fmt.Errorf( - "Error reading config for %s: %s", - k, - err) - } - - // Remove the fields we handle specially - delete(config, "source") - delete(config, "version") - delete(config, "providers") - - var source string - if o := listVal.Filter("source"); len(o.Items) > 0 { - err = hcl.DecodeObject(&source, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error parsing source for %s: %s", - k, - err) - } - } - - var version string - if o := listVal.Filter("version"); len(o.Items) > 0 { - err = hcl.DecodeObject(&version, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error parsing version for %s: %s", - k, - err) - } - } - - var providers map[string]string - if o := listVal.Filter("providers"); len(o.Items) > 0 { - err = hcl.DecodeObject(&providers, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error parsing providers for %s: %s", - k, - err) - } - } - - result = append(result, &Module{ - Name: k, - Source: source, - Version: version, - Providers: providers, - RawConfig: rawConfig, - }) - } - - return result, nil -} - -// loadLocalsHcl recurses into the given HCL object turns it into -// a list of locals. -func loadLocalsHcl(list *ast.ObjectList) ([]*Local, error) { - - result := make([]*Local, 0, len(list.Items)) - - for _, block := range list.Items { - if len(block.Keys) > 0 { - return nil, fmt.Errorf( - "locals block at %s should not have label %q", - block.Pos(), block.Keys[0].Token.Value(), - ) - } - - blockObj, ok := block.Val.(*ast.ObjectType) - if !ok { - return nil, fmt.Errorf("locals value at %s should be a block", block.Val.Pos()) - } - - // blockObj now contains directly our local decls - for _, item := range blockObj.List.Items { - if len(item.Keys) != 1 { - return nil, fmt.Errorf("local declaration at %s may not be a block", item.Val.Pos()) - } - - // By the time we get here there can only be one item left, but - // we'll decode into a map anyway because it's a convenient way - // to extract both the key and the value robustly. - kv := map[string]interface{}{} - hcl.DecodeObject(&kv, item) - for k, v := range kv { - rawConfig, err := NewRawConfig(map[string]interface{}{ - "value": v, - }) - - if err != nil { - return nil, fmt.Errorf( - "error parsing local value %q at %s: %s", - k, item.Val.Pos(), err, - ) - } - - result = append(result, &Local{ - Name: k, - RawConfig: rawConfig, - }) - } - } - } - - return result, nil -} - -// LoadOutputsHcl recurses into the given HCL object and turns -// it into a mapping of outputs. -func loadOutputsHcl(list *ast.ObjectList) ([]*Output, error) { - if err := assertAllBlocksHaveNames("output", list); err != nil { - return nil, err - } - - list = list.Children() - - // Go through each object and turn it into an actual result. - result := make([]*Output, 0, len(list.Items)) - for _, item := range list.Items { - n := item.Keys[0].Token.Value().(string) - - var listVal *ast.ObjectList - if ot, ok := item.Val.(*ast.ObjectType); ok { - listVal = ot.List - } else { - return nil, fmt.Errorf("output '%s': should be an object", n) - } - - var config map[string]interface{} - if err := hcl.DecodeObject(&config, item.Val); err != nil { - return nil, err - } - - // Delete special keys - delete(config, "depends_on") - delete(config, "description") - - rawConfig, err := NewRawConfig(config) - if err != nil { - return nil, fmt.Errorf( - "Error reading config for output %s: %s", - n, - err) - } - - // If we have depends fields, then add those in - var dependsOn []string - if o := listVal.Filter("depends_on"); len(o.Items) > 0 { - err := hcl.DecodeObject(&dependsOn, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error reading depends_on for output %q: %s", - n, - err) - } - } - - // If we have a description field, then filter that - var description string - if o := listVal.Filter("description"); len(o.Items) > 0 { - err := hcl.DecodeObject(&description, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error reading description for output %q: %s", - n, - err) - } - } - - result = append(result, &Output{ - Name: n, - RawConfig: rawConfig, - DependsOn: dependsOn, - Description: description, - }) - } - - return result, nil -} - -// LoadVariablesHcl recurses into the given HCL object and turns -// it into a list of variables. -func loadVariablesHcl(list *ast.ObjectList) ([]*Variable, error) { - if err := assertAllBlocksHaveNames("variable", list); err != nil { - return nil, err - } - - list = list.Children() - - // hclVariable is the structure each variable is decoded into - type hclVariable struct { - DeclaredType string `hcl:"type"` - Default interface{} - Description string - Fields []string `hcl:",decodedFields"` - } - - // Go through each object and turn it into an actual result. - result := make([]*Variable, 0, len(list.Items)) - for _, item := range list.Items { - // Clean up items from JSON - unwrapHCLObjectKeysFromJSON(item, 1) - - // Verify the keys - if len(item.Keys) != 1 { - return nil, fmt.Errorf( - "position %s: 'variable' must be followed by exactly one strings: a name", - item.Pos()) - } - - n := item.Keys[0].Token.Value().(string) - if !NameRegexp.MatchString(n) { - return nil, fmt.Errorf( - "position %s: 'variable' name must match regular expression: %s", - item.Pos(), NameRegexp) - } - - // Check for invalid keys - valid := []string{"type", "default", "description"} - if err := checkHCLKeys(item.Val, valid); err != nil { - return nil, multierror.Prefix(err, fmt.Sprintf( - "variable[%s]:", n)) - } - - // Decode into hclVariable to get typed values - var hclVar hclVariable - if err := hcl.DecodeObject(&hclVar, item.Val); err != nil { - return nil, err - } - - // Defaults turn into a slice of map[string]interface{} and - // we need to make sure to convert that down into the - // proper type for Config. - if ms, ok := hclVar.Default.([]map[string]interface{}); ok { - def := make(map[string]interface{}) - for _, m := range ms { - for k, v := range m { - def[k] = v - } - } - - hclVar.Default = def - } - - // Build the new variable and do some basic validation - newVar := &Variable{ - Name: n, - DeclaredType: hclVar.DeclaredType, - Default: hclVar.Default, - Description: hclVar.Description, - } - if err := newVar.ValidateTypeAndDefault(); err != nil { - return nil, err - } - - result = append(result, newVar) - } - - return result, nil -} - -// LoadProvidersHcl recurses into the given HCL object and turns -// it into a mapping of provider configs. -func loadProvidersHcl(list *ast.ObjectList) ([]*ProviderConfig, error) { - if err := assertAllBlocksHaveNames("provider", list); err != nil { - return nil, err - } - - list = list.Children() - if len(list.Items) == 0 { - return nil, nil - } - - // Go through each object and turn it into an actual result. - result := make([]*ProviderConfig, 0, len(list.Items)) - for _, item := range list.Items { - n := item.Keys[0].Token.Value().(string) - - var listVal *ast.ObjectList - if ot, ok := item.Val.(*ast.ObjectType); ok { - listVal = ot.List - } else { - return nil, fmt.Errorf("module '%s': should be an object", n) - } - - var config map[string]interface{} - if err := hcl.DecodeObject(&config, item.Val); err != nil { - return nil, err - } - - delete(config, "alias") - delete(config, "version") - - rawConfig, err := NewRawConfig(config) - if err != nil { - return nil, fmt.Errorf( - "Error reading config for provider config %s: %s", - n, - err) - } - - // If we have an alias field, then add those in - var alias string - if a := listVal.Filter("alias"); len(a.Items) > 0 { - err := hcl.DecodeObject(&alias, a.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error reading alias for provider[%s]: %s", - n, - err) - } - } - - // If we have a version field then extract it - var version string - if a := listVal.Filter("version"); len(a.Items) > 0 { - err := hcl.DecodeObject(&version, a.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error reading version for provider[%s]: %s", - n, - err) - } - } - - result = append(result, &ProviderConfig{ - Name: n, - Alias: alias, - Version: version, - RawConfig: rawConfig, - }) - } - - return result, nil -} - -// Given a handle to a HCL object, this recurses into the structure -// and pulls out a list of data sources. -// -// The resulting data sources may not be unique, but each one -// represents exactly one data definition in the HCL configuration. -// We leave it up to another pass to merge them together. -func loadDataResourcesHcl(list *ast.ObjectList) ([]*Resource, error) { - if err := assertAllBlocksHaveNames("data", list); err != nil { - return nil, err - } - - list = list.Children() - if len(list.Items) == 0 { - return nil, nil - } - - // Where all the results will go - var result []*Resource - - // Now go over all the types and their children in order to get - // all of the actual resources. - for _, item := range list.Items { - if len(item.Keys) != 2 { - return nil, fmt.Errorf( - "position %s: 'data' must be followed by exactly two strings: a type and a name", - item.Pos()) - } - - t := item.Keys[0].Token.Value().(string) - k := item.Keys[1].Token.Value().(string) - - var listVal *ast.ObjectList - if ot, ok := item.Val.(*ast.ObjectType); ok { - listVal = ot.List - } else { - return nil, fmt.Errorf("data sources %s[%s]: should be an object", t, k) - } - - var config map[string]interface{} - if err := hcl.DecodeObject(&config, item.Val); err != nil { - return nil, fmt.Errorf( - "Error reading config for %s[%s]: %s", - t, - k, - err) - } - - // Remove the fields we handle specially - delete(config, "depends_on") - delete(config, "provider") - delete(config, "count") - - rawConfig, err := NewRawConfig(config) - if err != nil { - return nil, fmt.Errorf( - "Error reading config for %s[%s]: %s", - t, - k, - err) - } - - // If we have a count, then figure it out - var count string = "1" - if o := listVal.Filter("count"); len(o.Items) > 0 { - err = hcl.DecodeObject(&count, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error parsing count for %s[%s]: %s", - t, - k, - err) - } - } - countConfig, err := NewRawConfig(map[string]interface{}{ - "count": count, - }) - if err != nil { - return nil, err - } - countConfig.Key = "count" - - // If we have depends fields, then add those in - var dependsOn []string - if o := listVal.Filter("depends_on"); len(o.Items) > 0 { - err := hcl.DecodeObject(&dependsOn, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error reading depends_on for %s[%s]: %s", - t, - k, - err) - } - } - - // If we have a provider, then parse it out - var provider string - if o := listVal.Filter("provider"); len(o.Items) > 0 { - err := hcl.DecodeObject(&provider, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error reading provider for %s[%s]: %s", - t, - k, - err) - } - } - - result = append(result, &Resource{ - Mode: DataResourceMode, - Name: k, - Type: t, - RawCount: countConfig, - RawConfig: rawConfig, - Provider: provider, - Provisioners: []*Provisioner{}, - DependsOn: dependsOn, - Lifecycle: ResourceLifecycle{}, - }) - } - - return result, nil -} - -// Given a handle to a HCL object, this recurses into the structure -// and pulls out a list of managed resources. -// -// The resulting resources may not be unique, but each resource -// represents exactly one "resource" block in the HCL configuration. -// We leave it up to another pass to merge them together. -func loadManagedResourcesHcl(list *ast.ObjectList) ([]*Resource, error) { - list = list.Children() - if len(list.Items) == 0 { - return nil, nil - } - - // Where all the results will go - var result []*Resource - - // Now go over all the types and their children in order to get - // all of the actual resources. - for _, item := range list.Items { - // GH-4385: We detect a pure provisioner resource and give the user - // an error about how to do it cleanly. - if len(item.Keys) == 4 && item.Keys[2].Token.Value().(string) == "provisioner" { - return nil, fmt.Errorf( - "position %s: provisioners in a resource should be wrapped in a list\n\n"+ - "Example: \"provisioner\": [ { \"local-exec\": ... } ]", - item.Pos()) - } - - // Fix up JSON input - unwrapHCLObjectKeysFromJSON(item, 2) - - if len(item.Keys) != 2 { - return nil, fmt.Errorf( - "position %s: resource must be followed by exactly two strings, a type and a name", - item.Pos()) - } - - t := item.Keys[0].Token.Value().(string) - k := item.Keys[1].Token.Value().(string) - - var listVal *ast.ObjectList - if ot, ok := item.Val.(*ast.ObjectType); ok { - listVal = ot.List - } else { - return nil, fmt.Errorf("resources %s[%s]: should be an object", t, k) - } - - var config map[string]interface{} - if err := hcl.DecodeObject(&config, item.Val); err != nil { - return nil, fmt.Errorf( - "Error reading config for %s[%s]: %s", - t, - k, - err) - } - - // Remove the fields we handle specially - delete(config, "connection") - delete(config, "count") - delete(config, "depends_on") - delete(config, "provisioner") - delete(config, "provider") - delete(config, "lifecycle") - - rawConfig, err := NewRawConfig(config) - if err != nil { - return nil, fmt.Errorf( - "Error reading config for %s[%s]: %s", - t, - k, - err) - } - - // If we have a count, then figure it out - var count string = "1" - if o := listVal.Filter("count"); len(o.Items) > 0 { - err = hcl.DecodeObject(&count, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error parsing count for %s[%s]: %s", - t, - k, - err) - } - } - countConfig, err := NewRawConfig(map[string]interface{}{ - "count": count, - }) - if err != nil { - return nil, err - } - countConfig.Key = "count" - - // If we have depends fields, then add those in - var dependsOn []string - if o := listVal.Filter("depends_on"); len(o.Items) > 0 { - err := hcl.DecodeObject(&dependsOn, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error reading depends_on for %s[%s]: %s", - t, - k, - err) - } - } - - // If we have connection info, then parse those out - var connInfo map[string]interface{} - if o := listVal.Filter("connection"); len(o.Items) > 0 { - err := hcl.DecodeObject(&connInfo, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error reading connection info for %s[%s]: %s", - t, - k, - err) - } - } - - // If we have provisioners, then parse those out - var provisioners []*Provisioner - if os := listVal.Filter("provisioner"); len(os.Items) > 0 { - var err error - provisioners, err = loadProvisionersHcl(os, connInfo) - if err != nil { - return nil, fmt.Errorf( - "Error reading provisioners for %s[%s]: %s", - t, - k, - err) - } - } - - // If we have a provider, then parse it out - var provider string - if o := listVal.Filter("provider"); len(o.Items) > 0 { - err := hcl.DecodeObject(&provider, o.Items[0].Val) - if err != nil { - return nil, fmt.Errorf( - "Error reading provider for %s[%s]: %s", - t, - k, - err) - } - } - - // Check if the resource should be re-created before - // destroying the existing instance - var lifecycle ResourceLifecycle - if o := listVal.Filter("lifecycle"); len(o.Items) > 0 { - if len(o.Items) > 1 { - return nil, fmt.Errorf( - "%s[%s]: Multiple lifecycle blocks found, expected one", - t, k) - } - - // Check for invalid keys - valid := []string{"create_before_destroy", "ignore_changes", "prevent_destroy"} - if err := checkHCLKeys(o.Items[0].Val, valid); err != nil { - return nil, multierror.Prefix(err, fmt.Sprintf( - "%s[%s]:", t, k)) - } - - var raw map[string]interface{} - if err = hcl.DecodeObject(&raw, o.Items[0].Val); err != nil { - return nil, fmt.Errorf( - "Error parsing lifecycle for %s[%s]: %s", - t, - k, - err) - } - - if err := mapstructure.WeakDecode(raw, &lifecycle); err != nil { - return nil, fmt.Errorf( - "Error parsing lifecycle for %s[%s]: %s", - t, - k, - err) - } - } - - result = append(result, &Resource{ - Mode: ManagedResourceMode, - Name: k, - Type: t, - RawCount: countConfig, - RawConfig: rawConfig, - Provisioners: provisioners, - Provider: provider, - DependsOn: dependsOn, - Lifecycle: lifecycle, - }) - } - - return result, nil -} - -func loadProvisionersHcl(list *ast.ObjectList, connInfo map[string]interface{}) ([]*Provisioner, error) { - if err := assertAllBlocksHaveNames("provisioner", list); err != nil { - return nil, err - } - - list = list.Children() - if len(list.Items) == 0 { - return nil, nil - } - - // Go through each object and turn it into an actual result. - result := make([]*Provisioner, 0, len(list.Items)) - for _, item := range list.Items { - n := item.Keys[0].Token.Value().(string) - - var listVal *ast.ObjectList - if ot, ok := item.Val.(*ast.ObjectType); ok { - listVal = ot.List - } else { - return nil, fmt.Errorf("provisioner '%s': should be an object", n) - } - - var config map[string]interface{} - if err := hcl.DecodeObject(&config, item.Val); err != nil { - return nil, err - } - - // Parse the "when" value - when := ProvisionerWhenCreate - if v, ok := config["when"]; ok { - switch v { - case "create": - when = ProvisionerWhenCreate - case "destroy": - when = ProvisionerWhenDestroy - default: - return nil, fmt.Errorf( - "position %s: 'provisioner' when must be 'create' or 'destroy'", - item.Pos()) - } - } - - // Parse the "on_failure" value - onFailure := ProvisionerOnFailureFail - if v, ok := config["on_failure"]; ok { - switch v { - case "continue": - onFailure = ProvisionerOnFailureContinue - case "fail": - onFailure = ProvisionerOnFailureFail - default: - return nil, fmt.Errorf( - "position %s: 'provisioner' on_failure must be 'continue' or 'fail'", - item.Pos()) - } - } - - // Delete fields we special case - delete(config, "connection") - delete(config, "when") - delete(config, "on_failure") - - rawConfig, err := NewRawConfig(config) - if err != nil { - return nil, err - } - - // Check if we have a provisioner-level connection - // block that overrides the resource-level - var subConnInfo map[string]interface{} - if o := listVal.Filter("connection"); len(o.Items) > 0 { - err := hcl.DecodeObject(&subConnInfo, o.Items[0].Val) - if err != nil { - return nil, err - } - } - - // Inherit from the resource connInfo any keys - // that are not explicitly overriden. - if connInfo != nil && subConnInfo != nil { - for k, v := range connInfo { - if _, ok := subConnInfo[k]; !ok { - subConnInfo[k] = v - } - } - } else if subConnInfo == nil { - subConnInfo = connInfo - } - - // Parse the connInfo - connRaw, err := NewRawConfig(subConnInfo) - if err != nil { - return nil, err - } - - result = append(result, &Provisioner{ - Type: n, - RawConfig: rawConfig, - ConnInfo: connRaw, - When: when, - OnFailure: onFailure, - }) - } - - return result, nil -} - -/* -func hclObjectMap(os *hclobj.Object) map[string]ast.ListNode { - objects := make(map[string][]*hclobj.Object) - - for _, o := range os.Elem(false) { - for _, elem := range o.Elem(true) { - val, ok := objects[elem.Key] - if !ok { - val = make([]*hclobj.Object, 0, 1) - } - - val = append(val, elem) - objects[elem.Key] = val - } - } - - return objects -} -*/ - -// assertAllBlocksHaveNames returns an error if any of the items in -// the given object list are blocks without keys (like "module {}") -// or simple assignments (like "module = 1"). It returns nil if -// neither of these things are true. -// -// The given name is used in any generated error messages, and should -// be the name of the block we're dealing with. The given list should -// be the result of calling .Filter on an object list with that same -// name. -func assertAllBlocksHaveNames(name string, list *ast.ObjectList) error { - if elem := list.Elem(); len(elem.Items) != 0 { - switch et := elem.Items[0].Val.(type) { - case *ast.ObjectType: - pos := et.Lbrace - return fmt.Errorf("%s: %q must be followed by a name", pos, name) - default: - pos := elem.Items[0].Val.Pos() - return fmt.Errorf("%s: %q must be a configuration block", pos, name) - } - } - return nil -} - -func checkHCLKeys(node ast.Node, valid []string) error { - var list *ast.ObjectList - switch n := node.(type) { - case *ast.ObjectList: - list = n - case *ast.ObjectType: - list = n.List - default: - return fmt.Errorf("cannot check HCL keys of type %T", n) - } - - validMap := make(map[string]struct{}, len(valid)) - for _, v := range valid { - validMap[v] = struct{}{} - } - - var result error - for _, item := range list.Items { - key := item.Keys[0].Token.Value().(string) - if _, ok := validMap[key]; !ok { - result = multierror.Append(result, fmt.Errorf( - "invalid key: %s", key)) - } - } - - return result -} - -// unwrapHCLObjectKeysFromJSON cleans up an edge case that can occur when -// parsing JSON as input: if we're parsing JSON then directly nested -// items will show up as additional "keys". -// -// For objects that expect a fixed number of keys, this breaks the -// decoding process. This function unwraps the object into what it would've -// looked like if it came directly from HCL by specifying the number of keys -// you expect. -// -// Example: -// -// { "foo": { "baz": {} } } -// -// Will show up with Keys being: []string{"foo", "baz"} -// when we really just want the first two. This function will fix this. -func unwrapHCLObjectKeysFromJSON(item *ast.ObjectItem, depth int) { - if len(item.Keys) > depth && item.Keys[0].Token.JSON { - for len(item.Keys) > depth { - // Pop off the last key - n := len(item.Keys) - key := item.Keys[n-1] - item.Keys[n-1] = nil - item.Keys = item.Keys[:n-1] - - // Wrap our value in a list - item.Val = &ast.ObjectType{ - List: &ast.ObjectList{ - Items: []*ast.ObjectItem{ - &ast.ObjectItem{ - Keys: []*ast.ObjectKey{key}, - Val: item.Val, - }, - }, - }, - } - } - } -} diff --git a/vendor/github.com/hashicorp/terraform/config/loader_hcl2.go b/vendor/github.com/hashicorp/terraform/config/loader_hcl2.go deleted file mode 100644 index da7559a9d..000000000 --- a/vendor/github.com/hashicorp/terraform/config/loader_hcl2.go +++ /dev/null @@ -1,473 +0,0 @@ -package config - -import ( - "fmt" - "sort" - "strings" - - hcl2 "github.com/hashicorp/hcl/v2" - gohcl2 "github.com/hashicorp/hcl/v2/gohcl" - hcl2parse "github.com/hashicorp/hcl/v2/hclparse" - "github.com/hashicorp/terraform/configs/hcl2shim" - "github.com/zclconf/go-cty/cty" -) - -// hcl2Configurable is an implementation of configurable that knows -// how to turn a HCL Body into a *Config object. -type hcl2Configurable struct { - SourceFilename string - Body hcl2.Body -} - -// hcl2Loader is a wrapper around a HCL parser that provides a fileLoaderFunc. -type hcl2Loader struct { - Parser *hcl2parse.Parser -} - -// For the moment we'll just have a global loader since we don't have anywhere -// better to stash this. -// TODO: refactor the loader API so that it uses some sort of object we can -// stash the parser inside. -var globalHCL2Loader = newHCL2Loader() - -// newHCL2Loader creates a new hcl2Loader containing a new HCL Parser. -// -// HCL parsers retain information about files that are loaded to aid in -// producing diagnostic messages, so all files within a single configuration -// should be loaded with the same parser to ensure the availability of -// full diagnostic information. -func newHCL2Loader() hcl2Loader { - return hcl2Loader{ - Parser: hcl2parse.NewParser(), - } -} - -// loadFile is a fileLoaderFunc that knows how to read a HCL2 file and turn it -// into a hcl2Configurable. -func (l hcl2Loader) loadFile(filename string) (configurable, []string, error) { - var f *hcl2.File - var diags hcl2.Diagnostics - if strings.HasSuffix(filename, ".json") { - f, diags = l.Parser.ParseJSONFile(filename) - } else { - f, diags = l.Parser.ParseHCLFile(filename) - } - if diags.HasErrors() { - // Return diagnostics as an error; callers may type-assert this to - // recover the original diagnostics, if it doesn't end up wrapped - // in another error. - return nil, nil, diags - } - - return &hcl2Configurable{ - SourceFilename: filename, - Body: f.Body, - }, nil, nil -} - -func (t *hcl2Configurable) Config() (*Config, error) { - config := &Config{} - - // these structs are used only for the initial shallow decoding; we'll - // expand this into the main, public-facing config structs afterwards. - type atlas struct { - Name string `hcl:"name"` - Include *[]string `hcl:"include"` - Exclude *[]string `hcl:"exclude"` - } - type provider struct { - Name string `hcl:"name,label"` - Alias *string `hcl:"alias,attr"` - Version *string `hcl:"version,attr"` - Config hcl2.Body `hcl:",remain"` - } - type module struct { - Name string `hcl:"name,label"` - Source string `hcl:"source,attr"` - Version *string `hcl:"version,attr"` - Providers *map[string]string `hcl:"providers,attr"` - Config hcl2.Body `hcl:",remain"` - } - type resourceLifecycle struct { - CreateBeforeDestroy *bool `hcl:"create_before_destroy,attr"` - PreventDestroy *bool `hcl:"prevent_destroy,attr"` - IgnoreChanges *[]string `hcl:"ignore_changes,attr"` - } - type connection struct { - Config hcl2.Body `hcl:",remain"` - } - type provisioner struct { - Type string `hcl:"type,label"` - - When *string `hcl:"when,attr"` - OnFailure *string `hcl:"on_failure,attr"` - - Connection *connection `hcl:"connection,block"` - Config hcl2.Body `hcl:",remain"` - } - type managedResource struct { - Type string `hcl:"type,label"` - Name string `hcl:"name,label"` - - CountExpr hcl2.Expression `hcl:"count,attr"` - Provider *string `hcl:"provider,attr"` - DependsOn *[]string `hcl:"depends_on,attr"` - - Lifecycle *resourceLifecycle `hcl:"lifecycle,block"` - Provisioners []provisioner `hcl:"provisioner,block"` - Connection *connection `hcl:"connection,block"` - - Config hcl2.Body `hcl:",remain"` - } - type dataResource struct { - Type string `hcl:"type,label"` - Name string `hcl:"name,label"` - - CountExpr hcl2.Expression `hcl:"count,attr"` - Provider *string `hcl:"provider,attr"` - DependsOn *[]string `hcl:"depends_on,attr"` - - Config hcl2.Body `hcl:",remain"` - } - type variable struct { - Name string `hcl:"name,label"` - - DeclaredType *string `hcl:"type,attr"` - Default *cty.Value `hcl:"default,attr"` - Description *string `hcl:"description,attr"` - Sensitive *bool `hcl:"sensitive,attr"` - } - type output struct { - Name string `hcl:"name,label"` - - ValueExpr hcl2.Expression `hcl:"value,attr"` - DependsOn *[]string `hcl:"depends_on,attr"` - Description *string `hcl:"description,attr"` - Sensitive *bool `hcl:"sensitive,attr"` - } - type locals struct { - Definitions hcl2.Attributes `hcl:",remain"` - } - type backend struct { - Type string `hcl:"type,label"` - Config hcl2.Body `hcl:",remain"` - } - type terraform struct { - RequiredVersion *string `hcl:"required_version,attr"` - Backend *backend `hcl:"backend,block"` - } - type topLevel struct { - Atlas *atlas `hcl:"atlas,block"` - Datas []dataResource `hcl:"data,block"` - Modules []module `hcl:"module,block"` - Outputs []output `hcl:"output,block"` - Providers []provider `hcl:"provider,block"` - Resources []managedResource `hcl:"resource,block"` - Terraform *terraform `hcl:"terraform,block"` - Variables []variable `hcl:"variable,block"` - Locals []*locals `hcl:"locals,block"` - } - - var raw topLevel - diags := gohcl2.DecodeBody(t.Body, nil, &raw) - if diags.HasErrors() { - // Do some minimal decoding to see if we can at least get the - // required Terraform version, which might help explain why we - // couldn't parse the rest. - if raw.Terraform != nil && raw.Terraform.RequiredVersion != nil { - config.Terraform = &Terraform{ - RequiredVersion: *raw.Terraform.RequiredVersion, - } - } - - // We return the diags as an implementation of error, which the - // caller than then type-assert if desired to recover the individual - // diagnostics. - // FIXME: The current API gives us no way to return warnings in the - // absence of any errors. - return config, diags - } - - if raw.Terraform != nil { - var reqdVersion string - var backend *Backend - - if raw.Terraform.RequiredVersion != nil { - reqdVersion = *raw.Terraform.RequiredVersion - } - if raw.Terraform.Backend != nil { - backend = new(Backend) - backend.Type = raw.Terraform.Backend.Type - - // We don't permit interpolations or nested blocks inside the - // backend config, so we can decode the config early here and - // get direct access to the values, which is important for the - // config hashing to work as expected. - var config map[string]string - configDiags := gohcl2.DecodeBody(raw.Terraform.Backend.Config, nil, &config) - diags = append(diags, configDiags...) - - raw := make(map[string]interface{}, len(config)) - for k, v := range config { - raw[k] = v - } - - var err error - backend.RawConfig, err = NewRawConfig(raw) - if err != nil { - diags = append(diags, &hcl2.Diagnostic{ - Severity: hcl2.DiagError, - Summary: "Invalid backend configuration", - Detail: fmt.Sprintf("Error in backend configuration: %s", err), - }) - } - } - - config.Terraform = &Terraform{ - RequiredVersion: reqdVersion, - Backend: backend, - } - } - - if raw.Atlas != nil { - var include, exclude []string - if raw.Atlas.Include != nil { - include = *raw.Atlas.Include - } - if raw.Atlas.Exclude != nil { - exclude = *raw.Atlas.Exclude - } - config.Atlas = &AtlasConfig{ - Name: raw.Atlas.Name, - Include: include, - Exclude: exclude, - } - } - - for _, rawM := range raw.Modules { - m := &Module{ - Name: rawM.Name, - Source: rawM.Source, - RawConfig: NewRawConfigHCL2(rawM.Config), - } - - if rawM.Version != nil { - m.Version = *rawM.Version - } - - if rawM.Providers != nil { - m.Providers = *rawM.Providers - } - - config.Modules = append(config.Modules, m) - } - - for _, rawV := range raw.Variables { - v := &Variable{ - Name: rawV.Name, - } - if rawV.DeclaredType != nil { - v.DeclaredType = *rawV.DeclaredType - } - if rawV.Default != nil { - v.Default = hcl2shim.ConfigValueFromHCL2(*rawV.Default) - } - if rawV.Description != nil { - v.Description = *rawV.Description - } - - config.Variables = append(config.Variables, v) - } - - for _, rawO := range raw.Outputs { - o := &Output{ - Name: rawO.Name, - } - - if rawO.Description != nil { - o.Description = *rawO.Description - } - if rawO.DependsOn != nil { - o.DependsOn = *rawO.DependsOn - } - if rawO.Sensitive != nil { - o.Sensitive = *rawO.Sensitive - } - - // The result is expected to be a map like map[string]interface{}{"value": something}, - // so we'll fake that with our hcl2shim.SingleAttrBody shim. - o.RawConfig = NewRawConfigHCL2(hcl2shim.SingleAttrBody{ - Name: "value", - Expr: rawO.ValueExpr, - }) - - config.Outputs = append(config.Outputs, o) - } - - for _, rawR := range raw.Resources { - r := &Resource{ - Mode: ManagedResourceMode, - Type: rawR.Type, - Name: rawR.Name, - } - if rawR.Lifecycle != nil { - var l ResourceLifecycle - if rawR.Lifecycle.CreateBeforeDestroy != nil { - l.CreateBeforeDestroy = *rawR.Lifecycle.CreateBeforeDestroy - } - if rawR.Lifecycle.PreventDestroy != nil { - l.PreventDestroy = *rawR.Lifecycle.PreventDestroy - } - if rawR.Lifecycle.IgnoreChanges != nil { - l.IgnoreChanges = *rawR.Lifecycle.IgnoreChanges - } - r.Lifecycle = l - } - if rawR.Provider != nil { - r.Provider = *rawR.Provider - } - if rawR.DependsOn != nil { - r.DependsOn = *rawR.DependsOn - } - - var defaultConnInfo *RawConfig - if rawR.Connection != nil { - defaultConnInfo = NewRawConfigHCL2(rawR.Connection.Config) - } - - for _, rawP := range rawR.Provisioners { - p := &Provisioner{ - Type: rawP.Type, - } - - switch { - case rawP.When == nil: - p.When = ProvisionerWhenCreate - case *rawP.When == "create": - p.When = ProvisionerWhenCreate - case *rawP.When == "destroy": - p.When = ProvisionerWhenDestroy - default: - p.When = ProvisionerWhenInvalid - } - - switch { - case rawP.OnFailure == nil: - p.OnFailure = ProvisionerOnFailureFail - case *rawP.When == "fail": - p.OnFailure = ProvisionerOnFailureFail - case *rawP.When == "continue": - p.OnFailure = ProvisionerOnFailureContinue - default: - p.OnFailure = ProvisionerOnFailureInvalid - } - - if rawP.Connection != nil { - p.ConnInfo = NewRawConfigHCL2(rawP.Connection.Config) - } else { - p.ConnInfo = defaultConnInfo - } - - p.RawConfig = NewRawConfigHCL2(rawP.Config) - - r.Provisioners = append(r.Provisioners, p) - } - - // The old loader records the count expression as a weird RawConfig with - // a single-element map inside. Since the rest of the world is assuming - // that, we'll mimic it here. - { - countBody := hcl2shim.SingleAttrBody{ - Name: "count", - Expr: rawR.CountExpr, - } - - r.RawCount = NewRawConfigHCL2(countBody) - r.RawCount.Key = "count" - } - - r.RawConfig = NewRawConfigHCL2(rawR.Config) - - config.Resources = append(config.Resources, r) - - } - - for _, rawR := range raw.Datas { - r := &Resource{ - Mode: DataResourceMode, - Type: rawR.Type, - Name: rawR.Name, - } - - if rawR.Provider != nil { - r.Provider = *rawR.Provider - } - if rawR.DependsOn != nil { - r.DependsOn = *rawR.DependsOn - } - - // The old loader records the count expression as a weird RawConfig with - // a single-element map inside. Since the rest of the world is assuming - // that, we'll mimic it here. - { - countBody := hcl2shim.SingleAttrBody{ - Name: "count", - Expr: rawR.CountExpr, - } - - r.RawCount = NewRawConfigHCL2(countBody) - r.RawCount.Key = "count" - } - - r.RawConfig = NewRawConfigHCL2(rawR.Config) - - config.Resources = append(config.Resources, r) - } - - for _, rawP := range raw.Providers { - p := &ProviderConfig{ - Name: rawP.Name, - } - - if rawP.Alias != nil { - p.Alias = *rawP.Alias - } - if rawP.Version != nil { - p.Version = *rawP.Version - } - - // The result is expected to be a map like map[string]interface{}{"value": something}, - // so we'll fake that with our hcl2shim.SingleAttrBody shim. - p.RawConfig = NewRawConfigHCL2(rawP.Config) - - config.ProviderConfigs = append(config.ProviderConfigs, p) - } - - for _, rawL := range raw.Locals { - names := make([]string, 0, len(rawL.Definitions)) - for n := range rawL.Definitions { - names = append(names, n) - } - sort.Strings(names) - for _, n := range names { - attr := rawL.Definitions[n] - l := &Local{ - Name: n, - RawConfig: NewRawConfigHCL2(hcl2shim.SingleAttrBody{ - Name: "value", - Expr: attr.Expr, - }), - } - config.Locals = append(config.Locals, l) - } - } - - // FIXME: The current API gives us no way to return warnings in the - // absence of any errors. - var err error - if diags.HasErrors() { - err = diags - } - - return config, err -} diff --git a/vendor/github.com/hashicorp/terraform/config/merge.go b/vendor/github.com/hashicorp/terraform/config/merge.go deleted file mode 100644 index 55fc864f7..000000000 --- a/vendor/github.com/hashicorp/terraform/config/merge.go +++ /dev/null @@ -1,204 +0,0 @@ -package config - -// Merge merges two configurations into a single configuration. -// -// Merge allows for the two configurations to have duplicate resources, -// because the resources will be merged. This differs from a single -// Config which must only have unique resources. -func Merge(c1, c2 *Config) (*Config, error) { - c := new(Config) - - // Merge unknown keys - unknowns := make(map[string]struct{}) - for _, k := range c1.unknownKeys { - _, present := unknowns[k] - if !present { - unknowns[k] = struct{}{} - c.unknownKeys = append(c.unknownKeys, k) - } - } - for _, k := range c2.unknownKeys { - _, present := unknowns[k] - if !present { - unknowns[k] = struct{}{} - c.unknownKeys = append(c.unknownKeys, k) - } - } - - // Merge Atlas configuration. This is a dumb one overrides the other - // sort of merge. - c.Atlas = c1.Atlas - if c2.Atlas != nil { - c.Atlas = c2.Atlas - } - - // Merge the Terraform configuration - if c1.Terraform != nil { - c.Terraform = c1.Terraform - if c2.Terraform != nil { - c.Terraform.Merge(c2.Terraform) - } - } else { - c.Terraform = c2.Terraform - } - - // NOTE: Everything below is pretty gross. Due to the lack of generics - // in Go, there is some hoop-jumping involved to make this merging a - // little more test-friendly and less repetitive. Ironically, making it - // less repetitive involves being a little repetitive, but I prefer to - // be repetitive with things that are less error prone than things that - // are more error prone (more logic). Type conversions to an interface - // are pretty low-error. - - var m1, m2, mresult []merger - - // Modules - m1 = make([]merger, 0, len(c1.Modules)) - m2 = make([]merger, 0, len(c2.Modules)) - for _, v := range c1.Modules { - m1 = append(m1, v) - } - for _, v := range c2.Modules { - m2 = append(m2, v) - } - mresult = mergeSlice(m1, m2) - if len(mresult) > 0 { - c.Modules = make([]*Module, len(mresult)) - for i, v := range mresult { - c.Modules[i] = v.(*Module) - } - } - - // Outputs - m1 = make([]merger, 0, len(c1.Outputs)) - m2 = make([]merger, 0, len(c2.Outputs)) - for _, v := range c1.Outputs { - m1 = append(m1, v) - } - for _, v := range c2.Outputs { - m2 = append(m2, v) - } - mresult = mergeSlice(m1, m2) - if len(mresult) > 0 { - c.Outputs = make([]*Output, len(mresult)) - for i, v := range mresult { - c.Outputs[i] = v.(*Output) - } - } - - // Provider Configs - m1 = make([]merger, 0, len(c1.ProviderConfigs)) - m2 = make([]merger, 0, len(c2.ProviderConfigs)) - for _, v := range c1.ProviderConfigs { - m1 = append(m1, v) - } - for _, v := range c2.ProviderConfigs { - m2 = append(m2, v) - } - mresult = mergeSlice(m1, m2) - if len(mresult) > 0 { - c.ProviderConfigs = make([]*ProviderConfig, len(mresult)) - for i, v := range mresult { - c.ProviderConfigs[i] = v.(*ProviderConfig) - } - } - - // Resources - m1 = make([]merger, 0, len(c1.Resources)) - m2 = make([]merger, 0, len(c2.Resources)) - for _, v := range c1.Resources { - m1 = append(m1, v) - } - for _, v := range c2.Resources { - m2 = append(m2, v) - } - mresult = mergeSlice(m1, m2) - if len(mresult) > 0 { - c.Resources = make([]*Resource, len(mresult)) - for i, v := range mresult { - c.Resources[i] = v.(*Resource) - } - } - - // Variables - m1 = make([]merger, 0, len(c1.Variables)) - m2 = make([]merger, 0, len(c2.Variables)) - for _, v := range c1.Variables { - m1 = append(m1, v) - } - for _, v := range c2.Variables { - m2 = append(m2, v) - } - mresult = mergeSlice(m1, m2) - if len(mresult) > 0 { - c.Variables = make([]*Variable, len(mresult)) - for i, v := range mresult { - c.Variables[i] = v.(*Variable) - } - } - - // Local Values - // These are simpler than the other config elements because they are just - // flat values and so no deep merging is required. - if localsCount := len(c1.Locals) + len(c2.Locals); localsCount != 0 { - // Explicit length check above because we want c.Locals to remain - // nil if the result would be empty. - c.Locals = make([]*Local, 0, len(c1.Locals)+len(c2.Locals)) - c.Locals = append(c.Locals, c1.Locals...) - c.Locals = append(c.Locals, c2.Locals...) - } - - return c, nil -} - -// merger is an interface that must be implemented by types that are -// merge-able. This simplifies the implementation of Merge for the various -// components of a Config. -type merger interface { - mergerName() string - mergerMerge(merger) merger -} - -// mergeSlice merges a slice of mergers. -func mergeSlice(m1, m2 []merger) []merger { - r := make([]merger, len(m1), len(m1)+len(m2)) - copy(r, m1) - - m := map[string]struct{}{} - for _, v2 := range m2 { - // If we already saw it, just append it because its a - // duplicate and invalid... - name := v2.mergerName() - if _, ok := m[name]; ok { - r = append(r, v2) - continue - } - m[name] = struct{}{} - - // Find an original to override - var original merger - originalIndex := -1 - for i, v := range m1 { - if v.mergerName() == name { - originalIndex = i - original = v - break - } - } - - var v merger - if original == nil { - v = v2 - } else { - v = original.mergerMerge(v2) - } - - if originalIndex == -1 { - r = append(r, v) - } else { - r[originalIndex] = v - } - } - - return r -} diff --git a/vendor/github.com/hashicorp/terraform/config/providers.go b/vendor/github.com/hashicorp/terraform/config/providers.go deleted file mode 100644 index eeddabc32..000000000 --- a/vendor/github.com/hashicorp/terraform/config/providers.go +++ /dev/null @@ -1,61 +0,0 @@ -package config - -import "github.com/blang/semver" - -// ProviderVersionConstraint presents a constraint for a particular -// provider, identified by its full name. -type ProviderVersionConstraint struct { - Constraint string - ProviderType string -} - -// ProviderVersionConstraints is a map from provider full name to its associated -// ProviderVersionConstraint, as produced by Config.RequiredProviders. -type ProviderVersionConstraints map[string]ProviderVersionConstraint - -// RequiredRanges returns a semver.Range for each distinct provider type in -// the constraint map. If the same provider type appears more than once -// (e.g. because aliases are in use) then their respective constraints are -// combined such that they must *all* apply. -// -// The result of this method can be passed to the -// PluginMetaSet.ConstrainVersions method within the plugin/discovery -// package in order to filter down the available plugins to those which -// satisfy the given constraints. -// -// This function will panic if any of the constraints within cannot be -// parsed as semver ranges. This is guaranteed to never happen for a -// constraint set that was built from a configuration that passed validation. -func (cons ProviderVersionConstraints) RequiredRanges() map[string]semver.Range { - ret := make(map[string]semver.Range, len(cons)) - - for _, con := range cons { - spec := semver.MustParseRange(con.Constraint) - if existing, exists := ret[con.ProviderType]; exists { - ret[con.ProviderType] = existing.AND(spec) - } else { - ret[con.ProviderType] = spec - } - } - - return ret -} - -// ProviderConfigsByFullName returns a map from provider full names (as -// returned by ProviderConfig.FullName()) to the corresponding provider -// configs. -// -// This function returns no new information than what's already in -// c.ProviderConfigs, but returns it in a more convenient shape. If there -// is more than one provider config with the same full name then the result -// is undefined, but that is guaranteed not to happen for any config that -// has passed validation. -func (c *Config) ProviderConfigsByFullName() map[string]*ProviderConfig { - ret := make(map[string]*ProviderConfig, len(c.ProviderConfigs)) - - for _, pc := range c.ProviderConfigs { - ret[pc.FullName()] = pc - } - - return ret -} diff --git a/vendor/github.com/hashicorp/terraform/config/provisioner_enums.go b/vendor/github.com/hashicorp/terraform/config/provisioner_enums.go deleted file mode 100644 index 00fd43fce..000000000 --- a/vendor/github.com/hashicorp/terraform/config/provisioner_enums.go +++ /dev/null @@ -1,40 +0,0 @@ -package config - -// ProvisionerWhen is an enum for valid values for when to run provisioners. -type ProvisionerWhen int - -const ( - ProvisionerWhenInvalid ProvisionerWhen = iota - ProvisionerWhenCreate - ProvisionerWhenDestroy -) - -var provisionerWhenStrs = map[ProvisionerWhen]string{ - ProvisionerWhenInvalid: "invalid", - ProvisionerWhenCreate: "create", - ProvisionerWhenDestroy: "destroy", -} - -func (v ProvisionerWhen) String() string { - return provisionerWhenStrs[v] -} - -// ProvisionerOnFailure is an enum for valid values for on_failure options -// for provisioners. -type ProvisionerOnFailure int - -const ( - ProvisionerOnFailureInvalid ProvisionerOnFailure = iota - ProvisionerOnFailureContinue - ProvisionerOnFailureFail -) - -var provisionerOnFailureStrs = map[ProvisionerOnFailure]string{ - ProvisionerOnFailureInvalid: "invalid", - ProvisionerOnFailureContinue: "continue", - ProvisionerOnFailureFail: "fail", -} - -func (v ProvisionerOnFailure) String() string { - return provisionerOnFailureStrs[v] -} diff --git a/vendor/github.com/hashicorp/terraform/config/raw_config.go b/vendor/github.com/hashicorp/terraform/config/raw_config.go deleted file mode 100644 index 27bcd1da0..000000000 --- a/vendor/github.com/hashicorp/terraform/config/raw_config.go +++ /dev/null @@ -1,419 +0,0 @@ -package config - -import ( - "bytes" - "encoding/gob" - "errors" - "strconv" - "sync" - - hcl2 "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hil" - "github.com/hashicorp/hil/ast" - "github.com/mitchellh/copystructure" - "github.com/mitchellh/reflectwalk" -) - -// RawConfig is a structure that holds a piece of configuration -// where the overall structure is unknown since it will be used -// to configure a plugin or some other similar external component. -// -// RawConfigs can be interpolated with variables that come from -// other resources, user variables, etc. -// -// RawConfig supports a query-like interface to request -// information from deep within the structure. -type RawConfig struct { - Key string - - // Only _one_ of Raw and Body may be populated at a time. - // - // In the normal case, Raw is populated and Body is nil. - // - // When the experimental HCL2 parsing mode is enabled, "Body" - // is populated and RawConfig serves only to transport the hcl2.Body - // through the rest of Terraform core so we can ultimately decode it - // once its schema is known. - // - // Once we transition to HCL2 as the primary representation, RawConfig - // should be removed altogether and the hcl2.Body should be passed - // around directly. - - Raw map[string]interface{} - Body hcl2.Body - - Interpolations []ast.Node - Variables map[string]InterpolatedVariable - - lock sync.Mutex - config map[string]interface{} - unknownKeys []string -} - -// NewRawConfig creates a new RawConfig structure and populates the -// publicly readable struct fields. -func NewRawConfig(raw map[string]interface{}) (*RawConfig, error) { - result := &RawConfig{Raw: raw} - if err := result.init(); err != nil { - return nil, err - } - - return result, nil -} - -// NewRawConfigHCL2 creates a new RawConfig that is serving as a capsule -// to transport a hcl2.Body. In this mode, the publicly-readable struct -// fields are not populated since all operations should instead be diverted -// to the HCL2 body. -// -// For a RawConfig object constructed with this function, the only valid use -// is to later retrieve the Body value and call its own methods. Callers -// may choose to set and then later handle the Key field, in a manner -// consistent with how it is handled by the Value method, but the Value -// method itself must not be used. -// -// This is an experimental codepath to be used only by the HCL2 config loader. -// Non-experimental parsing should _always_ use NewRawConfig to produce a -// fully-functional RawConfig object. -func NewRawConfigHCL2(body hcl2.Body) *RawConfig { - return &RawConfig{ - Body: body, - } -} - -// RawMap returns a copy of the RawConfig.Raw map. -func (r *RawConfig) RawMap() map[string]interface{} { - r.lock.Lock() - defer r.lock.Unlock() - - m := make(map[string]interface{}) - for k, v := range r.Raw { - m[k] = v - } - return m -} - -// Copy returns a copy of this RawConfig, uninterpolated. -func (r *RawConfig) Copy() *RawConfig { - if r == nil { - return nil - } - - r.lock.Lock() - defer r.lock.Unlock() - - if r.Body != nil { - return NewRawConfigHCL2(r.Body) - } - - newRaw := make(map[string]interface{}) - for k, v := range r.Raw { - newRaw[k] = v - } - - result, err := NewRawConfig(newRaw) - if err != nil { - panic("copy failed: " + err.Error()) - } - - result.Key = r.Key - return result -} - -// Value returns the value of the configuration if this configuration -// has a Key set. If this does not have a Key set, nil will be returned. -func (r *RawConfig) Value() interface{} { - if c := r.Config(); c != nil { - if v, ok := c[r.Key]; ok { - return v - } - } - - r.lock.Lock() - defer r.lock.Unlock() - return r.Raw[r.Key] -} - -// Config returns the entire configuration with the variables -// interpolated from any call to Interpolate. -// -// If any interpolated variables are unknown (value set to -// UnknownVariableValue), the first non-container (map, slice, etc.) element -// will be removed from the config. The keys of unknown variables -// can be found using the UnknownKeys function. -// -// By pruning out unknown keys from the configuration, the raw -// structure will always successfully decode into its ultimate -// structure using something like mapstructure. -func (r *RawConfig) Config() map[string]interface{} { - r.lock.Lock() - defer r.lock.Unlock() - return r.config -} - -// Interpolate uses the given mapping of variable values and uses -// those as the values to replace any variables in this raw -// configuration. -// -// Any prior calls to Interpolate are replaced with this one. -// -// If a variable key is missing, this will panic. -func (r *RawConfig) Interpolate(vs map[string]ast.Variable) error { - r.lock.Lock() - defer r.lock.Unlock() - - config := langEvalConfig(vs) - return r.interpolate(func(root ast.Node) (interface{}, error) { - // None of the variables we need are computed, meaning we should - // be able to properly evaluate. - result, err := hil.Eval(root, config) - if err != nil { - return "", err - } - - return result.Value, nil - }) -} - -// Merge merges another RawConfig into this one (overriding any conflicting -// values in this config) and returns a new config. The original config -// is not modified. -func (r *RawConfig) Merge(other *RawConfig) *RawConfig { - r.lock.Lock() - defer r.lock.Unlock() - - // Merge the raw configurations - raw := make(map[string]interface{}) - for k, v := range r.Raw { - raw[k] = v - } - for k, v := range other.Raw { - raw[k] = v - } - - // Create the result - result, err := NewRawConfig(raw) - if err != nil { - panic(err) - } - - // Merge the interpolated results - result.config = make(map[string]interface{}) - for k, v := range r.config { - result.config[k] = v - } - for k, v := range other.config { - result.config[k] = v - } - - // Build the unknown keys - if len(r.unknownKeys) > 0 || len(other.unknownKeys) > 0 { - unknownKeys := make(map[string]struct{}) - for _, k := range r.unknownKeys { - unknownKeys[k] = struct{}{} - } - for _, k := range other.unknownKeys { - unknownKeys[k] = struct{}{} - } - - result.unknownKeys = make([]string, 0, len(unknownKeys)) - for k, _ := range unknownKeys { - result.unknownKeys = append(result.unknownKeys, k) - } - } - - return result -} - -func (r *RawConfig) init() error { - r.lock.Lock() - defer r.lock.Unlock() - - r.config = r.Raw - r.Interpolations = nil - r.Variables = nil - - fn := func(node ast.Node) (interface{}, error) { - r.Interpolations = append(r.Interpolations, node) - vars, err := DetectVariables(node) - if err != nil { - return "", err - } - - for _, v := range vars { - if r.Variables == nil { - r.Variables = make(map[string]InterpolatedVariable) - } - - r.Variables[v.FullKey()] = v - } - - return "", nil - } - - walker := &interpolationWalker{F: fn} - if err := reflectwalk.Walk(r.Raw, walker); err != nil { - return err - } - - return nil -} - -func (r *RawConfig) interpolate(fn interpolationWalkerFunc) error { - if r.Body != nil { - // For RawConfigs created for the HCL2 experiement, callers must - // use the HCL2 Body API directly rather than interpolating via - // the RawConfig. - return errors.New("this feature is not yet supported under the HCL2 experiment") - } - - config, err := copystructure.Copy(r.Raw) - if err != nil { - return err - } - r.config = config.(map[string]interface{}) - - w := &interpolationWalker{F: fn, Replace: true} - err = reflectwalk.Walk(r.config, w) - if err != nil { - return err - } - - r.unknownKeys = w.unknownKeys - return nil -} - -func (r *RawConfig) merge(r2 *RawConfig) *RawConfig { - if r == nil && r2 == nil { - return nil - } - - if r == nil { - r = &RawConfig{} - } - - rawRaw, err := copystructure.Copy(r.Raw) - if err != nil { - panic(err) - } - - raw := rawRaw.(map[string]interface{}) - if r2 != nil { - for k, v := range r2.Raw { - raw[k] = v - } - } - - result, err := NewRawConfig(raw) - if err != nil { - panic(err) - } - - return result -} - -// couldBeInteger is a helper that determines if the represented value could -// result in an integer. -// -// This function only works for RawConfigs that have "Key" set, meaning that -// a single result can be produced. Calling this function will overwrite -// the Config and Value results to be a test value. -// -// This function is conservative. If there is some doubt about whether the -// result could be an integer -- for example, if it depends on a variable -// whose type we don't know yet -- it will still return true. -func (r *RawConfig) couldBeInteger() bool { - if r.Key == "" { - // un-keyed RawConfigs can never produce numbers - return false - } - if r.Body == nil { - // Normal path: using the interpolator in this package - // Interpolate with a fixed number to verify that its a number. - r.interpolate(func(root ast.Node) (interface{}, error) { - // Execute the node but transform the AST so that it returns - // a fixed value of "5" for all interpolations. - result, err := hil.Eval( - hil.FixedValueTransform( - root, &ast.LiteralNode{Value: "5", Typex: ast.TypeString}), - nil) - if err != nil { - return "", err - } - - return result.Value, nil - }) - _, err := strconv.ParseInt(r.Value().(string), 0, 0) - return err == nil - } else { - // We briefly tried to gradually implement HCL2 support by adding a - // branch here, but that experiment was not successful. - panic("HCL2 experimental path no longer supported") - } -} - -// UnknownKeys returns the keys of the configuration that are unknown -// because they had interpolated variables that must be computed. -func (r *RawConfig) UnknownKeys() []string { - r.lock.Lock() - defer r.lock.Unlock() - return r.unknownKeys -} - -// See GobEncode -func (r *RawConfig) GobDecode(b []byte) error { - var data gobRawConfig - err := gob.NewDecoder(bytes.NewReader(b)).Decode(&data) - if err != nil { - return err - } - - r.Key = data.Key - r.Raw = data.Raw - - return r.init() -} - -// GobEncode is a custom Gob encoder to use so that we only include the -// raw configuration. Interpolated variables and such are lost and the -// tree of interpolated variables is recomputed on decode, since it is -// referentially transparent. -func (r *RawConfig) GobEncode() ([]byte, error) { - r.lock.Lock() - defer r.lock.Unlock() - - data := gobRawConfig{ - Key: r.Key, - Raw: r.Raw, - } - - var buf bytes.Buffer - if err := gob.NewEncoder(&buf).Encode(data); err != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -type gobRawConfig struct { - Key string - Raw map[string]interface{} -} - -// langEvalConfig returns the evaluation configuration we use to execute. -// -// The interpolation functions are no longer available here, because this -// codepath is no longer used. Instead, see ../lang/functions.go . -func langEvalConfig(vs map[string]ast.Variable) *hil.EvalConfig { - funcMap := make(map[string]ast.Function) - for k, v := range Funcs() { - funcMap[k] = v - } - - return &hil.EvalConfig{ - GlobalScope: &ast.BasicScope{ - VarMap: vs, - FuncMap: funcMap, - }, - } -} diff --git a/vendor/github.com/hashicorp/terraform/config/resource_mode.go b/vendor/github.com/hashicorp/terraform/config/resource_mode.go deleted file mode 100644 index dd915217c..000000000 --- a/vendor/github.com/hashicorp/terraform/config/resource_mode.go +++ /dev/null @@ -1,9 +0,0 @@ -package config - -//go:generate go run golang.org/x/tools/cmd/stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go -type ResourceMode int - -const ( - ManagedResourceMode ResourceMode = iota - DataResourceMode -) diff --git a/vendor/github.com/hashicorp/terraform/config/resource_mode_string.go b/vendor/github.com/hashicorp/terraform/config/resource_mode_string.go deleted file mode 100644 index 010527824..000000000 --- a/vendor/github.com/hashicorp/terraform/config/resource_mode_string.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by "stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go"; DO NOT EDIT. - -package config - -import "strconv" - -func _() { - // An "invalid array index" compiler error signifies that the constant values have changed. - // Re-run the stringer command to generate them again. - var x [1]struct{} - _ = x[ManagedResourceMode-0] - _ = x[DataResourceMode-1] -} - -const _ResourceMode_name = "ManagedResourceModeDataResourceMode" - -var _ResourceMode_index = [...]uint8{0, 19, 35} - -func (i ResourceMode) String() string { - if i < 0 || i >= ResourceMode(len(_ResourceMode_index)-1) { - return "ResourceMode(" + strconv.FormatInt(int64(i), 10) + ")" - } - return _ResourceMode_name[_ResourceMode_index[i]:_ResourceMode_index[i+1]] -} diff --git a/vendor/github.com/hashicorp/terraform/config/testing.go b/vendor/github.com/hashicorp/terraform/config/testing.go deleted file mode 100644 index 831fc7786..000000000 --- a/vendor/github.com/hashicorp/terraform/config/testing.go +++ /dev/null @@ -1,17 +0,0 @@ -package config - -import ( - "testing" -) - -// TestRawConfig is used to create a RawConfig for testing. -func TestRawConfig(t *testing.T, c map[string]interface{}) *RawConfig { - t.Helper() - - cfg, err := NewRawConfig(c) - if err != nil { - t.Fatalf("err: %s", err) - } - - return cfg -} diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/getter.go b/vendor/github.com/hashicorp/terraform/configs/configload/getter.go deleted file mode 100644 index 75c7ef1f4..000000000 --- a/vendor/github.com/hashicorp/terraform/configs/configload/getter.go +++ /dev/null @@ -1,152 +0,0 @@ -package configload - -import ( - "fmt" - "log" - "os" - "path/filepath" - - cleanhttp "github.com/hashicorp/go-cleanhttp" - getter "github.com/hashicorp/go-getter" -) - -// We configure our own go-getter detector and getter sets here, because -// the set of sources we support is part of Terraform's documentation and -// so we don't want any new sources introduced in go-getter to sneak in here -// and work even though they aren't documented. This also insulates us from -// any meddling that might be done by other go-getter callers linked into our -// executable. - -var goGetterDetectors = []getter.Detector{ - new(getter.GitHubDetector), - new(getter.BitBucketDetector), - new(getter.GCSDetector), - new(getter.S3Detector), - new(getter.FileDetector), -} - -var goGetterNoDetectors = []getter.Detector{} - -var goGetterDecompressors = map[string]getter.Decompressor{ - "bz2": new(getter.Bzip2Decompressor), - "gz": new(getter.GzipDecompressor), - "xz": new(getter.XzDecompressor), - "zip": new(getter.ZipDecompressor), - - "tar.bz2": new(getter.TarBzip2Decompressor), - "tar.tbz2": new(getter.TarBzip2Decompressor), - - "tar.gz": new(getter.TarGzipDecompressor), - "tgz": new(getter.TarGzipDecompressor), - - "tar.xz": new(getter.TarXzDecompressor), - "txz": new(getter.TarXzDecompressor), -} - -var goGetterGetters = map[string]getter.Getter{ - "file": new(getter.FileGetter), - "gcs": new(getter.GCSGetter), - "git": new(getter.GitGetter), - "hg": new(getter.HgGetter), - "s3": new(getter.S3Getter), - "http": getterHTTPGetter, - "https": getterHTTPGetter, -} - -var getterHTTPClient = cleanhttp.DefaultClient() - -var getterHTTPGetter = &getter.HttpGetter{ - Client: getterHTTPClient, - Netrc: true, -} - -// A reusingGetter is a helper for the module installer that remembers -// the final resolved addresses of all of the sources it has already been -// asked to install, and will copy from a prior installation directory if -// it has the same resolved source address. -// -// The keys in a reusingGetter are resolved and trimmed source addresses -// (with a scheme always present, and without any "subdir" component), -// and the values are the paths where each source was previously installed. -type reusingGetter map[string]string - -// getWithGoGetter retrieves the package referenced in the given address -// into the installation path and then returns the full path to any subdir -// indicated in the address. -// -// The errors returned by this function are those surfaced by the underlying -// go-getter library, which have very inconsistent quality as -// end-user-actionable error messages. At this time we do not have any -// reasonable way to improve these error messages at this layer because -// the underlying errors are not separatelyr recognizable. -func (g reusingGetter) getWithGoGetter(instPath, addr string) (string, error) { - packageAddr, subDir := splitAddrSubdir(addr) - - log.Printf("[DEBUG] will download %q to %s", packageAddr, instPath) - - realAddr, err := getter.Detect(packageAddr, instPath, getter.Detectors) - if err != nil { - return "", err - } - - var realSubDir string - realAddr, realSubDir = splitAddrSubdir(realAddr) - if realSubDir != "" { - subDir = filepath.Join(realSubDir, subDir) - } - - if realAddr != packageAddr { - log.Printf("[TRACE] go-getter detectors rewrote %q to %q", packageAddr, realAddr) - } - - if prevDir, exists := g[realAddr]; exists { - log.Printf("[TRACE] copying previous install %s to %s", prevDir, instPath) - err := os.Mkdir(instPath, os.ModePerm) - if err != nil { - return "", fmt.Errorf("failed to create directory %s: %s", instPath, err) - } - err = copyDir(instPath, prevDir) - if err != nil { - return "", fmt.Errorf("failed to copy from %s to %s: %s", prevDir, instPath, err) - } - } else { - log.Printf("[TRACE] fetching %q to %q", realAddr, instPath) - client := getter.Client{ - Src: realAddr, - Dst: instPath, - Pwd: instPath, - - Mode: getter.ClientModeDir, - - Detectors: goGetterNoDetectors, // we already did detection above - Decompressors: goGetterDecompressors, - Getters: goGetterGetters, - } - err = client.Get() - if err != nil { - return "", err - } - // Remember where we installed this so we might reuse this directory - // on subsequent calls to avoid re-downloading. - g[realAddr] = instPath - } - - // Our subDir string can contain wildcards until this point, so that - // e.g. a subDir of * can expand to one top-level directory in a .tar.gz - // archive. Now that we've expanded the archive successfully we must - // resolve that into a concrete path. - var finalDir string - if subDir != "" { - finalDir, err = getter.SubdirGlob(instPath, subDir) - log.Printf("[TRACE] expanded %q to %q", subDir, finalDir) - if err != nil { - return "", err - } - } else { - finalDir = instPath - } - - // If we got this far then we have apparently succeeded in downloading - // the requested object! - return filepath.Clean(finalDir), nil -} diff --git a/vendor/github.com/hashicorp/terraform/configs/configload/source_addr.go b/vendor/github.com/hashicorp/terraform/configs/configload/source_addr.go deleted file mode 100644 index 594cf6406..000000000 --- a/vendor/github.com/hashicorp/terraform/configs/configload/source_addr.go +++ /dev/null @@ -1,45 +0,0 @@ -package configload - -import ( - "strings" - - "github.com/hashicorp/go-getter" - - "github.com/hashicorp/terraform/registry/regsrc" -) - -var localSourcePrefixes = []string{ - "./", - "../", - ".\\", - "..\\", -} - -func isLocalSourceAddr(addr string) bool { - for _, prefix := range localSourcePrefixes { - if strings.HasPrefix(addr, prefix) { - return true - } - } - return false -} - -func isRegistrySourceAddr(addr string) bool { - _, err := regsrc.ParseModuleSource(addr) - return err == nil -} - -// splitAddrSubdir splits the given address (which is assumed to be a -// registry address or go-getter-style address) into a package portion -// and a sub-directory portion. -// -// The package portion defines what should be downloaded and then the -// sub-directory portion, if present, specifies a sub-directory within -// the downloaded object (an archive, VCS repository, etc) that contains -// the module's configuration files. -// -// The subDir portion will be returned as empty if no subdir separator -// ("//") is present in the address. -func splitAddrSubdir(addr string) (packageAddr, subDir string) { - return getter.SourceDirSubdir(addr) -} diff --git a/vendor/github.com/hashicorp/terraform/configs/experiments.go b/vendor/github.com/hashicorp/terraform/configs/experiments.go deleted file mode 100644 index 8af1e951f..000000000 --- a/vendor/github.com/hashicorp/terraform/configs/experiments.go +++ /dev/null @@ -1,143 +0,0 @@ -package configs - -import ( - "fmt" - - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/terraform/experiments" -) - -// sniffActiveExperiments does minimal parsing of the given body for -// "terraform" blocks with "experiments" attributes, returning the -// experiments found. -// -// This is separate from other processing so that we can be sure that all of -// the experiments are known before we process the result of the module config, -// and thus we can take into account which experiments are active when deciding -// how to decode. -func sniffActiveExperiments(body hcl.Body) (experiments.Set, hcl.Diagnostics) { - rootContent, _, diags := body.PartialContent(configFileTerraformBlockSniffRootSchema) - - ret := experiments.NewSet() - - for _, block := range rootContent.Blocks { - content, _, blockDiags := block.Body.PartialContent(configFileExperimentsSniffBlockSchema) - diags = append(diags, blockDiags...) - - attr, exists := content.Attributes["experiments"] - if !exists { - continue - } - - exps, expDiags := decodeExperimentsAttr(attr) - diags = append(diags, expDiags...) - if !expDiags.HasErrors() { - ret = experiments.SetUnion(ret, exps) - } - } - - return ret, diags -} - -func decodeExperimentsAttr(attr *hcl.Attribute) (experiments.Set, hcl.Diagnostics) { - var diags hcl.Diagnostics - - exprs, moreDiags := hcl.ExprList(attr.Expr) - diags = append(diags, moreDiags...) - if moreDiags.HasErrors() { - return nil, diags - } - - var ret = experiments.NewSet() - for _, expr := range exprs { - kw := hcl.ExprAsKeyword(expr) - if kw == "" { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid experiment keyword", - Detail: "Elements of \"experiments\" must all be keywords representing active experiments.", - Subject: expr.Range().Ptr(), - }) - continue - } - - exp, err := experiments.GetCurrent(kw) - switch err := err.(type) { - case experiments.UnavailableError: - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unknown experiment keyword", - Detail: fmt.Sprintf("There is no current experiment with the keyword %q.", kw), - Subject: expr.Range().Ptr(), - }) - case experiments.ConcludedError: - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Experiment has concluded", - Detail: fmt.Sprintf("Experiment %q is no longer available. %s", kw, err.Message), - Subject: expr.Range().Ptr(), - }) - case nil: - // No error at all means it's valid and current. - ret.Add(exp) - - // However, experimental features are subject to breaking changes - // in future releases, so we'll warn about them to help make sure - // folks aren't inadvertently using them in places where that'd be - // inappropriate, particularly if the experiment is active in a - // shared module they depend on. - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagWarning, - Summary: fmt.Sprintf("Experimental feature %q is active", exp.Keyword()), - Detail: "Experimental features are subject to breaking changes in future minor or patch releases, based on feedback.\n\nIf you have feedback on the design of this feature, please open a GitHub issue to discuss it.", - Subject: expr.Range().Ptr(), - }) - - default: - // This should never happen, because GetCurrent is not documented - // to return any other error type, but we'll handle it to be robust. - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid experiment keyword", - Detail: fmt.Sprintf("Could not parse %q as an experiment keyword: %s.", kw, err.Error()), - Subject: expr.Range().Ptr(), - }) - } - } - return ret, diags -} - -func checkModuleExperiments(m *Module) hcl.Diagnostics { - var diags hcl.Diagnostics - - // When we have current experiments, this is a good place to check that - // the features in question can only be used when the experiments are - // active. Return error diagnostics if a feature is being used without - // opting in to the feature. For example: - /* - if !m.ActiveExperiments.Has(experiments.ResourceForEach) { - for _, rc := range m.ManagedResources { - if rc.ForEach != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Resource for_each is experimental", - Detail: "This feature is currently an opt-in experiment, subject to change in future releases based on feedback.\n\nActivate the feature for this module by adding resource_for_each to the list of active experiments.", - Subject: rc.ForEach.Range().Ptr(), - }) - } - } - for _, rc := range m.DataResources { - if rc.ForEach != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Resource for_each is experimental", - Detail: "This feature is currently an opt-in experiment, subject to change in future releases based on feedback.\n\nActivate the feature for this module by adding resource_for_each to the list of active experiments.", - Subject: rc.ForEach.Range().Ptr(), - }) - } - } - } - */ - - return diags -} diff --git a/vendor/github.com/hashicorp/terraform/configs/provider.go b/vendor/github.com/hashicorp/terraform/configs/provider.go deleted file mode 100644 index 6b57fc605..000000000 --- a/vendor/github.com/hashicorp/terraform/configs/provider.go +++ /dev/null @@ -1,209 +0,0 @@ -package configs - -import ( - "fmt" - - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/gohcl" - "github.com/hashicorp/hcl/v2/hclsyntax" - - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/tfdiags" -) - -// Provider represents a "provider" block in a module or file. A provider -// block is a provider configuration, and there can be zero or more -// configurations for each actual provider. -type Provider struct { - Name string - NameRange hcl.Range - Alias string - AliasRange *hcl.Range // nil if no alias set - - Version VersionConstraint - - Config hcl.Body - - DeclRange hcl.Range -} - -func decodeProviderBlock(block *hcl.Block) (*Provider, hcl.Diagnostics) { - var diags hcl.Diagnostics - - // Produce deprecation messages for any pre-0.12-style - // single-interpolation-only expressions. We do this up front here because - // then we can also catch instances inside special blocks like "connection", - // before PartialContent extracts them. - moreDiags := warnForDeprecatedInterpolationsInBody(block.Body) - diags = append(diags, moreDiags...) - - content, config, moreDiags := block.Body.PartialContent(providerBlockSchema) - diags = append(diags, moreDiags...) - - provider := &Provider{ - Name: block.Labels[0], - NameRange: block.LabelRanges[0], - Config: config, - DeclRange: block.DefRange, - } - - if attr, exists := content.Attributes["alias"]; exists { - valDiags := gohcl.DecodeExpression(attr.Expr, nil, &provider.Alias) - diags = append(diags, valDiags...) - provider.AliasRange = attr.Expr.Range().Ptr() - - if !hclsyntax.ValidIdentifier(provider.Alias) { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid provider configuration alias", - Detail: fmt.Sprintf("An alias must be a valid name. %s", badIdentifierDetail), - }) - } - } - - if attr, exists := content.Attributes["version"]; exists { - var versionDiags hcl.Diagnostics - provider.Version, versionDiags = decodeVersionConstraint(attr) - diags = append(diags, versionDiags...) - } - - // Reserved attribute names - for _, name := range []string{"count", "depends_on", "for_each", "source"} { - if attr, exists := content.Attributes[name]; exists { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Reserved argument name in provider block", - Detail: fmt.Sprintf("The provider argument name %q is reserved for use by Terraform in a future version.", name), - Subject: &attr.NameRange, - }) - } - } - - // Reserved block types (all of them) - for _, block := range content.Blocks { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Reserved block type name in provider block", - Detail: fmt.Sprintf("The block type name %q is reserved for use by Terraform in a future version.", block.Type), - Subject: &block.TypeRange, - }) - } - - return provider, diags -} - -// Addr returns the address of the receiving provider configuration, relative -// to its containing module. -func (p *Provider) Addr() addrs.ProviderConfig { - return addrs.ProviderConfig{ - Type: addrs.NewLegacyProvider(p.Name), - Alias: p.Alias, - } -} - -func (p *Provider) moduleUniqueKey() string { - if p.Alias != "" { - return fmt.Sprintf("%s.%s", p.Name, p.Alias) - } - return p.Name -} - -// ParseProviderConfigCompact parses the given absolute traversal as a relative -// provider address in compact form. The following are examples of traversals -// that can be successfully parsed as compact relative provider configuration -// addresses: -// -// aws -// aws.foo -// -// This function will panic if given a relative traversal. -// -// If the returned diagnostics contains errors then the result value is invalid -// and must not be used. -func ParseProviderConfigCompact(traversal hcl.Traversal) (addrs.ProviderConfig, tfdiags.Diagnostics) { - var diags tfdiags.Diagnostics - ret := addrs.ProviderConfig{ - Type: addrs.NewLegacyProvider(traversal.RootName()), - } - - if len(traversal) < 2 { - // Just a type name, then. - return ret, diags - } - - aliasStep := traversal[1] - switch ts := aliasStep.(type) { - case hcl.TraverseAttr: - ret.Alias = ts.Name - return ret, diags - default: - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid provider configuration address", - Detail: "The provider type name must either stand alone or be followed by an alias name separated with a dot.", - Subject: aliasStep.SourceRange().Ptr(), - }) - } - - if len(traversal) > 2 { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid provider configuration address", - Detail: "Extraneous extra operators after provider configuration address.", - Subject: traversal[2:].SourceRange().Ptr(), - }) - } - - return ret, diags -} - -// ParseProviderConfigCompactStr is a helper wrapper around ParseProviderConfigCompact -// that takes a string and parses it with the HCL native syntax traversal parser -// before interpreting it. -// -// This should be used only in specialized situations since it will cause the -// created references to not have any meaningful source location information. -// If a reference string is coming from a source that should be identified in -// error messages then the caller should instead parse it directly using a -// suitable function from the HCL API and pass the traversal itself to -// ParseProviderConfigCompact. -// -// Error diagnostics are returned if either the parsing fails or the analysis -// of the traversal fails. There is no way for the caller to distinguish the -// two kinds of diagnostics programmatically. If error diagnostics are returned -// then the returned address is invalid. -func ParseProviderConfigCompactStr(str string) (addrs.ProviderConfig, tfdiags.Diagnostics) { - var diags tfdiags.Diagnostics - - traversal, parseDiags := hclsyntax.ParseTraversalAbs([]byte(str), "", hcl.Pos{Line: 1, Column: 1}) - diags = diags.Append(parseDiags) - if parseDiags.HasErrors() { - return addrs.ProviderConfig{}, diags - } - - addr, addrDiags := ParseProviderConfigCompact(traversal) - diags = diags.Append(addrDiags) - return addr, diags -} - -var providerBlockSchema = &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "alias", - }, - { - Name: "version", - }, - - // Attribute names reserved for future expansion. - {Name: "count"}, - {Name: "depends_on"}, - {Name: "for_each"}, - {Name: "source"}, - }, - Blocks: []hcl.BlockHeaderSchema{ - // _All_ of these are reserved for future expansion. - {Type: "lifecycle"}, - {Type: "locals"}, - }, -} diff --git a/vendor/github.com/hashicorp/terraform/configs/provider_requirements.go b/vendor/github.com/hashicorp/terraform/configs/provider_requirements.go deleted file mode 100644 index 3890bbbcd..000000000 --- a/vendor/github.com/hashicorp/terraform/configs/provider_requirements.go +++ /dev/null @@ -1,32 +0,0 @@ -package configs - -import ( - "github.com/hashicorp/hcl/v2" -) - -// ProviderRequirement represents a declaration of a dependency on a particular -// provider version without actually configuring that provider. This is used in -// child modules that expect a provider to be passed in from their parent. -// -// TODO: "Source" is a placeholder for an attribute that is not yet supported. -type ProviderRequirement struct { - Name string - Source string // TODO - Requirement VersionConstraint -} - -func decodeRequiredProvidersBlock(block *hcl.Block) ([]*ProviderRequirement, hcl.Diagnostics) { - attrs, diags := block.Body.JustAttributes() - var reqs []*ProviderRequirement - for name, attr := range attrs { - req, reqDiags := decodeVersionConstraint(attr) - diags = append(diags, reqDiags...) - if !diags.HasErrors() { - reqs = append(reqs, &ProviderRequirement{ - Name: name, - Requirement: req, - }) - } - } - return reqs, diags -} diff --git a/vendor/github.com/hashicorp/terraform/experiments/doc.go b/vendor/github.com/hashicorp/terraform/experiments/doc.go deleted file mode 100644 index 5538d739c..000000000 --- a/vendor/github.com/hashicorp/terraform/experiments/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Package experiments contains the models and logic for opt-in experiments -// that can be activated for a particular Terraform module. -// -// We use experiments to get feedback on new configuration language features -// in a way that permits breaking changes without waiting for a future minor -// release. Any feature behind an experiment flag is subject to change in any -// way in even a patch release, until we have enough confidence about the -// design of the feature to make compatibility commitments about it. -package experiments diff --git a/vendor/github.com/hashicorp/terraform/experiments/errors.go b/vendor/github.com/hashicorp/terraform/experiments/errors.go deleted file mode 100644 index a1fdc6f5c..000000000 --- a/vendor/github.com/hashicorp/terraform/experiments/errors.go +++ /dev/null @@ -1,26 +0,0 @@ -package experiments - -import ( - "fmt" -) - -// UnavailableError is the error type returned by GetCurrent when the requested -// experiment is not recognized at all. -type UnavailableError struct { - ExperimentName string -} - -func (e UnavailableError) Error() string { - return fmt.Sprintf("no current experiment is named %q", e.ExperimentName) -} - -// ConcludedError is the error type returned by GetCurrent when the requested -// experiment is recognized as concluded. -type ConcludedError struct { - ExperimentName string - Message string -} - -func (e ConcludedError) Error() string { - return fmt.Sprintf("experiment %q has concluded: %s", e.ExperimentName, e.Message) -} diff --git a/vendor/github.com/hashicorp/terraform/experiments/experiment.go b/vendor/github.com/hashicorp/terraform/experiments/experiment.go deleted file mode 100644 index fb30a5fc4..000000000 --- a/vendor/github.com/hashicorp/terraform/experiments/experiment.go +++ /dev/null @@ -1,93 +0,0 @@ -package experiments - -// Experiment represents a particular experiment, which can be activated -// independently of all other experiments. -type Experiment string - -// All active and defunct experiments must be represented by constants whose -// internal string values are unique. -// -// Each of these declared constants must also be registered as either a -// current or a defunct experiment in the init() function below. -// -// Each experiment is represented by a string that must be a valid HCL -// identifier so that it can be specified in configuration. -const ( -// Example = Experiment("example") -) - -func init() { - // Each experiment constant defined above must be registered here as either - // a current or a concluded experiment. - // registerCurrentExperiment(Example) -} - -// GetCurrent takes an experiment name and returns the experiment value -// representing that expression if and only if it is a current experiment. -// -// If the selected experiment is concluded, GetCurrent will return an -// error of type ConcludedError whose message hopefully includes some guidance -// for users of the experiment on how to migrate to a stable feature that -// succeeded it. -// -// If the selected experiment is not known at all, GetCurrent will return an -// error of type UnavailableError. -func GetCurrent(name string) (Experiment, error) { - exp := Experiment(name) - if currentExperiments.Has(exp) { - return exp, nil - } - - if msg, concluded := concludedExperiments[exp]; concluded { - return Experiment(""), ConcludedError{ExperimentName: name, Message: msg} - } - - return Experiment(""), UnavailableError{ExperimentName: name} -} - -// Keyword returns the keyword that would be used to activate this experiment -// in the configuration. -func (e Experiment) Keyword() string { - return string(e) -} - -// IsCurrent returns true if the receiver is considered a currently-selectable -// experiment. -func (e Experiment) IsCurrent() bool { - return currentExperiments.Has(e) -} - -// IsConcluded returns true if the receiver is a concluded experiment. -func (e Experiment) IsConcluded() bool { - _, exists := concludedExperiments[e] - return exists -} - -// currentExperiments are those which are available to activate in the current -// version of Terraform. -// -// Members of this set are registered in the init function above. -var currentExperiments = make(Set) - -// concludedExperiments are those which were available to activate in an earlier -// version of Terraform but are no longer available, either because the feature -// in question has been implemented or because the experiment failed and the -// feature was abandoned. Each experiment maps to a message describing the -// outcome, so we can give users feedback about what they might do in modules -// using concluded experiments. -// -// After an experiment has been concluded for a whole major release span it can -// be removed, since we expect users to perform upgrades one major release at -// at time without skipping and thus they will see the concludedness error -// message as they upgrade through a prior major version. -// -// Members of this map are registered in the init function above. -var concludedExperiments = make(map[Experiment]string) - -func registerCurrentExperiment(exp Experiment) { - currentExperiments.Add(exp) -} - -func registerConcludedExperiment(exp Experiment, message string) { - concludedExperiments[exp] = message -} diff --git a/vendor/github.com/hashicorp/terraform/experiments/set.go b/vendor/github.com/hashicorp/terraform/experiments/set.go deleted file mode 100644 index 8247e212b..000000000 --- a/vendor/github.com/hashicorp/terraform/experiments/set.go +++ /dev/null @@ -1,46 +0,0 @@ -package experiments - -// Set is a collection of experiments where every experiment is either a member -// or not. -type Set map[Experiment]struct{} - -// NewSet constructs a new Set with the given experiments as its initial members. -func NewSet(exps ...Experiment) Set { - ret := make(Set) - for _, exp := range exps { - ret.Add(exp) - } - return ret -} - -// SetUnion constructs a new Set containing the members of all of the given -// sets. -func SetUnion(sets ...Set) Set { - ret := make(Set) - for _, set := range sets { - for exp := range set { - ret.Add(exp) - } - } - return ret -} - -// Add inserts the given experiment into the set. -// -// If the given experiment is already present then this is a no-op. -func (s Set) Add(exp Experiment) { - s[exp] = struct{}{} -} - -// Remove takes the given experiment out of the set. -// -// If the given experiment not already present then this is a no-op. -func (s Set) Remove(exp Experiment) { - delete(s, exp) -} - -// Has tests whether the given experiment is in the receiving set. -func (s Set) Has(exp Experiment) bool { - _, ok := s[exp] - return ok -} diff --git a/vendor/github.com/hashicorp/terraform/experiments/testing.go b/vendor/github.com/hashicorp/terraform/experiments/testing.go deleted file mode 100644 index 54ff2dfde..000000000 --- a/vendor/github.com/hashicorp/terraform/experiments/testing.go +++ /dev/null @@ -1,33 +0,0 @@ -package experiments - -import ( - "testing" -) - -// OverrideForTesting temporarily overrides the global tables -// of experiments in order to allow for a predictable set when unit testing -// the experiments infrastructure code. -// -// The correct way to use this function is to defer a call to its result so -// that the original tables can be restored at the conclusion of the calling -// test: -// -// defer experiments.OverrideForTesting(t, current, concluded)() -// -// This function modifies global variables that are normally fixed throughout -// our execution, so this function must not be called from non-test code and -// any test using it cannot safely run concurrently with other tests. -func OverrideForTesting(t *testing.T, current Set, concluded map[Experiment]string) func() { - // We're not currently using the given *testing.T in here, but we're - // requiring it anyway in case we might need it in future, and because - // it hopefully reinforces that only test code should be calling this. - - realCurrents := currentExperiments - realConcludeds := concludedExperiments - currentExperiments = current - concludedExperiments = concluded - return func() { - currentExperiments = realCurrents - concludedExperiments = realConcludeds - } -} diff --git a/vendor/github.com/hashicorp/terraform/helper/hilmapstructure/hilmapstructure.go b/vendor/github.com/hashicorp/terraform/helper/hilmapstructure/hilmapstructure.go deleted file mode 100644 index 67be1df1f..000000000 --- a/vendor/github.com/hashicorp/terraform/helper/hilmapstructure/hilmapstructure.go +++ /dev/null @@ -1,41 +0,0 @@ -package hilmapstructure - -import ( - "fmt" - "reflect" - - "github.com/mitchellh/mapstructure" -) - -var hilMapstructureDecodeHookEmptySlice []interface{} -var hilMapstructureDecodeHookStringSlice []string -var hilMapstructureDecodeHookEmptyMap map[string]interface{} - -// WeakDecode behaves in the same way as mapstructure.WeakDecode but has a -// DecodeHook which defeats the backward compatibility mode of mapstructure -// which WeakDecodes []interface{}{} into an empty map[string]interface{}. This -// allows us to use WeakDecode (desirable), but not fail on empty lists. -func WeakDecode(m interface{}, rawVal interface{}) error { - config := &mapstructure.DecoderConfig{ - DecodeHook: func(source reflect.Type, target reflect.Type, val interface{}) (interface{}, error) { - sliceType := reflect.TypeOf(hilMapstructureDecodeHookEmptySlice) - stringSliceType := reflect.TypeOf(hilMapstructureDecodeHookStringSlice) - mapType := reflect.TypeOf(hilMapstructureDecodeHookEmptyMap) - - if (source == sliceType || source == stringSliceType) && target == mapType { - return nil, fmt.Errorf("Cannot convert a []interface{} into a map[string]interface{}") - } - - return val, nil - }, - WeaklyTypedInput: true, - Result: rawVal, - } - - decoder, err := mapstructure.NewDecoder(config) - if err != nil { - return err - } - - return decoder.Decode(m) -} diff --git a/vendor/github.com/hashicorp/terraform/helper/logging/indent.go b/vendor/github.com/hashicorp/terraform/helper/logging/indent.go deleted file mode 100644 index e0da0d7c7..000000000 --- a/vendor/github.com/hashicorp/terraform/helper/logging/indent.go +++ /dev/null @@ -1,23 +0,0 @@ -package logging - -import ( - "strings" -) - -// Indent adds two spaces to the beginning of each line of the given string, -// with the goal of making the log level filter understand it as a line -// continuation rather than possibly as new log lines. -func Indent(s string) string { - var b strings.Builder - for len(s) > 0 { - end := strings.IndexByte(s, '\n') - if end == -1 { - end = len(s) - 1 - } - var l string - l, s = s[:end+1], s[end+1:] - b.WriteString(" ") - b.WriteString(l) - } - return b.String() -} diff --git a/vendor/github.com/hashicorp/terraform/helper/logging/level.go b/vendor/github.com/hashicorp/terraform/helper/logging/level.go deleted file mode 100644 index 0dc4dfe8d..000000000 --- a/vendor/github.com/hashicorp/terraform/helper/logging/level.go +++ /dev/null @@ -1,159 +0,0 @@ -package logging - -import ( - "bytes" - "io" - "sync" -) - -// LogLevel is a special string, conventionally written all in uppercase, that -// can be used to mark a log line for filtering and to specify filtering -// levels in the LevelFilter type. -type LogLevel string - -// LevelFilter is an io.Writer that can be used with a logger that -// will attempt to filter out log messages that aren't at least a certain -// level. -// -// This filtering is HEURISTIC-BASED, and so will not be 100% reliable. The -// assumptions it makes are: -// -// - Individual log messages are never split across multiple calls to the -// Write method. -// -// - Messages that carry levels are marked by a sequence starting with "[", -// then the level name string, and then "]". Any message without a sequence -// like this is an un-levelled message, and is not subject to filtering. -// -// - Each \n-delimited line in a write is a separate log message, unless a -// line starts with at least one space in which case it is interpreted -// as a continuation of the previous line. -// -// - If a log line starts with a non-whitespace character that isn't a digit -// then it's recognized as a degenerate continuation, because "real" log -// lines should start with a date/time and thus always have a leading -// digit. (This also cleans up after some situations where the assumptuion -// that messages arrive atomically aren't met, which is sadly sometimes -// true for longer messages that trip over some buffering behavior in -// panicwrap.) -// -// Because logging is a cross-cutting concern and not fully under the control -// of Terraform itself, there will certainly be cases where the above -// heuristics will fail. For example, it is likely that LevelFilter will -// occasionally misinterpret a continuation line as a new message because the -// code generating it doesn't know about our indentation convention. -// -// Our goal here is just to make a best effort to reduce the log volume, -// accepting that the results will not be 100% correct. -// -// Logging calls within Terraform Core should follow the above conventions so -// that the log output is broadly correct, however. -// -// Once the filter is in use somewhere, it is not safe to modify -// the structure. -type LevelFilter struct { - // Levels is the list of log levels, in increasing order of - // severity. Example might be: {"DEBUG", "WARN", "ERROR"}. - Levels []LogLevel - - // MinLevel is the minimum level allowed through - MinLevel LogLevel - - // The underlying io.Writer where log messages that pass the filter - // will be set. - Writer io.Writer - - badLevels map[LogLevel]struct{} - show bool - once sync.Once -} - -// Check will check a given line if it would be included in the level -// filter. -func (f *LevelFilter) Check(line []byte) bool { - f.once.Do(f.init) - - // Check for a log level - var level LogLevel - x := bytes.IndexByte(line, '[') - if x >= 0 { - y := bytes.IndexByte(line[x:], ']') - if y >= 0 { - level = LogLevel(line[x+1 : x+y]) - } - } - - //return level == "" - - _, ok := f.badLevels[level] - return !ok -} - -// Write is a specialized implementation of io.Writer suitable for being -// the output of a logger from the "log" package. -// -// This Writer implementation assumes that it will only recieve byte slices -// containing one or more entire lines of log output, each one terminated by -// a newline. This is compatible with the behavior of the "log" package -// directly, and is also tolerant of intermediaries that might buffer multiple -// separate writes together, as long as no individual log line is ever -// split into multiple slices. -// -// Behavior is undefined if any log line is split across multiple writes or -// written without a trailing '\n' delimiter. -func (f *LevelFilter) Write(p []byte) (n int, err error) { - for len(p) > 0 { - // Split at the first \n, inclusive - idx := bytes.IndexByte(p, '\n') - if idx == -1 { - // Invalid, undelimited write. We'll tolerate it assuming that - // our assumptions are being violated, but the results may be - // non-ideal. - idx = len(p) - 1 - break - } - var l []byte - l, p = p[:idx+1], p[idx+1:] - // Lines starting with characters other than decimal digits (including - // whitespace) are assumed to be continuations lines. This is an - // imprecise heuristic, but experimentally it seems to generate - // "good enough" results from Terraform Core's own logging. Its mileage - // may vary with output from other systems. - if l[0] >= '0' && l[0] <= '9' { - f.show = f.Check(l) - } - if f.show { - _, err = f.Writer.Write(l) - if err != nil { - // Technically it's not correct to say we've written the whole - // buffer, but for our purposes here it's good enough as we're - // only implementing io.Writer enough to satisfy logging - // use-cases. - return len(p), err - } - } - } - - // We always behave as if we wrote the whole of the buffer, even if - // we actually skipped some lines. We're only implementiong io.Writer - // enough to satisfy logging use-cases. - return len(p), nil -} - -// SetMinLevel is used to update the minimum log level -func (f *LevelFilter) SetMinLevel(min LogLevel) { - f.MinLevel = min - f.init() -} - -func (f *LevelFilter) init() { - badLevels := make(map[LogLevel]struct{}) - for _, level := range f.Levels { - if level == f.MinLevel { - break - } - badLevels[level] = struct{}{} - } - f.badLevels = badLevels - f.show = true -} diff --git a/vendor/github.com/hashicorp/terraform/helper/pathorcontents/read.go b/vendor/github.com/hashicorp/terraform/helper/pathorcontents/read.go deleted file mode 100644 index d0d4847da..000000000 --- a/vendor/github.com/hashicorp/terraform/helper/pathorcontents/read.go +++ /dev/null @@ -1,40 +0,0 @@ -// Helpers for dealing with file paths and their contents -package pathorcontents - -import ( - "io/ioutil" - "os" - - "github.com/mitchellh/go-homedir" -) - -// If the argument is a path, Read loads it and returns the contents, -// otherwise the argument is assumed to be the desired contents and is simply -// returned. -// -// The boolean second return value can be called `wasPath` - it indicates if a -// path was detected and a file loaded. -func Read(poc string) (string, bool, error) { - if len(poc) == 0 { - return poc, false, nil - } - - path := poc - if path[0] == '~' { - var err error - path, err = homedir.Expand(path) - if err != nil { - return path, true, err - } - } - - if _, err := os.Stat(path); err == nil { - contents, err := ioutil.ReadFile(path) - if err != nil { - return string(contents), true, err - } - return string(contents), true, nil - } - - return poc, false, nil -} diff --git a/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provisioner.go b/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provisioner.go deleted file mode 100644 index 088e94e4a..000000000 --- a/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provisioner.go +++ /dev/null @@ -1,201 +0,0 @@ -package plugin - -import ( - "log" - "strings" - "unicode/utf8" - - "github.com/hashicorp/terraform/helper/schema" - proto "github.com/hashicorp/terraform/internal/tfplugin5" - "github.com/hashicorp/terraform/plugin/convert" - "github.com/hashicorp/terraform/terraform" - "github.com/zclconf/go-cty/cty" - ctyconvert "github.com/zclconf/go-cty/cty/convert" - "github.com/zclconf/go-cty/cty/msgpack" - context "golang.org/x/net/context" -) - -// NewGRPCProvisionerServerShim wraps a terraform.ResourceProvisioner in a -// proto.ProvisionerServer implementation. If the provided provisioner is not a -// *schema.Provisioner, this will return nil, -func NewGRPCProvisionerServerShim(p terraform.ResourceProvisioner) *GRPCProvisionerServer { - sp, ok := p.(*schema.Provisioner) - if !ok { - return nil - } - return &GRPCProvisionerServer{ - provisioner: sp, - } -} - -type GRPCProvisionerServer struct { - provisioner *schema.Provisioner -} - -func (s *GRPCProvisionerServer) GetSchema(_ context.Context, req *proto.GetProvisionerSchema_Request) (*proto.GetProvisionerSchema_Response, error) { - resp := &proto.GetProvisionerSchema_Response{} - - resp.Provisioner = &proto.Schema{ - Block: convert.ConfigSchemaToProto(schema.InternalMap(s.provisioner.Schema).CoreConfigSchema()), - } - - return resp, nil -} - -func (s *GRPCProvisionerServer) ValidateProvisionerConfig(_ context.Context, req *proto.ValidateProvisionerConfig_Request) (*proto.ValidateProvisionerConfig_Response, error) { - resp := &proto.ValidateProvisionerConfig_Response{} - - cfgSchema := schema.InternalMap(s.provisioner.Schema).CoreConfigSchema() - - configVal, err := msgpack.Unmarshal(req.Config.Msgpack, cfgSchema.ImpliedType()) - if err != nil { - resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err) - return resp, nil - } - - config := terraform.NewResourceConfigShimmed(configVal, cfgSchema) - - warns, errs := s.provisioner.Validate(config) - resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, convert.WarnsAndErrsToProto(warns, errs)) - - return resp, nil -} - -// stringMapFromValue converts a cty.Value to a map[stirng]string. -// This will panic if the val is not a cty.Map(cty.String). -func stringMapFromValue(val cty.Value) map[string]string { - m := map[string]string{} - if val.IsNull() || !val.IsKnown() { - return m - } - - for it := val.ElementIterator(); it.Next(); { - ak, av := it.Element() - name := ak.AsString() - - if !av.IsKnown() || av.IsNull() { - continue - } - - av, _ = ctyconvert.Convert(av, cty.String) - m[name] = av.AsString() - } - - return m -} - -// uiOutput implements the terraform.UIOutput interface to adapt the grpc -// stream to the legacy Provisioner.Apply method. -type uiOutput struct { - srv proto.Provisioner_ProvisionResourceServer -} - -func (o uiOutput) Output(s string) { - err := o.srv.Send(&proto.ProvisionResource_Response{ - Output: toValidUTF8(s, string(utf8.RuneError)), - }) - if err != nil { - log.Printf("[ERROR] %s", err) - } -} - -func (s *GRPCProvisionerServer) ProvisionResource(req *proto.ProvisionResource_Request, srv proto.Provisioner_ProvisionResourceServer) error { - // We send back a diagnostics over the stream if there was a - // provisioner-side problem. - srvResp := &proto.ProvisionResource_Response{} - - cfgSchema := schema.InternalMap(s.provisioner.Schema).CoreConfigSchema() - cfgVal, err := msgpack.Unmarshal(req.Config.Msgpack, cfgSchema.ImpliedType()) - if err != nil { - srvResp.Diagnostics = convert.AppendProtoDiag(srvResp.Diagnostics, err) - srv.Send(srvResp) - return nil - } - resourceConfig := terraform.NewResourceConfigShimmed(cfgVal, cfgSchema) - - connVal, err := msgpack.Unmarshal(req.Connection.Msgpack, cty.Map(cty.String)) - if err != nil { - srvResp.Diagnostics = convert.AppendProtoDiag(srvResp.Diagnostics, err) - srv.Send(srvResp) - return nil - } - - conn := stringMapFromValue(connVal) - - instanceState := &terraform.InstanceState{ - Ephemeral: terraform.EphemeralState{ - ConnInfo: conn, - }, - Meta: make(map[string]interface{}), - } - - err = s.provisioner.Apply(uiOutput{srv}, instanceState, resourceConfig) - if err != nil { - srvResp.Diagnostics = convert.AppendProtoDiag(srvResp.Diagnostics, err) - srv.Send(srvResp) - } - return nil -} - -func (s *GRPCProvisionerServer) Stop(_ context.Context, req *proto.Stop_Request) (*proto.Stop_Response, error) { - resp := &proto.Stop_Response{} - - err := s.provisioner.Stop() - if err != nil { - resp.Error = err.Error() - } - - return resp, nil -} - -// FIXME: backported from go1.13 strings package, remove once terraform is -// using go >= 1.13 -// ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences -// replaced by the replacement string, which may be empty. -func toValidUTF8(s, replacement string) string { - var b strings.Builder - - for i, c := range s { - if c != utf8.RuneError { - continue - } - - _, wid := utf8.DecodeRuneInString(s[i:]) - if wid == 1 { - b.Grow(len(s) + len(replacement)) - b.WriteString(s[:i]) - s = s[i:] - break - } - } - - // Fast path for unchanged input - if b.Cap() == 0 { // didn't call b.Grow above - return s - } - - invalid := false // previous byte was from an invalid UTF-8 sequence - for i := 0; i < len(s); { - c := s[i] - if c < utf8.RuneSelf { - i++ - invalid = false - b.WriteByte(c) - continue - } - _, wid := utf8.DecodeRuneInString(s[i:]) - if wid == 1 { - i++ - if !invalid { - invalid = true - b.WriteString(replacement) - } - continue - } - invalid = false - b.WriteString(s[i : i+wid]) - i += wid - } - - return b.String() -} diff --git a/vendor/github.com/hashicorp/terraform/helper/schema/provisioner.go b/vendor/github.com/hashicorp/terraform/helper/schema/provisioner.go deleted file mode 100644 index eee155bfb..000000000 --- a/vendor/github.com/hashicorp/terraform/helper/schema/provisioner.go +++ /dev/null @@ -1,205 +0,0 @@ -package schema - -import ( - "context" - "errors" - "fmt" - "sync" - - "github.com/hashicorp/go-multierror" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/terraform" -) - -// Provisioner represents a resource provisioner in Terraform and properly -// implements all of the ResourceProvisioner API. -// -// This higher level structure makes it much easier to implement a new or -// custom provisioner for Terraform. -// -// The function callbacks for this structure are all passed a context object. -// This context object has a number of pre-defined values that can be accessed -// via the global functions defined in context.go. -type Provisioner struct { - // ConnSchema is the schema for the connection settings for this - // provisioner. - // - // The keys of this map are the configuration keys, and the value is - // the schema describing the value of the configuration. - // - // NOTE: The value of connection keys can only be strings for now. - ConnSchema map[string]*Schema - - // Schema is the schema for the usage of this provisioner. - // - // The keys of this map are the configuration keys, and the value is - // the schema describing the value of the configuration. - Schema map[string]*Schema - - // ApplyFunc is the function for executing the provisioner. This is required. - // It is given a context. See the Provisioner struct docs for more - // information. - ApplyFunc func(ctx context.Context) error - - // ValidateFunc is a function for extended validation. This is optional - // and should be used when individual field validation is not enough. - ValidateFunc func(*terraform.ResourceConfig) ([]string, []error) - - stopCtx context.Context - stopCtxCancel context.CancelFunc - stopOnce sync.Once -} - -// Keys that can be used to access data in the context parameters for -// Provisioners. -var ( - connDataInvalid = contextKey("data invalid") - - // This returns a *ResourceData for the connection information. - // Guaranteed to never be nil. - ProvConnDataKey = contextKey("provider conn data") - - // This returns a *ResourceData for the config information. - // Guaranteed to never be nil. - ProvConfigDataKey = contextKey("provider config data") - - // This returns a terraform.UIOutput. Guaranteed to never be nil. - ProvOutputKey = contextKey("provider output") - - // This returns the raw InstanceState passed to Apply. Guaranteed to - // be set, but may be nil. - ProvRawStateKey = contextKey("provider raw state") -) - -// InternalValidate should be called to validate the structure -// of the provisioner. -// -// This should be called in a unit test to verify before release that this -// structure is properly configured for use. -func (p *Provisioner) InternalValidate() error { - if p == nil { - return errors.New("provisioner is nil") - } - - var validationErrors error - { - sm := schemaMap(p.ConnSchema) - if err := sm.InternalValidate(sm); err != nil { - validationErrors = multierror.Append(validationErrors, err) - } - } - - { - sm := schemaMap(p.Schema) - if err := sm.InternalValidate(sm); err != nil { - validationErrors = multierror.Append(validationErrors, err) - } - } - - if p.ApplyFunc == nil { - validationErrors = multierror.Append(validationErrors, fmt.Errorf( - "ApplyFunc must not be nil")) - } - - return validationErrors -} - -// StopContext returns a context that checks whether a provisioner is stopped. -func (p *Provisioner) StopContext() context.Context { - p.stopOnce.Do(p.stopInit) - return p.stopCtx -} - -func (p *Provisioner) stopInit() { - p.stopCtx, p.stopCtxCancel = context.WithCancel(context.Background()) -} - -// Stop implementation of terraform.ResourceProvisioner interface. -func (p *Provisioner) Stop() error { - p.stopOnce.Do(p.stopInit) - p.stopCtxCancel() - return nil -} - -// GetConfigSchema implementation of terraform.ResourceProvisioner interface. -func (p *Provisioner) GetConfigSchema() (*configschema.Block, error) { - return schemaMap(p.Schema).CoreConfigSchema(), nil -} - -// Apply implementation of terraform.ResourceProvisioner interface. -func (p *Provisioner) Apply( - o terraform.UIOutput, - s *terraform.InstanceState, - c *terraform.ResourceConfig) error { - var connData, configData *ResourceData - - { - // We first need to turn the connection information into a - // terraform.ResourceConfig so that we can use that type to more - // easily build a ResourceData structure. We do this by simply treating - // the conn info as configuration input. - raw := make(map[string]interface{}) - if s != nil { - for k, v := range s.Ephemeral.ConnInfo { - raw[k] = v - } - } - - c := terraform.NewResourceConfigRaw(raw) - sm := schemaMap(p.ConnSchema) - diff, err := sm.Diff(nil, c, nil, nil, true) - if err != nil { - return err - } - connData, err = sm.Data(nil, diff) - if err != nil { - return err - } - } - - { - // Build the configuration data. Doing this requires making a "diff" - // even though that's never used. We use that just to get the correct types. - configMap := schemaMap(p.Schema) - diff, err := configMap.Diff(nil, c, nil, nil, true) - if err != nil { - return err - } - configData, err = configMap.Data(nil, diff) - if err != nil { - return err - } - } - - // Build the context and call the function - ctx := p.StopContext() - ctx = context.WithValue(ctx, ProvConnDataKey, connData) - ctx = context.WithValue(ctx, ProvConfigDataKey, configData) - ctx = context.WithValue(ctx, ProvOutputKey, o) - ctx = context.WithValue(ctx, ProvRawStateKey, s) - return p.ApplyFunc(ctx) -} - -// Validate implements the terraform.ResourceProvisioner interface. -func (p *Provisioner) Validate(c *terraform.ResourceConfig) (ws []string, es []error) { - if err := p.InternalValidate(); err != nil { - return nil, []error{fmt.Errorf( - "Internal validation of the provisioner failed! This is always a bug\n"+ - "with the provisioner itself, and not a user issue. Please report\n"+ - "this bug:\n\n%s", err)} - } - - if p.Schema != nil { - w, e := schemaMap(p.Schema).Validate(c) - ws = append(ws, w...) - es = append(es, e...) - } - - if p.ValidateFunc != nil { - w, e := p.ValidateFunc(c) - ws = append(ws, w...) - es = append(es, e...) - } - - return ws, es -} diff --git a/vendor/github.com/hashicorp/terraform/httpclient/client.go b/vendor/github.com/hashicorp/terraform/httpclient/client.go deleted file mode 100644 index bb06beb47..000000000 --- a/vendor/github.com/hashicorp/terraform/httpclient/client.go +++ /dev/null @@ -1,18 +0,0 @@ -package httpclient - -import ( - "net/http" - - cleanhttp "github.com/hashicorp/go-cleanhttp" -) - -// New returns the DefaultPooledClient from the cleanhttp -// package that will also send a Terraform User-Agent string. -func New() *http.Client { - cli := cleanhttp.DefaultPooledClient() - cli.Transport = &userAgentRoundTripper{ - userAgent: UserAgentString(), - inner: cli.Transport, - } - return cli -} diff --git a/vendor/github.com/hashicorp/terraform/plugin/resource_provisioner.go b/vendor/github.com/hashicorp/terraform/plugin/resource_provisioner.go deleted file mode 100644 index f0cc341f1..000000000 --- a/vendor/github.com/hashicorp/terraform/plugin/resource_provisioner.go +++ /dev/null @@ -1,182 +0,0 @@ -package plugin - -import ( - "net/rpc" - - "github.com/hashicorp/go-plugin" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/terraform" -) - -// ResourceProvisionerPlugin is the plugin.Plugin implementation. -type ResourceProvisionerPlugin struct { - ResourceProvisioner func() terraform.ResourceProvisioner -} - -func (p *ResourceProvisionerPlugin) Server(b *plugin.MuxBroker) (interface{}, error) { - return &ResourceProvisionerServer{ - Broker: b, - Provisioner: p.ResourceProvisioner(), - }, nil -} - -func (p *ResourceProvisionerPlugin) Client( - b *plugin.MuxBroker, c *rpc.Client) (interface{}, error) { - return &ResourceProvisioner{Broker: b, Client: c}, nil -} - -// ResourceProvisioner is an implementation of terraform.ResourceProvisioner -// that communicates over RPC. -type ResourceProvisioner struct { - Broker *plugin.MuxBroker - Client *rpc.Client -} - -func (p *ResourceProvisioner) GetConfigSchema() (*configschema.Block, error) { - panic("not implemented") - return nil, nil -} - -func (p *ResourceProvisioner) Validate(c *terraform.ResourceConfig) ([]string, []error) { - var resp ResourceProvisionerValidateResponse - args := ResourceProvisionerValidateArgs{ - Config: c, - } - - err := p.Client.Call("Plugin.Validate", &args, &resp) - if err != nil { - return nil, []error{err} - } - - var errs []error - if len(resp.Errors) > 0 { - errs = make([]error, len(resp.Errors)) - for i, err := range resp.Errors { - errs[i] = err - } - } - - return resp.Warnings, errs -} - -func (p *ResourceProvisioner) Apply( - output terraform.UIOutput, - s *terraform.InstanceState, - c *terraform.ResourceConfig) error { - id := p.Broker.NextId() - go p.Broker.AcceptAndServe(id, &UIOutputServer{ - UIOutput: output, - }) - - var resp ResourceProvisionerApplyResponse - args := &ResourceProvisionerApplyArgs{ - OutputId: id, - State: s, - Config: c, - } - - err := p.Client.Call("Plugin.Apply", args, &resp) - if err != nil { - return err - } - if resp.Error != nil { - err = resp.Error - } - - return err -} - -func (p *ResourceProvisioner) Stop() error { - var resp ResourceProvisionerStopResponse - err := p.Client.Call("Plugin.Stop", new(interface{}), &resp) - if err != nil { - return err - } - if resp.Error != nil { - err = resp.Error - } - - return err -} - -func (p *ResourceProvisioner) Close() error { - return p.Client.Close() -} - -type ResourceProvisionerValidateArgs struct { - Config *terraform.ResourceConfig -} - -type ResourceProvisionerValidateResponse struct { - Warnings []string - Errors []*plugin.BasicError -} - -type ResourceProvisionerApplyArgs struct { - OutputId uint32 - State *terraform.InstanceState - Config *terraform.ResourceConfig -} - -type ResourceProvisionerApplyResponse struct { - Error *plugin.BasicError -} - -type ResourceProvisionerStopResponse struct { - Error *plugin.BasicError -} - -// ResourceProvisionerServer is a net/rpc compatible structure for serving -// a ResourceProvisioner. This should not be used directly. -type ResourceProvisionerServer struct { - Broker *plugin.MuxBroker - Provisioner terraform.ResourceProvisioner -} - -func (s *ResourceProvisionerServer) Apply( - args *ResourceProvisionerApplyArgs, - result *ResourceProvisionerApplyResponse) error { - conn, err := s.Broker.Dial(args.OutputId) - if err != nil { - *result = ResourceProvisionerApplyResponse{ - Error: plugin.NewBasicError(err), - } - return nil - } - client := rpc.NewClient(conn) - defer client.Close() - - output := &UIOutput{Client: client} - - err = s.Provisioner.Apply(output, args.State, args.Config) - *result = ResourceProvisionerApplyResponse{ - Error: plugin.NewBasicError(err), - } - return nil -} - -func (s *ResourceProvisionerServer) Validate( - args *ResourceProvisionerValidateArgs, - reply *ResourceProvisionerValidateResponse) error { - warns, errs := s.Provisioner.Validate(args.Config) - berrs := make([]*plugin.BasicError, len(errs)) - for i, err := range errs { - berrs[i] = plugin.NewBasicError(err) - } - *reply = ResourceProvisionerValidateResponse{ - Warnings: warns, - Errors: berrs, - } - return nil -} - -func (s *ResourceProvisionerServer) Stop( - _ interface{}, - reply *ResourceProvisionerStopResponse) error { - err := s.Provisioner.Stop() - *reply = ResourceProvisionerStopResponse{ - Error: plugin.NewBasicError(err), - } - - return nil -} diff --git a/vendor/github.com/hashicorp/terraform/terraform/user_agent.go b/vendor/github.com/hashicorp/terraform/terraform/user_agent.go deleted file mode 100644 index 97f1ec1f6..000000000 --- a/vendor/github.com/hashicorp/terraform/terraform/user_agent.go +++ /dev/null @@ -1,12 +0,0 @@ -package terraform - -import ( - "github.com/hashicorp/terraform/httpclient" -) - -// Generate a UserAgent string -// -// Deprecated: Use httpclient.UserAgent(version) instead -func UserAgentString() string { - return httpclient.UserAgentString() -} diff --git a/vendor/github.com/hashicorp/terraform/terraform/version.go b/vendor/github.com/hashicorp/terraform/terraform/version.go deleted file mode 100644 index 0caeca0ad..000000000 --- a/vendor/github.com/hashicorp/terraform/terraform/version.go +++ /dev/null @@ -1,10 +0,0 @@ -package terraform - -import ( - "github.com/hashicorp/terraform/version" -) - -// Deprecated: Providers should use schema.Provider.TerraformVersion instead -func VersionString() string { - return version.String() -} diff --git a/vendor/github.com/hashicorp/terraform/tfdiags/consolidate_warnings.go b/vendor/github.com/hashicorp/terraform/tfdiags/consolidate_warnings.go deleted file mode 100644 index 06f3d52cc..000000000 --- a/vendor/github.com/hashicorp/terraform/tfdiags/consolidate_warnings.go +++ /dev/null @@ -1,146 +0,0 @@ -package tfdiags - -import "fmt" - -// ConsolidateWarnings checks if there is an unreasonable amount of warnings -// with the same summary in the receiver and, if so, returns a new diagnostics -// with some of those warnings consolidated into a single warning in order -// to reduce the verbosity of the output. -// -// This mechanism is here primarily for diagnostics printed out at the CLI. In -// other contexts it is likely better to just return the warnings directly, -// particularly if they are going to be interpreted by software rather than -// by a human reader. -// -// The returned slice always has a separate backing array from the reciever, -// but some diagnostic values themselves might be shared. -// -// The definition of "unreasonable" is given as the threshold argument. At most -// that many warnings with the same summary will be shown. -func (diags Diagnostics) ConsolidateWarnings(threshold int) Diagnostics { - if len(diags) == 0 { - return nil - } - - newDiags := make(Diagnostics, 0, len(diags)) - - // We'll track how many times we've seen each warning summary so we can - // decide when to start consolidating. Once we _have_ started consolidating, - // we'll also track the object representing the consolidated warning - // so we can continue appending to it. - warningStats := make(map[string]int) - warningGroups := make(map[string]*warningGroup) - - for _, diag := range diags { - severity := diag.Severity() - if severity != Warning || diag.Source().Subject == nil { - // Only warnings can get special treatment, and we only - // consolidate warnings that have source locations because - // our primary goal here is to deal with the situation where - // some configuration language feature is producing a warning - // each time it's used across a potentially-large config. - newDiags = newDiags.Append(diag) - continue - } - - desc := diag.Description() - summary := desc.Summary - if g, ok := warningGroups[summary]; ok { - // We're already grouping this one, so we'll just continue it. - g.Append(diag) - continue - } - - warningStats[summary]++ - if warningStats[summary] == threshold { - // Initially creating the group doesn't really change anything - // visibly in the result, since a group with only one warning - // is just a passthrough anyway, but once we do this any additional - // warnings with the same summary will get appended to this group. - g := &warningGroup{} - newDiags = newDiags.Append(g) - warningGroups[summary] = g - g.Append(diag) - continue - } - - // If this warning is not consolidating yet then we'll just append - // it directly. - newDiags = newDiags.Append(diag) - } - - return newDiags -} - -// A warningGroup is one or more warning diagnostics grouped together for -// UI consolidation purposes. -// -// A warningGroup with only one diagnostic in it is just a passthrough for -// that one diagnostic. If it has more than one then it will behave mostly -// like the first one but its detail message will include an additional -// sentence mentioning the consolidation. A warningGroup with no diagnostics -// at all is invalid and will panic when used. -type warningGroup struct { - Warnings Diagnostics -} - -var _ Diagnostic = (*warningGroup)(nil) - -func (wg *warningGroup) Severity() Severity { - return wg.Warnings[0].Severity() -} - -func (wg *warningGroup) Description() Description { - desc := wg.Warnings[0].Description() - if len(wg.Warnings) < 2 { - return desc - } - extraCount := len(wg.Warnings) - 1 - var msg string - switch extraCount { - case 1: - msg = "(and one more similar warning elsewhere)" - default: - msg = fmt.Sprintf("(and %d more similar warnings elsewhere)", extraCount) - } - if desc.Detail != "" { - desc.Detail = desc.Detail + "\n\n" + msg - } else { - desc.Detail = msg - } - return desc -} - -func (wg *warningGroup) Source() Source { - return wg.Warnings[0].Source() -} - -func (wg *warningGroup) FromExpr() *FromExpr { - return wg.Warnings[0].FromExpr() -} - -func (wg *warningGroup) Append(diag Diagnostic) { - if diag.Severity() != Warning { - panic("can't append a non-warning diagnostic to a warningGroup") - } - wg.Warnings = append(wg.Warnings, diag) -} - -// WarningGroupSourceRanges can be used in conjunction with -// Diagnostics.ConsolidateWarnings to recover the full set of original source -// locations from a consolidated warning. -// -// For convenience, this function accepts any diagnostic and will just return -// the single Source value from any diagnostic that isn't a warning group. -func WarningGroupSourceRanges(diag Diagnostic) []Source { - wg, ok := diag.(*warningGroup) - if !ok { - return []Source{diag.Source()} - } - - ret := make([]Source, len(wg.Warnings)) - for i, wrappedDiag := range wg.Warnings { - ret[i] = wrappedDiag.Source() - } - return ret -} diff --git a/vendor/github.com/hashicorp/yamux/go.mod b/vendor/github.com/hashicorp/yamux/go.mod new file mode 100644 index 000000000..672a0e581 --- /dev/null +++ b/vendor/github.com/hashicorp/yamux/go.mod @@ -0,0 +1 @@ +module github.com/hashicorp/yamux diff --git a/vendor/github.com/hashicorp/yamux/mux.go b/vendor/github.com/hashicorp/yamux/mux.go index 7abc7c744..18a078c8a 100644 --- a/vendor/github.com/hashicorp/yamux/mux.go +++ b/vendor/github.com/hashicorp/yamux/mux.go @@ -3,6 +3,7 @@ package yamux import ( "fmt" "io" + "log" "os" "time" ) @@ -30,8 +31,13 @@ type Config struct { // window size that we allow for a stream. MaxStreamWindowSize uint32 - // LogOutput is used to control the log destination + // LogOutput is used to control the log destination. Either Logger or + // LogOutput can be set, not both. LogOutput io.Writer + + // Logger is used to pass in the logger to be used. Either Logger or + // LogOutput can be set, not both. + Logger *log.Logger } // DefaultConfig is used to return a default configuration @@ -57,6 +63,11 @@ func VerifyConfig(config *Config) error { if config.MaxStreamWindowSize < initialStreamWindow { return fmt.Errorf("MaxStreamWindowSize must be larger than %d", initialStreamWindow) } + if config.LogOutput != nil && config.Logger != nil { + return fmt.Errorf("both Logger and LogOutput may not be set, select one") + } else if config.LogOutput == nil && config.Logger == nil { + return fmt.Errorf("one of Logger or LogOutput must be set, select one") + } return nil } diff --git a/vendor/github.com/hashicorp/yamux/session.go b/vendor/github.com/hashicorp/yamux/session.go index 32ba02e02..a80ddec35 100644 --- a/vendor/github.com/hashicorp/yamux/session.go +++ b/vendor/github.com/hashicorp/yamux/session.go @@ -86,9 +86,14 @@ type sendReady struct { // newSession is used to construct a new session func newSession(config *Config, conn io.ReadWriteCloser, client bool) *Session { + logger := config.Logger + if logger == nil { + logger = log.New(config.LogOutput, "", log.LstdFlags) + } + s := &Session{ config: config, - logger: log.New(config.LogOutput, "", log.LstdFlags), + logger: logger, conn: conn, bufRead: bufio.NewReader(conn), pings: make(map[uint32]chan struct{}), diff --git a/vendor/github.com/mitchellh/hashstructure/LICENSE b/vendor/github.com/mitchellh/hashstructure/LICENSE deleted file mode 100644 index a3866a291..000000000 --- a/vendor/github.com/mitchellh/hashstructure/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Mitchell Hashimoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/mitchellh/hashstructure/README.md b/vendor/github.com/mitchellh/hashstructure/README.md deleted file mode 100644 index 28ce45a3e..000000000 --- a/vendor/github.com/mitchellh/hashstructure/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# hashstructure [![GoDoc](https://godoc.org/github.com/mitchellh/hashstructure?status.svg)](https://godoc.org/github.com/mitchellh/hashstructure) - -hashstructure is a Go library for creating a unique hash value -for arbitrary values in Go. - -This can be used to key values in a hash (for use in a map, set, etc.) -that are complex. The most common use case is comparing two values without -sending data across the network, caching values locally (de-dup), and so on. - -## Features - - * Hash any arbitrary Go value, including complex types. - - * Tag a struct field to ignore it and not affect the hash value. - - * Tag a slice type struct field to treat it as a set where ordering - doesn't affect the hash code but the field itself is still taken into - account to create the hash value. - - * Optionally specify a custom hash function to optimize for speed, collision - avoidance for your data set, etc. - - * Optionally hash the output of `.String()` on structs that implement fmt.Stringer, - allowing effective hashing of time.Time - -## Installation - -Standard `go get`: - -``` -$ go get github.com/mitchellh/hashstructure -``` - -## Usage & Example - -For usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/hashstructure). - -A quick code example is shown below: - -```go -type ComplexStruct struct { - Name string - Age uint - Metadata map[string]interface{} -} - -v := ComplexStruct{ - Name: "mitchellh", - Age: 64, - Metadata: map[string]interface{}{ - "car": true, - "location": "California", - "siblings": []string{"Bob", "John"}, - }, -} - -hash, err := hashstructure.Hash(v, nil) -if err != nil { - panic(err) -} - -fmt.Printf("%d", hash) -// Output: -// 2307517237273902113 -``` diff --git a/vendor/github.com/mitchellh/hashstructure/go.mod b/vendor/github.com/mitchellh/hashstructure/go.mod deleted file mode 100644 index 966582aa9..000000000 --- a/vendor/github.com/mitchellh/hashstructure/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/mitchellh/hashstructure diff --git a/vendor/github.com/mitchellh/hashstructure/hashstructure.go b/vendor/github.com/mitchellh/hashstructure/hashstructure.go deleted file mode 100644 index ea13a1583..000000000 --- a/vendor/github.com/mitchellh/hashstructure/hashstructure.go +++ /dev/null @@ -1,358 +0,0 @@ -package hashstructure - -import ( - "encoding/binary" - "fmt" - "hash" - "hash/fnv" - "reflect" -) - -// ErrNotStringer is returned when there's an error with hash:"string" -type ErrNotStringer struct { - Field string -} - -// Error implements error for ErrNotStringer -func (ens *ErrNotStringer) Error() string { - return fmt.Sprintf("hashstructure: %s has hash:\"string\" set, but does not implement fmt.Stringer", ens.Field) -} - -// HashOptions are options that are available for hashing. -type HashOptions struct { - // Hasher is the hash function to use. If this isn't set, it will - // default to FNV. - Hasher hash.Hash64 - - // TagName is the struct tag to look at when hashing the structure. - // By default this is "hash". - TagName string - - // ZeroNil is flag determining if nil pointer should be treated equal - // to a zero value of pointed type. By default this is false. - ZeroNil bool -} - -// Hash returns the hash value of an arbitrary value. -// -// If opts is nil, then default options will be used. See HashOptions -// for the default values. The same *HashOptions value cannot be used -// concurrently. None of the values within a *HashOptions struct are -// safe to read/write while hashing is being done. -// -// Notes on the value: -// -// * Unexported fields on structs are ignored and do not affect the -// hash value. -// -// * Adding an exported field to a struct with the zero value will change -// the hash value. -// -// For structs, the hashing can be controlled using tags. For example: -// -// struct { -// Name string -// UUID string `hash:"ignore"` -// } -// -// The available tag values are: -// -// * "ignore" or "-" - The field will be ignored and not affect the hash code. -// -// * "set" - The field will be treated as a set, where ordering doesn't -// affect the hash code. This only works for slices. -// -// * "string" - The field will be hashed as a string, only works when the -// field implements fmt.Stringer -// -func Hash(v interface{}, opts *HashOptions) (uint64, error) { - // Create default options - if opts == nil { - opts = &HashOptions{} - } - if opts.Hasher == nil { - opts.Hasher = fnv.New64() - } - if opts.TagName == "" { - opts.TagName = "hash" - } - - // Reset the hash - opts.Hasher.Reset() - - // Create our walker and walk the structure - w := &walker{ - h: opts.Hasher, - tag: opts.TagName, - zeronil: opts.ZeroNil, - } - return w.visit(reflect.ValueOf(v), nil) -} - -type walker struct { - h hash.Hash64 - tag string - zeronil bool -} - -type visitOpts struct { - // Flags are a bitmask of flags to affect behavior of this visit - Flags visitFlag - - // Information about the struct containing this field - Struct interface{} - StructField string -} - -func (w *walker) visit(v reflect.Value, opts *visitOpts) (uint64, error) { - t := reflect.TypeOf(0) - - // Loop since these can be wrapped in multiple layers of pointers - // and interfaces. - for { - // If we have an interface, dereference it. We have to do this up - // here because it might be a nil in there and the check below must - // catch that. - if v.Kind() == reflect.Interface { - v = v.Elem() - continue - } - - if v.Kind() == reflect.Ptr { - if w.zeronil { - t = v.Type().Elem() - } - v = reflect.Indirect(v) - continue - } - - break - } - - // If it is nil, treat it like a zero. - if !v.IsValid() { - v = reflect.Zero(t) - } - - // Binary writing can use raw ints, we have to convert to - // a sized-int, we'll choose the largest... - switch v.Kind() { - case reflect.Int: - v = reflect.ValueOf(int64(v.Int())) - case reflect.Uint: - v = reflect.ValueOf(uint64(v.Uint())) - case reflect.Bool: - var tmp int8 - if v.Bool() { - tmp = 1 - } - v = reflect.ValueOf(tmp) - } - - k := v.Kind() - - // We can shortcut numeric values by directly binary writing them - if k >= reflect.Int && k <= reflect.Complex64 { - // A direct hash calculation - w.h.Reset() - err := binary.Write(w.h, binary.LittleEndian, v.Interface()) - return w.h.Sum64(), err - } - - switch k { - case reflect.Array: - var h uint64 - l := v.Len() - for i := 0; i < l; i++ { - current, err := w.visit(v.Index(i), nil) - if err != nil { - return 0, err - } - - h = hashUpdateOrdered(w.h, h, current) - } - - return h, nil - - case reflect.Map: - var includeMap IncludableMap - if opts != nil && opts.Struct != nil { - if v, ok := opts.Struct.(IncludableMap); ok { - includeMap = v - } - } - - // Build the hash for the map. We do this by XOR-ing all the key - // and value hashes. This makes it deterministic despite ordering. - var h uint64 - for _, k := range v.MapKeys() { - v := v.MapIndex(k) - if includeMap != nil { - incl, err := includeMap.HashIncludeMap( - opts.StructField, k.Interface(), v.Interface()) - if err != nil { - return 0, err - } - if !incl { - continue - } - } - - kh, err := w.visit(k, nil) - if err != nil { - return 0, err - } - vh, err := w.visit(v, nil) - if err != nil { - return 0, err - } - - fieldHash := hashUpdateOrdered(w.h, kh, vh) - h = hashUpdateUnordered(h, fieldHash) - } - - return h, nil - - case reflect.Struct: - parent := v.Interface() - var include Includable - if impl, ok := parent.(Includable); ok { - include = impl - } - - t := v.Type() - h, err := w.visit(reflect.ValueOf(t.Name()), nil) - if err != nil { - return 0, err - } - - l := v.NumField() - for i := 0; i < l; i++ { - if innerV := v.Field(i); v.CanSet() || t.Field(i).Name != "_" { - var f visitFlag - fieldType := t.Field(i) - if fieldType.PkgPath != "" { - // Unexported - continue - } - - tag := fieldType.Tag.Get(w.tag) - if tag == "ignore" || tag == "-" { - // Ignore this field - continue - } - - // if string is set, use the string value - if tag == "string" { - if impl, ok := innerV.Interface().(fmt.Stringer); ok { - innerV = reflect.ValueOf(impl.String()) - } else { - return 0, &ErrNotStringer{ - Field: v.Type().Field(i).Name, - } - } - } - - // Check if we implement includable and check it - if include != nil { - incl, err := include.HashInclude(fieldType.Name, innerV) - if err != nil { - return 0, err - } - if !incl { - continue - } - } - - switch tag { - case "set": - f |= visitFlagSet - } - - kh, err := w.visit(reflect.ValueOf(fieldType.Name), nil) - if err != nil { - return 0, err - } - - vh, err := w.visit(innerV, &visitOpts{ - Flags: f, - Struct: parent, - StructField: fieldType.Name, - }) - if err != nil { - return 0, err - } - - fieldHash := hashUpdateOrdered(w.h, kh, vh) - h = hashUpdateUnordered(h, fieldHash) - } - } - - return h, nil - - case reflect.Slice: - // We have two behaviors here. If it isn't a set, then we just - // visit all the elements. If it is a set, then we do a deterministic - // hash code. - var h uint64 - var set bool - if opts != nil { - set = (opts.Flags & visitFlagSet) != 0 - } - l := v.Len() - for i := 0; i < l; i++ { - current, err := w.visit(v.Index(i), nil) - if err != nil { - return 0, err - } - - if set { - h = hashUpdateUnordered(h, current) - } else { - h = hashUpdateOrdered(w.h, h, current) - } - } - - return h, nil - - case reflect.String: - // Directly hash - w.h.Reset() - _, err := w.h.Write([]byte(v.String())) - return w.h.Sum64(), err - - default: - return 0, fmt.Errorf("unknown kind to hash: %s", k) - } - -} - -func hashUpdateOrdered(h hash.Hash64, a, b uint64) uint64 { - // For ordered updates, use a real hash function - h.Reset() - - // We just panic if the binary writes fail because we are writing - // an int64 which should never be fail-able. - e1 := binary.Write(h, binary.LittleEndian, a) - e2 := binary.Write(h, binary.LittleEndian, b) - if e1 != nil { - panic(e1) - } - if e2 != nil { - panic(e2) - } - - return h.Sum64() -} - -func hashUpdateUnordered(a, b uint64) uint64 { - return a ^ b -} - -// visitFlag is used as a bitmask for affecting visit behavior -type visitFlag uint - -const ( - visitFlagInvalid visitFlag = iota - visitFlagSet = iota << 1 -) diff --git a/vendor/github.com/mitchellh/hashstructure/include.go b/vendor/github.com/mitchellh/hashstructure/include.go deleted file mode 100644 index b6289c0be..000000000 --- a/vendor/github.com/mitchellh/hashstructure/include.go +++ /dev/null @@ -1,15 +0,0 @@ -package hashstructure - -// Includable is an interface that can optionally be implemented by -// a struct. It will be called for each field in the struct to check whether -// it should be included in the hash. -type Includable interface { - HashInclude(field string, v interface{}) (bool, error) -} - -// IncludableMap is an interface that can optionally be implemented by -// a struct. It will be called when a map-type field is found to ask the -// struct if the map item should be included in the hash. -type IncludableMap interface { - HashIncludeMap(field string, k, v interface{}) (bool, error) -} diff --git a/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go b/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go index d7ab7b6d7..3a93a0b11 100644 --- a/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go +++ b/vendor/github.com/mitchellh/reflectwalk/reflectwalk.go @@ -230,7 +230,8 @@ func walkMap(v reflect.Value, w interface{}) error { ew.Enter(MapValue) } - if err := walk(kv, w); err != nil { + // get the map value again as it may have changed in the MapElem call + if err := walk(v.MapIndex(k), w); err != nil { return err } diff --git a/vendor/github.com/pkg/errors/.travis.yml b/vendor/github.com/pkg/errors/.travis.yml index 588ceca18..9159de03e 100644 --- a/vendor/github.com/pkg/errors/.travis.yml +++ b/vendor/github.com/pkg/errors/.travis.yml @@ -1,11 +1,10 @@ language: go go_import_path: github.com/pkg/errors go: - - 1.4.3 - - 1.5.4 - - 1.6.2 - - 1.7.1 + - 1.11.x + - 1.12.x + - 1.13.x - tip script: - - go test -v ./... + - make check diff --git a/vendor/github.com/pkg/errors/Makefile b/vendor/github.com/pkg/errors/Makefile new file mode 100644 index 000000000..ce9d7cded --- /dev/null +++ b/vendor/github.com/pkg/errors/Makefile @@ -0,0 +1,44 @@ +PKGS := github.com/pkg/errors +SRCDIRS := $(shell go list -f '{{.Dir}}' $(PKGS)) +GO := go + +check: test vet gofmt misspell unconvert staticcheck ineffassign unparam + +test: + $(GO) test $(PKGS) + +vet: | test + $(GO) vet $(PKGS) + +staticcheck: + $(GO) get honnef.co/go/tools/cmd/staticcheck + staticcheck -checks all $(PKGS) + +misspell: + $(GO) get github.com/client9/misspell/cmd/misspell + misspell \ + -locale GB \ + -error \ + *.md *.go + +unconvert: + $(GO) get github.com/mdempsky/unconvert + unconvert -v $(PKGS) + +ineffassign: + $(GO) get github.com/gordonklaus/ineffassign + find $(SRCDIRS) -name '*.go' | xargs ineffassign + +pedantic: check errcheck + +unparam: + $(GO) get mvdan.cc/unparam + unparam ./... + +errcheck: + $(GO) get github.com/kisielk/errcheck + errcheck $(PKGS) + +gofmt: + @echo Checking code is gofmted + @test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)" diff --git a/vendor/github.com/pkg/errors/README.md b/vendor/github.com/pkg/errors/README.md index 273db3c98..54dfdcb12 100644 --- a/vendor/github.com/pkg/errors/README.md +++ b/vendor/github.com/pkg/errors/README.md @@ -1,4 +1,4 @@ -# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) +# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/github.com/pkg/errors)](https://goreportcard.com/report/github.com/pkg/errors) [![Sourcegraph](https://sourcegraph.com/github.com/pkg/errors/-/badge.svg)](https://sourcegraph.com/github.com/pkg/errors?badge) Package errors provides simple error handling primitives. @@ -41,12 +41,19 @@ default: [Read the package documentation for more information](https://godoc.org/github.com/pkg/errors). +## Roadmap + +With the upcoming [Go2 error proposals](https://go.googlesource.com/proposal/+/master/design/go2draft.md) this package is moving into maintenance mode. The roadmap for a 1.0 release is as follows: + +- 0.9. Remove pre Go 1.9 and Go 1.10 support, address outstanding pull requests (if possible) +- 1.0. Final release. + ## Contributing -We welcome pull requests, bug fixes and issue reports. With that said, the bar for adding new symbols to this package is intentionally set high. +Because of the Go2 errors changes, this package is not accepting proposals for new functionality. With that said, we welcome pull requests, bug fixes and issue reports. -Before proposing a change, please discuss your change by raising an issue. +Before sending a PR, please discuss your change by raising an issue. -## Licence +## License BSD-2-Clause diff --git a/vendor/github.com/pkg/errors/errors.go b/vendor/github.com/pkg/errors/errors.go index 842ee8045..161aea258 100644 --- a/vendor/github.com/pkg/errors/errors.go +++ b/vendor/github.com/pkg/errors/errors.go @@ -6,7 +6,7 @@ // return err // } // -// which applied recursively up the call stack results in error reports +// which when applied recursively up the call stack results in error reports // without context or debugging information. The errors package allows // programmers to add context to the failure path in their code in a way // that does not destroy the original value of the error. @@ -15,16 +15,17 @@ // // The errors.Wrap function returns a new error that adds context to the // original error by recording a stack trace at the point Wrap is called, -// and the supplied message. For example +// together with the supplied message. For example // // _, err := ioutil.ReadAll(r) // if err != nil { // return errors.Wrap(err, "read failed") // } // -// If additional control is required the errors.WithStack and errors.WithMessage -// functions destructure errors.Wrap into its component operations of annotating -// an error with a stack trace and an a message, respectively. +// If additional control is required, the errors.WithStack and +// errors.WithMessage functions destructure errors.Wrap into its component +// operations: annotating an error with a stack trace and with a message, +// respectively. // // Retrieving the cause of an error // @@ -38,7 +39,7 @@ // } // // can be inspected by errors.Cause. errors.Cause will recursively retrieve -// the topmost error which does not implement causer, which is assumed to be +// the topmost error that does not implement causer, which is assumed to be // the original cause. For example: // // switch err := errors.Cause(err).(type) { @@ -48,16 +49,16 @@ // // unknown error // } // -// causer interface is not exported by this package, but is considered a part -// of stable public API. +// Although the causer interface is not exported by this package, it is +// considered a part of its stable public interface. // // Formatted printing of errors // // All error values returned from this package implement fmt.Formatter and can -// be formatted by the fmt package. The following verbs are supported +// be formatted by the fmt package. The following verbs are supported: // // %s print the error. If the error has a Cause it will be -// printed recursively +// printed recursively. // %v see %s // %+v extended format. Each Frame of the error's StackTrace will // be printed in detail. @@ -65,13 +66,13 @@ // Retrieving the stack trace of an error or wrapper // // New, Errorf, Wrap, and Wrapf record a stack trace at the point they are -// invoked. This information can be retrieved with the following interface. +// invoked. This information can be retrieved with the following interface: // // type stackTracer interface { // StackTrace() errors.StackTrace // } // -// Where errors.StackTrace is defined as +// The returned errors.StackTrace type is defined as // // type StackTrace []Frame // @@ -81,12 +82,12 @@ // // if err, ok := err.(stackTracer); ok { // for _, f := range err.StackTrace() { -// fmt.Printf("%+s:%d", f) +// fmt.Printf("%+s:%d\n", f, f) // } // } // -// stackTracer interface is not exported by this package, but is considered a part -// of stable public API. +// Although the stackTracer interface is not exported by this package, it is +// considered a part of its stable public interface. // // See the documentation for Frame.Format for more details. package errors @@ -158,6 +159,9 @@ type withStack struct { func (w *withStack) Cause() error { return w.error } +// Unwrap provides compatibility for Go 1.13 error chains. +func (w *withStack) Unwrap() error { return w.error } + func (w *withStack) Format(s fmt.State, verb rune) { switch verb { case 'v': @@ -192,7 +196,7 @@ func Wrap(err error, message string) error { } // Wrapf returns an error annotating err with a stack trace -// at the point Wrapf is call, and the format specifier. +// at the point Wrapf is called, and the format specifier. // If err is nil, Wrapf returns nil. func Wrapf(err error, format string, args ...interface{}) error { if err == nil { @@ -220,6 +224,18 @@ func WithMessage(err error, message string) error { } } +// WithMessagef annotates err with the format specifier. +// If err is nil, WithMessagef returns nil. +func WithMessagef(err error, format string, args ...interface{}) error { + if err == nil { + return nil + } + return &withMessage{ + cause: err, + msg: fmt.Sprintf(format, args...), + } +} + type withMessage struct { cause error msg string @@ -228,6 +244,9 @@ type withMessage struct { func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } func (w *withMessage) Cause() error { return w.cause } +// Unwrap provides compatibility for Go 1.13 error chains. +func (w *withMessage) Unwrap() error { return w.cause } + func (w *withMessage) Format(s fmt.State, verb rune) { switch verb { case 'v': diff --git a/vendor/github.com/pkg/errors/go113.go b/vendor/github.com/pkg/errors/go113.go new file mode 100644 index 000000000..be0d10d0c --- /dev/null +++ b/vendor/github.com/pkg/errors/go113.go @@ -0,0 +1,38 @@ +// +build go1.13 + +package errors + +import ( + stderrors "errors" +) + +// Is reports whether any error in err's chain matches target. +// +// The chain consists of err itself followed by the sequence of errors obtained by +// repeatedly calling Unwrap. +// +// An error is considered to match a target if it is equal to that target or if +// it implements a method Is(error) bool such that Is(target) returns true. +func Is(err, target error) bool { return stderrors.Is(err, target) } + +// As finds the first error in err's chain that matches target, and if so, sets +// target to that error value and returns true. +// +// The chain consists of err itself followed by the sequence of errors obtained by +// repeatedly calling Unwrap. +// +// An error matches target if the error's concrete value is assignable to the value +// pointed to by target, or if the error has a method As(interface{}) bool such that +// As(target) returns true. In the latter case, the As method is responsible for +// setting target. +// +// As will panic if target is not a non-nil pointer to either a type that implements +// error, or to any interface type. As returns false if err is nil. +func As(err error, target interface{}) bool { return stderrors.As(err, target) } + +// Unwrap returns the result of calling the Unwrap method on err, if err's +// type contains an Unwrap method returning error. +// Otherwise, Unwrap returns nil. +func Unwrap(err error) error { + return stderrors.Unwrap(err) +} diff --git a/vendor/github.com/pkg/errors/stack.go b/vendor/github.com/pkg/errors/stack.go index 6b1f2891a..779a8348f 100644 --- a/vendor/github.com/pkg/errors/stack.go +++ b/vendor/github.com/pkg/errors/stack.go @@ -5,10 +5,13 @@ import ( "io" "path" "runtime" + "strconv" "strings" ) // Frame represents a program counter inside a stack frame. +// For historical reasons if Frame is interpreted as a uintptr +// its value represents the program counter + 1. type Frame uintptr // pc returns the program counter for this frame; @@ -37,6 +40,15 @@ func (f Frame) line() int { return line } +// name returns the name of this function, if known. +func (f Frame) name() string { + fn := runtime.FuncForPC(f.pc()) + if fn == nil { + return "unknown" + } + return fn.Name() +} + // Format formats the frame according to the fmt.Formatter interface. // // %s source file @@ -46,29 +58,24 @@ func (f Frame) line() int { // // Format accepts flags that alter the printing of some verbs, as follows: // -// %+s path of source file relative to the compile time GOPATH +// %+s function name and path of source file relative to the compile time +// GOPATH separated by \n\t (\n\t) // %+v equivalent to %+s:%d func (f Frame) Format(s fmt.State, verb rune) { switch verb { case 's': switch { case s.Flag('+'): - pc := f.pc() - fn := runtime.FuncForPC(pc) - if fn == nil { - io.WriteString(s, "unknown") - } else { - file, _ := fn.FileLine(pc) - fmt.Fprintf(s, "%s\n\t%s", fn.Name(), file) - } + io.WriteString(s, f.name()) + io.WriteString(s, "\n\t") + io.WriteString(s, f.file()) default: io.WriteString(s, path.Base(f.file())) } case 'd': - fmt.Fprintf(s, "%d", f.line()) + io.WriteString(s, strconv.Itoa(f.line())) case 'n': - name := runtime.FuncForPC(f.pc()).Name() - io.WriteString(s, funcname(name)) + io.WriteString(s, funcname(f.name())) case 'v': f.Format(s, 's') io.WriteString(s, ":") @@ -76,25 +83,57 @@ func (f Frame) Format(s fmt.State, verb rune) { } } +// MarshalText formats a stacktrace Frame as a text string. The output is the +// same as that of fmt.Sprintf("%+v", f), but without newlines or tabs. +func (f Frame) MarshalText() ([]byte, error) { + name := f.name() + if name == "unknown" { + return []byte(name), nil + } + return []byte(fmt.Sprintf("%s %s:%d", name, f.file(), f.line())), nil +} + // StackTrace is stack of Frames from innermost (newest) to outermost (oldest). type StackTrace []Frame +// Format formats the stack of Frames according to the fmt.Formatter interface. +// +// %s lists source files for each Frame in the stack +// %v lists the source file and line number for each Frame in the stack +// +// Format accepts flags that alter the printing of some verbs, as follows: +// +// %+v Prints filename, function, and line number for each Frame in the stack. func (st StackTrace) Format(s fmt.State, verb rune) { switch verb { case 'v': switch { case s.Flag('+'): for _, f := range st { - fmt.Fprintf(s, "\n%+v", f) + io.WriteString(s, "\n") + f.Format(s, verb) } case s.Flag('#'): fmt.Fprintf(s, "%#v", []Frame(st)) default: - fmt.Fprintf(s, "%v", []Frame(st)) + st.formatSlice(s, verb) } case 's': - fmt.Fprintf(s, "%s", []Frame(st)) + st.formatSlice(s, verb) + } +} + +// formatSlice will format this StackTrace into the given buffer as a slice of +// Frame, only valid when called with '%s' or '%v'. +func (st StackTrace) formatSlice(s fmt.State, verb rune) { + io.WriteString(s, "[") + for i, f := range st { + if i > 0 { + io.WriteString(s, " ") + } + f.Format(s, verb) } + io.WriteString(s, "]") } // stack represents a stack of program counters. @@ -136,43 +175,3 @@ func funcname(name string) string { i = strings.Index(name, ".") return name[i+1:] } - -func trimGOPATH(name, file string) string { - // Here we want to get the source file path relative to the compile time - // GOPATH. As of Go 1.6.x there is no direct way to know the compiled - // GOPATH at runtime, but we can infer the number of path segments in the - // GOPATH. We note that fn.Name() returns the function name qualified by - // the import path, which does not include the GOPATH. Thus we can trim - // segments from the beginning of the file path until the number of path - // separators remaining is one more than the number of path separators in - // the function name. For example, given: - // - // GOPATH /home/user - // file /home/user/src/pkg/sub/file.go - // fn.Name() pkg/sub.Type.Method - // - // We want to produce: - // - // pkg/sub/file.go - // - // From this we can easily see that fn.Name() has one less path separator - // than our desired output. We count separators from the end of the file - // path until it finds two more than in the function name and then move - // one character forward to preserve the initial path segment without a - // leading separator. - const sep = "/" - goal := strings.Count(name, sep) + 2 - i := len(file) - for n := 0; n < goal; n++ { - i = strings.LastIndex(file[:i], sep) - if i == -1 { - // not enough separators found, set i so that the slice expression - // below leaves file unmodified - i = -len(sep) - break - } - } - // get back to 0 or trim the leading separator - file = file[i+len(sep):] - return file -} diff --git a/vendor/github.com/spf13/afero/unionFile.go b/vendor/github.com/spf13/afero/unionFile.go index abcf12d36..eda96312d 100644 --- a/vendor/github.com/spf13/afero/unionFile.go +++ b/vendor/github.com/spf13/afero/unionFile.go @@ -155,8 +155,8 @@ var defaultUnionMergeDirsFn = func(lofi, bofi []os.FileInfo) ([]os.FileInfo, err } // Readdir will weave the two directories together and -// return a single view of the overlayed directories -// At the end of the directory view, the error is io.EOF. +// return a single view of the overlayed directories. +// At the end of the directory view, the error is io.EOF if c > 0. func (f *UnionFile) Readdir(c int) (ofi []os.FileInfo, err error) { var merge DirsMerger = f.Merger if merge == nil { @@ -187,11 +187,15 @@ func (f *UnionFile) Readdir(c int) (ofi []os.FileInfo, err error) { f.files = append(f.files, merged...) } + if c <= 0 && len(f.files) == 0 { + return f.files, nil + } + if f.off >= len(f.files) { return nil, io.EOF } - if c == -1 { + if c <= 0 { return f.files[f.off:], nil } diff --git a/vendor/github.com/terraform-providers/terraform-provider-null/null/data_source.go b/vendor/github.com/terraform-providers/terraform-provider-null/null/data_source.go index 065029e7e..ef78c026b 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-null/null/data_source.go +++ b/vendor/github.com/terraform-providers/terraform-provider-null/null/data_source.go @@ -5,7 +5,7 @@ import ( "math/rand" "time" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func init() { @@ -17,19 +17,19 @@ func dataSource() *schema.Resource { Read: dataSourceRead, Schema: map[string]*schema.Schema{ - "inputs": &schema.Schema{ + "inputs": { Type: schema.TypeMap, Optional: true, }, - "outputs": &schema.Schema{ + "outputs": { Type: schema.TypeMap, Computed: true, }, - "random": &schema.Schema{ + "random": { Type: schema.TypeString, Computed: true, }, - "has_computed_default": &schema.Schema{ + "has_computed_default": { Type: schema.TypeString, Optional: true, Computed: true, diff --git a/vendor/github.com/terraform-providers/terraform-provider-null/null/provider.go b/vendor/github.com/terraform-providers/terraform-provider-null/null/provider.go index 7f67877fd..62cbd5161 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-null/null/provider.go +++ b/vendor/github.com/terraform-providers/terraform-provider-null/null/provider.go @@ -1,8 +1,8 @@ package null import ( - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // Provider returns a terraform.ResourceProvider. diff --git a/vendor/github.com/terraform-providers/terraform-provider-null/null/resource.go b/vendor/github.com/terraform-providers/terraform-provider-null/null/resource.go index a8467ad3d..1a006485f 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-null/null/resource.go +++ b/vendor/github.com/terraform-providers/terraform-provider-null/null/resource.go @@ -5,7 +5,7 @@ import ( "math/rand" "time" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func init() { @@ -19,7 +19,7 @@ func resource() *schema.Resource { Delete: resourceDelete, Schema: map[string]*schema.Schema{ - "triggers": &schema.Schema{ + "triggers": { Type: schema.TypeMap, Optional: true, ForceNew: true, diff --git a/vendor/github.com/terraform-providers/terraform-provider-random/random/provider.go b/vendor/github.com/terraform-providers/terraform-provider-random/random/provider.go index cbbe8cecf..2ee3c7079 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-random/random/provider.go +++ b/vendor/github.com/terraform-providers/terraform-provider-random/random/provider.go @@ -1,8 +1,8 @@ package random import ( - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // Provider returns a terraform.ResourceProvider. @@ -11,12 +11,13 @@ func Provider() terraform.ResourceProvider { Schema: map[string]*schema.Schema{}, ResourcesMap: map[string]*schema.Resource{ - "random_id": resourceId(), - "random_shuffle": resourceShuffle(), - "random_pet": resourcePet(), - "random_string": resourceString(), - "random_integer": resourceInteger(), - "random_uuid": resourceUuid(), + "random_id": resourceId(), + "random_shuffle": resourceShuffle(), + "random_pet": resourcePet(), + "random_string": resourceString(), + "random_password": resourcePassword(), + "random_integer": resourceInteger(), + "random_uuid": resourceUuid(), }, } } diff --git a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_id.go b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_id.go index cd460d9c9..edefff47d 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_id.go +++ b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_id.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/hashicorp/errwrap" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceId() *schema.Resource { diff --git a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_integer.go b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_integer.go index 729c16def..abb17572b 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_integer.go +++ b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_integer.go @@ -6,13 +6,13 @@ import ( "strings" "github.com/hashicorp/errwrap" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceInteger() *schema.Resource { return &schema.Resource{ Create: CreateInteger, - Read: RepopulateInteger, + Read: schema.Noop, Delete: schema.RemoveFromState, Importer: &schema.ResourceImporter{ State: ImportInteger, @@ -68,10 +68,6 @@ func CreateInteger(d *schema.ResourceData, meta interface{}) error { return nil } -func RepopulateInteger(d *schema.ResourceData, _ interface{}) error { - return nil -} - func ImportInteger(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { parts := strings.Split(d.Id(), ",") if len(parts) != 3 && len(parts) != 4 { diff --git a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_password.go b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_password.go new file mode 100644 index 000000000..5fe344888 --- /dev/null +++ b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_password.go @@ -0,0 +1,14 @@ +package random + +import ( + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func resourcePassword() *schema.Resource { + return &schema.Resource{ + Create: createStringFunc(true), + Read: readNil, + Delete: schema.RemoveFromState, + Schema: stringSchemaV1(true), + } +} diff --git a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_pet.go b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_pet.go index dc0d4db8d..59059793a 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_pet.go +++ b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_pet.go @@ -6,7 +6,7 @@ import ( "github.com/dustinkirkland/golang-petname" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourcePet() *schema.Resource { diff --git a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_shuffle.go b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_shuffle.go index e1f3a1f9c..e15c2c2bc 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_shuffle.go +++ b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_shuffle.go @@ -1,7 +1,7 @@ package random import ( - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceShuffle() *schema.Resource { diff --git a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_string.go b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_string.go index 7d58ec43d..3f4f3ec2d 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_string.go +++ b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_string.go @@ -1,184 +1,16 @@ package random import ( - "crypto/rand" - "math/big" - "sort" - - "github.com/hashicorp/errwrap" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceString() *schema.Resource { return &schema.Resource{ - Create: CreateString, - Read: ReadString, + Create: createStringFunc(false), + Read: readNil, Delete: schema.RemoveFromState, MigrateState: resourceRandomStringMigrateState, SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "keepers": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - }, - - "length": { - Type: schema.TypeInt, - Required: true, - ForceNew: true, - }, - - "special": { - Type: schema.TypeBool, - Optional: true, - Default: true, - ForceNew: true, - }, - - "upper": { - Type: schema.TypeBool, - Optional: true, - Default: true, - ForceNew: true, - }, - - "lower": { - Type: schema.TypeBool, - Optional: true, - Default: true, - ForceNew: true, - }, - - "number": { - Type: schema.TypeBool, - Optional: true, - Default: true, - ForceNew: true, - }, - - "min_numeric": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - ForceNew: true, - }, - - "min_upper": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - ForceNew: true, - }, - - "min_lower": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - ForceNew: true, - }, - - "min_special": { - Type: schema.TypeInt, - Optional: true, - Default: 0, - ForceNew: true, - }, - - "override_special": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - }, - - "result": { - Type: schema.TypeString, - Computed: true, - }, - }, - } -} - -func CreateString(d *schema.ResourceData, meta interface{}) error { - const numChars = "0123456789" - const lowerChars = "abcdefghijklmnopqrstuvwxyz" - const upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - var specialChars = "!@#$%&*()-_=+[]{}<>:?" - - length := d.Get("length").(int) - upper := d.Get("upper").(bool) - minUpper := d.Get("min_upper").(int) - lower := d.Get("lower").(bool) - minLower := d.Get("min_lower").(int) - number := d.Get("number").(bool) - minNumeric := d.Get("min_numeric").(int) - special := d.Get("special").(bool) - minSpecial := d.Get("min_special").(int) - overrideSpecial := d.Get("override_special").(string) - - if overrideSpecial != "" { - specialChars = overrideSpecial + Schema: stringSchemaV1(false), } - - var chars = string("") - if upper { - chars += upperChars - } - if lower { - chars += lowerChars - } - if number { - chars += numChars - } - if special { - chars += specialChars - } - - minMapping := map[string]int{ - numChars: minNumeric, - lowerChars: minLower, - upperChars: minUpper, - specialChars: minSpecial, - } - var result = make([]byte, 0, length) - for k, v := range minMapping { - s, err := generateRandomBytes(&k, v) - if err != nil { - return errwrap.Wrapf("error generating random bytes: {{err}}", err) - } - result = append(result, s...) - } - s, err := generateRandomBytes(&chars, length-len(result)) - if err != nil { - return errwrap.Wrapf("error generating random bytes: {{err}}", err) - } - result = append(result, s...) - order := make([]byte, len(result)) - if _, err := rand.Read(order); err != nil { - return errwrap.Wrapf("error generating random bytes: {{err}}", err) - } - sort.Slice(result, func(i, j int) bool { - return order[i] < order[j] - }) - - d.Set("result", string(result)) - d.SetId("none") - return nil -} - -func generateRandomBytes(charSet *string, length int) ([]byte, error) { - bytes := make([]byte, length) - setLen := big.NewInt(int64(len(*charSet))) - for i := range bytes { - idx, err := rand.Int(rand.Reader, setLen) - if err != nil { - return nil, err - } - bytes[i] = (*charSet)[idx.Int64()] - } - return bytes, nil -} - -func ReadString(d *schema.ResourceData, meta interface{}) error { - return nil } diff --git a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_string_migration.go b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_string_migration.go index 7d818867c..87b15399c 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_string_migration.go +++ b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_string_migration.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func resourceRandomStringMigrateState( diff --git a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_uuid.go b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_uuid.go index e199b1a29..0eb49ea73 100644 --- a/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_uuid.go +++ b/vendor/github.com/terraform-providers/terraform-provider-random/random/resource_uuid.go @@ -3,13 +3,13 @@ package random import ( "github.com/hashicorp/errwrap" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceUuid() *schema.Resource { return &schema.Resource{ Create: CreateUuid, - Read: RepopulateUuid, + Read: schema.Noop, Delete: schema.RemoveFromState, Importer: &schema.ResourceImporter{ State: ImportUuid, @@ -40,10 +40,6 @@ func CreateUuid(d *schema.ResourceData, meta interface{}) error { return nil } -func RepopulateUuid(d *schema.ResourceData, _ interface{}) error { - return nil -} - func ImportUuid(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { id := d.Id() bytes, err := uuid.ParseUUID(id) diff --git a/vendor/github.com/terraform-providers/terraform-provider-random/random/string.go b/vendor/github.com/terraform-providers/terraform-provider-random/random/string.go new file mode 100644 index 000000000..afd05448f --- /dev/null +++ b/vendor/github.com/terraform-providers/terraform-provider-random/random/string.go @@ -0,0 +1,187 @@ +// This file provides shared functionality between `resource_string` and `resource_password`. +// There is no intent to permanently couple their implementations +// Over time they could diverge, or one becomes deprecated +package random + +import ( + "crypto/rand" + "math/big" + "sort" + + "github.com/hashicorp/errwrap" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" +) + +func stringSchemaV1(sensitive bool) map[string]*schema.Schema { + return map[string]*schema.Schema{ + "keepers": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + }, + + "length": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + }, + + "special": { + Type: schema.TypeBool, + Optional: true, + Default: true, + ForceNew: true, + }, + + "upper": { + Type: schema.TypeBool, + Optional: true, + Default: true, + ForceNew: true, + }, + + "lower": { + Type: schema.TypeBool, + Optional: true, + Default: true, + ForceNew: true, + }, + + "number": { + Type: schema.TypeBool, + Optional: true, + Default: true, + ForceNew: true, + }, + + "min_numeric": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + ForceNew: true, + }, + + "min_upper": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + ForceNew: true, + }, + + "min_lower": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + ForceNew: true, + }, + + "min_special": { + Type: schema.TypeInt, + Optional: true, + Default: 0, + ForceNew: true, + }, + + "override_special": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + }, + + "result": { + Type: schema.TypeString, + Computed: true, + Sensitive: sensitive, + }, + } +} + +func createStringFunc(sensitive bool) func(d *schema.ResourceData, meta interface{}) error { + return func(d *schema.ResourceData, meta interface{}) error { + const numChars = "0123456789" + const lowerChars = "abcdefghijklmnopqrstuvwxyz" + const upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + var specialChars = "!@#$%&*()-_=+[]{}<>:?" + + length := d.Get("length").(int) + upper := d.Get("upper").(bool) + minUpper := d.Get("min_upper").(int) + lower := d.Get("lower").(bool) + minLower := d.Get("min_lower").(int) + number := d.Get("number").(bool) + minNumeric := d.Get("min_numeric").(int) + special := d.Get("special").(bool) + minSpecial := d.Get("min_special").(int) + overrideSpecial := d.Get("override_special").(string) + + if overrideSpecial != "" { + specialChars = overrideSpecial + } + + var chars = string("") + if upper { + chars += upperChars + } + if lower { + chars += lowerChars + } + if number { + chars += numChars + } + if special { + chars += specialChars + } + + minMapping := map[string]int{ + numChars: minNumeric, + lowerChars: minLower, + upperChars: minUpper, + specialChars: minSpecial, + } + var result = make([]byte, 0, length) + for k, v := range minMapping { + s, err := generateRandomBytes(&k, v) + if err != nil { + return errwrap.Wrapf("error generating random bytes: {{err}}", err) + } + result = append(result, s...) + } + s, err := generateRandomBytes(&chars, length-len(result)) + if err != nil { + return errwrap.Wrapf("error generating random bytes: {{err}}", err) + } + result = append(result, s...) + order := make([]byte, len(result)) + if _, err := rand.Read(order); err != nil { + return errwrap.Wrapf("error generating random bytes: {{err}}", err) + } + sort.Slice(result, func(i, j int) bool { + return order[i] < order[j] + }) + + d.Set("result", string(result)) + if sensitive { + d.SetId("none") + } else { + d.SetId(string(result)) + } + return nil + } +} + +func generateRandomBytes(charSet *string, length int) ([]byte, error) { + bytes := make([]byte, length) + setLen := big.NewInt(int64(len(*charSet))) + for i := range bytes { + idx, err := rand.Int(rand.Reader, setLen) + if err != nil { + return nil, err + } + bytes[i] = (*charSet)[idx.Int64()] + } + return bytes, nil +} + +func readNil(d *schema.ResourceData, meta interface{}) error { + return nil +} diff --git a/vendor/github.com/terraform-providers/terraform-provider-template/LICENSE b/vendor/github.com/terraform-providers/terraform-provider-template/LICENSE deleted file mode 100644 index a612ad981..000000000 --- a/vendor/github.com/terraform-providers/terraform-provider-template/LICENSE +++ /dev/null @@ -1,373 +0,0 @@ -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/terraform-providers/terraform-provider-template/template/datasource_cloudinit_config.go b/vendor/github.com/terraform-providers/terraform-provider-template/template/datasource_cloudinit_config.go deleted file mode 100644 index 8a24c329a..000000000 --- a/vendor/github.com/terraform-providers/terraform-provider-template/template/datasource_cloudinit_config.go +++ /dev/null @@ -1,185 +0,0 @@ -package template - -import ( - "bytes" - "compress/gzip" - "encoding/base64" - "fmt" - "io" - "mime/multipart" - "net/textproto" - "strconv" - - "github.com/hashicorp/terraform/helper/hashcode" - "github.com/hashicorp/terraform/helper/schema" -) - -func dataSourceCloudinitConfig() *schema.Resource { - return &schema.Resource{ - Read: dataSourceCloudinitConfigRead, - - Schema: map[string]*schema.Schema{ - "part": { - Type: schema.TypeList, - Required: true, - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "content_type": { - Type: schema.TypeString, - Optional: true, - }, - "content": { - Type: schema.TypeString, - Required: true, - }, - "filename": { - Type: schema.TypeString, - Optional: true, - }, - "merge_type": { - Type: schema.TypeString, - Optional: true, - }, - }, - }, - }, - "gzip": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "base64_encode": { - Type: schema.TypeBool, - Optional: true, - Default: true, - }, - "rendered": { - Type: schema.TypeString, - Computed: true, - Description: "rendered cloudinit configuration", - }, - }, - } -} - -func dataSourceCloudinitConfigRead(d *schema.ResourceData, meta interface{}) error { - rendered, err := renderCloudinitConfig(d) - if err != nil { - return err - } - - d.Set("rendered", rendered) - d.SetId(strconv.Itoa(hashcode.String(rendered))) - return nil -} - -func renderCloudinitConfig(d *schema.ResourceData) (string, error) { - gzipOutput := d.Get("gzip").(bool) - base64Output := d.Get("base64_encode").(bool) - - partsValue, hasParts := d.GetOk("part") - if !hasParts { - return "", fmt.Errorf("No parts found in the cloudinit resource declaration") - } - - cloudInitParts := make(cloudInitParts, len(partsValue.([]interface{}))) - for i, v := range partsValue.([]interface{}) { - p, castOk := v.(map[string]interface{}) - if !castOk { - return "", fmt.Errorf("Unable to parse parts in cloudinit resource declaration") - } - - part := cloudInitPart{} - if p, ok := p["content_type"]; ok { - part.ContentType = p.(string) - } - if p, ok := p["content"]; ok { - part.Content = p.(string) - } - if p, ok := p["merge_type"]; ok { - part.MergeType = p.(string) - } - if p, ok := p["filename"]; ok { - part.Filename = p.(string) - } - cloudInitParts[i] = part - } - - var buffer bytes.Buffer - - var err error - if gzipOutput { - gzipWriter := gzip.NewWriter(&buffer) - err = renderPartsToWriter(cloudInitParts, gzipWriter) - gzipWriter.Close() - } else { - err = renderPartsToWriter(cloudInitParts, &buffer) - } - if err != nil { - return "", err - } - - output := "" - if base64Output { - output = base64.StdEncoding.EncodeToString(buffer.Bytes()) - } else { - output = buffer.String() - } - - return output, nil -} - -func renderPartsToWriter(parts cloudInitParts, writer io.Writer) error { - mimeWriter := multipart.NewWriter(writer) - defer mimeWriter.Close() - - // we need to set the boundary explictly, otherwise the boundary is random - // and this causes terraform to complain about the resource being different - if err := mimeWriter.SetBoundary("MIMEBOUNDARY"); err != nil { - return err - } - - writer.Write([]byte(fmt.Sprintf("Content-Type: multipart/mixed; boundary=\"%s\"\n", mimeWriter.Boundary()))) - writer.Write([]byte("MIME-Version: 1.0\r\n\r\n")) - - for _, part := range parts { - header := textproto.MIMEHeader{} - if part.ContentType == "" { - header.Set("Content-Type", "text/plain") - } else { - header.Set("Content-Type", part.ContentType) - } - - header.Set("MIME-Version", "1.0") - header.Set("Content-Transfer-Encoding", "7bit") - - if part.Filename != "" { - header.Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, part.Filename)) - } - - if part.MergeType != "" { - header.Set("X-Merge-Type", part.MergeType) - } - - partWriter, err := mimeWriter.CreatePart(header) - if err != nil { - return err - } - - _, err = partWriter.Write([]byte(part.Content)) - if err != nil { - return err - } - } - - return nil -} - -type cloudInitPart struct { - ContentType string - MergeType string - Filename string - Content string -} - -type cloudInitParts []cloudInitPart diff --git a/vendor/github.com/terraform-providers/terraform-provider-template/template/datasource_template_file.go b/vendor/github.com/terraform-providers/terraform-provider-template/template/datasource_template_file.go deleted file mode 100644 index 28e5f6033..000000000 --- a/vendor/github.com/terraform-providers/terraform-provider-template/template/datasource_template_file.go +++ /dev/null @@ -1,165 +0,0 @@ -package template - -import ( - "crypto/sha256" - "encoding/hex" - "fmt" - "os" - "path/filepath" - "strings" - - "github.com/hashicorp/hil" - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/terraform/config" - "github.com/hashicorp/terraform/helper/pathorcontents" - "github.com/hashicorp/terraform/helper/schema" -) - -func dataSourceFile() *schema.Resource { - return &schema.Resource{ - Read: dataSourceFileRead, - - Schema: map[string]*schema.Schema{ - "template": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Description: "Contents of the template", - ConflictsWith: []string{"filename"}, - }, - "filename": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Description: "file to read template from", - // Make a "best effort" attempt to relativize the file path. - StateFunc: func(v interface{}) string { - if v == nil || v.(string) == "" { - return "" - } - pwd, err := os.Getwd() - if err != nil { - return v.(string) - } - rel, err := filepath.Rel(pwd, v.(string)) - if err != nil { - return v.(string) - } - return rel - }, - Deprecated: "Use the 'template' attribute instead.", - ConflictsWith: []string{"template"}, - }, - "vars": &schema.Schema{ - Type: schema.TypeMap, - Optional: true, - Default: make(map[string]interface{}), - Description: "variables to substitute", - ValidateFunc: validateVarsAttribute, - }, - "rendered": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Description: "rendered template", - }, - }, - } -} - -func dataSourceFileRead(d *schema.ResourceData, meta interface{}) error { - rendered, err := renderFile(d) - if err != nil { - return err - } - d.Set("rendered", rendered) - d.SetId(hash(rendered)) - return nil -} - -type templateRenderError error - -func renderFile(d *schema.ResourceData) (string, error) { - template := d.Get("template").(string) - filename := d.Get("filename").(string) - vars := d.Get("vars").(map[string]interface{}) - - contents := template - if template == "" && filename != "" { - data, _, err := pathorcontents.Read(filename) - if err != nil { - return "", err - } - - contents = data - } - - rendered, err := execute(contents, vars) - if err != nil { - return "", templateRenderError( - fmt.Errorf("failed to render %v: %v", filename, err), - ) - } - - return rendered, nil -} - -// execute parses and executes a template using vars. -func execute(s string, vars map[string]interface{}) (string, error) { - root, err := hil.Parse(s) - if err != nil { - return "", err - } - - varmap := make(map[string]ast.Variable) - for k, v := range vars { - // As far as I can tell, v is always a string. - // If it's not, tell the user gracefully. - s, ok := v.(string) - if !ok { - return "", fmt.Errorf("unexpected type for variable %q: %T", k, v) - } - varmap[k] = ast.Variable{ - Value: s, - Type: ast.TypeString, - } - } - - cfg := hil.EvalConfig{ - GlobalScope: &ast.BasicScope{ - VarMap: varmap, - FuncMap: config.Funcs(), - }, - } - - result, err := hil.Eval(root, &cfg) - if err != nil { - return "", err - } - if result.Type != hil.TypeString { - return "", fmt.Errorf("unexpected output hil.Type: %v", result.Type) - } - - return result.Value.(string), nil -} - -func hash(s string) string { - sha := sha256.Sum256([]byte(s)) - return hex.EncodeToString(sha[:]) -} - -func validateVarsAttribute(v interface{}, key string) (ws []string, es []error) { - // vars can only be primitives right now - var badVars []string - for k, v := range v.(map[string]interface{}) { - switch v.(type) { - case []interface{}: - badVars = append(badVars, fmt.Sprintf("%s (list)", k)) - case map[string]interface{}: - badVars = append(badVars, fmt.Sprintf("%s (map)", k)) - } - } - if len(badVars) > 0 { - es = append(es, fmt.Errorf( - "%s: cannot contain non-primitives; bad keys: %s", - key, strings.Join(badVars, ", "))) - } - return -} diff --git a/vendor/github.com/terraform-providers/terraform-provider-template/template/provider.go b/vendor/github.com/terraform-providers/terraform-provider-template/template/provider.go deleted file mode 100644 index fb340754d..000000000 --- a/vendor/github.com/terraform-providers/terraform-provider-template/template/provider.go +++ /dev/null @@ -1,26 +0,0 @@ -package template - -import ( - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" -) - -func Provider() terraform.ResourceProvider { - return &schema.Provider{ - DataSourcesMap: map[string]*schema.Resource{ - "template_file": dataSourceFile(), - "template_cloudinit_config": dataSourceCloudinitConfig(), - }, - ResourcesMap: map[string]*schema.Resource{ - "template_file": schema.DataSourceResourceShim( - "template_file", - dataSourceFile(), - ), - "template_cloudinit_config": schema.DataSourceResourceShim( - "template_cloudinit_config", - dataSourceCloudinitConfig(), - ), - "template_dir": resourceDir(), - }, - } -} diff --git a/vendor/github.com/terraform-providers/terraform-provider-template/template/resource_template_dir.go b/vendor/github.com/terraform-providers/terraform-provider-template/template/resource_template_dir.go deleted file mode 100644 index 63a2f18dc..000000000 --- a/vendor/github.com/terraform-providers/terraform-provider-template/template/resource_template_dir.go +++ /dev/null @@ -1,234 +0,0 @@ -package template - -import ( - "archive/tar" - "bytes" - "crypto/sha1" - "encoding/hex" - "fmt" - "io" - "io/ioutil" - "os" - "path" - "path/filepath" - - "github.com/hashicorp/terraform/helper/pathorcontents" - "github.com/hashicorp/terraform/helper/schema" -) - -func resourceDir() *schema.Resource { - return &schema.Resource{ - Create: resourceTemplateDirCreate, - Read: resourceTemplateDirRead, - Delete: resourceTemplateDirDelete, - - Schema: map[string]*schema.Schema{ - "source_dir": { - Type: schema.TypeString, - Description: "Path to the directory where the files to template reside", - Required: true, - ForceNew: true, - }, - "vars": { - Type: schema.TypeMap, - Optional: true, - Default: make(map[string]interface{}), - Description: "Variables to substitute", - ValidateFunc: validateVarsAttribute, - ForceNew: true, - }, - "destination_dir": { - Type: schema.TypeString, - Description: "Path to the directory where the templated files will be written", - Required: true, - ForceNew: true, - }, - }, - } -} - -func resourceTemplateDirRead(d *schema.ResourceData, meta interface{}) error { - sourceDir := d.Get("source_dir").(string) - destinationDir := d.Get("destination_dir").(string) - - // If the output doesn't exist, mark the resource for creation. - if _, err := os.Stat(destinationDir); os.IsNotExist(err) { - d.SetId("") - return nil - } - - // If the combined hash of the input and output directories is different from - // the stored one, mark the resource for re-creation. - // - // The output directory is technically enough for the general case, but by - // hashing the input directory as well, we make development much easier: when - // a developer modifies one of the input files, the generation is - // re-triggered. - hash, err := generateID(sourceDir, destinationDir) - if err != nil { - return err - } - if hash != d.Id() { - d.SetId("") - return nil - } - - return nil -} - -func resourceTemplateDirCreate(d *schema.ResourceData, meta interface{}) error { - sourceDir := d.Get("source_dir").(string) - destinationDir := d.Get("destination_dir").(string) - vars := d.Get("vars").(map[string]interface{}) - - // Always delete the output first, otherwise files that got deleted from the - // input directory might still be present in the output afterwards. - if err := resourceTemplateDirDelete(d, meta); err != nil { - return err - } - - // Create the destination directory and any other intermediate directories - // leading to it. - if _, err := os.Stat(destinationDir); err != nil { - if err := os.MkdirAll(destinationDir, 0777); err != nil { - return err - } - } - - // Recursively crawl the input files/directories and generate the output ones. - err := filepath.Walk(sourceDir, func(p string, f os.FileInfo, err error) error { - if err != nil { - return err - } - - if f.IsDir() { - return nil - } - - relPath, _ := filepath.Rel(sourceDir, p) - return generateDirFile(p, path.Join(destinationDir, relPath), f, vars) - }) - if err != nil { - return err - } - - // Compute ID. - hash, err := generateID(sourceDir, destinationDir) - if err != nil { - return err - } - d.SetId(hash) - - return nil -} - -func resourceTemplateDirDelete(d *schema.ResourceData, _ interface{}) error { - d.SetId("") - - destinationDir := d.Get("destination_dir").(string) - if _, err := os.Stat(destinationDir); os.IsNotExist(err) { - return nil - } - - if err := os.RemoveAll(destinationDir); err != nil { - return fmt.Errorf("could not delete directory %q: %s", destinationDir, err) - } - - return nil -} - -func generateDirFile(sourceDir, destinationDir string, f os.FileInfo, vars map[string]interface{}) error { - inputContent, _, err := pathorcontents.Read(sourceDir) - if err != nil { - return err - } - - outputContent, err := execute(inputContent, vars) - if err != nil { - return templateRenderError(fmt.Errorf("failed to render %v: %v", sourceDir, err)) - } - - outputDir := path.Dir(destinationDir) - if _, err := os.Stat(outputDir); err != nil { - if err := os.MkdirAll(outputDir, 0777); err != nil { - return err - } - } - - err = ioutil.WriteFile(destinationDir, []byte(outputContent), f.Mode()) - if err != nil { - return err - } - - return nil -} - -func generateID(sourceDir, destinationDir string) (string, error) { - inputHash, err := generateDirHash(sourceDir) - if err != nil { - return "", err - } - outputHash, err := generateDirHash(destinationDir) - if err != nil { - return "", err - } - checksum := sha1.Sum([]byte(inputHash + outputHash)) - return hex.EncodeToString(checksum[:]), nil -} - -func generateDirHash(directoryPath string) (string, error) { - tarData, err := tarDir(directoryPath) - if err != nil { - return "", fmt.Errorf("could not generate output checksum: %s", err) - } - - checksum := sha1.Sum(tarData) - return hex.EncodeToString(checksum[:]), nil -} - -func tarDir(directoryPath string) ([]byte, error) { - buf := new(bytes.Buffer) - tw := tar.NewWriter(buf) - - writeFile := func(p string, f os.FileInfo, err error) error { - if err != nil { - return err - } - - var header *tar.Header - var file *os.File - - header, err = tar.FileInfoHeader(f, f.Name()) - if err != nil { - return err - } - relPath, _ := filepath.Rel(directoryPath, p) - header.Name = relPath - - if err := tw.WriteHeader(header); err != nil { - return err - } - - if f.IsDir() { - return nil - } - - file, err = os.Open(p) - if err != nil { - return err - } - defer file.Close() - - _, err = io.Copy(tw, file) - return err - } - - if err := filepath.Walk(directoryPath, writeFile); err != nil { - return []byte{}, err - } - if err := tw.Flush(); err != nil { - return []byte{}, err - } - - return buf.Bytes(), nil -} diff --git a/vendor/golang.org/x/net/http2/hpack/encode.go b/vendor/golang.org/x/net/http2/hpack/encode.go index 97f17831f..1565cf270 100644 --- a/vendor/golang.org/x/net/http2/hpack/encode.go +++ b/vendor/golang.org/x/net/http2/hpack/encode.go @@ -150,7 +150,7 @@ func appendIndexed(dst []byte, i uint64) []byte { // extended buffer. // // If f.Sensitive is true, "Never Indexed" representation is used. If -// f.Sensitive is false and indexing is true, "Incremental Indexing" +// f.Sensitive is false and indexing is true, "Inremental Indexing" // representation is used. func appendNewName(dst []byte, f HeaderField, indexing bool) []byte { dst = append(dst, encodeTypeByte(indexing, f.Sensitive)) diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index d2ba820c7..5e01ce9ab 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -322,7 +322,7 @@ type ServeConnOpts struct { } func (o *ServeConnOpts) context() context.Context { - if o != nil && o.Context != nil { + if o.Context != nil { return o.Context } return context.Background() @@ -2415,11 +2415,7 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { clen = strconv.Itoa(len(p)) } _, hasContentType := rws.snapHeader["Content-Type"] - // If the Content-Encoding is non-blank, we shouldn't - // sniff the body. See Issue golang.org/issue/31753. - ce := rws.snapHeader.Get("Content-Encoding") - hasCE := len(ce) > 0 - if !hasCE && !hasContentType && bodyAllowedForStatus(rws.status) && len(p) > 0 { + if !hasContentType && bodyAllowedForStatus(rws.status) && len(p) > 0 { ctype = http.DetectContentType(p) } var date string @@ -2528,7 +2524,7 @@ const TrailerPrefix = "Trailer:" // trailers. That worked for a while, until we found the first major // user of Trailers in the wild: gRPC (using them only over http2), // and gRPC libraries permit setting trailers mid-stream without -// predeclaring them. So: change of plans. We still permit the old +// predeclarnig them. So: change of plans. We still permit the old // way, but we also permit this hack: if a Header() key begins with // "Trailer:", the suffix of that key is a Trailer. Because ':' is an // invalid token byte anyway, there is no ambiguity. (And it's already @@ -2828,7 +2824,7 @@ func (sc *serverConn) startPush(msg *startPushRequest) { // PUSH_PROMISE frames MUST only be sent on a peer-initiated stream that // is in either the "open" or "half-closed (remote)" state. if msg.parent.state != stateOpen && msg.parent.state != stateHalfClosedRemote { - // responseWriter.Push checks that the stream is peer-initiated. + // responseWriter.Push checks that the stream is peer-initiaed. msg.done <- errStreamClosed return } diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index c51a73c06..aeac7d8a5 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -1216,8 +1216,6 @@ var ( // abort request body write, but send stream reset of cancel. errStopReqBodyWriteAndCancel = errors.New("http2: canceling request") - - errReqBodyTooLong = errors.New("http2: request body larger than specified content length") ) func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) (err error) { @@ -1240,32 +1238,10 @@ func (cs *clientStream) writeRequestBody(body io.Reader, bodyCloser io.Closer) ( req := cs.req hasTrailers := req.Trailer != nil - remainLen := actualContentLength(req) - hasContentLen := remainLen != -1 var sawEOF bool for !sawEOF { - n, err := body.Read(buf[:len(buf)-1]) - if hasContentLen { - remainLen -= int64(n) - if remainLen == 0 && err == nil { - // The request body's Content-Length was predeclared and - // we just finished reading it all, but the underlying io.Reader - // returned the final chunk with a nil error (which is one of - // the two valid things a Reader can do at EOF). Because we'd prefer - // to send the END_STREAM bit early, double-check that we're actually - // at EOF. Subsequent reads should return (0, EOF) at this point. - // If either value is different, we return an error in one of two ways below. - var n1 int - n1, err = body.Read(buf[n:]) - remainLen -= int64(n1) - } - if remainLen < 0 { - err = errReqBodyTooLong - cc.writeStreamReset(cs.ID, ErrCodeCancel, err) - return err - } - } + n, err := body.Read(buf) if err == io.EOF { sawEOF = true err = nil diff --git a/vendor/golang.org/x/net/http2/writesched_priority.go b/vendor/golang.org/x/net/http2/writesched_priority.go index 2618b2c11..848fed6ec 100644 --- a/vendor/golang.org/x/net/http2/writesched_priority.go +++ b/vendor/golang.org/x/net/http2/writesched_priority.go @@ -149,7 +149,7 @@ func (n *priorityNode) addBytes(b int64) { } // walkReadyInOrder iterates over the tree in priority order, calling f for each node -// with a non-empty write queue. When f returns true, this function returns true and the +// with a non-empty write queue. When f returns true, this funcion returns true and the // walk halts. tmp is used as scratch space for sorting. // // f(n, openParent) takes two arguments: the node to visit, n, and a bool that is true diff --git a/vendor/golang.org/x/net/http2/writesched_random.go b/vendor/golang.org/x/net/http2/writesched_random.go index 9a7b9e581..36d7919f1 100644 --- a/vendor/golang.org/x/net/http2/writesched_random.go +++ b/vendor/golang.org/x/net/http2/writesched_random.go @@ -19,8 +19,7 @@ type randomWriteScheduler struct { zero writeQueue // sq contains the stream-specific queues, keyed by stream ID. - // When a stream is idle, closed, or emptied, it's deleted - // from the map. + // When a stream is idle or closed, it's deleted from the map. sq map[uint32]*writeQueue // pool of empty queues for reuse. @@ -64,12 +63,8 @@ func (ws *randomWriteScheduler) Pop() (FrameWriteRequest, bool) { return ws.zero.shift(), true } // Iterate over all non-idle streams until finding one that can be consumed. - for streamID, q := range ws.sq { + for _, q := range ws.sq { if wr, ok := q.consume(math.MaxInt32); ok { - if q.empty() { - delete(ws.sq, streamID) - ws.queuePool.put(q) - } return wr, true } } diff --git a/vendor/golang.org/x/sys/unix/affinity_linux.go b/vendor/golang.org/x/sys/unix/affinity_linux.go index 14e4d5caa..72afe3338 100644 --- a/vendor/golang.org/x/sys/unix/affinity_linux.go +++ b/vendor/golang.org/x/sys/unix/affinity_linux.go @@ -91,13 +91,9 @@ func onesCount64(x uint64) int { const m0 = 0x5555555555555555 // 01010101 ... const m1 = 0x3333333333333333 // 00110011 ... const m2 = 0x0f0f0f0f0f0f0f0f // 00001111 ... + const m3 = 0x00ff00ff00ff00ff // etc. + const m4 = 0x0000ffff0000ffff - // Unused in this function, but definitions preserved for - // documentation purposes: - // - // const m3 = 0x00ff00ff00ff00ff // etc. - // const m4 = 0x0000ffff0000ffff - // // Implementation: Parallel summing of adjacent bits. // See "Hacker's Delight", Chap. 5: Counting Bits. // The following pattern shows the general approach: diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go index 304016b68..4407c505a 100644 --- a/vendor/golang.org/x/sys/unix/dirent.go +++ b/vendor/golang.org/x/sys/unix/dirent.go @@ -2,101 +2,16 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris package unix -import "unsafe" - -// readInt returns the size-bytes unsigned integer in native byte order at offset off. -func readInt(b []byte, off, size uintptr) (u uint64, ok bool) { - if len(b) < int(off+size) { - return 0, false - } - if isBigEndian { - return readIntBE(b[off:], size), true - } - return readIntLE(b[off:], size), true -} - -func readIntBE(b []byte, size uintptr) uint64 { - switch size { - case 1: - return uint64(b[0]) - case 2: - _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[1]) | uint64(b[0])<<8 - case 4: - _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[3]) | uint64(b[2])<<8 | uint64(b[1])<<16 | uint64(b[0])<<24 - case 8: - _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 | - uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 - default: - panic("syscall: readInt with unsupported size") - } -} - -func readIntLE(b []byte, size uintptr) uint64 { - switch size { - case 1: - return uint64(b[0]) - case 2: - _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[0]) | uint64(b[1])<<8 - case 4: - _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 - case 8: - _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | - uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - default: - panic("syscall: readInt with unsupported size") - } -} +import "syscall" // ParseDirent parses up to max directory entries in buf, // appending the names to names. It returns the number of // bytes consumed from buf, the number of entries added // to names, and the new names slice. func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { - origlen := len(buf) - count = 0 - for max != 0 && len(buf) > 0 { - reclen, ok := direntReclen(buf) - if !ok || reclen > uint64(len(buf)) { - return origlen, count, names - } - rec := buf[:reclen] - buf = buf[reclen:] - ino, ok := direntIno(rec) - if !ok { - break - } - if ino == 0 { // File absent in directory. - continue - } - const namoff = uint64(unsafe.Offsetof(Dirent{}.Name)) - namlen, ok := direntNamlen(rec) - if !ok || namoff+namlen > uint64(len(rec)) { - break - } - name := rec[namoff : namoff+namlen] - for i, c := range name { - if c == 0 { - name = name[:i] - break - } - } - // Check for useless names before allocating a string. - if string(name) == "." || string(name) == ".." { - continue - } - max-- - count++ - names = append(names, string(name)) - } - return origlen - len(buf), count, names + return syscall.ParseDirent(buf, max, names) } diff --git a/vendor/golang.org/x/sys/unix/endian_little.go b/vendor/golang.org/x/sys/unix/endian_little.go index bcdb5d30e..085df2d8d 100644 --- a/vendor/golang.org/x/sys/unix/endian_little.go +++ b/vendor/golang.org/x/sys/unix/endian_little.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // -// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le riscv64 +// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le package unix diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 14624b953..3d85f2795 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -199,7 +199,6 @@ struct ltchars { #include #include #include -#include #include #include #include @@ -436,8 +435,6 @@ ccflags="$@" $2 ~ /^TC[IO](ON|OFF)$/ || $2 ~ /^IN_/ || $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || - $2 ~ /^LO_(KEY|NAME)_SIZE$/ || - $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ || $2 ~ /^TP_STATUS_/ || $2 ~ /^FALLOC_/ || diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go index 1aa065f9c..a079243dc 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -280,22 +280,6 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e return -1, ENOSYS } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - reclen, ok := direntReclen(buf) - if !ok { - return 0, false - } - return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true -} - //sys getdirent(fd int, buf []byte) (n int, err error) func Getdents(fd int, buf []byte) (n int, err error) { return getdirent(fd, buf) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 216b4ac9e..212009189 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -77,18 +77,6 @@ func nametomib(name string) (mib []_C_int, err error) { return buf[0 : n/siz], nil } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) -} - //sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) } func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) } diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index 260a400f9..bf537011f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -57,22 +57,6 @@ func nametomib(name string) (mib []_C_int, err error) { return buf[0 : n/siz], nil } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) -} - -func direntReclen(buf []byte) (uint64, bool) { - namlen, ok := direntNamlen(buf) - if !ok { - return 0, false - } - return (16 + namlen + 1 + 7) &^ 7, true -} - -func direntNamlen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) -} - //sysnb pipe() (r int, w int, err error) func Pipe(p []int) (err error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index 329d240b9..c9c802df0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -82,18 +82,6 @@ func nametomib(name string) (mib []_C_int, err error) { return buf[0 : n/siz], nil } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) -} - func Pipe(p []int) (err error) { return Pipe2(p, 0) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 637b5017b..11d07ace2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -1413,22 +1413,6 @@ func Reboot(cmd int) (err error) { return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, "") } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - reclen, ok := direntReclen(buf) - if !ok { - return 0, false - } - return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true -} - //sys mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 5ef309040..45377107a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -94,18 +94,6 @@ func nametomib(name string) (mib []_C_int, err error) { return mib, nil } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) -} - func SysctlClockinfo(name string) (*Clockinfo, error) { mib, err := sysctlmib(name) if err != nil { diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 1a074b2fe..4f34d6d03 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -43,18 +43,6 @@ func nametomib(name string) (mib []_C_int, err error) { return nil, EINVAL } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) -} - func SysctlClockinfo(name string) (*Clockinfo, error) { mib, err := sysctlmib(name) if err != nil { diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index 0153a316d..9147ba152 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -35,22 +35,6 @@ type SockaddrDatalink struct { raw RawSockaddrDatalink } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - reclen, ok := direntReclen(buf) - if !ok { - return 0, false - } - return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true -} - //sysnb pipe(p *[2]_C_int) (n int, err error) func Pipe(p []int) (err error) { diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 5213d820a..1db2f00de 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1149,20 +1135,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2025,10 +1997,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x80108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x80108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -2236,7 +2204,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2456,7 +2423,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x400854d5 TUNDETACHFILTER = 0x400854d6 - TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x800854db TUNGETIFF = 0x800454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 39b630cc5..8a9d2eadf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1149,20 +1135,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2026,10 +1998,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x80108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x80108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -2237,7 +2205,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2457,7 +2424,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x401054d5 TUNDETACHFILTER = 0x401054d6 - TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x801054db TUNGETIFF = 0x800454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index c59a1beb3..2e7455814 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1148,20 +1134,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2032,10 +2004,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x80108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x80108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -2243,7 +2211,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2463,7 +2430,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x400854d5 TUNDETACHFILTER = 0x400854d6 - TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x800854db TUNGETIFF = 0x800454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 5f35c19d1..b1dc633a2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -541,7 +528,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1151,20 +1137,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2016,10 +1988,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x80108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x80108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -2228,7 +2196,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2448,7 +2415,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x401054d5 TUNDETACHFILTER = 0x401054d6 - TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x801054db TUNGETIFF = 0x800454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index 7f1b7bef2..ad4d9afb6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1148,20 +1134,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2025,10 +1997,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x40108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x40108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x467f SIOCOUTQ = 0x7472 SIOCOUTQNSD = 0x894b @@ -2237,7 +2205,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2458,7 +2425,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x800854d5 TUNDETACHFILTER = 0x800854d6 - TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x400854db TUNGETIFF = 0x400454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 603d88b8b..fe2965028 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1148,20 +1134,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2025,10 +1997,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x40108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x40108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x467f SIOCOUTQ = 0x7472 SIOCOUTQNSD = 0x894b @@ -2237,7 +2205,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2458,7 +2425,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x801054d5 TUNDETACHFILTER = 0x801054d6 - TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x401054db TUNGETIFF = 0x400454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index ed178f8a7..608878303 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1148,20 +1134,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2025,10 +1997,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x40108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x40108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x467f SIOCOUTQ = 0x7472 SIOCOUTQNSD = 0x894b @@ -2237,7 +2205,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2458,7 +2425,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x801054d5 TUNDETACHFILTER = 0x801054d6 - TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x401054db TUNGETIFF = 0x400454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 080b78933..4cf9ddfad 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1148,20 +1134,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2025,10 +1997,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x40108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x40108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x467f SIOCOUTQ = 0x7472 SIOCOUTQNSD = 0x894b @@ -2237,7 +2205,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2458,7 +2425,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x800854d5 TUNDETACHFILTER = 0x800854d6 - TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x400854db TUNGETIFF = 0x400454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 961e8eabe..374e3007f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1148,20 +1134,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2083,10 +2055,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x40108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x40108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x4004667f SIOCOUTQ = 0x40047473 SIOCOUTQNSD = 0x894b @@ -2294,7 +2262,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2518,7 +2485,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x801054d5 TUNDETACHFILTER = 0x801054d6 - TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x401054db TUNGETIFF = 0x400454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 6e0538f22..badf14102 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1148,20 +1134,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2083,10 +2055,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x40108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x40108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x4004667f SIOCOUTQ = 0x40047473 SIOCOUTQNSD = 0x894b @@ -2294,7 +2262,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2518,7 +2485,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x801054d5 TUNDETACHFILTER = 0x801054d6 - TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x401054db TUNGETIFF = 0x400454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 06c0148c1..0ce8c7eff 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1148,20 +1134,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2013,10 +1985,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x80108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x80108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -2224,7 +2192,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2444,7 +2411,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x401054d5 TUNDETACHFILTER = 0x401054d6 - TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x801054db TUNGETIFF = 0x800454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 39875095c..47675125a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -196,8 +196,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -219,11 +217,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -245,19 +238,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -300,10 +290,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -423,7 +411,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -540,7 +527,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1148,20 +1134,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2086,10 +2058,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x80108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x80108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x541b SIOCOUTQ = 0x5411 SIOCOUTQNSD = 0x894b @@ -2297,7 +2265,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2517,7 +2484,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x401054d5 TUNDETACHFILTER = 0x401054d6 - TUNGETDEVNETNS = 0x54e3 TUNGETFEATURES = 0x800454cf TUNGETFILTER = 0x801054db TUNGETIFF = 0x800454d2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 8d80f99bc..a46fc9b43 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -199,8 +199,6 @@ const ( BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 BPF_ALU = 0x4 BPF_ALU64 = 0x7 BPF_AND = 0x50 @@ -222,11 +220,6 @@ const ( BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ANY_ALIGNMENT = 0x2 @@ -248,19 +241,16 @@ const ( BPF_F_PSEUDO_HDR = 0x10 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_RDONLY = 0x8 - BPF_F_RDONLY_PROG = 0x80 BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_REUSE_STACKID = 0x400 BPF_F_SEQ_NUMBER = 0x8 BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STRICT_ALIGNMENT = 0x1 - BPF_F_SYSCTL_BASE_NAME = 0x1 BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_STACK = 0x100 BPF_F_WRONLY = 0x10 - BPF_F_WRONLY_PROG = 0x100 BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_SEED = 0x40 BPF_H = 0x8 @@ -303,10 +293,8 @@ const ( BPF_OR = 0x40 BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_MAP_FD = 0x1 - BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 @@ -426,7 +414,6 @@ const ( CLONE_NEWUTS = 0x4000000 CLONE_PARENT = 0x8000 CLONE_PARENT_SETTID = 0x100000 - CLONE_PIDFD = 0x1000 CLONE_PTRACE = 0x2000 CLONE_SETTLS = 0x80000 CLONE_SIGHAND = 0x800 @@ -544,7 +531,6 @@ const ( ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RT = 0x6003 ETH_P_DSA = 0x1b - ETH_P_DSA_8021Q = 0xdadb ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada ETH_P_ERSPAN = 0x88be @@ -1152,20 +1138,6 @@ const ( LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - LOOP_CLR_FD = 0x4c01 - LOOP_CTL_ADD = 0x4c80 - LOOP_CTL_GET_FREE = 0x4c82 - LOOP_CTL_REMOVE = 0x4c81 - LOOP_GET_STATUS = 0x4c03 - LOOP_GET_STATUS64 = 0x4c05 - LOOP_SET_BLOCK_SIZE = 0x4c09 - LOOP_SET_CAPACITY = 0x4c07 - LOOP_SET_DIRECT_IO = 0x4c08 - LOOP_SET_FD = 0x4c00 - LOOP_SET_STATUS = 0x4c02 - LOOP_SET_STATUS64 = 0x4c04 - LO_KEY_SIZE = 0x20 - LO_NAME_SIZE = 0x40 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb MADV_DONTDUMP = 0x10 @@ -2078,10 +2050,6 @@ const ( SIOCGSKNS = 0x894c SIOCGSTAMP = 0x8906 SIOCGSTAMPNS = 0x8907 - SIOCGSTAMPNS_NEW = 0x40108907 - SIOCGSTAMPNS_OLD = 0x8907 - SIOCGSTAMP_NEW = 0x40108906 - SIOCGSTAMP_OLD = 0x8906 SIOCINQ = 0x4004667f SIOCOUTQ = 0x40047473 SIOCOUTQNSD = 0x894b @@ -2289,7 +2257,6 @@ const ( SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 - SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7 SYSFS_MAGIC = 0x62656572 S_BLKSIZE = 0x200 S_IEXEC = 0x40 @@ -2506,7 +2473,6 @@ const ( TS_COMM_LEN = 0x20 TUNATTACHFILTER = 0x801054d5 TUNDETACHFILTER = 0x801054d6 - TUNGETDEVNETNS = 0x200054e3 TUNGETFEATURES = 0x400454cf TUNGETFILTER = 0x401054db TUNGETIFF = 0x400454d2 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index e869c0603..33b6e4d1a 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -423,10 +423,4 @@ const ( SYS_IO_URING_SETUP = 425 SYS_IO_URING_ENTER = 426 SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 4917b8ab6..9ba207847 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -345,10 +345,4 @@ const ( SYS_IO_URING_SETUP = 425 SYS_IO_URING_ENTER = 426 SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index f85fcb4f8..94f68f101 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -387,10 +387,4 @@ const ( SYS_IO_URING_SETUP = 425 SYS_IO_URING_ENTER = 426 SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 678a119bc..15c413516 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -290,10 +290,4 @@ const ( SYS_IO_URING_SETUP = 425 SYS_IO_URING_ENTER = 426 SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 222c9f9a2..638465b14 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -408,10 +408,4 @@ const ( SYS_IO_URING_SETUP = 4425 SYS_IO_URING_ENTER = 4426 SYS_IO_URING_REGISTER = 4427 - SYS_OPEN_TREE = 4428 - SYS_MOVE_MOUNT = 4429 - SYS_FSOPEN = 4430 - SYS_FSCONFIG = 4431 - SYS_FSMOUNT = 4432 - SYS_FSPICK = 4433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 28e6d0e9d..57ec82aac 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -338,10 +338,4 @@ const ( SYS_IO_URING_SETUP = 5425 SYS_IO_URING_ENTER = 5426 SYS_IO_URING_REGISTER = 5427 - SYS_OPEN_TREE = 5428 - SYS_MOVE_MOUNT = 5429 - SYS_FSOPEN = 5430 - SYS_FSCONFIG = 5431 - SYS_FSMOUNT = 5432 - SYS_FSPICK = 5433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index e643c6f63..825a3e3b0 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -338,10 +338,4 @@ const ( SYS_IO_URING_SETUP = 5425 SYS_IO_URING_ENTER = 5426 SYS_IO_URING_REGISTER = 5427 - SYS_OPEN_TREE = 5428 - SYS_MOVE_MOUNT = 5429 - SYS_FSOPEN = 5430 - SYS_FSCONFIG = 5431 - SYS_FSMOUNT = 5432 - SYS_FSPICK = 5433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 01d93c420..f152dfdd0 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -408,10 +408,4 @@ const ( SYS_IO_URING_SETUP = 4425 SYS_IO_URING_ENTER = 4426 SYS_IO_URING_REGISTER = 4427 - SYS_OPEN_TREE = 4428 - SYS_MOVE_MOUNT = 4429 - SYS_FSOPEN = 4430 - SYS_FSCONFIG = 4431 - SYS_FSMOUNT = 4432 - SYS_FSPICK = 4433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index 5744149eb..7cbe78b19 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -387,10 +387,4 @@ const ( SYS_IO_URING_SETUP = 425 SYS_IO_URING_ENTER = 426 SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 21c832042..51a2f1236 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -387,10 +387,4 @@ const ( SYS_IO_URING_SETUP = 425 SYS_IO_URING_ENTER = 426 SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index c1bb6d8f2..323432ae3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -289,10 +289,4 @@ const ( SYS_IO_URING_SETUP = 425 SYS_IO_URING_ENTER = 426 SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index bc3cc6b5b..9dca97484 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -352,10 +352,4 @@ const ( SYS_IO_URING_SETUP = 425 SYS_IO_URING_ENTER = 426 SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 0a2841ba8..d3da46f0d 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -367,10 +367,4 @@ const ( SYS_IO_URING_SETUP = 425 SYS_IO_URING_ENTER = 426 SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 ) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 50bc4128f..5492b9666 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -2484,40 +2484,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint16 - Inode uint32 - Rdevice uint16 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]int8 - Encrypt_key [32]uint8 - Init [2]uint32 - Reserved [4]int8 -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 055eaa76a..caf33b2c5 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -2497,41 +2497,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint64 - Inode uint64 - Rdevice uint64 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]int8 - Encrypt_key [32]uint8 - Init [2]uint64 - Reserved [4]int8 - _ [4]byte -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 66019c9cf..93aec7e22 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -2475,40 +2475,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint16 - Inode uint32 - Rdevice uint16 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint32 - Reserved [4]uint8 -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 3104798c4..0a038436d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -2476,41 +2476,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint32 - Inode uint64 - Rdevice uint32 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]int8 - Encrypt_key [32]uint8 - Init [2]uint64 - Reserved [4]int8 - _ [4]byte -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 46c86021b..2de0e5800 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -2481,40 +2481,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint32 - Inode uint32 - Rdevice uint32 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]int8 - Encrypt_key [32]uint8 - Init [2]uint32 - Reserved [4]int8 -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index c2fe1a62a..3735eb42e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -2478,41 +2478,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint32 - Inode uint64 - Rdevice uint32 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]int8 - Encrypt_key [32]uint8 - Init [2]uint64 - Reserved [4]int8 - _ [4]byte -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index f1eb0d397..073c29939 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -2478,41 +2478,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint32 - Inode uint64 - Rdevice uint32 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]int8 - Encrypt_key [32]uint8 - Init [2]uint64 - Reserved [4]int8 - _ [4]byte -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 8759bc36b..58d09f75e 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -2481,40 +2481,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint32 - Inode uint32 - Rdevice uint32 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]int8 - Encrypt_key [32]uint8 - Init [2]uint32 - Reserved [4]int8 -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index a81200541..3f1e62e03 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -2486,41 +2486,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint64 - Inode uint64 - Rdevice uint64 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 - Reserved [4]uint8 - _ [4]byte -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 74b7a9199..e67be11eb 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -2486,41 +2486,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint64 - Inode uint64 - Rdevice uint64 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 - Reserved [4]uint8 - _ [4]byte -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 8344583e7..f44f29403 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -2503,41 +2503,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint32 - Inode uint64 - Rdevice uint32 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 - Reserved [4]uint8 - _ [4]byte -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index d8fc0bc1c..90bf5dcc7 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -2500,41 +2500,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint16 - Inode uint64 - Rdevice uint16 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]int8 - Encrypt_key [32]uint8 - Init [2]uint64 - Reserved [4]int8 - _ [4]byte -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 5e0ab9329..4f054dcbb 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -2481,41 +2481,3 @@ const ( LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_3 = 0x20080522 ) - -const ( - LO_FLAGS_READ_ONLY = 0x1 - LO_FLAGS_AUTOCLEAR = 0x4 - LO_FLAGS_PARTSCAN = 0x8 - LO_FLAGS_DIRECT_IO = 0x10 -) - -type LoopInfo struct { - Number int32 - Device uint32 - Inode uint64 - Rdevice uint32 - Offset int32 - Encrypt_type int32 - Encrypt_key_size int32 - Flags int32 - Name [64]int8 - Encrypt_key [32]uint8 - Init [2]uint64 - Reserved [4]int8 - _ [4]byte -} -type LoopInfo64 struct { - Device uint64 - Inode uint64 - Rdevice uint64 - Offset uint64 - Sizelimit uint64 - Number uint32 - Encrypt_type uint32 - Encrypt_key_size uint32 - Flags uint32 - File_name [64]uint8 - Crypt_name [64]uint8 - Encrypt_key [32]uint8 - Init [2]uint64 -} diff --git a/vendor/golang.org/x/sys/windows/service.go b/vendor/golang.org/x/sys/windows/service.go index 847e00bc9..03383f1df 100644 --- a/vendor/golang.org/x/sys/windows/service.go +++ b/vendor/golang.org/x/sys/windows/service.go @@ -159,10 +159,6 @@ type SERVICE_DESCRIPTION struct { Description *uint16 } -type SERVICE_DELAYED_AUTO_START_INFO struct { - IsDelayedAutoStartUp uint32 -} - type SERVICE_STATUS_PROCESS struct { ServiceType uint32 CurrentState uint32 diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 1e3947f0f..8a563f92b 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -197,11 +197,8 @@ const ( FILE_MAP_READ = 0x04 FILE_MAP_EXECUTE = 0x20 - CTRL_C_EVENT = 0 - CTRL_BREAK_EVENT = 1 - CTRL_CLOSE_EVENT = 2 - CTRL_LOGOFF_EVENT = 5 - CTRL_SHUTDOWN_EVENT = 6 + CTRL_C_EVENT = 0 + CTRL_BREAK_EVENT = 1 // Windows reserves errors >= 1<<29 for application use. APPLICATION_ERROR = 1 << 29 diff --git a/vendor/google.golang.org/grpc/.travis.yml b/vendor/google.golang.org/grpc/.travis.yml index 591343edf..024408e64 100644 --- a/vendor/google.golang.org/grpc/.travis.yml +++ b/vendor/google.golang.org/grpc/.travis.yml @@ -3,15 +3,15 @@ language: go matrix: include: - go: 1.12.x - env: GO111MODULE=on - - go: 1.11.x env: VET=1 GO111MODULE=on - - go: 1.11.x + - go: 1.12.x env: RACE=1 GO111MODULE=on - - go: 1.11.x + - go: 1.12.x env: RUN386=1 - - go: 1.11.x + - go: 1.12.x env: GRPC_GO_RETRY=on + - go: 1.11.x + env: GO111MODULE=on - go: 1.10.x - go: 1.9.x - go: 1.9.x diff --git a/vendor/google.golang.org/grpc/balancer.go b/vendor/google.golang.org/grpc/balancer.go index a78e702ba..a8eb0f476 100644 --- a/vendor/google.golang.org/grpc/balancer.go +++ b/vendor/google.golang.org/grpc/balancer.go @@ -43,7 +43,7 @@ type Address struct { // BalancerConfig specifies the configurations for Balancer. // -// Deprecated: please use package balancer. +// Deprecated: please use package balancer. May be removed in a future 1.x release. type BalancerConfig struct { // DialCreds is the transport credential the Balancer implementation can // use to dial to a remote load balancer server. The Balancer implementations @@ -57,7 +57,7 @@ type BalancerConfig struct { // BalancerGetOptions configures a Get call. // -// Deprecated: please use package balancer. +// Deprecated: please use package balancer. May be removed in a future 1.x release. type BalancerGetOptions struct { // BlockingWait specifies whether Get should block when there is no // connected address. @@ -66,7 +66,7 @@ type BalancerGetOptions struct { // Balancer chooses network addresses for RPCs. // -// Deprecated: please use package balancer. +// Deprecated: please use package balancer. May be removed in a future 1.x release. type Balancer interface { // Start does the initialization work to bootstrap a Balancer. For example, // this function may start the name resolution and watch the updates. It will @@ -120,7 +120,7 @@ type Balancer interface { // RoundRobin returns a Balancer that selects addresses round-robin. It uses r to watch // the name resolution updates and updates the addresses available correspondingly. // -// Deprecated: please use package balancer/roundrobin. +// Deprecated: please use package balancer/roundrobin. May be removed in a future 1.x release. func RoundRobin(r naming.Resolver) Balancer { return &roundRobin{r: r} } diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index 4b72daa8b..c266f4ec1 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -22,6 +22,7 @@ package balancer import ( "context" + "encoding/json" "errors" "net" "strings" @@ -31,6 +32,7 @@ import ( "google.golang.org/grpc/internal" "google.golang.org/grpc/metadata" "google.golang.org/grpc/resolver" + "google.golang.org/grpc/serviceconfig" ) var ( @@ -39,7 +41,10 @@ var ( ) // Register registers the balancer builder to the balancer map. b.Name -// (lowercased) will be used as the name registered with this builder. +// (lowercased) will be used as the name registered with this builder. If the +// Builder implements ConfigParser, ParseConfig will be called when new service +// configs are received by the resolver, and the result will be provided to the +// Balancer in UpdateClientConnState. // // NOTE: this function must only be called during initialization time (i.e. in // an init() function), and is not thread-safe. If multiple Balancers are @@ -172,6 +177,14 @@ type Builder interface { Name() string } +// ConfigParser parses load balancer configs. +type ConfigParser interface { + // ParseConfig parses the JSON load balancer config provided into an + // internal form or returns an error if the config is invalid. For future + // compatibility reasons, unknown fields in the config should be ignored. + ParseConfig(LoadBalancingConfigJSON json.RawMessage) (serviceconfig.LoadBalancingConfig, error) +} + // PickOptions contains addition information for the Pick operation. type PickOptions struct { // FullMethodName is the method name that NewClientStream() is called @@ -270,7 +283,7 @@ type Balancer interface { // non-nil error to gRPC. // // Deprecated: if V2Balancer is implemented by the Balancer, - // UpdateResolverState will be called instead. + // UpdateClientConnState will be called instead. HandleResolvedAddrs([]resolver.Address, error) // Close closes the balancer. The balancer is not required to call // ClientConn.RemoveSubConn for its existing SubConns. @@ -283,14 +296,23 @@ type SubConnState struct { // TODO: add last connection error } +// ClientConnState describes the state of a ClientConn relevant to the +// balancer. +type ClientConnState struct { + ResolverState resolver.State + // The parsed load balancing configuration returned by the builder's + // ParseConfig method, if implemented. + BalancerConfig serviceconfig.LoadBalancingConfig +} + // V2Balancer is defined for documentation purposes. If a Balancer also -// implements V2Balancer, its UpdateResolverState method will be called instead -// of HandleResolvedAddrs and its UpdateSubConnState will be called instead of -// HandleSubConnStateChange. +// implements V2Balancer, its UpdateClientConnState method will be called +// instead of HandleResolvedAddrs and its UpdateSubConnState will be called +// instead of HandleSubConnStateChange. type V2Balancer interface { - // UpdateResolverState is called by gRPC when the state of the resolver + // UpdateClientConnState is called by gRPC when the state of the ClientConn // changes. - UpdateResolverState(resolver.State) + UpdateClientConnState(ClientConnState) // UpdateSubConnState is called by gRPC when the state of a SubConn // changes. UpdateSubConnState(SubConn, SubConnState) diff --git a/vendor/google.golang.org/grpc/balancer/base/balancer.go b/vendor/google.golang.org/grpc/balancer/base/balancer.go index c5a51bd1d..1af88f0a3 100644 --- a/vendor/google.golang.org/grpc/balancer/base/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/base/balancer.go @@ -70,13 +70,15 @@ func (b *baseBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) panic("not implemented") } -func (b *baseBalancer) UpdateResolverState(s resolver.State) { - // TODO: handle s.Err (log if not nil) once implemented. - // TODO: handle s.ServiceConfig? - grpclog.Infoln("base.baseBalancer: got new resolver state: ", s) +func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) { + // TODO: handle s.ResolverState.Err (log if not nil) once implemented. + // TODO: handle s.ResolverState.ServiceConfig? + if grpclog.V(2) { + grpclog.Infoln("base.baseBalancer: got new ClientConn state: ", s) + } // addrsSet is the set converted from addrs, it's used for quick lookup of an address. addrsSet := make(map[resolver.Address]struct{}) - for _, a := range s.Addresses { + for _, a := range s.ResolverState.Addresses { addrsSet[a] = struct{}{} if _, ok := b.subConns[a]; !ok { // a is a new address (not existing in b.subConns). @@ -127,10 +129,14 @@ func (b *baseBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectiv func (b *baseBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) { s := state.ConnectivityState - grpclog.Infof("base.baseBalancer: handle SubConn state change: %p, %v", sc, s) + if grpclog.V(2) { + grpclog.Infof("base.baseBalancer: handle SubConn state change: %p, %v", sc, s) + } oldS, ok := b.scStates[sc] if !ok { - grpclog.Infof("base.baseBalancer: got state changes for an unknown SubConn: %p, %v", sc, s) + if grpclog.V(2) { + grpclog.Infof("base.baseBalancer: got state changes for an unknown SubConn: %p, %v", sc, s) + } return } b.scStates[sc] = s diff --git a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go index bc965f0ac..8df4095ca 100644 --- a/vendor/google.golang.org/grpc/balancer_conn_wrappers.go +++ b/vendor/google.golang.org/grpc/balancer_conn_wrappers.go @@ -88,7 +88,7 @@ type ccBalancerWrapper struct { cc *ClientConn balancer balancer.Balancer stateChangeQueue *scStateUpdateBuffer - resolverUpdateCh chan *resolver.State + ccUpdateCh chan *balancer.ClientConnState done chan struct{} mu sync.Mutex @@ -99,7 +99,7 @@ func newCCBalancerWrapper(cc *ClientConn, b balancer.Builder, bopts balancer.Bui ccb := &ccBalancerWrapper{ cc: cc, stateChangeQueue: newSCStateUpdateBuffer(), - resolverUpdateCh: make(chan *resolver.State, 1), + ccUpdateCh: make(chan *balancer.ClientConnState, 1), done: make(chan struct{}), subConns: make(map[*acBalancerWrapper]struct{}), } @@ -126,7 +126,7 @@ func (ccb *ccBalancerWrapper) watcher() { } else { ccb.balancer.HandleSubConnStateChange(t.sc, t.state) } - case s := <-ccb.resolverUpdateCh: + case s := <-ccb.ccUpdateCh: select { case <-ccb.done: ccb.balancer.Close() @@ -134,9 +134,9 @@ func (ccb *ccBalancerWrapper) watcher() { default: } if ub, ok := ccb.balancer.(balancer.V2Balancer); ok { - ub.UpdateResolverState(*s) + ub.UpdateClientConnState(*s) } else { - ccb.balancer.HandleResolvedAddrs(s.Addresses, nil) + ccb.balancer.HandleResolvedAddrs(s.ResolverState.Addresses, nil) } case <-ccb.done: } @@ -151,9 +151,11 @@ func (ccb *ccBalancerWrapper) watcher() { for acbw := range scs { ccb.cc.removeAddrConn(acbw.getAddrConn(), errConnDrain) } + ccb.UpdateBalancerState(connectivity.Connecting, nil) return default: } + ccb.cc.firstResolveEvent.Fire() } } @@ -178,9 +180,10 @@ func (ccb *ccBalancerWrapper) handleSubConnStateChange(sc balancer.SubConn, s co }) } -func (ccb *ccBalancerWrapper) updateResolverState(s resolver.State) { +func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) { if ccb.cc.curBalancerName != grpclbName { // Filter any grpclb addresses since we don't have the grpclb balancer. + s := &ccs.ResolverState for i := 0; i < len(s.Addresses); { if s.Addresses[i].Type == resolver.GRPCLB { copy(s.Addresses[i:], s.Addresses[i+1:]) @@ -191,10 +194,10 @@ func (ccb *ccBalancerWrapper) updateResolverState(s resolver.State) { } } select { - case <-ccb.resolverUpdateCh: + case <-ccb.ccUpdateCh: default: } - ccb.resolverUpdateCh <- &s + ccb.ccUpdateCh <- ccs } func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index 78e6d178a..a7643df7d 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -38,13 +38,13 @@ import ( "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/channelz" - "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/resolver" _ "google.golang.org/grpc/resolver/dns" // To register dns resolver. _ "google.golang.org/grpc/resolver/passthrough" // To register passthrough resolver. + "google.golang.org/grpc/serviceconfig" "google.golang.org/grpc/status" ) @@ -532,24 +532,6 @@ func (cc *ClientConn) waitForResolvedAddrs(ctx context.Context) error { } } -// gRPC should resort to default service config when: -// * resolver service config is disabled -// * or, resolver does not return a service config or returns an invalid one. -func (cc *ClientConn) fallbackToDefaultServiceConfig(sc string) bool { - if cc.dopts.disableServiceConfig { - return true - } - // The logic below is temporary, will be removed once we change the resolver.State ServiceConfig field type. - // Right now, we assume that empty service config string means resolver does not return a config. - if sc == "" { - return true - } - // TODO: the logic below is temporary. Once we finish the logic to validate service config - // in resolver, we will replace the logic below. - _, err := parseServiceConfig(sc) - return err != nil -} - func (cc *ClientConn) updateResolverState(s resolver.State) error { cc.mu.Lock() defer cc.mu.Unlock() @@ -560,44 +542,37 @@ func (cc *ClientConn) updateResolverState(s resolver.State) error { return nil } - if cc.fallbackToDefaultServiceConfig(s.ServiceConfig) { + if cc.dopts.disableServiceConfig || s.ServiceConfig == nil { if cc.dopts.defaultServiceConfig != nil && cc.sc == nil { cc.applyServiceConfig(cc.dopts.defaultServiceConfig) } - } else { - // TODO: the parsing logic below will be moved inside resolver. - sc, err := parseServiceConfig(s.ServiceConfig) - if err != nil { - return err - } - if cc.sc == nil || cc.sc.rawJSONString != s.ServiceConfig { - cc.applyServiceConfig(sc) - } - } - - // update the service config that will be sent to balancer. - if cc.sc != nil { - s.ServiceConfig = cc.sc.rawJSONString + } else if sc, ok := s.ServiceConfig.(*ServiceConfig); ok { + cc.applyServiceConfig(sc) } + var balCfg serviceconfig.LoadBalancingConfig if cc.dopts.balancerBuilder == nil { // Only look at balancer types and switch balancer if balancer dial // option is not set. - var isGRPCLB bool - for _, a := range s.Addresses { - if a.Type == resolver.GRPCLB { - isGRPCLB = true - break - } - } var newBalancerName string - // TODO: use new loadBalancerConfig field with appropriate priority. - if isGRPCLB { - newBalancerName = grpclbName - } else if cc.sc != nil && cc.sc.LB != nil { - newBalancerName = *cc.sc.LB + if cc.sc != nil && cc.sc.lbConfig != nil { + newBalancerName = cc.sc.lbConfig.name + balCfg = cc.sc.lbConfig.cfg } else { - newBalancerName = PickFirstBalancerName + var isGRPCLB bool + for _, a := range s.Addresses { + if a.Type == resolver.GRPCLB { + isGRPCLB = true + break + } + } + if isGRPCLB { + newBalancerName = grpclbName + } else if cc.sc != nil && cc.sc.LB != nil { + newBalancerName = *cc.sc.LB + } else { + newBalancerName = PickFirstBalancerName + } } cc.switchBalancer(newBalancerName) } else if cc.balancerWrapper == nil { @@ -607,8 +582,7 @@ func (cc *ClientConn) updateResolverState(s resolver.State) error { cc.balancerWrapper = newCCBalancerWrapper(cc, cc.dopts.balancerBuilder, cc.balancerBuildOpts) } - cc.balancerWrapper.updateResolverState(s) - cc.firstResolveEvent.Fire() + cc.balancerWrapper.updateClientConnState(&balancer.ClientConnState{ResolverState: s, BalancerConfig: balCfg}) return nil } @@ -621,7 +595,7 @@ func (cc *ClientConn) updateResolverState(s resolver.State) error { // // Caller must hold cc.mu. func (cc *ClientConn) switchBalancer(name string) { - if strings.ToLower(cc.curBalancerName) == strings.ToLower(name) { + if strings.EqualFold(cc.curBalancerName, name) { return } @@ -760,6 +734,8 @@ func (ac *addrConn) connect() error { ac.mu.Unlock() return nil } + // Update connectivity state within the lock to prevent subsequent or + // concurrent calls from resetting the transport more than once. ac.updateConnectivityState(connectivity.Connecting) ac.mu.Unlock() @@ -770,7 +746,16 @@ func (ac *addrConn) connect() error { // tryUpdateAddrs tries to update ac.addrs with the new addresses list. // -// It checks whether current connected address of ac is in the new addrs list. +// If ac is Connecting, it returns false. The caller should tear down the ac and +// create a new one. Note that the backoff will be reset when this happens. +// +// If ac is TransientFailure, it updates ac.addrs and returns true. The updated +// addresses will be picked up by retry in the next iteration after backoff. +// +// If ac is Shutdown or Idle, it updates ac.addrs and returns true. +// +// If ac is Ready, it checks whether current connected address of ac is in the +// new addrs list. // - If true, it updates ac.addrs and returns true. The ac will keep using // the existing connection. // - If false, it does nothing and returns false. @@ -778,17 +763,18 @@ func (ac *addrConn) tryUpdateAddrs(addrs []resolver.Address) bool { ac.mu.Lock() defer ac.mu.Unlock() grpclog.Infof("addrConn: tryUpdateAddrs curAddr: %v, addrs: %v", ac.curAddr, addrs) - if ac.state == connectivity.Shutdown { + if ac.state == connectivity.Shutdown || + ac.state == connectivity.TransientFailure || + ac.state == connectivity.Idle { ac.addrs = addrs return true } - // Unless we're busy reconnecting already, let's reconnect from the top of - // the list. - if ac.state != connectivity.Ready { + if ac.state == connectivity.Connecting { return false } + // ac.state is Ready, try to find the connected address. var curAddrFound bool for _, a := range addrs { if reflect.DeepEqual(ac.curAddr, a) { @@ -1037,6 +1023,9 @@ func (ac *addrConn) resetTransport() { // The spec doesn't mention what should be done for multiple addresses. // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md#proposed-backoff-algorithm connectDeadline := time.Now().Add(dialDuration) + + ac.updateConnectivityState(connectivity.Connecting) + ac.transport = nil ac.mu.Unlock() newTr, addr, reconnect, err := ac.tryAllAddrs(addrs, connectDeadline) @@ -1071,55 +1060,32 @@ func (ac *addrConn) resetTransport() { ac.mu.Lock() if ac.state == connectivity.Shutdown { - newTr.Close() ac.mu.Unlock() + newTr.Close() return } ac.curAddr = addr ac.transport = newTr ac.backoffIdx = 0 - healthCheckConfig := ac.cc.healthCheckConfig() - // LB channel health checking is only enabled when all the four requirements below are met: - // 1. it is not disabled by the user with the WithDisableHealthCheck DialOption, - // 2. the internal.HealthCheckFunc is set by importing the grpc/healthcheck package, - // 3. a service config with non-empty healthCheckConfig field is provided, - // 4. the current load balancer allows it. hctx, hcancel := context.WithCancel(ac.ctx) - healthcheckManagingState := false - if !ac.cc.dopts.disableHealthCheck && healthCheckConfig != nil && ac.scopts.HealthCheckEnabled { - if ac.cc.dopts.healthCheckFunc == nil { - // TODO: add a link to the health check doc in the error message. - grpclog.Error("the client side LB channel health check function has not been set.") - } else { - // TODO(deklerk) refactor to just return transport - go ac.startHealthCheck(hctx, newTr, addr, healthCheckConfig.ServiceName) - healthcheckManagingState = true - } - } - if !healthcheckManagingState { - ac.updateConnectivityState(connectivity.Ready) - } + ac.startHealthCheck(hctx) ac.mu.Unlock() // Block until the created transport is down. And when this happens, // we restart from the top of the addr list. <-reconnect.Done() hcancel() - - // Need to reconnect after a READY, the addrConn enters - // TRANSIENT_FAILURE. + // restart connecting - the top of the loop will set state to + // CONNECTING. This is against the current connectivity semantics doc, + // however it allows for graceful behavior for RPCs not yet dispatched + // - unfortunate timing would otherwise lead to the RPC failing even + // though the TRANSIENT_FAILURE state (called for by the doc) would be + // instantaneous. // - // This will set addrConn to TRANSIENT_FAILURE for a very short period - // of time, and turns CONNECTING. It seems reasonable to skip this, but - // READY-CONNECTING is not a valid transition. - ac.mu.Lock() - if ac.state == connectivity.Shutdown { - ac.mu.Unlock() - return - } - ac.updateConnectivityState(connectivity.TransientFailure) - ac.mu.Unlock() + // Ideally we should transition to Idle here and block until there is + // RPC activity that leads to the balancer requesting a reconnect of + // the associated SubConn. } } @@ -1133,8 +1099,6 @@ func (ac *addrConn) tryAllAddrs(addrs []resolver.Address, connectDeadline time.T ac.mu.Unlock() return nil, resolver.Address{}, nil, errConnClosing } - ac.updateConnectivityState(connectivity.Connecting) - ac.transport = nil ac.cc.mu.RLock() ac.dopts.copts.KeepaliveParams = ac.cc.mkp @@ -1178,14 +1142,35 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne Authority: ac.cc.authority, } + once := sync.Once{} onGoAway := func(r transport.GoAwayReason) { ac.mu.Lock() ac.adjustParams(r) + once.Do(func() { + if ac.state == connectivity.Ready { + // Prevent this SubConn from being used for new RPCs by setting its + // state to Connecting. + // + // TODO: this should be Idle when grpc-go properly supports it. + ac.updateConnectivityState(connectivity.Connecting) + } + }) ac.mu.Unlock() reconnect.Fire() } onClose := func() { + ac.mu.Lock() + once.Do(func() { + if ac.state == connectivity.Ready { + // Prevent this SubConn from being used for new RPCs by setting its + // state to Connecting. + // + // TODO: this should be Idle when grpc-go properly supports it. + ac.updateConnectivityState(connectivity.Connecting) + } + }) + ac.mu.Unlock() close(onCloseCalled) reconnect.Fire() } @@ -1207,60 +1192,99 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne return nil, nil, err } - if ac.dopts.reqHandshake == envconfig.RequireHandshakeOn { - select { - case <-time.After(connectDeadline.Sub(time.Now())): - // We didn't get the preface in time. - newTr.Close() - grpclog.Warningf("grpc: addrConn.createTransport failed to connect to %v: didn't receive server preface in time. Reconnecting...", addr) - return nil, nil, errors.New("timed out waiting for server handshake") - case <-prefaceReceived: - // We got the preface - huzzah! things are good. - case <-onCloseCalled: - // The transport has already closed - noop. - return nil, nil, errors.New("connection closed") - // TODO(deklerk) this should bail on ac.ctx.Done(). Add a test and fix. - } + select { + case <-time.After(connectDeadline.Sub(time.Now())): + // We didn't get the preface in time. + newTr.Close() + grpclog.Warningf("grpc: addrConn.createTransport failed to connect to %v: didn't receive server preface in time. Reconnecting...", addr) + return nil, nil, errors.New("timed out waiting for server handshake") + case <-prefaceReceived: + // We got the preface - huzzah! things are good. + case <-onCloseCalled: + // The transport has already closed - noop. + return nil, nil, errors.New("connection closed") + // TODO(deklerk) this should bail on ac.ctx.Done(). Add a test and fix. } return newTr, reconnect, nil } -func (ac *addrConn) startHealthCheck(ctx context.Context, newTr transport.ClientTransport, addr resolver.Address, serviceName string) { - // Set up the health check helper functions - newStream := func() (interface{}, error) { - return ac.newClientStream(ctx, &StreamDesc{ServerStreams: true}, "/grpc.health.v1.Health/Watch", newTr) +// startHealthCheck starts the health checking stream (RPC) to watch the health +// stats of this connection if health checking is requested and configured. +// +// LB channel health checking is enabled when all requirements below are met: +// 1. it is not disabled by the user with the WithDisableHealthCheck DialOption +// 2. internal.HealthCheckFunc is set by importing the grpc/healthcheck package +// 3. a service config with non-empty healthCheckConfig field is provided +// 4. the load balancer requests it +// +// It sets addrConn to READY if the health checking stream is not started. +// +// Caller must hold ac.mu. +func (ac *addrConn) startHealthCheck(ctx context.Context) { + var healthcheckManagingState bool + defer func() { + if !healthcheckManagingState { + ac.updateConnectivityState(connectivity.Ready) + } + }() + + if ac.cc.dopts.disableHealthCheck { + return } - firstReady := true - reportHealth := func(ok bool) { + healthCheckConfig := ac.cc.healthCheckConfig() + if healthCheckConfig == nil { + return + } + if !ac.scopts.HealthCheckEnabled { + return + } + healthCheckFunc := ac.cc.dopts.healthCheckFunc + if healthCheckFunc == nil { + // The health package is not imported to set health check function. + // + // TODO: add a link to the health check doc in the error message. + grpclog.Error("Health check is requested but health check function is not set.") + return + } + + healthcheckManagingState = true + + // Set up the health check helper functions. + currentTr := ac.transport + newStream := func(method string) (interface{}, error) { + ac.mu.Lock() + if ac.transport != currentTr { + ac.mu.Unlock() + return nil, status.Error(codes.Canceled, "the provided transport is no longer valid to use") + } + ac.mu.Unlock() + return newNonRetryClientStream(ctx, &StreamDesc{ServerStreams: true}, method, currentTr, ac) + } + setConnectivityState := func(s connectivity.State) { ac.mu.Lock() defer ac.mu.Unlock() - if ac.transport != newTr { + if ac.transport != currentTr { return } - if ok { - if firstReady { - firstReady = false - ac.curAddr = addr - } - ac.updateConnectivityState(connectivity.Ready) - } else { - ac.updateConnectivityState(connectivity.TransientFailure) - } + ac.updateConnectivityState(s) } - err := ac.cc.dopts.healthCheckFunc(ctx, newStream, reportHealth, serviceName) - if err != nil { - if status.Code(err) == codes.Unimplemented { - if channelz.IsOn() { - channelz.AddTraceEvent(ac.channelzID, &channelz.TraceEventDesc{ - Desc: "Subchannel health check is unimplemented at server side, thus health check is disabled", - Severity: channelz.CtError, - }) + // Start the health checking stream. + go func() { + err := ac.cc.dopts.healthCheckFunc(ctx, newStream, setConnectivityState, healthCheckConfig.ServiceName) + if err != nil { + if status.Code(err) == codes.Unimplemented { + if channelz.IsOn() { + channelz.AddTraceEvent(ac.channelzID, &channelz.TraceEventDesc{ + Desc: "Subchannel health check is unimplemented at server side, thus health check is disabled", + Severity: channelz.CtError, + }) + } + grpclog.Error("Subchannel health check is unimplemented at server side, thus health check is disabled") + } else { + grpclog.Errorf("HealthCheckFunc exits with unexpected error %v", err) } - grpclog.Error("Subchannel health check is unimplemented at server side, thus health check is disabled") - } else { - grpclog.Errorf("HealthCheckFunc exits with unexpected error %v", err) } - } + }() } func (ac *addrConn) resetConnectBackoff() { diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go index 88aff9459..8ea3d4a1d 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/credentials/credentials.go @@ -278,24 +278,22 @@ type ChannelzSecurityValue interface { // TLSChannelzSecurityValue defines the struct that TLS protocol should return // from GetSecurityValue(), containing security info like cipher and certificate used. type TLSChannelzSecurityValue struct { + ChannelzSecurityValue StandardName string LocalCertificate []byte RemoteCertificate []byte } -func (*TLSChannelzSecurityValue) isChannelzSecurityValue() {} - // OtherChannelzSecurityValue defines the struct that non-TLS protocol should return // from GetSecurityValue(), which contains protocol specific security info. Note // the Value field will be sent to users of channelz requesting channel info, and // thus sensitive info should better be avoided. type OtherChannelzSecurityValue struct { + ChannelzSecurityValue Name string Value proto.Message } -func (*OtherChannelzSecurityValue) isChannelzSecurityValue() {} - var cipherSuiteLookup = map[uint16]string{ tls.TLS_RSA_WITH_RC4_128_SHA: "TLS_RSA_WITH_RC4_128_SHA", tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index 69c003159..e8f34d0d6 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -60,7 +60,6 @@ type dialOptions struct { balancerBuilder balancer.Builder // This is to support grpclb. resolverBuilder resolver.Builder - reqHandshake envconfig.RequireHandshakeSetting channelzParentID int64 disableServiceConfig bool disableRetry bool @@ -100,17 +99,6 @@ func newFuncDialOption(f func(*dialOptions)) *funcDialOption { } } -// WithWaitForHandshake blocks until the initial settings frame is received from -// the server before assigning RPCs to the connection. -// -// Deprecated: this is the default behavior, and this option will be removed -// after the 1.18 release. -func WithWaitForHandshake() DialOption { - return newFuncDialOption(func(o *dialOptions) { - o.reqHandshake = envconfig.RequireHandshakeOn - }) -} - // WithWriteBufferSize determines how much data can be batched before doing a // write on the wire. The corresponding memory allocation for this buffer will // be twice the size to keep syscalls low. The default value for this buffer is @@ -156,7 +144,8 @@ func WithInitialConnWindowSize(s int32) DialOption { // WithMaxMsgSize returns a DialOption which sets the maximum message size the // client can receive. // -// Deprecated: use WithDefaultCallOptions(MaxCallRecvMsgSize(s)) instead. +// Deprecated: use WithDefaultCallOptions(MaxCallRecvMsgSize(s)) instead. Will +// be supported throughout 1.x. func WithMaxMsgSize(s int) DialOption { return WithDefaultCallOptions(MaxCallRecvMsgSize(s)) } @@ -172,7 +161,8 @@ func WithDefaultCallOptions(cos ...CallOption) DialOption { // WithCodec returns a DialOption which sets a codec for message marshaling and // unmarshaling. // -// Deprecated: use WithDefaultCallOptions(ForceCodec(_)) instead. +// Deprecated: use WithDefaultCallOptions(ForceCodec(_)) instead. Will be +// supported throughout 1.x. func WithCodec(c Codec) DialOption { return WithDefaultCallOptions(CallCustomCodec(c)) } @@ -181,7 +171,7 @@ func WithCodec(c Codec) DialOption { // message compression. It has lower priority than the compressor set by the // UseCompressor CallOption. // -// Deprecated: use UseCompressor instead. +// Deprecated: use UseCompressor instead. Will be supported throughout 1.x. func WithCompressor(cp Compressor) DialOption { return newFuncDialOption(func(o *dialOptions) { o.cp = cp @@ -196,7 +186,8 @@ func WithCompressor(cp Compressor) DialOption { // message. If no compressor is registered for the encoding, an Unimplemented // status error will be returned. // -// Deprecated: use encoding.RegisterCompressor instead. +// Deprecated: use encoding.RegisterCompressor instead. Will be supported +// throughout 1.x. func WithDecompressor(dc Decompressor) DialOption { return newFuncDialOption(func(o *dialOptions) { o.dc = dc @@ -207,7 +198,7 @@ func WithDecompressor(dc Decompressor) DialOption { // Name resolver will be ignored if this DialOption is specified. // // Deprecated: use the new balancer APIs in balancer package and -// WithBalancerName. +// WithBalancerName. Will be removed in a future 1.x release. func WithBalancer(b Balancer) DialOption { return newFuncDialOption(func(o *dialOptions) { o.balancerBuilder = &balancerWrapperBuilder{ @@ -223,7 +214,8 @@ func WithBalancer(b Balancer) DialOption { // The balancer cannot be overridden by balancer option specified by service // config. // -// This is an EXPERIMENTAL API. +// Deprecated: use WithDefaultServiceConfig and WithDisableServiceConfig +// instead. Will be removed in a future 1.x release. func WithBalancerName(balancerName string) DialOption { builder := balancer.Get(balancerName) if builder == nil { @@ -244,9 +236,10 @@ func withResolverBuilder(b resolver.Builder) DialOption { // WithServiceConfig returns a DialOption which has a channel to read the // service configuration. // -// Deprecated: service config should be received through name resolver, as -// specified here. -// https://github.com/grpc/grpc/blob/master/doc/service_config.md +// Deprecated: service config should be received through name resolver or via +// WithDefaultServiceConfig, as specified at +// https://github.com/grpc/grpc/blob/master/doc/service_config.md. Will be +// removed in a future 1.x release. func WithServiceConfig(c <-chan ServiceConfig) DialOption { return newFuncDialOption(func(o *dialOptions) { o.scChan = c @@ -329,7 +322,8 @@ func WithCredentialsBundle(b credentials.Bundle) DialOption { // WithTimeout returns a DialOption that configures a timeout for dialing a // ClientConn initially. This is valid if and only if WithBlock() is present. // -// Deprecated: use DialContext and context.WithTimeout instead. +// Deprecated: use DialContext and context.WithTimeout instead. Will be +// supported throughout 1.x. func WithTimeout(d time.Duration) DialOption { return newFuncDialOption(func(o *dialOptions) { o.timeout = d @@ -356,7 +350,8 @@ func init() { // is returned by f, gRPC checks the error's Temporary() method to decide if it // should try to reconnect to the network address. // -// Deprecated: use WithContextDialer instead +// Deprecated: use WithContextDialer instead. Will be supported throughout +// 1.x. func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption { return WithContextDialer( func(ctx context.Context, addr string) (net.Conn, error) { @@ -480,8 +475,10 @@ func WithDisableServiceConfig() DialOption { // WithDefaultServiceConfig returns a DialOption that configures the default // service config, which will be used in cases where: -// 1. WithDisableServiceConfig is called. -// 2. Resolver does not return service config or if the resolver gets and invalid config. +// +// 1. WithDisableServiceConfig is also used. +// 2. Resolver does not return a service config or if the resolver returns an +// invalid service config. // // This API is EXPERIMENTAL. func WithDefaultServiceConfig(s string) DialOption { @@ -537,7 +534,6 @@ func withHealthCheckFunc(f internal.HealthChecker) DialOption { func defaultDialOptions() dialOptions { return dialOptions{ disableRetry: !envconfig.Retry, - reqHandshake: envconfig.RequireHandshake, healthCheckFunc: internal.HealthCheckFunc, copts: transport.ConnectOptions{ WriteBufferSize: defaultWriteBufSize, diff --git a/vendor/google.golang.org/grpc/go.mod b/vendor/google.golang.org/grpc/go.mod index b75c069aa..c1a8340c5 100644 --- a/vendor/google.golang.org/grpc/go.mod +++ b/vendor/google.golang.org/grpc/go.mod @@ -11,10 +11,9 @@ require ( golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 golang.org/x/net v0.0.0-20190311183353-d8887717615a golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be - golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f // indirect golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a - golang.org/x/tools v0.0.0-20190311212946-11955173bddd + golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 google.golang.org/appengine v1.1.0 // indirect google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 - honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099 + honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc ) diff --git a/vendor/google.golang.org/grpc/go.sum b/vendor/google.golang.org/grpc/go.sum index 2a1723474..741677d2e 100644 --- a/vendor/google.golang.org/grpc/go.sum +++ b/vendor/google.golang.org/grpc/go.sum @@ -19,17 +19,19 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJV golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd h1:/e+gpKk9r3dJobndpTytxS2gOy6m5uvpg+ISQoEcusQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099 h1:XJP7lxbSxWLOMNdBE4B/STaqVy6L73o0knwj2vIlxnw= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/vendor/google.golang.org/grpc/health/client.go b/vendor/google.golang.org/grpc/health/client.go index e15f04c22..b43746e61 100644 --- a/vendor/google.golang.org/grpc/health/client.go +++ b/vendor/google.golang.org/grpc/health/client.go @@ -26,6 +26,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/connectivity" healthpb "google.golang.org/grpc/health/grpc_health_v1" "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/backoff" @@ -51,7 +52,11 @@ func init() { internal.HealthCheckFunc = clientHealthCheck } -func clientHealthCheck(ctx context.Context, newStream func() (interface{}, error), reportHealth func(bool), service string) error { +const healthCheckMethod = "/grpc.health.v1.Health/Watch" + +// This function implements the protocol defined at: +// https://github.com/grpc/grpc/blob/master/doc/health-checking.md +func clientHealthCheck(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State), service string) error { tryCnt := 0 retryConnection: @@ -65,7 +70,8 @@ retryConnection: if ctx.Err() != nil { return nil } - rawS, err := newStream() + setConnectivityState(connectivity.Connecting) + rawS, err := newStream(healthCheckMethod) if err != nil { continue retryConnection } @@ -73,7 +79,7 @@ retryConnection: s, ok := rawS.(grpc.ClientStream) // Ideally, this should never happen. But if it happens, the server is marked as healthy for LBing purposes. if !ok { - reportHealth(true) + setConnectivityState(connectivity.Ready) return fmt.Errorf("newStream returned %v (type %T); want grpc.ClientStream", rawS, rawS) } @@ -89,19 +95,23 @@ retryConnection: // Reports healthy for the LBing purposes if health check is not implemented in the server. if status.Code(err) == codes.Unimplemented { - reportHealth(true) + setConnectivityState(connectivity.Ready) return err } // Reports unhealthy if server's Watch method gives an error other than UNIMPLEMENTED. if err != nil { - reportHealth(false) + setConnectivityState(connectivity.TransientFailure) continue retryConnection } // As a message has been received, removes the need for backoff for the next retry by reseting the try count. tryCnt = 0 - reportHealth(resp.Status == healthpb.HealthCheckResponse_SERVING) + if resp.Status == healthpb.HealthCheckResponse_SERVING { + setConnectivityState(connectivity.Ready) + } else { + setConnectivityState(connectivity.TransientFailure) + } } } } diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index 11be7cd08..3ee8740f1 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -25,40 +25,11 @@ import ( ) const ( - prefix = "GRPC_GO_" - retryStr = prefix + "RETRY" - requireHandshakeStr = prefix + "REQUIRE_HANDSHAKE" -) - -// RequireHandshakeSetting describes the settings for handshaking. -type RequireHandshakeSetting int - -const ( - // RequireHandshakeOn indicates to wait for handshake before considering a - // connection ready/successful. - RequireHandshakeOn RequireHandshakeSetting = iota - // RequireHandshakeOff indicates to not wait for handshake before - // considering a connection ready/successful. - RequireHandshakeOff + prefix = "GRPC_GO_" + retryStr = prefix + "RETRY" ) var ( // Retry is set if retry is explicitly enabled via "GRPC_GO_RETRY=on". Retry = strings.EqualFold(os.Getenv(retryStr), "on") - // RequireHandshake is set based upon the GRPC_GO_REQUIRE_HANDSHAKE - // environment variable. - // - // Will be removed after the 1.18 release. - RequireHandshake = RequireHandshakeOn ) - -func init() { - switch strings.ToLower(os.Getenv(requireHandshakeStr)) { - case "on": - fallthrough - default: - RequireHandshake = RequireHandshakeOn - case "off": - RequireHandshake = RequireHandshakeOff - } -} diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index c1d2c690c..bc1f99ac8 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -23,6 +23,8 @@ package internal import ( "context" "time" + + "google.golang.org/grpc/connectivity" ) var ( @@ -37,10 +39,25 @@ var ( // KeepaliveMinPingTime is the minimum ping interval. This must be 10s by // default, but tests may wish to set it lower for convenience. KeepaliveMinPingTime = 10 * time.Second + // ParseServiceConfig is a function to parse JSON service configs into + // opaque data structures. + ParseServiceConfig func(sc string) (interface{}, error) + // StatusRawProto is exported by status/status.go. This func returns a + // pointer to the wrapped Status proto for a given status.Status without a + // call to proto.Clone(). The returned Status proto should not be mutated by + // the caller. + StatusRawProto interface{} // func (*status.Status) *spb.Status ) // HealthChecker defines the signature of the client-side LB channel health checking function. -type HealthChecker func(ctx context.Context, newStream func() (interface{}, error), reportHealth func(bool), serviceName string) error +// +// The implementation is expected to create a health checking RPC stream by +// calling newStream(), watch for the health status of serviceName, and report +// it's health back by calling setConnectivityState(). +// +// The health checking protocol is defined at: +// https://github.com/grpc/grpc/blob/master/doc/health-checking.md +type HealthChecker func(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State), serviceName string) error const ( // CredsBundleModeFallback switches GoogleDefaultCreds to fallback mode. diff --git a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go index 204ba1588..b8e0aa4db 100644 --- a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go +++ b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go @@ -23,6 +23,7 @@ import ( "fmt" "runtime" "sync" + "sync/atomic" "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" @@ -84,12 +85,24 @@ func (il *itemList) isEmpty() bool { // the control buffer of transport. They represent different aspects of // control tasks, e.g., flow control, settings, streaming resetting, etc. +// maxQueuedTransportResponseFrames is the most queued "transport response" +// frames we will buffer before preventing new reads from occurring on the +// transport. These are control frames sent in response to client requests, +// such as RST_STREAM due to bad headers or settings acks. +const maxQueuedTransportResponseFrames = 50 + +type cbItem interface { + isTransportResponseFrame() bool +} + // registerStream is used to register an incoming stream with loopy writer. type registerStream struct { streamID uint32 wq *writeQuota } +func (*registerStream) isTransportResponseFrame() bool { return false } + // headerFrame is also used to register stream on the client-side. type headerFrame struct { streamID uint32 @@ -102,6 +115,10 @@ type headerFrame struct { onOrphaned func(error) // Valid on client-side } +func (h *headerFrame) isTransportResponseFrame() bool { + return h.cleanup != nil && h.cleanup.rst // Results in a RST_STREAM +} + type cleanupStream struct { streamID uint32 rst bool @@ -109,6 +126,8 @@ type cleanupStream struct { onWrite func() } +func (c *cleanupStream) isTransportResponseFrame() bool { return c.rst } // Results in a RST_STREAM + type dataFrame struct { streamID uint32 endStream bool @@ -119,27 +138,41 @@ type dataFrame struct { onEachWrite func() } +func (*dataFrame) isTransportResponseFrame() bool { return false } + type incomingWindowUpdate struct { streamID uint32 increment uint32 } +func (*incomingWindowUpdate) isTransportResponseFrame() bool { return false } + type outgoingWindowUpdate struct { streamID uint32 increment uint32 } +func (*outgoingWindowUpdate) isTransportResponseFrame() bool { + return false // window updates are throttled by thresholds +} + type incomingSettings struct { ss []http2.Setting } +func (*incomingSettings) isTransportResponseFrame() bool { return true } // Results in a settings ACK + type outgoingSettings struct { ss []http2.Setting } +func (*outgoingSettings) isTransportResponseFrame() bool { return false } + type incomingGoAway struct { } +func (*incomingGoAway) isTransportResponseFrame() bool { return false } + type goAway struct { code http2.ErrCode debugData []byte @@ -147,15 +180,21 @@ type goAway struct { closeConn bool } +func (*goAway) isTransportResponseFrame() bool { return false } + type ping struct { ack bool data [8]byte } +func (*ping) isTransportResponseFrame() bool { return true } + type outFlowControlSizeRequest struct { resp chan uint32 } +func (*outFlowControlSizeRequest) isTransportResponseFrame() bool { return false } + type outStreamState int const ( @@ -238,6 +277,14 @@ type controlBuffer struct { consumerWaiting bool list *itemList err error + + // transportResponseFrames counts the number of queued items that represent + // the response of an action initiated by the peer. trfChan is created + // when transportResponseFrames >= maxQueuedTransportResponseFrames and is + // closed and nilled when transportResponseFrames drops below the + // threshold. Both fields are protected by mu. + transportResponseFrames int + trfChan atomic.Value // *chan struct{} } func newControlBuffer(done <-chan struct{}) *controlBuffer { @@ -248,12 +295,24 @@ func newControlBuffer(done <-chan struct{}) *controlBuffer { } } -func (c *controlBuffer) put(it interface{}) error { +// throttle blocks if there are too many incomingSettings/cleanupStreams in the +// controlbuf. +func (c *controlBuffer) throttle() { + ch, _ := c.trfChan.Load().(*chan struct{}) + if ch != nil { + select { + case <-*ch: + case <-c.done: + } + } +} + +func (c *controlBuffer) put(it cbItem) error { _, err := c.executeAndPut(nil, it) return err } -func (c *controlBuffer) executeAndPut(f func(it interface{}) bool, it interface{}) (bool, error) { +func (c *controlBuffer) executeAndPut(f func(it interface{}) bool, it cbItem) (bool, error) { var wakeUp bool c.mu.Lock() if c.err != nil { @@ -271,6 +330,15 @@ func (c *controlBuffer) executeAndPut(f func(it interface{}) bool, it interface{ c.consumerWaiting = false } c.list.enqueue(it) + if it.isTransportResponseFrame() { + c.transportResponseFrames++ + if c.transportResponseFrames == maxQueuedTransportResponseFrames { + // We are adding the frame that puts us over the threshold; create + // a throttling channel. + ch := make(chan struct{}) + c.trfChan.Store(&ch) + } + } c.mu.Unlock() if wakeUp { select { @@ -304,7 +372,17 @@ func (c *controlBuffer) get(block bool) (interface{}, error) { return nil, c.err } if !c.list.isEmpty() { - h := c.list.dequeue() + h := c.list.dequeue().(cbItem) + if h.isTransportResponseFrame() { + if c.transportResponseFrames == maxQueuedTransportResponseFrames { + // We are removing the frame that put us over the + // threshold; close and clear the throttling channel. + ch := c.trfChan.Load().(*chan struct{}) + close(*ch) + c.trfChan.Store((*chan struct{})(nil)) + } + c.transportResponseFrames-- + } c.mu.Unlock() return h, nil } diff --git a/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go b/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go index 5ea997a7e..f262edd8e 100644 --- a/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go +++ b/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go @@ -149,6 +149,7 @@ func (f *inFlow) maybeAdjust(n uint32) uint32 { n = uint32(math.MaxInt32) } f.mu.Lock() + defer f.mu.Unlock() // estSenderQuota is the receiver's view of the maximum number of bytes the sender // can send without a window update. estSenderQuota := int32(f.limit - (f.pendingData + f.pendingUpdate)) @@ -169,10 +170,8 @@ func (f *inFlow) maybeAdjust(n uint32) uint32 { // is padded; We will fallback on the current available window(at least a 1/4th of the limit). f.delta = n } - f.mu.Unlock() return f.delta } - f.mu.Unlock() return 0 } diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index f2de84d43..78f9ddc3d 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -24,6 +24,7 @@ package transport import ( + "bytes" "context" "errors" "fmt" @@ -347,7 +348,7 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace ht.stats.HandleRPC(s.ctx, inHeader) } s.trReader = &transportReader{ - reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf}, + reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf, freeBuffer: func(*bytes.Buffer) {}}, windowHandler: func(int) {}, } @@ -361,7 +362,7 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace for buf := make([]byte, readSize); ; { n, err := req.Body.Read(buf) if n > 0 { - s.buf.put(recvMsg{data: buf[:n:n]}) + s.buf.put(recvMsg{buffer: bytes.NewBuffer(buf[:n:n])}) buf = buf[n:] } if err != nil { diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index e26e28141..41a79c567 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -117,6 +117,8 @@ type http2Client struct { onGoAway func(GoAwayReason) onClose func() + + bufferPool *bufferPool } func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr string) (net.Conn, error) { @@ -249,6 +251,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne onGoAway: onGoAway, onClose: onClose, keepaliveEnabled: keepaliveEnabled, + bufferPool: newBufferPool(), } t.controlBuf = newControlBuffer(t.ctxDone) if opts.InitialWindowSize >= defaultWindowSize { @@ -367,6 +370,7 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { closeStream: func(err error) { t.CloseStream(s, err) }, + freeBuffer: t.bufferPool.put, }, windowHandler: func(n int) { t.updateWindow(s, uint32(n)) @@ -437,6 +441,15 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { var k string + for k, vv := range md { + // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. + if isReservedHeader(k) { + continue + } + for _, v := range vv { + headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) + } + } for _, vv := range added { for i, v := range vv { if i%2 == 0 { @@ -450,15 +463,6 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) headerFields = append(headerFields, hpack.HeaderField{Name: strings.ToLower(k), Value: encodeMetadataHeader(k, v)}) } } - for k, vv := range md { - // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } } if md, ok := t.md.(*metadata.MD); ok { for k, vv := range *md { @@ -489,6 +493,9 @@ func (t *http2Client) createAudience(callHdr *CallHdr) string { } func (t *http2Client) getTrAuthData(ctx context.Context, audience string) (map[string]string, error) { + if len(t.perRPCCreds) == 0 { + return nil, nil + } authData := map[string]string{} for _, c := range t.perRPCCreds { data, err := c.GetRequestMetadata(ctx, audience) @@ -509,7 +516,7 @@ func (t *http2Client) getTrAuthData(ctx context.Context, audience string) (map[s } func (t *http2Client) getCallAuthData(ctx context.Context, audience string, callHdr *CallHdr) (map[string]string, error) { - callAuthData := map[string]string{} + var callAuthData map[string]string // Check if credentials.PerRPCCredentials were provided via call options. // Note: if these credentials are provided both via dial options and call // options, then both sets of credentials will be applied. @@ -521,6 +528,7 @@ func (t *http2Client) getCallAuthData(ctx context.Context, audience string, call if err != nil { return nil, status.Errorf(codes.Internal, "transport: %v", err) } + callAuthData = make(map[string]string, len(data)) for k, v := range data { // Capital header names are illegal in HTTP/2 k = strings.ToLower(k) @@ -552,7 +560,6 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Strea if atomic.CompareAndSwapUint32(&s.headerChanClosed, 0, 1) { close(s.headerChan) } - } hdr := &headerFrame{ hf: headerFields, @@ -765,6 +772,9 @@ func (t *http2Client) Close() error { t.mu.Unlock() return nil } + // Call t.onClose before setting the state to closing to prevent the client + // from attempting to create new streams ASAP. + t.onClose() t.state = closing streams := t.activeStreams t.activeStreams = nil @@ -785,7 +795,6 @@ func (t *http2Client) Close() error { } t.statsHandler.HandleConn(t.ctx, connEnd) } - t.onClose() return err } @@ -946,9 +955,10 @@ func (t *http2Client) handleData(f *http2.DataFrame) { // guarantee f.Data() is consumed before the arrival of next frame. // Can this copy be eliminated? if len(f.Data()) > 0 { - data := make([]byte, len(f.Data())) - copy(data, f.Data()) - s.write(recvMsg{data: data}) + buffer := t.bufferPool.get() + buffer.Reset() + buffer.Write(f.Data()) + s.write(recvMsg{buffer: buffer}) } } // The server has closed the stream without sending trailers. Record that @@ -973,9 +983,9 @@ func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) { statusCode = codes.Unknown } if statusCode == codes.Canceled { - // Our deadline was already exceeded, and that was likely the cause of - // this cancelation. Alter the status code accordingly. - if d, ok := s.ctx.Deadline(); ok && d.After(time.Now()) { + if d, ok := s.ctx.Deadline(); ok && !d.After(time.Now()) { + // Our deadline was already exceeded, and that was likely the cause + // of this cancelation. Alter the status code accordingly. statusCode = codes.DeadlineExceeded } } @@ -1080,11 +1090,12 @@ func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { default: t.setGoAwayReason(f) close(t.goAway) - t.state = draining t.controlBuf.put(&incomingGoAway{}) - - // This has to be a new goroutine because we're still using the current goroutine to read in the transport. + // Notify the clientconn about the GOAWAY before we set the state to + // draining, to allow the client to stop attempting to create streams + // before disallowing new streams on this connection. t.onGoAway(t.goAwayReason) + t.state = draining } // All streams with IDs greater than the GoAwayId // and smaller than the previous GoAway ID should be killed. @@ -1234,6 +1245,7 @@ func (t *http2Client) reader() { // loop to keep reading incoming messages on this transport. for { + t.controlBuf.throttle() frame, err := t.framer.fr.ReadFrame() if t.keepaliveEnabled { atomic.CompareAndSwapUint32(&t.activity, 0, 1) @@ -1321,6 +1333,7 @@ func (t *http2Client) keepalive() { timer.Reset(t.kp.Time) continue } + infof("transport: closing client transport due to idleness.") t.Close() return case <-t.ctx.Done(): diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index 435092e5c..83439b562 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -35,9 +35,11 @@ import ( "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" + spb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/keepalive" @@ -55,6 +57,9 @@ var ( // ErrHeaderListSizeLimitViolation indicates that the header list size is larger // than the limit set by peer. ErrHeaderListSizeLimitViolation = errors.New("transport: trying to send header list size larger than the limit set by peer") + // statusRawProto is a function to get to the raw status proto wrapped in a + // status.Status without a proto.Clone(). + statusRawProto = internal.StatusRawProto.(func(*status.Status) *spb.Status) ) // http2Server implements the ServerTransport interface with HTTP2. @@ -119,6 +124,7 @@ type http2Server struct { // Fields below are for channelz metric collection. channelzID int64 // channelz unique identification number czData *channelzData + bufferPool *bufferPool } // newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is @@ -220,6 +226,7 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err kep: kep, initialWindowSize: iwz, czData: new(channelzData), + bufferPool: newBufferPool(), } t.controlBuf = newControlBuffer(t.ctxDone) if dynamicWindow { @@ -405,9 +412,10 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone) s.trReader = &transportReader{ reader: &recvBufferReader{ - ctx: s.ctx, - ctxDone: s.ctxDone, - recv: s.buf, + ctx: s.ctx, + ctxDone: s.ctxDone, + recv: s.buf, + freeBuffer: t.bufferPool.put, }, windowHandler: func(n int) { t.updateWindow(s, uint32(n)) @@ -428,6 +436,7 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func( func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.Context, string) context.Context) { defer close(t.readerDone) for { + t.controlBuf.throttle() frame, err := t.framer.fr.ReadFrame() atomic.StoreUint32(&t.activity, 1) if err != nil { @@ -591,9 +600,10 @@ func (t *http2Server) handleData(f *http2.DataFrame) { // guarantee f.Data() is consumed before the arrival of next frame. // Can this copy be eliminated? if len(f.Data()) > 0 { - data := make([]byte, len(f.Data())) - copy(data, f.Data()) - s.write(recvMsg{data: data}) + buffer := t.bufferPool.get() + buffer.Reset() + buffer.Write(f.Data()) + s.write(recvMsg{buffer: buffer}) } } if f.Header().Flags.Has(http2.FlagDataEndStream) { @@ -757,6 +767,10 @@ func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { return nil } +func (t *http2Server) setResetPingStrikes() { + atomic.StoreUint32(&t.resetPingStrikes, 1) +} + func (t *http2Server) writeHeaderLocked(s *Stream) error { // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields // first and create a slice of that exact size. @@ -771,9 +785,7 @@ func (t *http2Server) writeHeaderLocked(s *Stream) error { streamID: s.id, hf: headerFields, endStream: false, - onWrite: func() { - atomic.StoreUint32(&t.resetPingStrikes, 1) - }, + onWrite: t.setResetPingStrikes, }) if !success { if err != nil { @@ -817,7 +829,7 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status", Value: strconv.Itoa(int(st.Code()))}) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())}) - if p := st.Proto(); p != nil && len(p.Details) > 0 { + if p := statusRawProto(st); p != nil && len(p.Details) > 0 { stBytes, err := proto.Marshal(p) if err != nil { // TODO: return error instead, when callers are able to handle it. @@ -833,9 +845,7 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { streamID: s.id, hf: headerFields, endStream: true, - onWrite: func() { - atomic.StoreUint32(&t.resetPingStrikes, 1) - }, + onWrite: t.setResetPingStrikes, } s.hdrMu.Unlock() success, err := t.controlBuf.execute(t.checkForHeaderListSize, trailingHeader) @@ -887,12 +897,10 @@ func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) e hdr = append(hdr, data[:emptyLen]...) data = data[emptyLen:] df := &dataFrame{ - streamID: s.id, - h: hdr, - d: data, - onEachWrite: func() { - atomic.StoreUint32(&t.resetPingStrikes, 1) - }, + streamID: s.id, + h: hdr, + d: data, + onEachWrite: t.setResetPingStrikes, } if err := s.wq.get(int32(len(hdr) + len(data))); err != nil { select { @@ -958,6 +966,7 @@ func (t *http2Server) keepalive() { select { case <-maxAge.C: // Close the connection after grace period. + infof("transport: closing server transport due to maximum connection age.") t.Close() // Resetting the timer so that the clean-up doesn't deadlock. maxAge.Reset(infinity) @@ -971,6 +980,7 @@ func (t *http2Server) keepalive() { continue } if pingSent { + infof("transport: closing server transport due to idleness.") t.Close() // Resetting the timer so that the clean-up doesn't deadlock. keepalive.Reset(infinity) @@ -1019,13 +1029,7 @@ func (t *http2Server) Close() error { } // deleteStream deletes the stream s from transport's active streams. -func (t *http2Server) deleteStream(s *Stream, eosReceived bool) (oldState streamState) { - oldState = s.swapState(streamDone) - if oldState == streamDone { - // If the stream was already done, return. - return oldState - } - +func (t *http2Server) deleteStream(s *Stream, eosReceived bool) { // In case stream sending and receiving are invoked in separate // goroutines (e.g., bi-directional streaming), cancel needs to be // called to interrupt the potential blocking on other goroutines. @@ -1047,15 +1051,13 @@ func (t *http2Server) deleteStream(s *Stream, eosReceived bool) (oldState stream atomic.AddInt64(&t.czData.streamsFailed, 1) } } - - return oldState } // finishStream closes the stream and puts the trailing headerFrame into controlbuf. func (t *http2Server) finishStream(s *Stream, rst bool, rstCode http2.ErrCode, hdr *headerFrame, eosReceived bool) { - oldState := t.deleteStream(s, eosReceived) - // If the stream is already closed, then don't put trailing header to controlbuf. + oldState := s.swapState(streamDone) if oldState == streamDone { + // If the stream was already done, return. return } @@ -1063,14 +1065,18 @@ func (t *http2Server) finishStream(s *Stream, rst bool, rstCode http2.ErrCode, h streamID: s.id, rst: rst, rstCode: rstCode, - onWrite: func() {}, + onWrite: func() { + t.deleteStream(s, eosReceived) + }, } t.controlBuf.put(hdr) } // closeStream clears the footprint of a stream when the stream is not needed any more. func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, eosReceived bool) { + s.swapState(streamDone) t.deleteStream(s, eosReceived) + t.controlBuf.put(&cleanupStream{ streamID: s.id, rst: rst, diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go index 4bf583efc..1c1d10670 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -22,6 +22,7 @@ package transport import ( + "bytes" "context" "errors" "fmt" @@ -39,10 +40,32 @@ import ( "google.golang.org/grpc/tap" ) +type bufferPool struct { + pool sync.Pool +} + +func newBufferPool() *bufferPool { + return &bufferPool{ + pool: sync.Pool{ + New: func() interface{} { + return new(bytes.Buffer) + }, + }, + } +} + +func (p *bufferPool) get() *bytes.Buffer { + return p.pool.Get().(*bytes.Buffer) +} + +func (p *bufferPool) put(b *bytes.Buffer) { + p.pool.Put(b) +} + // recvMsg represents the received msg from the transport. All transport // protocol specific info has been removed. type recvMsg struct { - data []byte + buffer *bytes.Buffer // nil: received some data // io.EOF: stream is completed. data is nil. // other non-nil error: transport failure. data is nil. @@ -117,8 +140,9 @@ type recvBufferReader struct { ctx context.Context ctxDone <-chan struct{} // cache of ctx.Done() (for performance). recv *recvBuffer - last []byte // Stores the remaining data in the previous calls. + last *bytes.Buffer // Stores the remaining data in the previous calls. err error + freeBuffer func(*bytes.Buffer) } // Read reads the next len(p) bytes from last. If last is drained, it tries to @@ -128,10 +152,13 @@ func (r *recvBufferReader) Read(p []byte) (n int, err error) { if r.err != nil { return 0, r.err } - if r.last != nil && len(r.last) > 0 { + if r.last != nil { // Read remaining data left in last call. - copied := copy(p, r.last) - r.last = r.last[copied:] + copied, _ := r.last.Read(p) + if r.last.Len() == 0 { + r.freeBuffer(r.last) + r.last = nil + } return copied, nil } if r.closeStream != nil { @@ -157,6 +184,19 @@ func (r *recvBufferReader) readClient(p []byte) (n int, err error) { // r.readAdditional acts on that message and returns the necessary error. select { case <-r.ctxDone: + // Note that this adds the ctx error to the end of recv buffer, and + // reads from the head. This will delay the error until recv buffer is + // empty, thus will delay ctx cancellation in Recv(). + // + // It's done this way to fix a race between ctx cancel and trailer. The + // race was, stream.Recv() may return ctx error if ctxDone wins the + // race, but stream.Trailer() may return a non-nil md because the stream + // was not marked as done when trailer is received. This closeStream + // call will mark stream as done, thus fix the race. + // + // TODO: delaying ctx error seems like a unnecessary side effect. What + // we really want is to mark the stream as done, and return ctx error + // faster. r.closeStream(ContextErr(r.ctx.Err())) m := <-r.recv.get() return r.readAdditional(m, p) @@ -170,8 +210,13 @@ func (r *recvBufferReader) readAdditional(m recvMsg, p []byte) (n int, err error if m.err != nil { return 0, m.err } - copied := copy(p, m.data) - r.last = m.data[copied:] + copied, _ := m.buffer.Read(p) + if m.buffer.Len() == 0 { + r.freeBuffer(m.buffer) + r.last = nil + } else { + r.last = m.buffer + } return copied, nil } @@ -266,6 +311,14 @@ func (s *Stream) waitOnHeader() error { } select { case <-s.ctx.Done(): + // We prefer success over failure when reading messages because we delay + // context error in stream.Read(). To keep behavior consistent, we also + // prefer success here. + select { + case <-s.headerChan: + return nil + default: + } return ContextErr(s.ctx.Err()) case <-s.headerChan: return nil diff --git a/vendor/google.golang.org/grpc/naming/naming.go b/vendor/google.golang.org/grpc/naming/naming.go index c99fdbef4..f4c1c8b68 100644 --- a/vendor/google.golang.org/grpc/naming/naming.go +++ b/vendor/google.golang.org/grpc/naming/naming.go @@ -17,9 +17,8 @@ */ // Package naming defines the naming API and related data structures for gRPC. -// The interface is EXPERIMENTAL and may be subject to change. // -// Deprecated: please use package resolver. +// This package is deprecated: please use package resolver instead. package naming // Operation defines the corresponding operations for a name resolution change. diff --git a/vendor/google.golang.org/grpc/pickfirst.go b/vendor/google.golang.org/grpc/pickfirst.go index d1e38aad7..ed05b02ed 100644 --- a/vendor/google.golang.org/grpc/pickfirst.go +++ b/vendor/google.golang.org/grpc/pickfirst.go @@ -51,14 +51,18 @@ type pickfirstBalancer struct { func (b *pickfirstBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { if err != nil { - grpclog.Infof("pickfirstBalancer: HandleResolvedAddrs called with error %v", err) + if grpclog.V(2) { + grpclog.Infof("pickfirstBalancer: HandleResolvedAddrs called with error %v", err) + } return } if b.sc == nil { b.sc, err = b.cc.NewSubConn(addrs, balancer.NewSubConnOptions{}) if err != nil { //TODO(yuxuanli): why not change the cc state to Idle? - grpclog.Errorf("pickfirstBalancer: failed to NewSubConn: %v", err) + if grpclog.V(2) { + grpclog.Errorf("pickfirstBalancer: failed to NewSubConn: %v", err) + } return } b.cc.UpdateBalancerState(connectivity.Idle, &picker{sc: b.sc}) @@ -70,9 +74,13 @@ func (b *pickfirstBalancer) HandleResolvedAddrs(addrs []resolver.Address, err er } func (b *pickfirstBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { - grpclog.Infof("pickfirstBalancer: HandleSubConnStateChange: %p, %v", sc, s) + if grpclog.V(2) { + grpclog.Infof("pickfirstBalancer: HandleSubConnStateChange: %p, %v", sc, s) + } if b.sc != sc { - grpclog.Infof("pickfirstBalancer: ignored state change because sc is not recognized") + if grpclog.V(2) { + grpclog.Infof("pickfirstBalancer: ignored state change because sc is not recognized") + } return } if s == connectivity.Shutdown { diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index f6f6934d9..e83da346a 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -20,6 +20,10 @@ // All APIs in this package are experimental. package resolver +import ( + "google.golang.org/grpc/serviceconfig" +) + var ( // m is a map from scheme to resolver builder. m = make(map[string]Builder) @@ -100,11 +104,12 @@ type BuildOption struct { // State contains the current Resolver state relevant to the ClientConn. type State struct { - Addresses []Address // Resolved addresses for the target - ServiceConfig string // JSON representation of the service config + Addresses []Address // Resolved addresses for the target + // ServiceConfig is the parsed service config; obtained from + // serviceconfig.Parse. + ServiceConfig serviceconfig.Config // TODO: add Err error - // TODO: add ParsedServiceConfig interface{} } // ClientConn contains the callbacks for resolver to notify any updates diff --git a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go index e9cef3a92..6934905b0 100644 --- a/vendor/google.golang.org/grpc/resolver_conn_wrapper.go +++ b/vendor/google.golang.org/grpc/resolver_conn_wrapper.go @@ -138,19 +138,22 @@ func (ccr *ccResolverWrapper) NewServiceConfig(sc string) { return } grpclog.Infof("ccResolverWrapper: got new service config: %v", sc) + c, err := parseServiceConfig(sc) + if err != nil { + return + } if channelz.IsOn() { - ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: sc}) + ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: c}) } - ccr.curState.ServiceConfig = sc + ccr.curState.ServiceConfig = c ccr.cc.updateResolverState(ccr.curState) } func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { - if s.ServiceConfig == ccr.curState.ServiceConfig && (len(ccr.curState.Addresses) == 0) == (len(s.Addresses) == 0) { - return - } var updates []string - if s.ServiceConfig != ccr.curState.ServiceConfig { + oldSC, oldOK := ccr.curState.ServiceConfig.(*ServiceConfig) + newSC, newOK := s.ServiceConfig.(*ServiceConfig) + if oldOK != newOK || (oldOK && newOK && oldSC.rawJSONString != newSC.rawJSONString) { updates = append(updates, "service config updated") } if len(ccr.curState.Addresses) > 0 && len(s.Addresses) == 0 { diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index 495a4f9b8..f064b73e5 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -42,6 +42,7 @@ import ( "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/metadata" @@ -56,6 +57,8 @@ const ( defaultServerMaxSendMessageSize = math.MaxInt32 ) +var statusOK = status.New(codes.OK, "") + type methodHandler func(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor UnaryServerInterceptor) (interface{}, error) // MethodDesc represents an RPC service's method specification. @@ -90,17 +93,15 @@ type Server struct { mu sync.Mutex // guards following lis map[net.Listener]bool - conns map[io.Closer]bool + conns map[transport.ServerTransport]bool serve bool drain bool cv *sync.Cond // signaled when connections close for GracefulStop m map[string]*service // service name -> service info events trace.EventLog - quit chan struct{} - done chan struct{} - quitOnce sync.Once - doneOnce sync.Once + quit *grpcsync.Event + done *grpcsync.Event channelzRemoveOnce sync.Once serveWG sync.WaitGroup // counts active Serve goroutines for GracefulStop @@ -386,10 +387,10 @@ func NewServer(opt ...ServerOption) *Server { s := &Server{ lis: make(map[net.Listener]bool), opts: opts, - conns: make(map[io.Closer]bool), + conns: make(map[transport.ServerTransport]bool), m: make(map[string]*service), - quit: make(chan struct{}), - done: make(chan struct{}), + quit: grpcsync.NewEvent(), + done: grpcsync.NewEvent(), czData: new(channelzData), } s.cv = sync.NewCond(&s.mu) @@ -556,11 +557,9 @@ func (s *Server) Serve(lis net.Listener) error { s.serveWG.Add(1) defer func() { s.serveWG.Done() - select { - // Stop or GracefulStop called; block until done and return nil. - case <-s.quit: - <-s.done - default: + if s.quit.HasFired() { + // Stop or GracefulStop called; block until done and return nil. + <-s.done.Done() } }() @@ -603,7 +602,7 @@ func (s *Server) Serve(lis net.Listener) error { timer := time.NewTimer(tempDelay) select { case <-timer.C: - case <-s.quit: + case <-s.quit.Done(): timer.Stop() return nil } @@ -613,10 +612,8 @@ func (s *Server) Serve(lis net.Listener) error { s.printf("done serving; Accept = %v", err) s.mu.Unlock() - select { - case <-s.quit: + if s.quit.HasFired() { return nil - default: } return err } @@ -637,6 +634,10 @@ func (s *Server) Serve(lis net.Listener) error { // handleRawConn forks a goroutine to handle a just-accepted connection that // has not had any I/O performed on it yet. func (s *Server) handleRawConn(rawConn net.Conn) { + if s.quit.HasFired() { + rawConn.Close() + return + } rawConn.SetDeadline(time.Now().Add(s.opts.connectionTimeout)) conn, authInfo, err := s.useTransportAuthenticator(rawConn) if err != nil { @@ -653,14 +654,6 @@ func (s *Server) handleRawConn(rawConn net.Conn) { return } - s.mu.Lock() - if s.conns == nil { - s.mu.Unlock() - conn.Close() - return - } - s.mu.Unlock() - // Finish handshaking (HTTP2) st := s.newHTTP2Transport(conn, authInfo) if st == nil { @@ -768,6 +761,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { // traceInfo returns a traceInfo and associates it with stream, if tracing is enabled. // If tracing is not enabled, it returns nil. func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Stream) (trInfo *traceInfo) { + if !EnableTracing { + return nil + } tr, ok := trace.FromContext(stream.Context()) if !ok { return nil @@ -786,27 +782,27 @@ func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Strea return trInfo } -func (s *Server) addConn(c io.Closer) bool { +func (s *Server) addConn(st transport.ServerTransport) bool { s.mu.Lock() defer s.mu.Unlock() if s.conns == nil { - c.Close() + st.Close() return false } if s.drain { // Transport added after we drained our existing conns: drain it // immediately. - c.(transport.ServerTransport).Drain() + st.Drain() } - s.conns[c] = true + s.conns[st] = true return true } -func (s *Server) removeConn(c io.Closer) { +func (s *Server) removeConn(st transport.ServerTransport) { s.mu.Lock() defer s.mu.Unlock() if s.conns != nil { - delete(s.conns, c) + delete(s.conns, st) s.cv.Broadcast() } } @@ -978,10 +974,11 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. } if sh != nil { sh.HandleRPC(stream.Context(), &stats.InPayload{ - RecvTime: time.Now(), - Payload: v, - Data: d, - Length: len(d), + RecvTime: time.Now(), + Payload: v, + WireLength: payInfo.wireLength, + Data: d, + Length: len(d), }) } if binlog != nil { @@ -1077,7 +1074,7 @@ func (s *Server) processUnaryRPC(t transport.ServerTransport, stream *transport. // TODO: Should we be logging if writing status failed here, like above? // Should the logging be in WriteStatus? Should we ignore the WriteStatus // error or allow the stats handler to see it? - err = t.WriteStatus(stream, status.New(codes.OK, "")) + err = t.WriteStatus(stream, statusOK) if binlog != nil { binlog.Log(&binarylog.ServerTrailer{ Trailer: stream.Trailer(), @@ -1235,7 +1232,7 @@ func (s *Server) processStreamingRPC(t transport.ServerTransport, stream *transp ss.trInfo.tr.LazyLog(stringer("OK"), false) ss.mu.Unlock() } - err = t.WriteStatus(ss.s, status.New(codes.OK, "")) + err = t.WriteStatus(ss.s, statusOK) if ss.binlog != nil { ss.binlog.Log(&binarylog.ServerTrailer{ Trailer: ss.s.Trailer(), @@ -1352,15 +1349,11 @@ func ServerTransportStreamFromContext(ctx context.Context) ServerTransportStream // pending RPCs on the client side will get notified by connection // errors. func (s *Server) Stop() { - s.quitOnce.Do(func() { - close(s.quit) - }) + s.quit.Fire() defer func() { s.serveWG.Wait() - s.doneOnce.Do(func() { - close(s.done) - }) + s.done.Fire() }() s.channelzRemoveOnce.Do(func() { @@ -1397,15 +1390,8 @@ func (s *Server) Stop() { // accepting new connections and RPCs and blocks until all the pending RPCs are // finished. func (s *Server) GracefulStop() { - s.quitOnce.Do(func() { - close(s.quit) - }) - - defer func() { - s.doneOnce.Do(func() { - close(s.done) - }) - }() + s.quit.Fire() + defer s.done.Fire() s.channelzRemoveOnce.Do(func() { if channelz.IsOn() { @@ -1423,8 +1409,8 @@ func (s *Server) GracefulStop() { } s.lis = nil if !s.drain { - for c := range s.conns { - c.(transport.ServerTransport).Drain() + for st := range s.conns { + st.Drain() } s.drain = true } diff --git a/vendor/google.golang.org/grpc/service_config.go b/vendor/google.golang.org/grpc/service_config.go index 1c5227426..d0787f1e2 100644 --- a/vendor/google.golang.org/grpc/service_config.go +++ b/vendor/google.golang.org/grpc/service_config.go @@ -25,8 +25,11 @@ import ( "strings" "time" + "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal" + "google.golang.org/grpc/serviceconfig" ) const maxInt = int(^uint(0) >> 1) @@ -61,6 +64,11 @@ type MethodConfig struct { retryPolicy *retryPolicy } +type lbConfig struct { + name string + cfg serviceconfig.LoadBalancingConfig +} + // ServiceConfig is provided by the service provider and contains parameters for how // clients that connect to the service should behave. // @@ -68,10 +76,18 @@ type MethodConfig struct { // through name resolver, as specified here // https://github.com/grpc/grpc/blob/master/doc/service_config.md type ServiceConfig struct { - // LB is the load balancer the service providers recommends. The balancer specified - // via grpc.WithBalancer will override this. + serviceconfig.Config + + // LB is the load balancer the service providers recommends. The balancer + // specified via grpc.WithBalancer will override this. This is deprecated; + // lbConfigs is preferred. If lbConfig and LB are both present, lbConfig + // will be used. LB *string + // lbConfig is the service config's load balancing configuration. If + // lbConfig and LB are both present, lbConfig will be used. + lbConfig *lbConfig + // Methods contains a map for the methods in this service. If there is an // exact match for a method (i.e. /service/method) in the map, use the // corresponding MethodConfig. If there's no exact match, look for the @@ -233,15 +249,27 @@ type jsonMC struct { RetryPolicy *jsonRetryPolicy } +type loadBalancingConfig map[string]json.RawMessage + // TODO(lyuxuan): delete this struct after cleaning up old service config implementation. type jsonSC struct { LoadBalancingPolicy *string + LoadBalancingConfig *[]loadBalancingConfig MethodConfig *[]jsonMC RetryThrottling *retryThrottlingPolicy HealthCheckConfig *healthCheckConfig } +func init() { + internal.ParseServiceConfig = func(sc string) (interface{}, error) { + return parseServiceConfig(sc) + } +} + func parseServiceConfig(js string) (*ServiceConfig, error) { + if len(js) == 0 { + return nil, fmt.Errorf("no JSON service config provided") + } var rsc jsonSC err := json.Unmarshal([]byte(js), &rsc) if err != nil { @@ -255,10 +283,38 @@ func parseServiceConfig(js string) (*ServiceConfig, error) { healthCheckConfig: rsc.HealthCheckConfig, rawJSONString: js, } + if rsc.LoadBalancingConfig != nil { + for i, lbcfg := range *rsc.LoadBalancingConfig { + if len(lbcfg) != 1 { + err := fmt.Errorf("invalid loadBalancingConfig: entry %v does not contain exactly 1 policy/config pair: %q", i, lbcfg) + grpclog.Warningf(err.Error()) + return nil, err + } + var name string + var jsonCfg json.RawMessage + for name, jsonCfg = range lbcfg { + } + builder := balancer.Get(name) + if builder == nil { + continue + } + sc.lbConfig = &lbConfig{name: name} + if parser, ok := builder.(balancer.ConfigParser); ok { + var err error + sc.lbConfig.cfg, err = parser.ParseConfig(jsonCfg) + if err != nil { + return nil, fmt.Errorf("error parsing loadBalancingConfig for policy %q: %v", name, err) + } + } else if string(jsonCfg) != "{}" { + grpclog.Warningf("non-empty balancer configuration %q, but balancer does not implement ParseConfig", string(jsonCfg)) + } + break + } + } + if rsc.MethodConfig == nil { return &sc, nil } - for _, m := range *rsc.MethodConfig { if m.Name == nil { continue @@ -299,11 +355,11 @@ func parseServiceConfig(js string) (*ServiceConfig, error) { } if sc.retryThrottling != nil { - if sc.retryThrottling.MaxTokens <= 0 || - sc.retryThrottling.MaxTokens > 1000 || - sc.retryThrottling.TokenRatio <= 0 { - // Illegal throttling config; disable throttling. - sc.retryThrottling = nil + if mt := sc.retryThrottling.MaxTokens; mt <= 0 || mt > 1000 { + return nil, fmt.Errorf("invalid retry throttling config: maxTokens (%v) out of range (0, 1000]", mt) + } + if tr := sc.retryThrottling.TokenRatio; tr <= 0 { + return nil, fmt.Errorf("invalid retry throttling config: tokenRatio (%v) may not be negative", tr) } } return &sc, nil diff --git a/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go b/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go new file mode 100644 index 000000000..53b27875a --- /dev/null +++ b/vendor/google.golang.org/grpc/serviceconfig/serviceconfig.go @@ -0,0 +1,48 @@ +/* + * + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package serviceconfig defines types and methods for operating on gRPC +// service configs. +// +// This package is EXPERIMENTAL. +package serviceconfig + +import ( + "google.golang.org/grpc/internal" +) + +// Config represents an opaque data structure holding a service config. +type Config interface { + isConfig() +} + +// LoadBalancingConfig represents an opaque data structure holding a load +// balancer config. +type LoadBalancingConfig interface { + isLoadBalancingConfig() +} + +// Parse parses the JSON service config provided into an internal form or +// returns an error if the config is invalid. +func Parse(ServiceConfigJSON string) (Config, error) { + c, err := internal.ParseServiceConfig(ServiceConfigJSON) + if err != nil { + return nil, err + } + return c.(Config), err +} diff --git a/vendor/google.golang.org/grpc/status/status.go b/vendor/google.golang.org/grpc/status/status.go index ed36681bb..a1348e9b1 100644 --- a/vendor/google.golang.org/grpc/status/status.go +++ b/vendor/google.golang.org/grpc/status/status.go @@ -36,8 +36,15 @@ import ( "github.com/golang/protobuf/ptypes" spb "google.golang.org/genproto/googleapis/rpc/status" "google.golang.org/grpc/codes" + "google.golang.org/grpc/internal" ) +func init() { + internal.StatusRawProto = statusRawProto +} + +func statusRawProto(s *Status) *spb.Status { return s.s } + // statusError is an alias of a status proto. It implements error and Status, // and a nil statusError should never be returned by this package. type statusError spb.Status @@ -51,6 +58,17 @@ func (se *statusError) GRPCStatus() *Status { return &Status{s: (*spb.Status)(se)} } +// Is implements future error.Is functionality. +// A statusError is equivalent if the code and message are identical. +func (se *statusError) Is(target error) bool { + tse, ok := target.(*statusError) + if !ok { + return false + } + + return proto.Equal((*spb.Status)(se), (*spb.Status)(tse)) +} + // Status represents an RPC status code, message, and details. It is immutable // and should be created with New, Newf, or FromProto. type Status struct { @@ -125,7 +143,7 @@ func FromProto(s *spb.Status) *Status { // Status is returned with codes.Unknown and the original error message. func FromError(err error) (s *Status, ok bool) { if err == nil { - return &Status{s: &spb.Status{Code: int32(codes.OK)}}, true + return nil, true } if se, ok := err.(interface { GRPCStatus() *Status @@ -199,7 +217,7 @@ func Code(err error) codes.Code { func FromContextError(err error) *Status { switch err { case nil: - return New(codes.OK, "") + return nil case context.DeadlineExceeded: return New(codes.DeadlineExceeded, err.Error()) case context.Canceled: diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index e10e62317..134a624a1 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -30,7 +30,6 @@ import ( "golang.org/x/net/trace" "google.golang.org/grpc/balancer" "google.golang.org/grpc/codes" - "google.golang.org/grpc/connectivity" "google.golang.org/grpc/encoding" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/balancerload" @@ -328,13 +327,23 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth return cs, nil } -func (cs *clientStream) newAttemptLocked(sh stats.Handler, trInfo *traceInfo) error { - cs.attempt = &csAttempt{ +// newAttemptLocked creates a new attempt with a transport. +// If it succeeds, then it replaces clientStream's attempt with this new attempt. +func (cs *clientStream) newAttemptLocked(sh stats.Handler, trInfo *traceInfo) (retErr error) { + newAttempt := &csAttempt{ cs: cs, dc: cs.cc.dopts.dc, statsHandler: sh, trInfo: trInfo, } + defer func() { + if retErr != nil { + // This attempt is not set in the clientStream, so it's finish won't + // be called. Call it here for stats and trace in case they are not + // nil. + newAttempt.finish(retErr) + } + }() if err := cs.ctx.Err(); err != nil { return toRPCErr(err) @@ -346,8 +355,9 @@ func (cs *clientStream) newAttemptLocked(sh stats.Handler, trInfo *traceInfo) er if trInfo != nil { trInfo.firstLine.SetRemoteAddr(t.RemoteAddr()) } - cs.attempt.t = t - cs.attempt.done = done + newAttempt.t = t + newAttempt.done = done + cs.attempt = newAttempt return nil } @@ -396,11 +406,18 @@ type clientStream struct { serverHeaderBinlogged bool mu sync.Mutex - firstAttempt bool // if true, transparent retry is valid - numRetries int // exclusive of transparent retry attempt(s) - numRetriesSincePushback int // retries since pushback; to reset backoff - finished bool // TODO: replace with atomic cmpxchg or sync.Once? - attempt *csAttempt // the active client stream attempt + firstAttempt bool // if true, transparent retry is valid + numRetries int // exclusive of transparent retry attempt(s) + numRetriesSincePushback int // retries since pushback; to reset backoff + finished bool // TODO: replace with atomic cmpxchg or sync.Once? + // attempt is the active client stream attempt. + // The only place where it is written is the newAttemptLocked method and this method never writes nil. + // So, attempt can be nil only inside newClientStream function when clientStream is first created. + // One of the first things done after clientStream's creation, is to call newAttemptLocked which either + // assigns a non nil value to the attempt or returns an error. If an error is returned from newAttemptLocked, + // then newClientStream calls finish on the clientStream and returns. So, finish method is the only + // place where we need to check if the attempt is nil. + attempt *csAttempt // TODO(hedging): hedging will have multiple attempts simultaneously. committed bool // active attempt committed for retry? buffer []func(a *csAttempt) error // operations to replay on retry @@ -458,8 +475,8 @@ func (cs *clientStream) shouldRetry(err error) error { if cs.attempt.s != nil { <-cs.attempt.s.Done() } - if cs.firstAttempt && !cs.callInfo.failFast && (cs.attempt.s == nil || cs.attempt.s.Unprocessed()) { - // First attempt, wait-for-ready, stream unprocessed: transparently retry. + if cs.firstAttempt && (cs.attempt.s == nil || cs.attempt.s.Unprocessed()) { + // First attempt, stream unprocessed: transparently retry. cs.firstAttempt = false return nil } @@ -806,11 +823,11 @@ func (cs *clientStream) finish(err error) { } if cs.attempt != nil { cs.attempt.finish(err) - } - // after functions all rely upon having a stream. - if cs.attempt.s != nil { - for _, o := range cs.opts { - o.after(cs.callInfo) + // after functions all rely upon having a stream. + if cs.attempt.s != nil { + for _, o := range cs.opts { + o.after(cs.callInfo) + } } } cs.cancel() @@ -965,19 +982,18 @@ func (a *csAttempt) finish(err error) { a.mu.Unlock() } -func (ac *addrConn) newClientStream(ctx context.Context, desc *StreamDesc, method string, t transport.ClientTransport, opts ...CallOption) (_ ClientStream, err error) { - ac.mu.Lock() - if ac.transport != t { - ac.mu.Unlock() - return nil, status.Error(codes.Canceled, "the provided transport is no longer valid to use") - } - // transition to CONNECTING state when an attempt starts - if ac.state != connectivity.Connecting { - ac.updateConnectivityState(connectivity.Connecting) - ac.cc.handleSubConnStateChange(ac.acbw, ac.state) - } - ac.mu.Unlock() - +// newClientStream creates a ClientStream with the specified transport, on the +// given addrConn. +// +// It's expected that the given transport is either the same one in addrConn, or +// is already closed. To avoid race, transport is specified separately, instead +// of using ac.transpot. +// +// Main difference between this and ClientConn.NewStream: +// - no retry +// - no service config (or wait for service config) +// - no tracing or stats +func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method string, t transport.ClientTransport, ac *addrConn, opts ...CallOption) (_ ClientStream, err error) { if t == nil { // TODO: return RPC error here? return nil, errors.New("transport provided is nil") @@ -985,14 +1001,6 @@ func (ac *addrConn) newClientStream(ctx context.Context, desc *StreamDesc, metho // defaultCallInfo contains unnecessary info(i.e. failfast, maxRetryRPCBufferSize), so we just initialize an empty struct. c := &callInfo{} - for _, o := range opts { - if err := o.before(c); err != nil { - return nil, toRPCErr(err) - } - } - c.maxReceiveMessageSize = getMaxSize(nil, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize) - c.maxSendMessageSize = getMaxSize(nil, c.maxSendMessageSize, defaultServerMaxSendMessageSize) - // Possible context leak: // The cancel function for the child context we create will only be called // when RecvMsg returns a non-nil error, if the ClientConn is closed, or if @@ -1005,6 +1013,13 @@ func (ac *addrConn) newClientStream(ctx context.Context, desc *StreamDesc, metho } }() + for _, o := range opts { + if err := o.before(c); err != nil { + return nil, toRPCErr(err) + } + } + c.maxReceiveMessageSize = getMaxSize(nil, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize) + c.maxSendMessageSize = getMaxSize(nil, c.maxSendMessageSize, defaultServerMaxSendMessageSize) if err := setCallInfoCodec(c); err != nil { return nil, err } @@ -1037,6 +1052,7 @@ func (ac *addrConn) newClientStream(ctx context.Context, desc *StreamDesc, metho callHdr.Creds = c.creds } + // Use a special addrConnStream to avoid retry. as := &addrConnStream{ callHdr: callHdr, ac: ac, diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 5c8cb709a..5411a73a2 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.21.1" +const Version = "1.23.0" diff --git a/vendor/google.golang.org/grpc/vet.sh b/vendor/google.golang.org/grpc/vet.sh index 11037b94d..661e1e1de 100644 --- a/vendor/google.golang.org/grpc/vet.sh +++ b/vendor/google.golang.org/grpc/vet.sh @@ -105,12 +105,14 @@ if go help mod >& /dev/null; then fi # - Collection of static analysis checks -# TODO(menghanl): fix errors in transport_test. +# TODO(dfawley): don't use deprecated functions in examples. staticcheck -go 1.9 -checks 'inherit,-ST1015' -ignore ' google.golang.org/grpc/balancer.go:SA1019 +google.golang.org/grpc/balancer/grpclb/grpclb_remote_balancer.go:SA1019 google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go:SA1019 -google.golang.org/grpc/balancer/xds/edsbalancer/balancergroup.go:SA1019 -google.golang.org/grpc/balancer/xds/xds.go:SA1019 +google.golang.org/grpc/xds/internal/balancer/edsbalancer/balancergroup.go:SA1019 +google.golang.org/grpc/xds/internal/balancer/xds.go:SA1019 +google.golang.org/grpc/xds/internal/balancer/xds_client.go:SA1019 google.golang.org/grpc/balancer_conn_wrappers.go:SA1019 google.golang.org/grpc/balancer_test.go:SA1019 google.golang.org/grpc/benchmark/benchmain/main.go:SA1019 @@ -118,10 +120,13 @@ google.golang.org/grpc/benchmark/worker/benchmark_client.go:SA1019 google.golang.org/grpc/clientconn.go:S1024 google.golang.org/grpc/clientconn_state_transition_test.go:SA1019 google.golang.org/grpc/clientconn_test.go:SA1019 +google.golang.org/grpc/examples/features/debugging/client/main.go:SA1019 +google.golang.org/grpc/examples/features/load_balancing/client/main.go:SA1019 google.golang.org/grpc/internal/transport/handler_server.go:SA1019 google.golang.org/grpc/internal/transport/handler_server_test.go:SA1019 google.golang.org/grpc/resolver/dns/dns_resolver.go:SA1019 google.golang.org/grpc/stats/stats_test.go:SA1019 +google.golang.org/grpc/test/balancer_test.go:SA1019 google.golang.org/grpc/test/channelz_test.go:SA1019 google.golang.org/grpc/test/end2end_test.go:SA1019 google.golang.org/grpc/test/healthcheck_test.go:SA1019 diff --git a/vendor/modules.txt b/vendor/modules.txt index 88916fd5a..067a7e411 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -16,7 +16,7 @@ github.com/apparentlymart/go-cidr/cidr github.com/apparentlymart/go-textseg/textseg # github.com/armon/go-radix v1.0.0 github.com/armon/go-radix -# github.com/aws/aws-sdk-go v1.25.3 +# github.com/aws/aws-sdk-go v1.19.39 github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/awserr github.com/aws/aws-sdk-go/aws/awsutil @@ -38,7 +38,6 @@ github.com/aws/aws-sdk-go/aws/signer/v4 github.com/aws/aws-sdk-go/internal/ini github.com/aws/aws-sdk-go/internal/s3err github.com/aws/aws-sdk-go/internal/sdkio -github.com/aws/aws-sdk-go/internal/sdkmath github.com/aws/aws-sdk-go/internal/sdkrand github.com/aws/aws-sdk-go/internal/sdkuri github.com/aws/aws-sdk-go/internal/shareddefaults @@ -53,15 +52,10 @@ github.com/aws/aws-sdk-go/private/protocol/restxml github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil github.com/aws/aws-sdk-go/service/s3 github.com/aws/aws-sdk-go/service/sts -github.com/aws/aws-sdk-go/service/sts/stsiface # github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d github.com/bgentry/go-netrc/netrc # github.com/bgentry/speakeasy v0.1.0 github.com/bgentry/speakeasy -# github.com/blang/semver v3.5.1+incompatible -github.com/blang/semver -# github.com/bmatcuk/doublestar v1.1.5 -github.com/bmatcuk/doublestar # github.com/davecgh/go-spew v1.1.1 github.com/davecgh/go-spew/spew # github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0 @@ -75,7 +69,7 @@ github.com/golang/protobuf/ptypes github.com/golang/protobuf/ptypes/any github.com/golang/protobuf/ptypes/duration github.com/golang/protobuf/ptypes/timestamp -# github.com/google/go-cmp v0.3.1 +# github.com/google/go-cmp v0.3.0 github.com/google/go-cmp/cmp github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags @@ -92,11 +86,11 @@ github.com/hashicorp/go-cleanhttp # github.com/hashicorp/go-getter v1.4.0 github.com/hashicorp/go-getter github.com/hashicorp/go-getter/helper/url -# github.com/hashicorp/go-hclog v0.0.0-20181001195459-61d530d6c27f +# github.com/hashicorp/go-hclog v0.9.2 github.com/hashicorp/go-hclog # github.com/hashicorp/go-multierror v1.0.0 github.com/hashicorp/go-multierror -# github.com/hashicorp/go-plugin v1.0.1-0.20190610192547-a1bc61569a26 +# github.com/hashicorp/go-plugin v1.0.1 github.com/hashicorp/go-plugin github.com/hashicorp/go-plugin/internal/plugin # github.com/hashicorp/go-safetemp v1.0.0 @@ -107,7 +101,7 @@ github.com/hashicorp/go-uuid github.com/hashicorp/go-version # github.com/hashicorp/golang-lru v0.5.1 github.com/hashicorp/golang-lru/simplelru -# github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f +# github.com/hashicorp/hcl v1.0.0 github.com/hashicorp/hcl github.com/hashicorp/hcl/hcl/ast github.com/hashicorp/hcl/hcl/parser @@ -117,83 +111,70 @@ github.com/hashicorp/hcl/hcl/token github.com/hashicorp/hcl/json/parser github.com/hashicorp/hcl/json/scanner github.com/hashicorp/hcl/json/token -# github.com/hashicorp/hcl/v2 v2.0.0 -github.com/hashicorp/hcl/v2 -github.com/hashicorp/hcl/v2/ext/dynblock -github.com/hashicorp/hcl/v2/ext/typeexpr -github.com/hashicorp/hcl/v2/gohcl -github.com/hashicorp/hcl/v2/hcldec -github.com/hashicorp/hcl/v2/hcled -github.com/hashicorp/hcl/v2/hclparse -github.com/hashicorp/hcl/v2/hclsyntax -github.com/hashicorp/hcl/v2/hclwrite -github.com/hashicorp/hcl/v2/json # github.com/hashicorp/hcl2 v0.0.0-20190821123243-0c888d1241f6 +github.com/hashicorp/hcl2/ext/dynblock +github.com/hashicorp/hcl2/ext/typeexpr github.com/hashicorp/hcl2/gohcl github.com/hashicorp/hcl2/hcl github.com/hashicorp/hcl2/hcl/hclsyntax github.com/hashicorp/hcl2/hcl/json +github.com/hashicorp/hcl2/hcldec +github.com/hashicorp/hcl2/hcled github.com/hashicorp/hcl2/hclparse github.com/hashicorp/hcl2/hclwrite -# github.com/hashicorp/hil v0.0.0-20190212112733-ab17b08d6590 -github.com/hashicorp/hil +# github.com/hashicorp/hil v0.0.0-20190212132231-97b3a9cdfa93 github.com/hashicorp/hil/ast -github.com/hashicorp/hil/parser -github.com/hashicorp/hil/scanner -# github.com/hashicorp/terraform v0.12.18 -github.com/hashicorp/terraform/addrs -github.com/hashicorp/terraform/command/format -github.com/hashicorp/terraform/config -github.com/hashicorp/terraform/configs -github.com/hashicorp/terraform/configs/configload -github.com/hashicorp/terraform/configs/configschema -github.com/hashicorp/terraform/configs/hcl2shim -github.com/hashicorp/terraform/dag -github.com/hashicorp/terraform/experiments -github.com/hashicorp/terraform/flatmap -github.com/hashicorp/terraform/helper/acctest -github.com/hashicorp/terraform/helper/config -github.com/hashicorp/terraform/helper/didyoumean -github.com/hashicorp/terraform/helper/hashcode -github.com/hashicorp/terraform/helper/hilmapstructure -github.com/hashicorp/terraform/helper/logging -github.com/hashicorp/terraform/helper/pathorcontents -github.com/hashicorp/terraform/helper/plugin -github.com/hashicorp/terraform/helper/resource -github.com/hashicorp/terraform/helper/schema -github.com/hashicorp/terraform/helper/structure -github.com/hashicorp/terraform/helper/validation -github.com/hashicorp/terraform/httpclient -github.com/hashicorp/terraform/internal/earlyconfig -github.com/hashicorp/terraform/internal/initwd -github.com/hashicorp/terraform/internal/modsdir -github.com/hashicorp/terraform/internal/tfplugin5 -github.com/hashicorp/terraform/lang -github.com/hashicorp/terraform/lang/blocktoattr -github.com/hashicorp/terraform/lang/funcs -github.com/hashicorp/terraform/moduledeps -github.com/hashicorp/terraform/plans -github.com/hashicorp/terraform/plans/objchange -github.com/hashicorp/terraform/plugin -github.com/hashicorp/terraform/plugin/convert -github.com/hashicorp/terraform/plugin/discovery -github.com/hashicorp/terraform/providers -github.com/hashicorp/terraform/provisioners -github.com/hashicorp/terraform/registry -github.com/hashicorp/terraform/registry/regsrc -github.com/hashicorp/terraform/registry/response -github.com/hashicorp/terraform/states -github.com/hashicorp/terraform/states/statefile -github.com/hashicorp/terraform/terraform -github.com/hashicorp/terraform/tfdiags -github.com/hashicorp/terraform/version +# github.com/hashicorp/logutils v1.0.0 +github.com/hashicorp/logutils # github.com/hashicorp/terraform-config-inspect v0.0.0-20190821133035-82a99dc22ef4 github.com/hashicorp/terraform-config-inspect/tfconfig -# github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596 -github.com/hashicorp/terraform-svchost -github.com/hashicorp/terraform-svchost/auth -github.com/hashicorp/terraform-svchost/disco -# github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb +# github.com/hashicorp/terraform-plugin-sdk v1.1.0 +github.com/hashicorp/terraform-plugin-sdk/helper/acctest +github.com/hashicorp/terraform-plugin-sdk/helper/hashcode +github.com/hashicorp/terraform-plugin-sdk/helper/logging +github.com/hashicorp/terraform-plugin-sdk/helper/resource +github.com/hashicorp/terraform-plugin-sdk/helper/schema +github.com/hashicorp/terraform-plugin-sdk/helper/structure +github.com/hashicorp/terraform-plugin-sdk/helper/validation +github.com/hashicorp/terraform-plugin-sdk/internal/addrs +github.com/hashicorp/terraform-plugin-sdk/internal/command/format +github.com/hashicorp/terraform-plugin-sdk/internal/configs +github.com/hashicorp/terraform-plugin-sdk/internal/configs/configload +github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema +github.com/hashicorp/terraform-plugin-sdk/internal/configs/hcl2shim +github.com/hashicorp/terraform-plugin-sdk/internal/dag +github.com/hashicorp/terraform-plugin-sdk/internal/earlyconfig +github.com/hashicorp/terraform-plugin-sdk/internal/flatmap +github.com/hashicorp/terraform-plugin-sdk/internal/helper/config +github.com/hashicorp/terraform-plugin-sdk/internal/helper/didyoumean +github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin +github.com/hashicorp/terraform-plugin-sdk/internal/httpclient +github.com/hashicorp/terraform-plugin-sdk/internal/initwd +github.com/hashicorp/terraform-plugin-sdk/internal/lang +github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr +github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs +github.com/hashicorp/terraform-plugin-sdk/internal/modsdir +github.com/hashicorp/terraform-plugin-sdk/internal/moduledeps +github.com/hashicorp/terraform-plugin-sdk/internal/plans +github.com/hashicorp/terraform-plugin-sdk/internal/plans/objchange +github.com/hashicorp/terraform-plugin-sdk/internal/plugin/convert +github.com/hashicorp/terraform-plugin-sdk/internal/plugin/discovery +github.com/hashicorp/terraform-plugin-sdk/internal/providers +github.com/hashicorp/terraform-plugin-sdk/internal/provisioners +github.com/hashicorp/terraform-plugin-sdk/internal/registry +github.com/hashicorp/terraform-plugin-sdk/internal/registry/regsrc +github.com/hashicorp/terraform-plugin-sdk/internal/registry/response +github.com/hashicorp/terraform-plugin-sdk/internal/states +github.com/hashicorp/terraform-plugin-sdk/internal/states/statefile +github.com/hashicorp/terraform-plugin-sdk/internal/svchost +github.com/hashicorp/terraform-plugin-sdk/internal/svchost/auth +github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco +github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags +github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5 +github.com/hashicorp/terraform-plugin-sdk/internal/version +github.com/hashicorp/terraform-plugin-sdk/plugin +github.com/hashicorp/terraform-plugin-sdk/terraform +# github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d github.com/hashicorp/yamux # github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af github.com/jmespath/go-jmespath @@ -215,30 +196,26 @@ github.com/mitchellh/go-homedir github.com/mitchellh/go-testing-interface # github.com/mitchellh/go-wordwrap v1.0.0 github.com/mitchellh/go-wordwrap -# github.com/mitchellh/hashstructure v1.0.0 -github.com/mitchellh/hashstructure # github.com/mitchellh/mapstructure v1.1.2 github.com/mitchellh/mapstructure -# github.com/mitchellh/reflectwalk v1.0.0 +# github.com/mitchellh/reflectwalk v1.0.1 github.com/mitchellh/reflectwalk # github.com/oklog/run v1.0.0 github.com/oklog/run -# github.com/pkg/errors v0.8.0 +# github.com/pkg/errors v0.9.1 github.com/pkg/errors # github.com/posener/complete v1.2.1 github.com/posener/complete github.com/posener/complete/cmd github.com/posener/complete/cmd/install github.com/posener/complete/match -# github.com/spf13/afero v1.2.1 +# github.com/spf13/afero v1.2.2 github.com/spf13/afero github.com/spf13/afero/mem -# github.com/terraform-providers/terraform-provider-null v1.0.0 +# github.com/terraform-providers/terraform-provider-null v1.0.1-0.20191204185112-e5c592237f62 github.com/terraform-providers/terraform-provider-null/null -# github.com/terraform-providers/terraform-provider-random v2.0.0+incompatible +# github.com/terraform-providers/terraform-provider-random v1.3.2-0.20190925210718-83518d96ae4f github.com/terraform-providers/terraform-provider-random/random -# github.com/terraform-providers/terraform-provider-template v1.0.0 -github.com/terraform-providers/terraform-provider-template/template # github.com/ulikunitz/xz v0.5.5 github.com/ulikunitz/xz github.com/ulikunitz/xz/internal/hash @@ -297,7 +274,7 @@ go.opencensus.io/trace go.opencensus.io/trace/internal go.opencensus.io/trace/propagation go.opencensus.io/trace/tracestate -# golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 +# golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 golang.org/x/crypto/bcrypt golang.org/x/crypto/blowfish golang.org/x/crypto/cast5 @@ -315,7 +292,7 @@ golang.org/x/crypto/openpgp/s2k golang.org/x/crypto/poly1305 golang.org/x/crypto/ssh golang.org/x/crypto/ssh/terminal -# golang.org/x/net v0.0.0-20191009170851-d66e71096ffb +# golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 golang.org/x/net/context golang.org/x/net/context/ctxhttp golang.org/x/net/http/httpguts @@ -330,7 +307,7 @@ golang.org/x/oauth2/google golang.org/x/oauth2/internal golang.org/x/oauth2/jws golang.org/x/oauth2/jwt -# golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa +# golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 golang.org/x/sys/cpu golang.org/x/sys/unix golang.org/x/sys/windows @@ -370,7 +347,7 @@ google.golang.org/genproto/googleapis/iam/v1 google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/rpc/status google.golang.org/genproto/googleapis/type/expr -# google.golang.org/grpc v1.21.1 +# google.golang.org/grpc v1.23.0 google.golang.org/grpc google.golang.org/grpc/balancer google.golang.org/grpc/balancer/base @@ -402,6 +379,7 @@ google.golang.org/grpc/peer google.golang.org/grpc/resolver google.golang.org/grpc/resolver/dns google.golang.org/grpc/resolver/passthrough +google.golang.org/grpc/serviceconfig google.golang.org/grpc/stats google.golang.org/grpc/status google.golang.org/grpc/tap diff --git a/vsphere/config.go b/vsphere/config.go index 2d6f64553..d53cbb678 100644 --- a/vsphere/config.go +++ b/vsphere/config.go @@ -12,7 +12,7 @@ import ( "path/filepath" "time" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi" "github.com/vmware/govmomi/session" diff --git a/vsphere/config_test.go b/vsphere/config_test.go index 5ea6f8f5f..5ab7c6a13 100644 --- a/vsphere/config_test.go +++ b/vsphere/config_test.go @@ -8,7 +8,7 @@ import ( "strconv" "testing" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func testAccClientPreCheck(t *testing.T) { diff --git a/vsphere/data_source_vsphere_compute_cluster.go b/vsphere/data_source_vsphere_compute_cluster.go index 04c64919d..092a2f563 100644 --- a/vsphere/data_source_vsphere_compute_cluster.go +++ b/vsphere/data_source_vsphere_compute_cluster.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" ) diff --git a/vsphere/data_source_vsphere_compute_cluster_test.go b/vsphere/data_source_vsphere_compute_cluster_test.go index d0ac7efff..e4c81bdbf 100644 --- a/vsphere/data_source_vsphere_compute_cluster_test.go +++ b/vsphere/data_source_vsphere_compute_cluster_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereComputeCluster_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_custom_attribute.go b/vsphere/data_source_vsphere_custom_attribute.go index b8b9ed902..818e9ec7c 100644 --- a/vsphere/data_source_vsphere_custom_attribute.go +++ b/vsphere/data_source_vsphere_custom_attribute.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/vmware/govmomi/object" ) diff --git a/vsphere/data_source_vsphere_custom_attribute_test.go b/vsphere/data_source_vsphere_custom_attribute_test.go index 1d5869d9a..bc8658615 100644 --- a/vsphere/data_source_vsphere_custom_attribute_test.go +++ b/vsphere/data_source_vsphere_custom_attribute_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereCustomAttribute_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_datacenter.go b/vsphere/data_source_vsphere_datacenter.go index c18551d1b..7f1443249 100644 --- a/vsphere/data_source_vsphere_datacenter.go +++ b/vsphere/data_source_vsphere_datacenter.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func dataSourceVSphereDatacenter() *schema.Resource { diff --git a/vsphere/data_source_vsphere_datacenter_test.go b/vsphere/data_source_vsphere_datacenter_test.go index 967849a46..524c695c2 100644 --- a/vsphere/data_source_vsphere_datacenter_test.go +++ b/vsphere/data_source_vsphere_datacenter_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) var testAccDataSourceVSphereDatacenterExpectedRegexp = regexp.MustCompile("^datacenter-") diff --git a/vsphere/data_source_vsphere_datastore.go b/vsphere/data_source_vsphere_datastore.go index 722853421..2929af43c 100644 --- a/vsphere/data_source_vsphere_datastore.go +++ b/vsphere/data_source_vsphere_datastore.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/vmware/govmomi/object" ) diff --git a/vsphere/data_source_vsphere_datastore_cluster.go b/vsphere/data_source_vsphere_datastore_cluster.go index ca5fe473d..35910f89b 100644 --- a/vsphere/data_source_vsphere_datastore_cluster.go +++ b/vsphere/data_source_vsphere_datastore_cluster.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func dataSourceVSphereDatastoreCluster() *schema.Resource { diff --git a/vsphere/data_source_vsphere_datastore_cluster_test.go b/vsphere/data_source_vsphere_datastore_cluster_test.go index 278847d72..0500d6525 100644 --- a/vsphere/data_source_vsphere_datastore_cluster_test.go +++ b/vsphere/data_source_vsphere_datastore_cluster_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereDatastoreCluster_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_datastore_test.go b/vsphere/data_source_vsphere_datastore_test.go index 8d90586a7..484a950ad 100644 --- a/vsphere/data_source_vsphere_datastore_test.go +++ b/vsphere/data_source_vsphere_datastore_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereDatastore_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_distributed_virtual_switch.go b/vsphere/data_source_vsphere_distributed_virtual_switch.go index 129c88740..f5facdaa2 100644 --- a/vsphere/data_source_vsphere_distributed_virtual_switch.go +++ b/vsphere/data_source_vsphere_distributed_virtual_switch.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/object" "github.com/vmware/govmomi/vim25/types" diff --git a/vsphere/data_source_vsphere_distributed_virtual_switch_test.go b/vsphere/data_source_vsphere_distributed_virtual_switch_test.go index 2c736cd26..2978b4966 100644 --- a/vsphere/data_source_vsphere_distributed_virtual_switch_test.go +++ b/vsphere/data_source_vsphere_distributed_virtual_switch_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereDistributedVirtualSwitch_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_folder.go b/vsphere/data_source_vsphere_folder.go index 3e0308d36..763b2ebc0 100644 --- a/vsphere/data_source_vsphere_folder.go +++ b/vsphere/data_source_vsphere_folder.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" ) diff --git a/vsphere/data_source_vsphere_folder_test.go b/vsphere/data_source_vsphere_folder_test.go index bce5f34d0..9a27bfcfa 100644 --- a/vsphere/data_source_vsphere_folder_test.go +++ b/vsphere/data_source_vsphere_folder_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) var testAccDataSourceVSphereFolderExpectedRegexp = regexp.MustCompile("^group-v") diff --git a/vsphere/data_source_vsphere_host.go b/vsphere/data_source_vsphere_host.go index 90f7dd8c3..233162b32 100644 --- a/vsphere/data_source_vsphere_host.go +++ b/vsphere/data_source_vsphere_host.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/hostsystem" ) diff --git a/vsphere/data_source_vsphere_host_test.go b/vsphere/data_source_vsphere_host_test.go index 9093802df..d7864decf 100644 --- a/vsphere/data_source_vsphere_host_test.go +++ b/vsphere/data_source_vsphere_host_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereHost_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_network.go b/vsphere/data_source_vsphere_network.go index 7ccdce55b..59b61881e 100644 --- a/vsphere/data_source_vsphere_network.go +++ b/vsphere/data_source_vsphere_network.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/network" "github.com/vmware/govmomi/object" ) diff --git a/vsphere/data_source_vsphere_network_test.go b/vsphere/data_source_vsphere_network_test.go index 1376d51f1..aeb31af39 100644 --- a/vsphere/data_source_vsphere_network_test.go +++ b/vsphere/data_source_vsphere_network_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereNetwork_dvsPortgroup(t *testing.T) { diff --git a/vsphere/data_source_vsphere_resource_pool.go b/vsphere/data_source_vsphere_resource_pool.go index b1f2caf15..159d5a143 100644 --- a/vsphere/data_source_vsphere_resource_pool.go +++ b/vsphere/data_source_vsphere_resource_pool.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/resourcepool" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/object" diff --git a/vsphere/data_source_vsphere_resource_pool_test.go b/vsphere/data_source_vsphere_resource_pool_test.go index ea0c2c87a..03841b54a 100644 --- a/vsphere/data_source_vsphere_resource_pool_test.go +++ b/vsphere/data_source_vsphere_resource_pool_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereResourcePool_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_tag.go b/vsphere/data_source_vsphere_tag.go index a1a6c49ae..7cc5be806 100644 --- a/vsphere/data_source_vsphere_tag.go +++ b/vsphere/data_source_vsphere_tag.go @@ -1,6 +1,6 @@ package vsphere -import "github.com/hashicorp/terraform/helper/schema" +import "github.com/hashicorp/terraform-plugin-sdk/helper/schema" func dataSourceVSphereTag() *schema.Resource { return &schema.Resource{ diff --git a/vsphere/data_source_vsphere_tag_category.go b/vsphere/data_source_vsphere_tag_category.go index 1e8b0263f..d25c46640 100644 --- a/vsphere/data_source_vsphere_tag_category.go +++ b/vsphere/data_source_vsphere_tag_category.go @@ -1,6 +1,6 @@ package vsphere -import "github.com/hashicorp/terraform/helper/schema" +import "github.com/hashicorp/terraform-plugin-sdk/helper/schema" func dataSourceVSphereTagCategory() *schema.Resource { return &schema.Resource{ diff --git a/vsphere/data_source_vsphere_tag_category_test.go b/vsphere/data_source_vsphere_tag_category_test.go index c0f955ff2..1578e05db 100644 --- a/vsphere/data_source_vsphere_tag_category_test.go +++ b/vsphere/data_source_vsphere_tag_category_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereTagCategory_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_tag_test.go b/vsphere/data_source_vsphere_tag_test.go index 0a51f00e7..a8dcdc51c 100644 --- a/vsphere/data_source_vsphere_tag_test.go +++ b/vsphere/data_source_vsphere_tag_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereTag_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_vapp_container.go b/vsphere/data_source_vsphere_vapp_container.go index b16716029..b8866ab48 100644 --- a/vsphere/data_source_vsphere_vapp_container.go +++ b/vsphere/data_source_vsphere_vapp_container.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/vappcontainer" ) diff --git a/vsphere/data_source_vsphere_vapp_container_test.go b/vsphere/data_source_vsphere_vapp_container_test.go index bcd678f85..40dc00494 100644 --- a/vsphere/data_source_vsphere_vapp_container_test.go +++ b/vsphere/data_source_vsphere_vapp_container_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereVAppContainer_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_virtual_machine.go b/vsphere/data_source_vsphere_virtual_machine.go index 116edf97d..50371e731 100644 --- a/vsphere/data_source_vsphere_virtual_machine.go +++ b/vsphere/data_source_vsphere_virtual_machine.go @@ -4,7 +4,7 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice" "github.com/vmware/govmomi/object" diff --git a/vsphere/data_source_vsphere_virtual_machine_test.go b/vsphere/data_source_vsphere_virtual_machine_test.go index 7cf5c9a9b..896ba0433 100644 --- a/vsphere/data_source_vsphere_virtual_machine_test.go +++ b/vsphere/data_source_vsphere_virtual_machine_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccDataSourceVSphereVirtualMachine_basic(t *testing.T) { diff --git a/vsphere/data_source_vsphere_vmfs_disks.go b/vsphere/data_source_vsphere_vmfs_disks.go index a1050ca70..200112493 100644 --- a/vsphere/data_source_vsphere_vmfs_disks.go +++ b/vsphere/data_source_vsphere_vmfs_disks.go @@ -7,8 +7,8 @@ import ( "sort" "time" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/vmware/govmomi/vim25/mo" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/data_source_vsphere_vmfs_disks_test.go b/vsphere/data_source_vsphere_vmfs_disks_test.go index 1a9532b68..0a8a4d58b 100644 --- a/vsphere/data_source_vsphere_vmfs_disks_test.go +++ b/vsphere/data_source_vsphere_vmfs_disks_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccDataSourceVSphereVmfsDisks_basic(t *testing.T) { diff --git a/vsphere/datastore_structure.go b/vsphere/datastore_structure.go index 27c5b4db3..0279e83b2 100644 --- a/vsphere/datastore_structure.go +++ b/vsphere/datastore_structure.go @@ -3,7 +3,7 @@ package vsphere import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/storagepod" diff --git a/vsphere/distributed_port_group_structure.go b/vsphere/distributed_port_group_structure.go index 8100a24da..e28d1fa31 100644 --- a/vsphere/distributed_port_group_structure.go +++ b/vsphere/distributed_port_group_structure.go @@ -1,8 +1,8 @@ package vsphere import ( - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/distributed_virtual_port_setting_structure.go b/vsphere/distributed_virtual_port_setting_structure.go index 244cec6ba..8095394a9 100644 --- a/vsphere/distributed_virtual_port_setting_structure.go +++ b/vsphere/distributed_virtual_port_setting_structure.go @@ -3,8 +3,8 @@ package vsphere import ( "log" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/distributed_virtual_switch_structure.go b/vsphere/distributed_virtual_switch_structure.go index 163c865b1..d164150ea 100644 --- a/vsphere/distributed_virtual_switch_structure.go +++ b/vsphere/distributed_virtual_switch_structure.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/helper_test.go b/vsphere/helper_test.go index 73a479d6c..91f373e6e 100644 --- a/vsphere/helper_test.go +++ b/vsphere/helper_test.go @@ -12,8 +12,8 @@ import ( "testing" "time" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/dvportgroup" diff --git a/vsphere/host_nas_volume_structure.go b/vsphere/host_nas_volume_structure.go index 79728b3b0..b180c633d 100644 --- a/vsphere/host_nas_volume_structure.go +++ b/vsphere/host_nas_volume_structure.go @@ -1,8 +1,8 @@ package vsphere import ( - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/host_network_policy_structure.go b/vsphere/host_network_policy_structure.go index dfc9504e5..31405d675 100644 --- a/vsphere/host_network_policy_structure.go +++ b/vsphere/host_network_policy_structure.go @@ -1,8 +1,8 @@ package vsphere import ( - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/host_port_group_structure.go b/vsphere/host_port_group_structure.go index be10c0778..62c910147 100644 --- a/vsphere/host_port_group_structure.go +++ b/vsphere/host_port_group_structure.go @@ -4,9 +4,9 @@ import ( "fmt" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/host_virtual_switch_structure.go b/vsphere/host_virtual_switch_structure.go index fc9f8d8c6..63786c6cc 100644 --- a/vsphere/host_virtual_switch_structure.go +++ b/vsphere/host_virtual_switch_structure.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/internal/helper/customattribute/custom_attributes_helper.go b/vsphere/internal/helper/customattribute/custom_attributes_helper.go index 13bcddf42..e497e6fa7 100644 --- a/vsphere/internal/helper/customattribute/custom_attributes_helper.go +++ b/vsphere/internal/helper/customattribute/custom_attributes_helper.go @@ -6,7 +6,7 @@ import ( "fmt" "strconv" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi" "github.com/vmware/govmomi/object" diff --git a/vsphere/internal/helper/structure/structure_helper.go b/vsphere/internal/helper/structure/structure_helper.go index 08bf7ba96..053b15a80 100644 --- a/vsphere/internal/helper/structure/structure_helper.go +++ b/vsphere/internal/helper/structure/structure_helper.go @@ -6,7 +6,7 @@ import ( "reflect" "strconv" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/internal/virtualdevice/virtual_machine_cdrom_subresource.go b/vsphere/internal/virtualdevice/virtual_machine_cdrom_subresource.go index 49e89d67c..4e12c1bc0 100644 --- a/vsphere/internal/virtualdevice/virtual_machine_cdrom_subresource.go +++ b/vsphere/internal/virtualdevice/virtual_machine_cdrom_subresource.go @@ -6,7 +6,7 @@ import ( "reflect" "regexp" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/mitchellh/copystructure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" diff --git a/vsphere/internal/virtualdevice/virtual_machine_device_subresource.go b/vsphere/internal/virtualdevice/virtual_machine_device_subresource.go index 706306baa..c04114203 100644 --- a/vsphere/internal/virtualdevice/virtual_machine_device_subresource.go +++ b/vsphere/internal/virtualdevice/virtual_machine_device_subresource.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/mitchellh/copystructure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/vmware/govmomi" diff --git a/vsphere/internal/virtualdevice/virtual_machine_disk_subresource.go b/vsphere/internal/virtualdevice/virtual_machine_disk_subresource.go index 7de2ce1ba..922418505 100644 --- a/vsphere/internal/virtualdevice/virtual_machine_disk_subresource.go +++ b/vsphere/internal/virtualdevice/virtual_machine_disk_subresource.go @@ -11,8 +11,8 @@ import ( "sort" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/mitchellh/copystructure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/storagepod" diff --git a/vsphere/internal/virtualdevice/virtual_machine_network_interface_subresource.go b/vsphere/internal/virtualdevice/virtual_machine_network_interface_subresource.go index 4698c4c3a..39f75628c 100644 --- a/vsphere/internal/virtualdevice/virtual_machine_network_interface_subresource.go +++ b/vsphere/internal/virtualdevice/virtual_machine_network_interface_subresource.go @@ -8,8 +8,8 @@ import ( "sort" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/mitchellh/copystructure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/dvportgroup" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/network" diff --git a/vsphere/internal/vmworkflow/virtual_machine_clone_subresource.go b/vsphere/internal/vmworkflow/virtual_machine_clone_subresource.go index 6d68b030e..3baa3f5b3 100644 --- a/vsphere/internal/vmworkflow/virtual_machine_clone_subresource.go +++ b/vsphere/internal/vmworkflow/virtual_machine_clone_subresource.go @@ -4,8 +4,8 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/hostsystem" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/resourcepool" diff --git a/vsphere/internal/vmworkflow/virtual_machine_customize_subresource.go b/vsphere/internal/vmworkflow/virtual_machine_customize_subresource.go index 02f077f59..c263bf163 100644 --- a/vsphere/internal/vmworkflow/virtual_machine_customize_subresource.go +++ b/vsphere/internal/vmworkflow/virtual_machine_customize_subresource.go @@ -6,8 +6,8 @@ import ( "net" "regexp" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/provider.go b/vsphere/provider.go index d396c5f54..90c7dce3a 100644 --- a/vsphere/provider.go +++ b/vsphere/provider.go @@ -5,8 +5,8 @@ import ( "path/filepath" "time" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) // defaultAPITimeout is a default timeout value that is passed to functions diff --git a/vsphere/provider_test.go b/vsphere/provider_test.go index b26285e33..4060c53ff 100644 --- a/vsphere/provider_test.go +++ b/vsphere/provider_test.go @@ -4,11 +4,10 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-null/null" "github.com/terraform-providers/terraform-provider-random/random" - "github.com/terraform-providers/terraform-provider-template/template" ) var testAccProviders map[string]terraform.ResourceProvider @@ -21,12 +20,10 @@ func init() { testAccProvider = Provider().(*schema.Provider) testAccNullProvider = null.Provider().(*schema.Provider) testAccRandomProvider = random.Provider().(*schema.Provider) - testAccTemplateProvider = template.Provider().(*schema.Provider) testAccProviders = map[string]terraform.ResourceProvider{ - "vsphere": testAccProvider, - "null": testAccNullProvider, - "random": testAccRandomProvider, - "template": testAccTemplateProvider, + "vsphere": testAccProvider, + "null": testAccNullProvider, + "random": testAccRandomProvider, } } diff --git a/vsphere/resource_vsphere_compute_cluster.go b/vsphere/resource_vsphere_compute_cluster.go index 62e4be4ff..5036956f6 100644 --- a/vsphere/resource_vsphere_compute_cluster.go +++ b/vsphere/resource_vsphere_compute_cluster.go @@ -4,8 +4,8 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" diff --git a/vsphere/resource_vsphere_compute_cluster_host_group.go b/vsphere/resource_vsphere_compute_cluster_host_group.go index 6c46749db..a15700222 100644 --- a/vsphere/resource_vsphere_compute_cluster_host_group.go +++ b/vsphere/resource_vsphere_compute_cluster_host_group.go @@ -7,7 +7,7 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_compute_cluster_host_group_test.go b/vsphere/resource_vsphere_compute_cluster_host_group_test.go index 2ce0b2be5..7274ae5a7 100644 --- a/vsphere/resource_vsphere_compute_cluster_host_group_test.go +++ b/vsphere/resource_vsphere_compute_cluster_host_group_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/vim25/types" diff --git a/vsphere/resource_vsphere_compute_cluster_test.go b/vsphere/resource_vsphere_compute_cluster_test.go index 92a6dd304..b55c8562c 100644 --- a/vsphere/resource_vsphere_compute_cluster_test.go +++ b/vsphere/resource_vsphere_compute_cluster_test.go @@ -7,8 +7,8 @@ import ( "path" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/hostsystem" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_compute_cluster_vm_affinity_rule.go b/vsphere/resource_vsphere_compute_cluster_vm_affinity_rule.go index 791620432..2bbae3365 100644 --- a/vsphere/resource_vsphere_compute_cluster_vm_affinity_rule.go +++ b/vsphere/resource_vsphere_compute_cluster_vm_affinity_rule.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_compute_cluster_vm_affinity_rule_test.go b/vsphere/resource_vsphere_compute_cluster_vm_affinity_rule_test.go index 9201d1bf0..8e9d1218c 100644 --- a/vsphere/resource_vsphere_compute_cluster_vm_affinity_rule_test.go +++ b/vsphere/resource_vsphere_compute_cluster_vm_affinity_rule_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" diff --git a/vsphere/resource_vsphere_compute_cluster_vm_anti_affinity_rule.go b/vsphere/resource_vsphere_compute_cluster_vm_anti_affinity_rule.go index 49985ae71..4d7b9bc0b 100644 --- a/vsphere/resource_vsphere_compute_cluster_vm_anti_affinity_rule.go +++ b/vsphere/resource_vsphere_compute_cluster_vm_anti_affinity_rule.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_compute_cluster_vm_anti_affinity_rule_test.go b/vsphere/resource_vsphere_compute_cluster_vm_anti_affinity_rule_test.go index 7647c7ef3..f480f4c58 100644 --- a/vsphere/resource_vsphere_compute_cluster_vm_anti_affinity_rule_test.go +++ b/vsphere/resource_vsphere_compute_cluster_vm_anti_affinity_rule_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" diff --git a/vsphere/resource_vsphere_compute_cluster_vm_dependency_rule.go b/vsphere/resource_vsphere_compute_cluster_vm_dependency_rule.go index a56ba9402..be4fc66b9 100644 --- a/vsphere/resource_vsphere_compute_cluster_vm_dependency_rule.go +++ b/vsphere/resource_vsphere_compute_cluster_vm_dependency_rule.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_compute_cluster_vm_dependency_rule_test.go b/vsphere/resource_vsphere_compute_cluster_vm_dependency_rule_test.go index 867fba154..07c90d671 100644 --- a/vsphere/resource_vsphere_compute_cluster_vm_dependency_rule_test.go +++ b/vsphere/resource_vsphere_compute_cluster_vm_dependency_rule_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/vim25/types" diff --git a/vsphere/resource_vsphere_compute_cluster_vm_group.go b/vsphere/resource_vsphere_compute_cluster_vm_group.go index c5b2cf262..606c0f86c 100644 --- a/vsphere/resource_vsphere_compute_cluster_vm_group.go +++ b/vsphere/resource_vsphere_compute_cluster_vm_group.go @@ -7,7 +7,7 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_compute_cluster_vm_group_test.go b/vsphere/resource_vsphere_compute_cluster_vm_group_test.go index 98d86a7d4..b1ec597af 100644 --- a/vsphere/resource_vsphere_compute_cluster_vm_group_test.go +++ b/vsphere/resource_vsphere_compute_cluster_vm_group_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" diff --git a/vsphere/resource_vsphere_compute_cluster_vm_host_rule.go b/vsphere/resource_vsphere_compute_cluster_vm_host_rule.go index 739bc9427..dea6e429c 100644 --- a/vsphere/resource_vsphere_compute_cluster_vm_host_rule.go +++ b/vsphere/resource_vsphere_compute_cluster_vm_host_rule.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_compute_cluster_vm_host_rule_test.go b/vsphere/resource_vsphere_compute_cluster_vm_host_rule_test.go index 718d4e317..081f0b7a5 100644 --- a/vsphere/resource_vsphere_compute_cluster_vm_host_rule_test.go +++ b/vsphere/resource_vsphere_compute_cluster_vm_host_rule_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/vim25/types" diff --git a/vsphere/resource_vsphere_custom_attribute.go b/vsphere/resource_vsphere_custom_attribute.go index 4e73f02ca..88c989dac 100644 --- a/vsphere/resource_vsphere_custom_attribute.go +++ b/vsphere/resource_vsphere_custom_attribute.go @@ -5,7 +5,7 @@ import ( "fmt" "strconv" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/vmware/govmomi/object" ) diff --git a/vsphere/resource_vsphere_custom_attribute_test.go b/vsphere/resource_vsphere_custom_attribute_test.go index 6456acd47..bd6b6525d 100644 --- a/vsphere/resource_vsphere_custom_attribute_test.go +++ b/vsphere/resource_vsphere_custom_attribute_test.go @@ -5,8 +5,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccResourceVSphereCustomAttribute_basic(t *testing.T) { diff --git a/vsphere/resource_vsphere_datacenter.go b/vsphere/resource_vsphere_datacenter.go index 164b06054..5a86494eb 100644 --- a/vsphere/resource_vsphere_datacenter.go +++ b/vsphere/resource_vsphere_datacenter.go @@ -9,8 +9,8 @@ import ( "context" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datacenter" "github.com/vmware/govmomi/find" diff --git a/vsphere/resource_vsphere_datacenter_test.go b/vsphere/resource_vsphere_datacenter_test.go index 08315b0c8..5df31e574 100644 --- a/vsphere/resource_vsphere_datacenter_test.go +++ b/vsphere/resource_vsphere_datacenter_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/vmware/govmomi/find" ) diff --git a/vsphere/resource_vsphere_datastore_cluster.go b/vsphere/resource_vsphere_datastore_cluster.go index 846995baf..4a27440d1 100644 --- a/vsphere/resource_vsphere_datastore_cluster.go +++ b/vsphere/resource_vsphere_datastore_cluster.go @@ -4,8 +4,8 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/storagepod" diff --git a/vsphere/resource_vsphere_datastore_cluster_test.go b/vsphere/resource_vsphere_datastore_cluster_test.go index 8645e19bc..0092908d9 100644 --- a/vsphere/resource_vsphere_datastore_cluster_test.go +++ b/vsphere/resource_vsphere_datastore_cluster_test.go @@ -8,8 +8,8 @@ import ( "reflect" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/vim25/types" diff --git a/vsphere/resource_vsphere_datastore_cluster_vm_anti_affinity_rule.go b/vsphere/resource_vsphere_datastore_cluster_vm_anti_affinity_rule.go index 376688987..9cf99c6a8 100644 --- a/vsphere/resource_vsphere_datastore_cluster_vm_anti_affinity_rule.go +++ b/vsphere/resource_vsphere_datastore_cluster_vm_anti_affinity_rule.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/storagepod" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_datastore_cluster_vm_anti_affinity_rule_test.go b/vsphere/resource_vsphere_datastore_cluster_vm_anti_affinity_rule_test.go index 24fc40ba4..aa90d2dd7 100644 --- a/vsphere/resource_vsphere_datastore_cluster_vm_anti_affinity_rule_test.go +++ b/vsphere/resource_vsphere_datastore_cluster_vm_anti_affinity_rule_test.go @@ -10,8 +10,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" diff --git a/vsphere/resource_vsphere_distributed_port_group.go b/vsphere/resource_vsphere_distributed_port_group.go index ab8136ffb..7aceaf70f 100644 --- a/vsphere/resource_vsphere_distributed_port_group.go +++ b/vsphere/resource_vsphere_distributed_port_group.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/dvportgroup" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" diff --git a/vsphere/resource_vsphere_distributed_port_group_test.go b/vsphere/resource_vsphere_distributed_port_group_test.go index cdeb688d6..02dc2076a 100644 --- a/vsphere/resource_vsphere_distributed_port_group_test.go +++ b/vsphere/resource_vsphere_distributed_port_group_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/resource_vsphere_distributed_virtual_switch.go b/vsphere/resource_vsphere_distributed_virtual_switch.go index 8d70e295a..3f054f688 100644 --- a/vsphere/resource_vsphere_distributed_virtual_switch.go +++ b/vsphere/resource_vsphere_distributed_virtual_switch.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" diff --git a/vsphere/resource_vsphere_distributed_virtual_switch_test.go b/vsphere/resource_vsphere_distributed_virtual_switch_test.go index 505fdabe4..681d6336a 100644 --- a/vsphere/resource_vsphere_distributed_virtual_switch_test.go +++ b/vsphere/resource_vsphere_distributed_virtual_switch_test.go @@ -8,8 +8,8 @@ import ( "reflect" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/vim25/types" diff --git a/vsphere/resource_vsphere_dpm_host_override.go b/vsphere/resource_vsphere_dpm_host_override.go index b59197a03..8b2b15ae5 100644 --- a/vsphere/resource_vsphere_dpm_host_override.go +++ b/vsphere/resource_vsphere_dpm_host_override.go @@ -7,8 +7,8 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/hostsystem" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" diff --git a/vsphere/resource_vsphere_dpm_host_override_test.go b/vsphere/resource_vsphere_dpm_host_override_test.go index 2126224ac..cf38a2f79 100644 --- a/vsphere/resource_vsphere_dpm_host_override_test.go +++ b/vsphere/resource_vsphere_dpm_host_override_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/vim25/types" diff --git a/vsphere/resource_vsphere_drs_vm_override.go b/vsphere/resource_vsphere_drs_vm_override.go index 1cd114f61..f8c960fd4 100644 --- a/vsphere/resource_vsphere_drs_vm_override.go +++ b/vsphere/resource_vsphere_drs_vm_override.go @@ -7,8 +7,8 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_drs_vm_override_test.go b/vsphere/resource_vsphere_drs_vm_override_test.go index fd5ecb7c7..f7d9f5f4e 100644 --- a/vsphere/resource_vsphere_drs_vm_override_test.go +++ b/vsphere/resource_vsphere_drs_vm_override_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" diff --git a/vsphere/resource_vsphere_file.go b/vsphere/resource_vsphere_file.go index 60e63ff8e..d8e4e1c47 100644 --- a/vsphere/resource_vsphere_file.go +++ b/vsphere/resource_vsphere_file.go @@ -6,7 +6,7 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/vmware/govmomi" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/object" diff --git a/vsphere/resource_vsphere_file_test.go b/vsphere/resource_vsphere_file_test.go index a4bbaf21d..932f5c1a1 100644 --- a/vsphere/resource_vsphere_file_test.go +++ b/vsphere/resource_vsphere_file_test.go @@ -7,8 +7,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/object" ) diff --git a/vsphere/resource_vsphere_folder.go b/vsphere/resource_vsphere_folder.go index 64a187bb3..79bc7be3a 100644 --- a/vsphere/resource_vsphere_folder.go +++ b/vsphere/resource_vsphere_folder.go @@ -7,8 +7,8 @@ import ( "path" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_folder_migrate.go b/vsphere/resource_vsphere_folder_migrate.go index cddfd3c6b..cf8c673ba 100644 --- a/vsphere/resource_vsphere_folder_migrate.go +++ b/vsphere/resource_vsphere_folder_migrate.go @@ -3,7 +3,7 @@ package vsphere import ( "log" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" ) diff --git a/vsphere/resource_vsphere_folder_migrate_test.go b/vsphere/resource_vsphere_folder_migrate_test.go index b3744a4f6..be51cd8fa 100644 --- a/vsphere/resource_vsphere_folder_migrate_test.go +++ b/vsphere/resource_vsphere_folder_migrate_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func testAccResourceVSphereFolderMigrateStatePreCheck(t *testing.T) { diff --git a/vsphere/resource_vsphere_folder_test.go b/vsphere/resource_vsphere_folder_test.go index 9f880204c..014cf9034 100644 --- a/vsphere/resource_vsphere_folder_test.go +++ b/vsphere/resource_vsphere_folder_test.go @@ -7,8 +7,8 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/object" diff --git a/vsphere/resource_vsphere_ha_vm_override.go b/vsphere/resource_vsphere_ha_vm_override.go index da9b40d66..6cdd34030 100644 --- a/vsphere/resource_vsphere_ha_vm_override.go +++ b/vsphere/resource_vsphere_ha_vm_override.go @@ -7,8 +7,8 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_ha_vm_override_test.go b/vsphere/resource_vsphere_ha_vm_override_test.go index 52eb36324..c91f7c295 100644 --- a/vsphere/resource_vsphere_ha_vm_override_test.go +++ b/vsphere/resource_vsphere_ha_vm_override_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" diff --git a/vsphere/resource_vsphere_host.go b/vsphere/resource_vsphere_host.go index 6773b40c0..818f01384 100644 --- a/vsphere/resource_vsphere_host.go +++ b/vsphere/resource_vsphere_host.go @@ -6,8 +6,8 @@ import ( "log" "time" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/clustercomputeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/hostsystem" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_host_port_group.go b/vsphere/resource_vsphere_host_port_group.go index 4c3296d0e..13637eca2 100644 --- a/vsphere/resource_vsphere_host_port_group.go +++ b/vsphere/resource_vsphere_host_port_group.go @@ -5,7 +5,7 @@ import ( "context" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" ) diff --git a/vsphere/resource_vsphere_host_port_group_test.go b/vsphere/resource_vsphere_host_port_group_test.go index b66fd7488..b9f63f7e6 100644 --- a/vsphere/resource_vsphere_host_port_group_test.go +++ b/vsphere/resource_vsphere_host_port_group_test.go @@ -6,8 +6,8 @@ import ( "reflect" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccResourceVSphereHostPortGroup_basic(t *testing.T) { diff --git a/vsphere/resource_vsphere_host_test.go b/vsphere/resource_vsphere_host_test.go index bcb239993..2ddc9ea9a 100644 --- a/vsphere/resource_vsphere_host_test.go +++ b/vsphere/resource_vsphere_host_test.go @@ -15,8 +15,8 @@ import ( "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/hostsystem" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccResourceVSphereHost_basic(t *testing.T) { diff --git a/vsphere/resource_vsphere_host_virtual_switch.go b/vsphere/resource_vsphere_host_virtual_switch.go index b37ee6525..ce56fb0e9 100644 --- a/vsphere/resource_vsphere_host_virtual_switch.go +++ b/vsphere/resource_vsphere_host_virtual_switch.go @@ -5,7 +5,7 @@ import ( "context" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" ) diff --git a/vsphere/resource_vsphere_host_virtual_switch_test.go b/vsphere/resource_vsphere_host_virtual_switch_test.go index 3181c707c..8d6725db4 100644 --- a/vsphere/resource_vsphere_host_virtual_switch_test.go +++ b/vsphere/resource_vsphere_host_virtual_switch_test.go @@ -7,8 +7,8 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccResourceVSphereHostVirtualSwitch_basic(t *testing.T) { diff --git a/vsphere/resource_vsphere_license.go b/vsphere/resource_vsphere_license.go index a24a7948c..efbf91ddd 100644 --- a/vsphere/resource_vsphere_license.go +++ b/vsphere/resource_vsphere_license.go @@ -7,7 +7,7 @@ import ( "context" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/vmware/govmomi/license" "github.com/vmware/govmomi/vim25/methods" "github.com/vmware/govmomi/vim25/types" diff --git a/vsphere/resource_vsphere_license_test.go b/vsphere/resource_vsphere_license_test.go index 2e0e21b46..363187afc 100644 --- a/vsphere/resource_vsphere_license_test.go +++ b/vsphere/resource_vsphere_license_test.go @@ -9,8 +9,8 @@ import ( "regexp" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/vmware/govmomi/license" ) diff --git a/vsphere/resource_vsphere_nas_datastore.go b/vsphere/resource_vsphere_nas_datastore.go index cc59f00a7..e6dcef5b8 100644 --- a/vsphere/resource_vsphere_nas_datastore.go +++ b/vsphere/resource_vsphere_nas_datastore.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" diff --git a/vsphere/resource_vsphere_nas_datastore_test.go b/vsphere/resource_vsphere_nas_datastore_test.go index 809231e11..c686805db 100644 --- a/vsphere/resource_vsphere_nas_datastore_test.go +++ b/vsphere/resource_vsphere_nas_datastore_test.go @@ -6,8 +6,8 @@ import ( "path" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_resource_pool.go b/vsphere/resource_vsphere_resource_pool.go index 949e3defb..48b4c2ce3 100644 --- a/vsphere/resource_vsphere_resource_pool.go +++ b/vsphere/resource_vsphere_resource_pool.go @@ -4,8 +4,8 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/resourcepool" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" diff --git a/vsphere/resource_vsphere_resource_pool_test.go b/vsphere/resource_vsphere_resource_pool_test.go index 3ff46affe..2aee7ecd2 100644 --- a/vsphere/resource_vsphere_resource_pool_test.go +++ b/vsphere/resource_vsphere_resource_pool_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" ) diff --git a/vsphere/resource_vsphere_storage_drs_vm_override.go b/vsphere/resource_vsphere_storage_drs_vm_override.go index dd3a7aae3..0c9deee75 100644 --- a/vsphere/resource_vsphere_storage_drs_vm_override.go +++ b/vsphere/resource_vsphere_storage_drs_vm_override.go @@ -7,8 +7,8 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/storagepod" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_storage_drs_vm_override_test.go b/vsphere/resource_vsphere_storage_drs_vm_override_test.go index 8d27c5bfc..a0cb0689d 100644 --- a/vsphere/resource_vsphere_storage_drs_vm_override_test.go +++ b/vsphere/resource_vsphere_storage_drs_vm_override_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi/vim25/types" diff --git a/vsphere/resource_vsphere_tag.go b/vsphere/resource_vsphere_tag.go index 97b5ae1ad..4dd22f015 100644 --- a/vsphere/resource_vsphere_tag.go +++ b/vsphere/resource_vsphere_tag.go @@ -8,7 +8,7 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/vmware/vic/pkg/vsphere/tags" ) diff --git a/vsphere/resource_vsphere_tag_category.go b/vsphere/resource_vsphere_tag_category.go index f704b799c..540f80352 100644 --- a/vsphere/resource_vsphere_tag_category.go +++ b/vsphere/resource_vsphere_tag_category.go @@ -7,8 +7,8 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/vmware/vic/pkg/vsphere/tags" ) diff --git a/vsphere/resource_vsphere_tag_category_test.go b/vsphere/resource_vsphere_tag_category_test.go index 678b7a6c7..2c2ffbcfd 100644 --- a/vsphere/resource_vsphere_tag_category_test.go +++ b/vsphere/resource_vsphere_tag_category_test.go @@ -9,8 +9,8 @@ import ( "strings" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccResourceVSphereTagCategory_basic(t *testing.T) { diff --git a/vsphere/resource_vsphere_tag_test.go b/vsphere/resource_vsphere_tag_test.go index 86e3dba5d..769e9e141 100644 --- a/vsphere/resource_vsphere_tag_test.go +++ b/vsphere/resource_vsphere_tag_test.go @@ -8,8 +8,8 @@ import ( "strings" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" ) func TestAccResourceVSphereTag_basic(t *testing.T) { diff --git a/vsphere/resource_vsphere_vapp_container.go b/vsphere/resource_vsphere_vapp_container.go index e570b09ef..20fc4f3ba 100644 --- a/vsphere/resource_vsphere_vapp_container.go +++ b/vsphere/resource_vsphere_vapp_container.go @@ -5,8 +5,8 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/resourcepool" diff --git a/vsphere/resource_vsphere_vapp_container_test.go b/vsphere/resource_vsphere_vapp_container_test.go index cc1597119..71b101f3a 100644 --- a/vsphere/resource_vsphere_vapp_container_test.go +++ b/vsphere/resource_vsphere_vapp_container_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/vappcontainer" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_vapp_entity.go b/vsphere/resource_vsphere_vapp_entity.go index 2e4636fa8..d05932526 100644 --- a/vsphere/resource_vsphere_vapp_entity.go +++ b/vsphere/resource_vsphere_vapp_entity.go @@ -5,7 +5,7 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/vappcontainer" diff --git a/vsphere/resource_vsphere_vapp_entity_test.go b/vsphere/resource_vsphere_vapp_entity_test.go index bbc32d1ea..6a94b9d75 100644 --- a/vsphere/resource_vsphere_vapp_entity_test.go +++ b/vsphere/resource_vsphere_vapp_entity_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" ) diff --git a/vsphere/resource_vsphere_virtual_disk.go b/vsphere/resource_vsphere_virtual_disk.go index 7463b3c8e..7a58765ea 100644 --- a/vsphere/resource_vsphere_virtual_disk.go +++ b/vsphere/resource_vsphere_virtual_disk.go @@ -10,7 +10,7 @@ import ( "context" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/vmware/govmomi" "github.com/vmware/govmomi/find" "github.com/vmware/govmomi/object" diff --git a/vsphere/resource_vsphere_virtual_disk_test.go b/vsphere/resource_vsphere_virtual_disk_test.go index 53725478a..27abd90d8 100644 --- a/vsphere/resource_vsphere_virtual_disk_test.go +++ b/vsphere/resource_vsphere_virtual_disk_test.go @@ -8,9 +8,9 @@ import ( "context" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/vmware/govmomi/find" ) diff --git a/vsphere/resource_vsphere_virtual_machine.go b/vsphere/resource_vsphere_virtual_machine.go index dd4cbd877..def83b903 100644 --- a/vsphere/resource_vsphere_virtual_machine.go +++ b/vsphere/resource_vsphere_virtual_machine.go @@ -9,8 +9,8 @@ import ( "strings" "time" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" diff --git a/vsphere/resource_vsphere_virtual_machine_migrate.go b/vsphere/resource_vsphere_virtual_machine_migrate.go index 3d6df7b56..c4d687e44 100644 --- a/vsphere/resource_vsphere_virtual_machine_migrate.go +++ b/vsphere/resource_vsphere_virtual_machine_migrate.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice" "github.com/vmware/govmomi/object" diff --git a/vsphere/resource_vsphere_virtual_machine_migrate_test.go b/vsphere/resource_vsphere_virtual_machine_migrate_test.go index 6cfe9b94d..906e4f776 100644 --- a/vsphere/resource_vsphere_virtual_machine_migrate_test.go +++ b/vsphere/resource_vsphere_virtual_machine_migrate_test.go @@ -6,7 +6,7 @@ import ( "strconv" "testing" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/virtualdevice" "github.com/vmware/govmomi/object" diff --git a/vsphere/resource_vsphere_virtual_machine_snapshot.go b/vsphere/resource_vsphere_virtual_machine_snapshot.go index d36fa045f..9815ab9b3 100644 --- a/vsphere/resource_vsphere_virtual_machine_snapshot.go +++ b/vsphere/resource_vsphere_virtual_machine_snapshot.go @@ -6,7 +6,7 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" "github.com/vmware/govmomi/vim25/types" ) diff --git a/vsphere/resource_vsphere_virtual_machine_snapshot_test.go b/vsphere/resource_vsphere_virtual_machine_snapshot_test.go index c1d77c89d..6d3af6cb4 100644 --- a/vsphere/resource_vsphere_virtual_machine_snapshot_test.go +++ b/vsphere/resource_vsphere_virtual_machine_snapshot_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" ) diff --git a/vsphere/resource_vsphere_virtual_machine_test.go b/vsphere/resource_vsphere_virtual_machine_test.go index 765146b64..bc33c3e29 100644 --- a/vsphere/resource_vsphere_virtual_machine_test.go +++ b/vsphere/resource_vsphere_virtual_machine_test.go @@ -12,8 +12,8 @@ import ( "strings" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/computeresource" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" diff --git a/vsphere/resource_vsphere_vmfs_datastore.go b/vsphere/resource_vsphere_vmfs_datastore.go index e95a5750d..4b2bae762 100644 --- a/vsphere/resource_vsphere_vmfs_datastore.go +++ b/vsphere/resource_vsphere_vmfs_datastore.go @@ -7,8 +7,8 @@ import ( "strings" "time" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/customattribute" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" diff --git a/vsphere/resource_vsphere_vmfs_datastore_test.go b/vsphere/resource_vsphere_vmfs_datastore_test.go index 184d96849..58a8453d6 100644 --- a/vsphere/resource_vsphere_vmfs_datastore_test.go +++ b/vsphere/resource_vsphere_vmfs_datastore_test.go @@ -7,8 +7,8 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/datastore" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/folder" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" diff --git a/vsphere/resource_vsphere_vnic.go b/vsphere/resource_vsphere_vnic.go index 807b9edf4..d8d55bbc1 100644 --- a/vsphere/resource_vsphere_vnic.go +++ b/vsphere/resource_vsphere_vnic.go @@ -3,7 +3,7 @@ package vsphere import ( "context" "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/hostsystem" "github.com/vmware/govmomi" "github.com/vmware/govmomi/object" diff --git a/vsphere/resource_vsphere_vnic_test.go b/vsphere/resource_vsphere_vnic_test.go index 365bb9bcf..877900535 100644 --- a/vsphere/resource_vsphere_vnic_test.go +++ b/vsphere/resource_vsphere_vnic_test.go @@ -4,8 +4,8 @@ import ( "context" "errors" "fmt" - "github.com/hashicorp/terraform/helper/resource" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/vmware/govmomi" "os" "strconv" diff --git a/vsphere/tags_helper.go b/vsphere/tags_helper.go index 01a2fe7af..df26853e9 100644 --- a/vsphere/tags_helper.go +++ b/vsphere/tags_helper.go @@ -6,7 +6,7 @@ import ( "log" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/vmware/govmomi" diff --git a/vsphere/virtual_machine_config_structure.go b/vsphere/virtual_machine_config_structure.go index fb8b22add..7e78d9f83 100644 --- a/vsphere/virtual_machine_config_structure.go +++ b/vsphere/virtual_machine_config_structure.go @@ -5,9 +5,9 @@ import ( "log" "reflect" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/helper/validation" - "github.com/hashicorp/terraform/terraform" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/terraform" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/structure" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/viapi" "github.com/terraform-providers/terraform-provider-vsphere/vsphere/internal/helper/virtualmachine" diff --git a/vsphere/virtual_machine_guest_structure.go b/vsphere/virtual_machine_guest_structure.go index 7bb14f204..f1cb964e6 100644 --- a/vsphere/virtual_machine_guest_structure.go +++ b/vsphere/virtual_machine_guest_structure.go @@ -5,7 +5,7 @@ import ( "net" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/vmware/govmomi/vim25/types" )