From 9eaa87642b97ff15473da1f61e2efba5d97201a7 Mon Sep 17 00:00:00 2001 From: Andy Gertjejansen Date: Tue, 22 Oct 2019 09:13:16 -0500 Subject: [PATCH] Updating to latest separate Terraform SDK Update vendor directory Update vendor --- go.mod | 11 +- go.sum | 76 +- main.go | 2 +- okta/app.go | 4 +- okta/app_filter.go | 2 +- okta/config.go | 2 +- okta/data_source_okta_app.go | 2 +- okta/data_source_okta_app_saml.go | 4 +- okta/data_source_okta_app_saml_metadata.go | 2 +- ...data_source_okta_app_saml_metadata_test.go | 4 +- okta/data_source_okta_app_saml_test.go | 4 +- okta/data_source_okta_app_test.go | 4 +- okta/data_source_okta_auth_server.go | 2 +- okta/data_source_okta_auth_server_test.go | 4 +- okta/data_source_okta_default_policy.go | 4 +- okta/data_source_okta_default_policy_test.go | 4 +- okta/data_source_okta_everyone_group.go | 2 +- okta/data_source_okta_everyone_group_test.go | 4 +- okta/data_source_okta_group.go | 2 +- okta/data_source_okta_group_test.go | 4 +- okta/data_source_okta_idp_metadata_saml.go | 2 +- ...data_source_okta_idp_metadata_saml_test.go | 4 +- okta/data_source_okta_idp_saml.go | 2 +- okta/data_source_okta_idp_saml_test.go | 4 +- okta/data_source_okta_policy.go | 4 +- okta/data_source_okta_policy_test.go | 4 +- okta/data_source_okta_user.go | 2 +- okta/data_source_okta_user_test.go | 4 +- okta/data_source_okta_users.go | 4 +- okta/data_source_okta_users_test.go | 4 +- okta/idp.go | 4 +- okta/policy.go | 4 +- okta/policy_rule.go | 4 +- okta/provider.go | 6 +- okta/provider_sweeper_test.go | 2 +- okta/provider_test.go | 4 +- okta/resource_okta_app_auto_login.go | 4 +- okta/resource_okta_app_auto_login_test.go | 4 +- okta/resource_okta_app_bookmark.go | 2 +- okta/resource_okta_app_bookmark_test.go | 4 +- okta/resource_okta_app_group_assignment.go | 2 +- ...resource_okta_app_group_assignment_test.go | 6 +- okta/resource_okta_app_oauth.go | 4 +- okta/resource_okta_app_oauth_redirect_uri.go | 2 +- ...source_okta_app_oauth_redirect_uri_test.go | 6 +- okta/resource_okta_app_oauth_test.go | 4 +- okta/resource_okta_app_saml.go | 4 +- okta/resource_okta_app_saml_test.go | 6 +- ...resource_okta_app_secure_password_store.go | 4 +- ...rce_okta_app_secure_password_store_test.go | 4 +- okta/resource_okta_app_swa.go | 2 +- okta/resource_okta_app_swa_test.go | 4 +- okta/resource_okta_app_three_field.go | 2 +- okta/resource_okta_app_three_field_test.go | 4 +- okta/resource_okta_app_user.go | 2 +- okta/resource_okta_app_user_base_schema.go | 2 +- ...resource_okta_app_user_base_schema_test.go | 4 +- okta/resource_okta_app_user_schema.go | 2 +- okta/resource_okta_app_user_schema_test.go | 6 +- okta/resource_okta_app_user_test.go | 6 +- okta/resource_okta_auth_server.go | 4 +- okta/resource_okta_auth_server_claim.go | 4 +- okta/resource_okta_auth_server_claim_test.go | 4 +- okta/resource_okta_auth_server_policy.go | 2 +- okta/resource_okta_auth_server_policy_rule.go | 4 +- ...ource_okta_auth_server_policy_rule_test.go | 4 +- okta/resource_okta_auth_server_policy_test.go | 4 +- okta/resource_okta_auth_server_scope.go | 4 +- okta/resource_okta_auth_server_scope_test.go | 4 +- okta/resource_okta_auth_server_test.go | 4 +- okta/resource_okta_factor.go | 4 +- okta/resource_okta_group.go | 2 +- okta/resource_okta_group_roles.go | 2 +- okta/resource_okta_group_roles_test.go | 4 +- okta/resource_okta_group_rule.go | 2 +- okta/resource_okta_group_rule_test.go | 4 +- okta/resource_okta_group_test.go | 4 +- okta/resource_okta_idp_oidc.go | 4 +- okta/resource_okta_idp_oidc_test.go | 4 +- okta/resource_okta_idp_saml.go | 4 +- okta/resource_okta_idp_saml_signing_key.go | 2 +- okta/resource_okta_idp_saml_test.go | 4 +- okta/resource_okta_idp_social.go | 4 +- okta/resource_okta_idp_social_test.go | 4 +- okta/resource_okta_inline_hooks.go | 4 +- okta/resource_okta_inline_hooks_test.go | 4 +- okta/resource_okta_network_zone.go | 4 +- okta/resource_okta_network_zone_test.go | 4 +- okta/resource_okta_policy_mfa.go | 4 +- okta/resource_okta_policy_mfa_test.go | 4 +- okta/resource_okta_policy_password.go | 4 +- okta/resource_okta_policy_password_test.go | 6 +- ...resource_okta_policy_rule_idp_discovery.go | 4 +- ...rce_okta_policy_rule_idp_discovery_test.go | 4 +- okta/resource_okta_policy_rule_mfa.go | 4 +- okta/resource_okta_policy_rule_mfa_test.go | 4 +- okta/resource_okta_policy_rule_password.go | 4 +- ...resource_okta_policy_rule_password_test.go | 6 +- okta/resource_okta_policy_rule_sign_on.go | 4 +- .../resource_okta_policy_rule_sign_on_test.go | 4 +- okta/resource_okta_policy_sign_on.go | 2 +- okta/resource_okta_policy_sign_on_test.go | 4 +- okta/resource_okta_template_email.go | 2 +- okta/resource_okta_template_email_test.go | 4 +- okta/resource_okta_trusted_origin.go | 2 +- okta/resource_okta_trusted_origin_test.go | 6 +- okta/resource_okta_user.go | 4 +- okta/resource_okta_user_base_schema.go | 2 +- okta/resource_okta_user_base_schema_test.go | 6 +- okta/resource_okta_user_schema.go | 2 +- okta/resource_okta_user_schema_test.go | 6 +- okta/resource_okta_user_test.go | 6 +- okta/saml.go | 2 +- okta/test_utils.go | 6 +- okta/user.go | 4 +- okta/user_schema.go | 4 +- okta/utils.go | 2 +- sdk/idp_models.go | 2 +- 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/.gitignore | 32 - .../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 - .../github.com/hashicorp/go-getter/README.md | 6 +- .../github.com/hashicorp/go-getter/get_git.go | 3 + vendor/github.com/hashicorp/go-getter/go.mod | 9 +- vendor/github.com/hashicorp/go-getter/go.sum | 210 +- .../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 + 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 --- .../LICENSE | 0 .../helper/acctest/acctest.go | 0 .../helper/acctest/random.go | 0 .../helper/acctest/remotetests.go | 0 .../helper/hashcode/hashcode.go | 0 .../helper/logging/logging.go | 0 .../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 | 15 +- .../helper/resource/testing.go | 20 +- .../helper/resource/testing_config.go | 12 +- .../helper/resource/testing_import_state.go | 8 +- .../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 | 2 +- .../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 | 2 +- .../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 | 2 +- .../internal}/addrs/output_value.go | 0 .../internal}/addrs/parse_ref.go | 2 +- .../internal}/addrs/parse_target.go | 2 +- .../internal}/addrs/path_attr.go | 0 .../internal}/addrs/provider_config.go | 2 +- .../internal/addrs/provider_type.go | 7 + .../internal}/addrs/referenceable.go | 0 .../internal}/addrs/resource.go | 2 +- .../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 | 2 +- .../internal}/command/format/diff.go | 10 +- .../internal}/command/format/format.go | 0 .../internal}/command/format/object_id.go | 0 .../internal}/command/format/plan.go | 8 +- .../internal}/command/format/state.go | 126 +- .../internal}/configs/backend.go | 2 +- .../internal}/configs/compat_shim.go | 0 .../internal}/configs/config.go | 2 +- .../internal}/configs/config_build.go | 2 +- .../internal}/configs/configload/copy_dir.go | 0 .../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 | 2 +- .../configs/configload/loader_snapshot.go | 4 +- .../configs/configload/module_mgr.go | 20 +- .../internal}/configs/configload/testing.go | 0 .../configs/configschema/coerce_value.go | 0 .../configs/configschema/decoder_spec.go | 0 .../internal}/configs/configschema/doc.go | 0 .../configs/configschema/empty_value.go | 0 .../configs/configschema/implied_type.go | 0 .../configs/configschema/internal_validate.go | 0 .../configschema/nestingmode_string.go | 0 .../configs/configschema/none_required.go | 0 .../internal}/configs/configschema/schema.go | 2 +- .../configschema/validate_traversal.go | 4 +- .../internal}/configs/depends_on.go | 0 .../internal}/configs/doc.go | 0 .../internal}/configs/hcl2shim/flatmap.go | 0 .../internal}/configs/hcl2shim/paths.go | 0 .../configs/hcl2shim/single_attr_body.go | 0 .../internal}/configs/hcl2shim/values.go | 2 +- .../configs/hcl2shim/values_equiv.go | 0 .../internal}/configs/module.go | 2 +- .../internal}/configs/module_call.go | 0 .../internal}/configs/module_merge.go | 2 +- .../internal}/configs/module_merge_body.go | 0 .../internal}/configs/named_values.go | 2 +- .../internal}/configs/parser.go | 0 .../internal}/configs/parser_config.go | 0 .../internal}/configs/parser_config_dir.go | 0 .../internal}/configs/parser_values.go | 0 .../internal}/configs/provider.go | 2 +- .../internal}/configs/provisioner.go | 4 +- .../configs/provisioneronfailure_string.go | 0 .../configs/provisionerwhen_string.go | 0 .../internal}/configs/resource.go | 2 +- .../internal}/configs/synth_body.go | 0 .../internal}/configs/util.go | 0 .../internal}/configs/variable_type_hint.go | 2 +- .../configs/variabletypehint_string.go | 0 .../internal}/configs/version_constraint.go | 0 .../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 | 2 +- .../internal}/lang/blocktoattr/schema.go | 2 +- .../internal}/lang/blocktoattr/variables.go | 2 +- .../internal}/lang/data.go | 4 +- .../internal}/lang/doc.go | 0 .../internal}/lang/eval.go | 8 +- .../internal}/lang/funcs/cidr.go | 89 + .../internal}/lang/funcs/collection.go | 0 .../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 | 79 - .../internal}/lang/funcs/number.go | 62 + .../internal}/lang/funcs/string.go | 0 .../internal}/lang/functions.go | 16 +- .../internal}/lang/references.go | 8 +- .../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 | 2 +- .../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 | 62 +- .../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 | 2 +- .../internal}/providers/doc.go | 0 .../internal}/providers/provider.go | 6 +- .../internal}/providers/resolver.go | 2 +- .../internal}/provisioners/doc.go | 0 .../internal}/provisioners/factory.go | 0 .../internal}/provisioners/provisioner.go | 4 +- .../internal}/registry/client.go | 12 +- .../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 | 4 +- .../internal}/states/instance_object_src.go | 4 +- .../internal}/states/module.go | 2 +- .../internal}/states/objectstatus_string.go | 0 .../internal}/states/output_value.go | 0 .../internal}/states/resource.go | 4 +- .../internal}/states/state.go | 2 +- .../internal}/states/state_deepcopy.go | 2 +- .../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 | 6 +- .../internal}/states/statefile/version4.go | 6 +- .../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 | 18 +- .../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 | 0 .../internal}/tfdiags/diagnostic.go | 2 +- .../internal}/tfdiags/diagnostic_base.go | 0 .../internal}/tfdiags/diagnostics.go | 0 .../internal}/tfdiags/doc.go | 0 .../internal}/tfdiags/error.go | 0 .../internal}/tfdiags/hcl.go | 0 .../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 | 157 +- .../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 | 51 +- .../terraform/context_components.go | 4 +- .../terraform/context_graph_type.go | 2 +- .../terraform/context_import.go | 8 +- .../terraform/context_input.go | 6 +- .../terraform/diff.go | 28 +- .../terraform/edge_destroy.go | 2 +- .../terraform/eval.go | 2 +- .../terraform/eval_apply.go | 16 +- .../terraform/eval_check_prevent_destroy.go | 10 +- .../terraform/eval_context.go | 16 +- .../terraform/eval_context_builtin.go | 31 +- .../terraform/eval_context_mock.go | 16 +- .../terraform/eval_count.go | 4 +- .../terraform/eval_count_boundary.go | 4 +- .../terraform/eval_diff.go | 235 +-- .../terraform/eval_error.go | 0 .../terraform/eval_filter.go | 0 .../terraform/eval_filter_operation.go | 0 .../terraform/eval_for_each.go | 24 +- .../terraform/eval_if.go | 0 .../terraform/eval_import_state.go | 8 +- .../terraform/eval_lang.go | 4 +- .../terraform/eval_local.go | 6 +- .../terraform/eval_noop.go | 0 .../terraform/eval_output.go | 6 +- .../terraform/eval_provider.go | 8 +- .../terraform/eval_provisioner.go | 4 +- .../terraform/eval_read_data.go | 14 +- .../terraform/eval_refresh.go | 8 +- .../terraform/eval_sequence.go | 2 +- .../terraform/eval_state.go | 10 +- .../terraform/eval_state_upgrade.go | 10 +- .../terraform/eval_validate.go | 12 +- .../terraform/eval_validate_selfref.go | 8 +- .../terraform/eval_variable.go | 28 +- .../terraform/evaltree_provider.go | 6 +- .../terraform/evaluate.go | 14 +- .../terraform/evaluate_valid.go | 8 +- .../terraform/features.go | 0 .../terraform/graph.go | 6 +- .../terraform/graph_builder.go | 4 +- .../terraform/graph_builder_apply.go | 12 +- .../terraform/graph_builder_destroy_plan.go | 10 +- .../terraform/graph_builder_eval.go | 10 +- .../terraform/graph_builder_import.go | 11 +- .../terraform/graph_builder_plan.go | 10 +- .../terraform/graph_builder_refresh.go | 10 +- .../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 | 2 +- .../terraform/graphtype_string.go | 0 .../terraform/hook.go | 24 +- .../terraform/hook_mock.go | 8 +- .../terraform/hook_stop.go | 8 +- .../terraform/instancetype.go | 2 +- .../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 | 33 +- .../terraform/node_local.go | 8 +- .../terraform/node_module_removed.go | 2 +- .../terraform/node_module_variable.go | 8 +- .../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 | 0 .../terraform/node_provisioner.go | 2 +- .../terraform/node_resource_abstract.go | 30 +- .../terraform/node_resource_apply.go | 6 +- .../terraform/node_resource_apply_instance.go | 14 +- .../terraform/node_resource_destroy.go | 10 +- .../node_resource_destroy_deposed.go | 10 +- .../terraform/node_resource_plan.go | 4 +- .../terraform/node_resource_plan_destroy.go | 10 +- .../terraform/node_resource_plan_instance.go | 8 +- .../terraform/node_resource_plan_orphan.go | 6 +- .../terraform/node_resource_refresh.go | 12 +- .../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 | 2 +- .../terraform/resource_mode_string.go | 0 .../terraform/resource_provider.go | 6 +- .../terraform/resource_provider_mock.go | 0 .../terraform/resource_provisioner.go | 4 +- .../terraform/resource_provisioner_mock.go | 2 +- .../terraform/schemas.go | 12 +- .../terraform/state.go | 50 +- .../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 | 2 +- .../transform_attach_config_provider.go | 4 +- .../transform_attach_config_resource.go | 4 +- .../terraform/transform_attach_schema.go | 4 +- .../terraform/transform_attach_state.go | 4 +- .../terraform/transform_config.go | 6 +- .../terraform/transform_config_flat.go | 4 +- .../terraform/transform_count_boundary.go | 4 +- .../terraform/transform_destroy_cbd.go | 6 +- .../terraform/transform_destroy_edge.go | 8 +- .../terraform/transform_diff.go | 8 +- .../terraform/transform_expand.go | 2 +- .../terraform/transform_import_provider.go | 4 +- .../terraform/transform_import_state.go | 6 +- .../terraform/transform_local.go | 2 +- .../terraform/transform_module_variable.go | 4 +- .../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 | 20 +- .../terraform/transform_provisioner.go | 42 +- .../terraform/transform_reference.go | 22 +- .../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 | 6 +- .../terraform/walkoperation_string.go | 0 .../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 - .../terraform/config/hcl2_shim_util.go | 134 -- .../hashicorp/terraform/config/import_tree.go | 151 -- .../hashicorp/terraform/config/interpolate.go | 439 ---- .../terraform/config/interpolate_funcs.go | 1761 ----------------- .../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 | 450 ----- .../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 - .../helper/hilmapstructure/hilmapstructure.go | 41 - .../helper/plugin/grpc_provisioner.go | 147 -- .../terraform/helper/schema/provisioner.go | 205 -- .../hashicorp/terraform/httpclient/client.go | 18 - .../terraform/plugin/resource_provisioner.go | 182 -- .../terraform/svchost/auth/from_map.go | 48 - .../svchost/auth/token_credentials.go | 43 - .../terraform/svchost/disco/oauth_client.go | 178 -- .../terraform/terraform/user_agent.go | 12 - .../hashicorp/terraform/terraform/version.go | 10 - .../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 - .../x/tools/go/analysis/analysis.go | 6 +- .../x/tools/go/analysis/diagnostic.go | 32 +- .../go/analysis/diagnostic_experimental.go | 41 - vendor/golang.org/x/tools/go/analysis/doc.go | 16 +- .../analysis/internal/analysisflags/flags.go | 6 +- .../go/analysis/internal/checker/checker.go | 131 +- .../tools/go/analysis/internal/facts/facts.go | 22 +- .../go/analysis/unitchecker/unitchecker.go | 8 + .../x/tools/go/analysis/validate.go | 2 +- .../x/tools/go/internal/gcimporter/bimport.go | 5 +- .../tools/go/internal/packagesdriver/sizes.go | 27 +- .../x/tools/go/packages/external.go | 29 +- .../golang.org/x/tools/go/packages/golist.go | 187 +- .../x/tools/go/packages/golist_overlay.go | 42 +- .../x/tools/go/packages/packages.go | 116 +- .../x/tools/go/types/objectpath/objectpath.go | 2 +- .../x/tools/internal/gopathwalk/walk.go | 36 +- vendor/modules.txt | 109 +- 677 files changed, 2784 insertions(+), 17034 deletions(-) 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/.gitignore 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 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/hashicorp/{terraform => terraform-plugin-sdk}/LICENSE (100%) 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 (100%) 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 (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/helper/resource/testing.go (98%) 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 (96%) 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 (82%) 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 (81%) 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 (99%) 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 (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/addrs/parse_target.go (99%) 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 (99%) 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 (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/command/format/diff.go (99%) 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%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/command/format/plan.go (96%) 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 (95%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/compat_shim.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/config.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/config_build.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/copy_dir.go (100%) 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 (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configload/loader_snapshot.go (99%) 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 (100%) 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 (100%) 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 (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/configschema/validate_traversal.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/depends_on.go (100%) 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 (100%) 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 (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/module_call.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/module_merge.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/module_merge_body.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/named_values.go (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/parser.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/parser_config.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/parser_config_dir.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/parser_values.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/provider.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/provisioner.go (96%) 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 (99%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/synth_body.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/util.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/configs/variable_type_hint.go (96%) 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 (100%) 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 (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/blocktoattr/schema.go (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/blocktoattr/variables.go (96%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/data.go (93%) 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 (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/cidr.go (53%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/collection.go (100%) 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 (72%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/funcs/string.go (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/functions.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/lang/references.go (91%) 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 (88%) 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 (92%) 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 (94%) 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 (98%) 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 (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/instance_object_src.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/module.go (99%) 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 (98%) 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 (99%) 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 (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/states/statefile/version4.go (98%) 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 => terraform-plugin-sdk/internal}/svchost/auth/cache.go (63%) rename vendor/github.com/hashicorp/{terraform => 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 => terraform-plugin-sdk/internal}/svchost/auth/helper_program.go (54%) rename vendor/github.com/hashicorp/{terraform => 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 => terraform-plugin-sdk/internal}/svchost/disco/disco.go (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/svchost/disco/host.go (59%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/svchost/label_iter.go (78%) rename vendor/github.com/hashicorp/{terraform => 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 (100%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk/internal}/tfdiags/diagnostic.go (90%) 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 (100%) 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 (100%) 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 (96%) 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 (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/context_components.go (93%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/context_graph_type.go (91%) 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 (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/diff.go (98%) 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 (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_check_prevent_destroy.go (74%) 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 (90%) 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 (97%) 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 (81%) 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 (92%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_local.go (90%) 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 (94%) 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 (96%) 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 (98%) 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 (88%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/eval_variable.go (76%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/evaltree_provider.go (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/evaluate.go (98%) 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 (94%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/graph_builder_apply.go (94%) 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 (88%) 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 (77%) 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 (69%) 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 (90%) 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 (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_module_variable.go (94%) 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 (100%) 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 (95%) 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 (96%) 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 (97%) 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 (89%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/node_resource_plan_instance.go (95%) 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 (96%) 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 (65%) 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 (98%) 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 (97%) 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 (96%) 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%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_config_flat.go (94%) 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 (98%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_destroy_edge.go (97%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_diff.go (96%) 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 (90%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/transform_import_state.go (97%) 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 (97%) 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 (96%) 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 (91%) rename vendor/github.com/hashicorp/{terraform => terraform-plugin-sdk}/terraform/walkoperation_string.go (100%) 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/hcl2_shim_util.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/helper/hilmapstructure/hilmapstructure.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/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/oauth_client.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/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 delete mode 100644 vendor/golang.org/x/tools/go/analysis/diagnostic_experimental.go diff --git a/go.mod b/go.mod index 17139dbb..d7b230c3 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,6 @@ module github.com/articulate/terraform-provider-okta go 1.12 require ( - cloud.google.com/go v0.45.1 // indirect - github.com/apparentlymart/go-cidr v1.0.1 // indirect github.com/articulate/oktasdk-go v0.0.0-20190417182045-e41ed7befc56 github.com/aws/aws-sdk-go v1.23.16 // indirect github.com/beevik/etree v1.1.0 // indirect @@ -13,23 +11,17 @@ require ( github.com/crewjam/saml v0.0.0-20180831135026-ebc5f787b786 github.com/google/go-cmp v0.3.1 // indirect github.com/hashicorp/go-cleanhttp v0.5.1 - github.com/hashicorp/go-plugin v1.0.1 // indirect - github.com/hashicorp/go-version v1.2.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hil v0.0.0-20190212132231-97b3a9cdfa93 // indirect - github.com/hashicorp/terraform v0.12.8 - github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect + github.com/hashicorp/terraform-plugin-sdk v1.1.1 github.com/kelseyhightower/envconfig v1.4.0 // indirect github.com/mattn/go-colorable v0.1.2 // indirect github.com/mattn/go-isatty v0.0.9 // indirect - github.com/mitchellh/reflectwalk v1.0.1 // indirect github.com/okta/okta-sdk-golang v0.1.0 github.com/peterhellberg/link v1.0.0 github.com/russellhaering/goxmldsig v0.0.0-20180430223755-7acd5e4a6ef7 // indirect - github.com/spf13/afero v1.2.2 // indirect github.com/ulikunitz/xz v0.5.6 // indirect github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect - github.com/zclconf/go-cty v1.1.0 // indirect go.opencensus.io v0.22.1 // indirect golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect @@ -38,7 +30,6 @@ require ( google.golang.org/api v0.10.0 // indirect google.golang.org/appengine v1.6.2 // indirect google.golang.org/genproto v0.0.0-20190905072037-92dd089d5514 // indirect - google.golang.org/grpc v1.23.0 // indirect ) replace github.com/okta/okta-sdk-golang => github.com/articulate/okta-sdk-golang v1.1.1 diff --git a/go.sum b/go.sum index 8a86cd3b..832c3fca 100644 --- a/go.sum +++ b/go.sum @@ -25,8 +25,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 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 h1:y8Gs8CzNfDF5AZvjr+5UyGQvQEBL7pwo+v+wX6q9JI8= github.com/ChrisTrenkamp/goxpath v0.0.0-20170922090931-c385f95c6022/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4= -github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/Unknwon/com v0.0.0-20151008135407-28b053d5a292 h1:tuQ7w+my8a8mkwN7x2TSd7OzTjkZ7rAeSyH4xncuAMI= 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= @@ -35,15 +33,10 @@ github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki 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/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= 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/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apparentlymart/go-cidr v1.0.0 h1:lGDvXx8Lv9QHjrAVP7jyzleG4F9+FkRhJcEsDFxeb8w= github.com/apparentlymart/go-cidr v1.0.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-cidr v1.0.1 h1:NmIwLZ/KdsjIUlhf+/Np40atNXm/+lZ5txfTJ/SpF+U= @@ -67,10 +60,9 @@ github.com/articulate/oktasdk-go v0.0.0-20190417182045-e41ed7befc56/go.mod h1:UT github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.16.36/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.19.18/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.22.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.19.39/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.23.16 h1:cMEmZoIeno2dgz3grc4vUQ33ZJh32d/4C67tNDxOERw= github.com/aws/aws-sdk-go v1.23.16/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc= github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs= github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -82,15 +74,12 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ 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/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= 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-20161106042343-c914be64f07d/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -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 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -115,18 +104,12 @@ github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25Kn github.com/dylanmei/iso8601 v0.1.0 h1:812NGQDBcqquTfH5Yeo7lwR0nzx/cKdsmf3qMjPURUI= 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/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= 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/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -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.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= 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= @@ -155,6 +138,7 @@ github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y 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 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= @@ -183,17 +167,13 @@ github.com/gophercloud/gophercloud v0.0.0-20190208042652-bc37892e1968/go.mod h1: github.com/gophercloud/utils v0.0.0-20190128072930-fbb6ab446f01 h1:OgCNGSnEalfkRpn//WGJHhpo7fkP+LhTpvEITZ7CkK4= 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/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= 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.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.5.1/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/hashicorp/aws-sdk-go-base v0.2.0/go.mod h1:ZIWACGGi0N7a4DZbf15yuE1JQORmWLtBcVM6F5SXNFU= -github.com/hashicorp/aws-sdk-go-base v0.3.0/go.mod h1:ZIWACGGi0N7a4DZbf15yuE1JQORmWLtBcVM6F5SXNFU= github.com/hashicorp/consul v0.0.0-20171026175957-610f3c86a089 h1:1eDpXAxTh0iPv+1kc9/gfSI2pxRERDsTk/lNGolwHn8= 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= @@ -208,18 +188,19 @@ github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng 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.3.0/go.mod h1:/O1k/AizTN0QmfEKknCYGvICeyKUDqCYA8vvWtGWDeQ= -github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e h1:6krcdHPiS+aIP9XKzJzSahfjD7jG7Z+4+opm0z39V1M= -github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e/go.mod h1:/O1k/AizTN0QmfEKknCYGvICeyKUDqCYA8vvWtGWDeQ= +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-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI= +github.com/hashicorp/go-hclog v0.9.2/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-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.20190430211030-5692942914bb/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= -github.com/hashicorp/go-plugin v1.0.1-0.20190610192547-a1bc61569a26/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= 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-retryablehttp v0.5.2 h1:AoISa4P4IsW0/m4T6St8Yw38gTl5GtBAgfkhYh1xAz4= @@ -258,12 +239,13 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/memberlist v0.1.0/go.mod h1:ncdBp14cuox2iFOq3kDiquKU6fqsTBc3W6JvZwjxxsE= github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb h1:ZbgmOQt8DOg796figP87/EFCVx2v2h9yRvwHF/zceX4= github.com/hashicorp/serf v0.0.0-20160124182025-e4ec8cc423bb/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE= +github.com/hashicorp/terraform v0.12.0 h1:It2vmod2dBMB4+r+aUW2Afx0HlftyUwzNsNH3I2vrJ8= github.com/hashicorp/terraform v0.12.0/go.mod h1:Ke0ig9gGZ8rhV6OddAhBYt5nXmpvXsuNQQ8w9qYBZfU= -github.com/hashicorp/terraform v0.12.8 h1:51Z5K8oj42KZi0IiTf99wMTujDpvsTd3eaF1k5z1URk= -github.com/hashicorp/terraform v0.12.8/go.mod h1:8rXMj8q+hRsR/28WWWyiHu1GEDSjWaHPoV14E66X5VU= github.com/hashicorp/terraform-config-inspect v0.0.0-20190327195015-8022a2663a70/go.mod h1:ItvqtvbC3K23FFET62ZwnkwtpbKZm8t8eMcWjmVVjD8= 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-plugin-sdk v1.1.1 h1:wQ2HtvOE8K4QYcm2JB8YFw9u7OplFJ2HMV5WOpMRL2Y= +github.com/hashicorp/terraform-plugin-sdk v1.1.1/go.mod h1:NuwtLpEpPsFaKJPJNGtMcn9vlhe6Ofe+Y6NqXhJgV2M= github.com/hashicorp/vault v0.10.4/go.mod h1:KfSyffbKxoVyspOdlaGVjIuwLobi07qD1bAbosPMpP0= 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= @@ -279,10 +261,8 @@ github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0 github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/joyent/triton-go v0.0.0-20180313100802-d8f9c0314926 h1:kie3qOosvRKqwij2HGzXWffwpXvcqfPPXRUw8I4F/mg= 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-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA= github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8= @@ -293,8 +273,6 @@ github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -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= @@ -364,9 +342,6 @@ github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/I github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE= github.com/mitchellh/reflectwalk v1.0.1/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/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= @@ -379,7 +354,6 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= -github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/packer-community/winrmcp v0.0.0-20180102160824-81144009af58 h1:m3CEgv3ah1Rhy82L+c0QG/U3VyY1UsvsIdkh0/rU97Y= 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= @@ -389,24 +363,15 @@ github.com/peterhellberg/link v1.0.0 h1:mUWkiegowUXEcmlb+ybF75Q/8D2Y0BjZtR8cxoKh github.com/peterhellberg/link v1.0.0/go.mod h1:gtSlOT4jmkY8P47hbTc8PTgiDDWpdPbFYl75keYyBB8= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.0.0-20170505043639-c605e284fe17/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.0/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.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -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.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -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/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/russellhaering/goxmldsig v0.0.0-20180430223755-7acd5e4a6ef7 h1:J4AOUcOh/t1XbQcJfkEqhzgvMJ2tDxdCVvmHxW5QXao= github.com/russellhaering/goxmldsig v0.0.0-20180430223755-7acd5e4a6ef7/go.mod h1:Oz4y6ImuOQZxynhbSXk7btjEfNBtGlj2dcaOvXl2FSM= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= @@ -438,7 +403,6 @@ github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go. github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= -github.com/sirupsen/logrus v1.2.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= @@ -452,7 +416,6 @@ github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc= 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= @@ -482,15 +445,12 @@ github.com/zclconf/go-cty v0.0.0-20181129180422-88fbe721e0f8/go.mod h1:xnAOWiHeO github.com/zclconf/go-cty v0.0.0-20190426224007-b18a157db9e2/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v0.0.0-20190516203816-4fecf87372ec/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= -github.com/zclconf/go-cty v1.0.1-0.20190708163926-19588f92a98f/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= github.com/zclconf/go-cty-yaml v1.0.1 h1:up11wlgAaDvlAGENcFDnZgkn0qUJurso7k6EpURKNF8= github.com/zclconf/go-cty-yaml v1.0.1/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0= go.opencensus.io v0.18.0 h1:Mk5rgZcggtbvtAun5aJzAtjKKN/t0R3jJPlWILlv938= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= -go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.1 h1:8dP3SGL7MPB94crU3bEPplMPe83FI4EouesJUeFHv50= @@ -511,8 +471,7 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk 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/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/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 h1:Gv7RPwsi3eZ2Fgewe3CBsuOebPwO27PoXzRpJPsvSSM= golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -533,9 +492,7 @@ golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181106065722-10aee1819953/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-20181129055619-fae4c4e3ad76/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= @@ -545,6 +502,7 @@ 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-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 h1:k7pJ2yAPLPgbskkFdhRCsA77k2fySZ1zf2zCjvQCiIM= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -567,9 +525,6 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h 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-20181029174526-d69651ed3497/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-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/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 h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= @@ -584,7 +539,6 @@ golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7w 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/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd h1:DBH9mDw0zluJT/R+nGuV3jWFWLFaHyYZWD4tOT+cjn0= @@ -622,7 +576,6 @@ google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+ google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= google.golang.org/api v0.1.0 h1:K6z2u68e86TPdSdefXdzvXgR1zEMa+459vBSfWYAZkI= google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= -google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -657,12 +610,10 @@ google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9M google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.18.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0 h1:AzbTB6ux+okLTzP8Ru1Xs41C303zdcfEht7MQnYJt5A= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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= @@ -670,11 +621,8 @@ gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -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 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= 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 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/main.go b/main.go index d0f2fcb8..53704986 100644 --- a/main.go +++ b/main.go @@ -3,7 +3,7 @@ package main import ( "github.com/articulate/terraform-provider-okta/okta" - "github.com/hashicorp/terraform/plugin" + "github.com/hashicorp/terraform-plugin-sdk/plugin" ) func main() { diff --git a/okta/app.go b/okta/app.go index 828c33b8..c9ee48d6 100644 --- a/okta/app.go +++ b/okta/app.go @@ -4,8 +4,8 @@ import ( "encoding/json" "sync" - "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/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/app_filter.go b/okta/app_filter.go index c3495800..42184aaa 100644 --- a/okta/app_filter.go +++ b/okta/app_filter.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/config.go b/okta/config.go index d71b7ba2..842ea4b0 100644 --- a/okta/config.go +++ b/okta/config.go @@ -10,7 +10,7 @@ import ( articulateOkta "github.com/articulate/oktasdk-go/okta" "github.com/hashicorp/go-cleanhttp" - "github.com/hashicorp/terraform/helper/logging" + "github.com/hashicorp/terraform-plugin-sdk/helper/logging" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/okta/data_source_okta_app.go b/okta/data_source_okta_app.go index 60201dec..2270cda6 100644 --- a/okta/data_source_okta_app.go +++ b/okta/data_source_okta_app.go @@ -3,7 +3,7 @@ package okta import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func dataSourceApp() *schema.Resource { diff --git a/okta/data_source_okta_app_saml.go b/okta/data_source_okta_app_saml.go index 949604b6..99375eac 100644 --- a/okta/data_source_okta_app_saml.go +++ b/okta/data_source_okta_app_saml.go @@ -3,8 +3,8 @@ package okta import ( "fmt" - "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" ) func dataSourceAppSaml() *schema.Resource { diff --git a/okta/data_source_okta_app_saml_metadata.go b/okta/data_source_okta_app_saml_metadata.go index 4bd7853f..fa2e6e2b 100644 --- a/okta/data_source_okta_app_saml_metadata.go +++ b/okta/data_source_okta_app_saml_metadata.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/crewjam/saml" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func dataSourceAppMetadataSaml() *schema.Resource { diff --git a/okta/data_source_okta_app_saml_metadata_test.go b/okta/data_source_okta_app_saml_metadata_test.go index 9e97c9b9..647742a9 100644 --- a/okta/data_source_okta_app_saml_metadata_test.go +++ b/okta/data_source_okta_app_saml_metadata_test.go @@ -3,8 +3,8 @@ package okta import ( "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceAppMetadataSaml_read(t *testing.T) { diff --git a/okta/data_source_okta_app_saml_test.go b/okta/data_source_okta_app_saml_test.go index 28a0e6f1..21f0c0b4 100644 --- a/okta/data_source_okta_app_saml_test.go +++ b/okta/data_source_okta_app_saml_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceAppSaml_read(t *testing.T) { diff --git a/okta/data_source_okta_app_test.go b/okta/data_source_okta_app_test.go index 17c1e3a7..113c1145 100644 --- a/okta/data_source_okta_app_test.go +++ b/okta/data_source_okta_app_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceApp_read(t *testing.T) { diff --git a/okta/data_source_okta_auth_server.go b/okta/data_source_okta_auth_server.go index edf35d70..c477fdde 100644 --- a/okta/data_source_okta_auth_server.go +++ b/okta/data_source_okta_auth_server.go @@ -3,7 +3,7 @@ package okta import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/data_source_okta_auth_server_test.go b/okta/data_source_okta_auth_server_test.go index 1e3f86d2..90dcf5f4 100644 --- a/okta/data_source_okta_auth_server_test.go +++ b/okta/data_source_okta_auth_server_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceAuthServer_read(t *testing.T) { diff --git a/okta/data_source_okta_default_policy.go b/okta/data_source_okta_default_policy.go index dc2427b9..191c5b96 100644 --- a/okta/data_source_okta_default_policy.go +++ b/okta/data_source_okta_default_policy.go @@ -3,8 +3,8 @@ package okta import ( "fmt" - "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" ) // data source to retrieve information on a Default Policy diff --git a/okta/data_source_okta_default_policy_test.go b/okta/data_source_okta_default_policy_test.go index 2d62347e..c1b85410 100644 --- a/okta/data_source_okta_default_policy_test.go +++ b/okta/data_source_okta_default_policy_test.go @@ -5,8 +5,8 @@ import ( "strconv" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceDefaultPolicy_read(t *testing.T) { diff --git a/okta/data_source_okta_everyone_group.go b/okta/data_source_okta_everyone_group.go index 58825feb..06d20e14 100644 --- a/okta/data_source_okta_everyone_group.go +++ b/okta/data_source_okta_everyone_group.go @@ -1,7 +1,7 @@ package okta import ( - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) // data source to retrieve information on the Everyone Group diff --git a/okta/data_source_okta_everyone_group_test.go b/okta/data_source_okta_everyone_group_test.go index 23f5a0db..135687ed 100644 --- a/okta/data_source_okta_everyone_group_test.go +++ b/okta/data_source_okta_everyone_group_test.go @@ -5,8 +5,8 @@ import ( "strconv" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceEveryoneGroup_read(t *testing.T) { diff --git a/okta/data_source_okta_group.go b/okta/data_source_okta_group.go index 33044b87..5b870de2 100644 --- a/okta/data_source_okta_group.go +++ b/okta/data_source_okta_group.go @@ -6,7 +6,7 @@ import ( "github.com/okta/okta-sdk-golang/okta/query" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func dataSourceGroup() *schema.Resource { diff --git a/okta/data_source_okta_group_test.go b/okta/data_source_okta_group_test.go index 4ee7f3ee..21646c7a 100644 --- a/okta/data_source_okta_group_test.go +++ b/okta/data_source_okta_group_test.go @@ -3,8 +3,8 @@ package okta import ( "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceGroup_read(t *testing.T) { diff --git a/okta/data_source_okta_idp_metadata_saml.go b/okta/data_source_okta_idp_metadata_saml.go index 1864fd90..4bf65ee7 100644 --- a/okta/data_source_okta_idp_metadata_saml.go +++ b/okta/data_source_okta_idp_metadata_saml.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/crewjam/saml" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func dataSourceIdpMetadataSaml() *schema.Resource { diff --git a/okta/data_source_okta_idp_metadata_saml_test.go b/okta/data_source_okta_idp_metadata_saml_test.go index f86498c2..ab93005c 100644 --- a/okta/data_source_okta_idp_metadata_saml_test.go +++ b/okta/data_source_okta_idp_metadata_saml_test.go @@ -3,8 +3,8 @@ package okta import ( "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceIdpMetadataSaml_read(t *testing.T) { diff --git a/okta/data_source_okta_idp_saml.go b/okta/data_source_okta_idp_saml.go index 81f3391e..dd8a1acd 100644 --- a/okta/data_source_okta_idp_saml.go +++ b/okta/data_source_okta_idp_saml.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/data_source_okta_idp_saml_test.go b/okta/data_source_okta_idp_saml_test.go index a8c2beac..3e5af3f1 100644 --- a/okta/data_source_okta_idp_saml_test.go +++ b/okta/data_source_okta_idp_saml_test.go @@ -3,8 +3,8 @@ package okta import ( "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceIdpSaml_read(t *testing.T) { diff --git a/okta/data_source_okta_policy.go b/okta/data_source_okta_policy.go index 5dc42469..b64a1610 100644 --- a/okta/data_source_okta_policy.go +++ b/okta/data_source_okta_policy.go @@ -3,8 +3,8 @@ package okta import ( "fmt" - "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" ) func dataSourcePolicy() *schema.Resource { diff --git a/okta/data_source_okta_policy_test.go b/okta/data_source_okta_policy_test.go index 82944ebe..6fa490b3 100644 --- a/okta/data_source_okta_policy_test.go +++ b/okta/data_source_okta_policy_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourcePolicy_read(t *testing.T) { diff --git a/okta/data_source_okta_user.go b/okta/data_source_okta_user.go index 1d116f54..85b45a06 100644 --- a/okta/data_source_okta_user.go +++ b/okta/data_source_okta_user.go @@ -7,7 +7,7 @@ import ( "github.com/okta/okta-sdk-golang/okta/query" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func dataSourceUser() *schema.Resource { diff --git a/okta/data_source_okta_user_test.go b/okta/data_source_okta_user_test.go index ef056234..7de3094f 100644 --- a/okta/data_source_okta_user_test.go +++ b/okta/data_source_okta_user_test.go @@ -3,8 +3,8 @@ package okta import ( "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceUser_read(t *testing.T) { diff --git a/okta/data_source_okta_users.go b/okta/data_source_okta_users.go index b612f1dd..d3d81bc3 100644 --- a/okta/data_source_okta_users.go +++ b/okta/data_source_okta_users.go @@ -3,8 +3,8 @@ package okta import ( "fmt" - "github.com/hashicorp/terraform/helper/hashcode" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/hashcode" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/data_source_okta_users_test.go b/okta/data_source_okta_users_test.go index a61252bd..8a9148da 100644 --- a/okta/data_source_okta_users_test.go +++ b/okta/data_source_okta_users_test.go @@ -3,8 +3,8 @@ package okta import ( "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaDataSourceUsers_read(t *testing.T) { diff --git a/okta/idp.go b/okta/idp.go index 25804fef..7cbbcd38 100644 --- a/okta/idp.go +++ b/okta/idp.go @@ -6,8 +6,8 @@ import ( "github.com/articulate/terraform-provider-okta/sdk" - "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" ) const ( diff --git a/okta/policy.go b/okta/policy.go index 8b503523..6aab601f 100644 --- a/okta/policy.go +++ b/okta/policy.go @@ -7,8 +7,8 @@ import ( "github.com/okta/okta-sdk-golang/okta" articulateOkta "github.com/articulate/oktasdk-go/okta" - "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" ) // Basis of policy schema diff --git a/okta/policy_rule.go b/okta/policy_rule.go index f8244d7c..6c135196 100644 --- a/okta/policy_rule.go +++ b/okta/policy_rule.go @@ -5,8 +5,8 @@ import ( "strings" articulateOkta "github.com/articulate/oktasdk-go/okta" - "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" ) const ( diff --git a/okta/provider.go b/okta/provider.go index 23cf42c1..a65af8d1 100644 --- a/okta/provider.go +++ b/okta/provider.go @@ -5,9 +5,9 @@ import ( "fmt" "log" - "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" ) // Resource names, defined in place, used throughout the provider and tests diff --git a/okta/provider_sweeper_test.go b/okta/provider_sweeper_test.go index 0df46f92..ea20461f 100644 --- a/okta/provider_sweeper_test.go +++ b/okta/provider_sweeper_test.go @@ -8,7 +8,7 @@ import ( articulateOkta "github.com/articulate/oktasdk-go/okta" sdk "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/okta/provider_test.go b/okta/provider_test.go index 0b0a291a..d442dc35 100644 --- a/okta/provider_test.go +++ b/okta/provider_test.go @@ -6,8 +6,8 @@ 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" ) var testAccProviders map[string]terraform.ResourceProvider diff --git a/okta/resource_okta_app_auto_login.go b/okta/resource_okta_app_auto_login.go index a15949ff..be361218 100644 --- a/okta/resource_okta_app_auto_login.go +++ b/okta/resource_okta_app_auto_login.go @@ -1,8 +1,8 @@ package okta 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/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_app_auto_login_test.go b/okta/resource_okta_app_auto_login_test.go index 7bdeaff6..d5f8521f 100644 --- a/okta/resource_okta_app_auto_login_test.go +++ b/okta/resource_okta_app_auto_login_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_app_bookmark.go b/okta/resource_okta_app_bookmark.go index 071a018f..7091b346 100644 --- a/okta/resource_okta_app_bookmark.go +++ b/okta/resource_okta_app_bookmark.go @@ -1,7 +1,7 @@ package okta import ( - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_app_bookmark_test.go b/okta/resource_okta_app_bookmark_test.go index ffedab9d..da083b8d 100644 --- a/okta/resource_okta_app_bookmark_test.go +++ b/okta/resource_okta_app_bookmark_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_app_group_assignment.go b/okta/resource_okta_app_group_assignment.go index 6424ff5c..69203baa 100644 --- a/okta/resource_okta_app_group_assignment.go +++ b/okta/resource_okta_app_group_assignment.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_app_group_assignment_test.go b/okta/resource_okta_app_group_assignment_test.go index 33429934..4377f997 100644 --- a/okta/resource_okta_app_group_assignment_test.go +++ b/okta/resource_okta_app_group_assignment_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "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" ) func TestAccAppGroupAssignment_crud(t *testing.T) { diff --git a/okta/resource_okta_app_oauth.go b/okta/resource_okta_app_oauth.go index a0f8279e..4cb52f09 100644 --- a/okta/resource_okta_app_oauth.go +++ b/okta/resource_okta_app_oauth.go @@ -3,8 +3,8 @@ package okta import ( "encoding/json" - "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/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_app_oauth_redirect_uri.go b/okta/resource_okta_app_oauth_redirect_uri.go index a93ada55..416cbb6f 100644 --- a/okta/resource_okta_app_oauth_redirect_uri.go +++ b/okta/resource_okta_app_oauth_redirect_uri.go @@ -1,7 +1,7 @@ package okta import ( - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_app_oauth_redirect_uri_test.go b/okta/resource_okta_app_oauth_redirect_uri_test.go index e1513310..98c66e54 100644 --- a/okta/resource_okta_app_oauth_redirect_uri_test.go +++ b/okta/resource_okta_app_oauth_redirect_uri_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "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/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_app_oauth_test.go b/okta/resource_okta_app_oauth_test.go index 9e079740..b4c347ee 100644 --- a/okta/resource_okta_app_oauth_test.go +++ b/okta/resource_okta_app_oauth_test.go @@ -5,8 +5,8 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_app_saml.go b/okta/resource_okta_app_saml.go index 9b8798bf..ba45bf3f 100644 --- a/okta/resource_okta_app_saml.go +++ b/okta/resource_okta_app_saml.go @@ -7,8 +7,8 @@ import ( "fmt" "github.com/crewjam/saml" - "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/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_app_saml_test.go b/okta/resource_okta_app_saml_test.go index 0b79897f..8e792385 100644 --- a/okta/resource_okta_app_saml_test.go +++ b/okta/resource_okta_app_saml_test.go @@ -6,9 +6,9 @@ import ( "regexp" "testing" - "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/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_app_secure_password_store.go b/okta/resource_okta_app_secure_password_store.go index fe60b88b..bdbcb917 100644 --- a/okta/resource_okta_app_secure_password_store.go +++ b/okta/resource_okta_app_secure_password_store.go @@ -1,8 +1,8 @@ package okta 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/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_app_secure_password_store_test.go b/okta/resource_okta_app_secure_password_store_test.go index d566f9e0..03ec29ec 100644 --- a/okta/resource_okta_app_secure_password_store_test.go +++ b/okta/resource_okta_app_secure_password_store_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_app_swa.go b/okta/resource_okta_app_swa.go index 5ef63aef..ae8096e5 100644 --- a/okta/resource_okta_app_swa.go +++ b/okta/resource_okta_app_swa.go @@ -1,7 +1,7 @@ package okta import ( - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_app_swa_test.go b/okta/resource_okta_app_swa_test.go index 425e7d7f..ba0597aa 100644 --- a/okta/resource_okta_app_swa_test.go +++ b/okta/resource_okta_app_swa_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_app_three_field.go b/okta/resource_okta_app_three_field.go index b4ee98f5..b44fdecf 100644 --- a/okta/resource_okta_app_three_field.go +++ b/okta/resource_okta_app_three_field.go @@ -1,7 +1,7 @@ package okta import ( - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_app_three_field_test.go b/okta/resource_okta_app_three_field_test.go index 4bde5960..21e8022b 100644 --- a/okta/resource_okta_app_three_field_test.go +++ b/okta/resource_okta_app_three_field_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_app_user.go b/okta/resource_okta_app_user.go index df61bec4..a65c0b4b 100644 --- a/okta/resource_okta_app_user.go +++ b/okta/resource_okta_app_user.go @@ -3,7 +3,7 @@ package okta import ( "encoding/json" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_app_user_base_schema.go b/okta/resource_okta_app_user_base_schema.go index 092d57a9..aba3014e 100644 --- a/okta/resource_okta_app_user_base_schema.go +++ b/okta/resource_okta_app_user_base_schema.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceAppUserBaseSchema() *schema.Resource { diff --git a/okta/resource_okta_app_user_base_schema_test.go b/okta/resource_okta_app_user_base_schema_test.go index 5a2c0d8b..3f38c99b 100644 --- a/okta/resource_okta_app_user_base_schema_test.go +++ b/okta/resource_okta_app_user_base_schema_test.go @@ -4,10 +4,10 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta" - "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" ) func TestAccAppUserBaseSchema_change(t *testing.T) { diff --git a/okta/resource_okta_app_user_schema.go b/okta/resource_okta_app_user_schema.go index 3f43dbdb..7022664f 100644 --- a/okta/resource_okta_app_user_schema.go +++ b/okta/resource_okta_app_user_schema.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceAppUserSchema() *schema.Resource { diff --git a/okta/resource_okta_app_user_schema_test.go b/okta/resource_okta_app_user_schema_test.go index 4bc0a0eb..353136d8 100644 --- a/okta/resource_okta_app_user_schema_test.go +++ b/okta/resource_okta_app_user_schema_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "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" ) func TestAccAppUserSchemas_crud(t *testing.T) { diff --git a/okta/resource_okta_app_user_test.go b/okta/resource_okta_app_user_test.go index 351a31a3..cee6ea30 100644 --- a/okta/resource_okta_app_user_test.go +++ b/okta/resource_okta_app_user_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "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" ) func TestAccOktaAppUser_crud(t *testing.T) { diff --git a/okta/resource_okta_auth_server.go b/okta/resource_okta_auth_server.go index cc09e89c..23871fe5 100644 --- a/okta/resource_okta_auth_server.go +++ b/okta/resource_okta_auth_server.go @@ -3,8 +3,8 @@ package okta import ( "net/http" - "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/articulate/terraform-provider-okta/sdk" "github.com/okta/okta-sdk-golang/okta" diff --git a/okta/resource_okta_auth_server_claim.go b/okta/resource_okta_auth_server_claim.go index 92e8df42..2d868521 100644 --- a/okta/resource_okta_auth_server_claim.go +++ b/okta/resource_okta_auth_server_claim.go @@ -4,8 +4,8 @@ import ( "net/http" "github.com/articulate/terraform-provider-okta/sdk" - "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" ) func resourceAuthServerClaim() *schema.Resource { diff --git a/okta/resource_okta_auth_server_claim_test.go b/okta/resource_okta_auth_server_claim_test.go index 8eb89142..a4cd0692 100644 --- a/okta/resource_okta_auth_server_claim_test.go +++ b/okta/resource_okta_auth_server_claim_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaAuthServerClaim_create(t *testing.T) { diff --git a/okta/resource_okta_auth_server_policy.go b/okta/resource_okta_auth_server_policy.go index 45b1057e..079cfc83 100644 --- a/okta/resource_okta_auth_server_policy.go +++ b/okta/resource_okta_auth_server_policy.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceAuthServerPolicy() *schema.Resource { diff --git a/okta/resource_okta_auth_server_policy_rule.go b/okta/resource_okta_auth_server_policy_rule.go index 18dbeff3..cf4a0277 100644 --- a/okta/resource_okta_auth_server_policy_rule.go +++ b/okta/resource_okta_auth_server_policy_rule.go @@ -4,8 +4,8 @@ import ( "net/http" "github.com/articulate/terraform-provider-okta/sdk" - "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" ) func resourceAuthServerPolicyRule() *schema.Resource { diff --git a/okta/resource_okta_auth_server_policy_rule_test.go b/okta/resource_okta_auth_server_policy_rule_test.go index 18c2fa6f..59445777 100644 --- a/okta/resource_okta_auth_server_policy_rule_test.go +++ b/okta/resource_okta_auth_server_policy_rule_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaAuthServerPolicyRule_create(t *testing.T) { diff --git a/okta/resource_okta_auth_server_policy_test.go b/okta/resource_okta_auth_server_policy_test.go index 7072a8af..823a5660 100644 --- a/okta/resource_okta_auth_server_policy_test.go +++ b/okta/resource_okta_auth_server_policy_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaAuthServerPolicy_crud(t *testing.T) { diff --git a/okta/resource_okta_auth_server_scope.go b/okta/resource_okta_auth_server_scope.go index 31377ac8..36a4d41e 100644 --- a/okta/resource_okta_auth_server_scope.go +++ b/okta/resource_okta_auth_server_scope.go @@ -4,8 +4,8 @@ import ( "net/http" "github.com/articulate/terraform-provider-okta/sdk" - "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" ) func resourceAuthServerScope() *schema.Resource { diff --git a/okta/resource_okta_auth_server_scope_test.go b/okta/resource_okta_auth_server_scope_test.go index 3dc9e092..c2de095e 100644 --- a/okta/resource_okta_auth_server_scope_test.go +++ b/okta/resource_okta_auth_server_scope_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaAuthServerScope_crud(t *testing.T) { diff --git a/okta/resource_okta_auth_server_test.go b/okta/resource_okta_auth_server_test.go index e3797c8c..39b682bd 100644 --- a/okta/resource_okta_auth_server_test.go +++ b/okta/resource_okta_auth_server_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_factor.go b/okta/resource_okta_factor.go index 02e21f64..d3765c6f 100644 --- a/okta/resource_okta_factor.go +++ b/okta/resource_okta_factor.go @@ -2,8 +2,8 @@ package okta import ( "github.com/articulate/oktasdk-go/okta" - "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" ) // Predefined second authentication factors. They must be activated in order to use them in MFA policies. diff --git a/okta/resource_okta_group.go b/okta/resource_okta_group.go index 59ee4f10..2485a7b0 100644 --- a/okta/resource_okta_group.go +++ b/okta/resource_okta_group.go @@ -5,7 +5,7 @@ import ( "github.com/okta/okta-sdk-golang/okta" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_group_roles.go b/okta/resource_okta_group_roles.go index a7990755..e5408b48 100644 --- a/okta/resource_okta_group_roles.go +++ b/okta/resource_okta_group_roles.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceGroupRoles() *schema.Resource { diff --git a/okta/resource_okta_group_roles_test.go b/okta/resource_okta_group_roles_test.go index 751032ec..7cfa8fe6 100644 --- a/okta/resource_okta_group_roles_test.go +++ b/okta/resource_okta_group_roles_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaGroupAdminRoles_crud(t *testing.T) { diff --git a/okta/resource_okta_group_rule.go b/okta/resource_okta_group_rule.go index 6c8fc284..2eb0d736 100644 --- a/okta/resource_okta_group_rule.go +++ b/okta/resource_okta_group_rule.go @@ -5,7 +5,7 @@ import ( "github.com/okta/okta-sdk-golang/okta" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceGroupRule() *schema.Resource { diff --git a/okta/resource_okta_group_rule_test.go b/okta/resource_okta_group_rule_test.go index 4d46533b..73ceec68 100644 --- a/okta/resource_okta_group_rule_test.go +++ b/okta/resource_okta_group_rule_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_group_test.go b/okta/resource_okta_group_test.go index 03d6ba7c..33841757 100644 --- a/okta/resource_okta_group_test.go +++ b/okta/resource_okta_group_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_idp_oidc.go b/okta/resource_okta_idp_oidc.go index 08f0a159..2063f718 100644 --- a/okta/resource_okta_idp_oidc.go +++ b/okta/resource_okta_idp_oidc.go @@ -2,8 +2,8 @@ package okta import ( "github.com/articulate/terraform-provider-okta/sdk" - "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/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_idp_oidc_test.go b/okta/resource_okta_idp_oidc_test.go index 299ecc4f..40e33d92 100644 --- a/okta/resource_okta_idp_oidc_test.go +++ b/okta/resource_okta_idp_oidc_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaIdpOidc_crud(t *testing.T) { diff --git a/okta/resource_okta_idp_saml.go b/okta/resource_okta_idp_saml.go index 825a3fbf..bf12b822 100644 --- a/okta/resource_okta_idp_saml.go +++ b/okta/resource_okta_idp_saml.go @@ -2,8 +2,8 @@ package okta import ( "github.com/articulate/terraform-provider-okta/sdk" - "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/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_idp_saml_signing_key.go b/okta/resource_okta_idp_saml_signing_key.go index 601e2e7d..531c7ba9 100644 --- a/okta/resource_okta_idp_saml_signing_key.go +++ b/okta/resource_okta_idp_saml_signing_key.go @@ -4,7 +4,7 @@ import ( "net/http" "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceIdpSigningKey() *schema.Resource { diff --git a/okta/resource_okta_idp_saml_test.go b/okta/resource_okta_idp_saml_test.go index 4677b1f1..fd6a7abc 100644 --- a/okta/resource_okta_idp_saml_test.go +++ b/okta/resource_okta_idp_saml_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaIdpSaml_crud(t *testing.T) { diff --git a/okta/resource_okta_idp_social.go b/okta/resource_okta_idp_social.go index e016639d..c30bf57f 100644 --- a/okta/resource_okta_idp_social.go +++ b/okta/resource_okta_idp_social.go @@ -2,8 +2,8 @@ package okta import ( "github.com/articulate/terraform-provider-okta/sdk" - "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/okta/okta-sdk-golang/okta" ) diff --git a/okta/resource_okta_idp_social_test.go b/okta/resource_okta_idp_social_test.go index 5667efa4..204281c1 100644 --- a/okta/resource_okta_idp_social_test.go +++ b/okta/resource_okta_idp_social_test.go @@ -5,8 +5,8 @@ import ( "testing" "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaIdpSocial_crud(t *testing.T) { diff --git a/okta/resource_okta_inline_hooks.go b/okta/resource_okta_inline_hooks.go index cecb5524..9b9b1ae7 100644 --- a/okta/resource_okta_inline_hooks.go +++ b/okta/resource_okta_inline_hooks.go @@ -2,8 +2,8 @@ package okta import ( "github.com/articulate/terraform-provider-okta/sdk" - "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" "net/http" ) diff --git a/okta/resource_okta_inline_hooks_test.go b/okta/resource_okta_inline_hooks_test.go index d41ae951..47cf7164 100644 --- a/okta/resource_okta_inline_hooks_test.go +++ b/okta/resource_okta_inline_hooks_test.go @@ -4,8 +4,8 @@ import ( "net/http" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaInlineHook_crud(t *testing.T) { diff --git a/okta/resource_okta_network_zone.go b/okta/resource_okta_network_zone.go index 0f25c949..9b823763 100644 --- a/okta/resource_okta_network_zone.go +++ b/okta/resource_okta_network_zone.go @@ -4,8 +4,8 @@ import ( "strings" "github.com/articulate/terraform-provider-okta/sdk" - "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" ) func resourceNetworkZone() *schema.Resource { diff --git a/okta/resource_okta_network_zone_test.go b/okta/resource_okta_network_zone_test.go index 98ece5df..23f4ef26 100644 --- a/okta/resource_okta_network_zone_test.go +++ b/okta/resource_okta_network_zone_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaNetworkZone_crud(t *testing.T) { diff --git a/okta/resource_okta_policy_mfa.go b/okta/resource_okta_policy_mfa.go index cbe0dd2f..0e27b5ef 100644 --- a/okta/resource_okta_policy_mfa.go +++ b/okta/resource_okta_policy_mfa.go @@ -4,10 +4,10 @@ import ( "fmt" "log" - "github.com/hashicorp/terraform/helper/validation" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" articulateOkta "github.com/articulate/oktasdk-go/okta" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func getPolicyFactorSchema(key string) map[string]*schema.Schema { diff --git a/okta/resource_okta_policy_mfa_test.go b/okta/resource_okta_policy_mfa_test.go index ce4c049d..66e2cb98 100644 --- a/okta/resource_okta_policy_mfa_test.go +++ b/okta/resource_okta_policy_mfa_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func deleteMfaPolicies(client *testClient) error { diff --git a/okta/resource_okta_policy_password.go b/okta/resource_okta_policy_password.go index b96d2065..da41f5ee 100644 --- a/okta/resource_okta_policy_password.go +++ b/okta/resource_okta_policy_password.go @@ -5,8 +5,8 @@ import ( "log" articulateOkta "github.com/articulate/oktasdk-go/okta" - "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" ) func resourcePolicyPassword() *schema.Resource { diff --git a/okta/resource_okta_policy_password_test.go b/okta/resource_okta_policy_password_test.go index 75424779..2a10f58b 100644 --- a/okta/resource_okta_policy_password_test.go +++ b/okta/resource_okta_policy_password_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "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" ) func deletePasswordPolicies(client *testClient) error { diff --git a/okta/resource_okta_policy_rule_idp_discovery.go b/okta/resource_okta_policy_rule_idp_discovery.go index 89270950..36708c01 100644 --- a/okta/resource_okta_policy_rule_idp_discovery.go +++ b/okta/resource_okta_policy_rule_idp_discovery.go @@ -2,8 +2,8 @@ package okta import ( "github.com/articulate/terraform-provider-okta/sdk" - "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" ) var platformIncludeResource = &schema.Resource{ diff --git a/okta/resource_okta_policy_rule_idp_discovery_test.go b/okta/resource_okta_policy_rule_idp_discovery_test.go index bbbcb5de..fb5b15f8 100644 --- a/okta/resource_okta_policy_rule_idp_discovery_test.go +++ b/okta/resource_okta_policy_rule_idp_discovery_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func deletePolicyRuleIdpDiscovery(client *testClient) error { diff --git a/okta/resource_okta_policy_rule_mfa.go b/okta/resource_okta_policy_rule_mfa.go index 38e511a4..bf8e9607 100644 --- a/okta/resource_okta_policy_rule_mfa.go +++ b/okta/resource_okta_policy_rule_mfa.go @@ -2,8 +2,8 @@ package okta import ( articulateOkta "github.com/articulate/oktasdk-go/okta" - "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" ) func resourcePolicyMfaRule() *schema.Resource { diff --git a/okta/resource_okta_policy_rule_mfa_test.go b/okta/resource_okta_policy_rule_mfa_test.go index 5cc9dc19..37d80519 100644 --- a/okta/resource_okta_policy_rule_mfa_test.go +++ b/okta/resource_okta_policy_rule_mfa_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func deleteMfaPolicyRules(client *testClient) error { diff --git a/okta/resource_okta_policy_rule_password.go b/okta/resource_okta_policy_rule_password.go index e2ff8c5c..bd95e1cb 100644 --- a/okta/resource_okta_policy_rule_password.go +++ b/okta/resource_okta_policy_rule_password.go @@ -5,8 +5,8 @@ import ( "log" articulateOkta "github.com/articulate/oktasdk-go/okta" - "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" ) func resourcePolicyPasswordRule() *schema.Resource { diff --git a/okta/resource_okta_policy_rule_password_test.go b/okta/resource_okta_policy_rule_password_test.go index cf88d9d4..4799638c 100644 --- a/okta/resource_okta_policy_rule_password_test.go +++ b/okta/resource_okta_policy_rule_password_test.go @@ -7,9 +7,9 @@ import ( "strings" "testing" - "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" ) func deletepolicyRulePasswords(client *testClient) error { diff --git a/okta/resource_okta_policy_rule_sign_on.go b/okta/resource_okta_policy_rule_sign_on.go index 9923fe36..2882019c 100644 --- a/okta/resource_okta_policy_rule_sign_on.go +++ b/okta/resource_okta_policy_rule_sign_on.go @@ -5,8 +5,8 @@ import ( "log" articulateOkta "github.com/articulate/oktasdk-go/okta" - "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" ) func resourcePolicySignonRule() *schema.Resource { diff --git a/okta/resource_okta_policy_rule_sign_on_test.go b/okta/resource_okta_policy_rule_sign_on_test.go index 0843e613..0982fb1f 100644 --- a/okta/resource_okta_policy_rule_sign_on_test.go +++ b/okta/resource_okta_policy_rule_sign_on_test.go @@ -5,8 +5,8 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func deleteSignOnPolicyRules(client *testClient) error { diff --git a/okta/resource_okta_policy_sign_on.go b/okta/resource_okta_policy_sign_on.go index 18d9fd89..08e1dd14 100644 --- a/okta/resource_okta_policy_sign_on.go +++ b/okta/resource_okta_policy_sign_on.go @@ -5,7 +5,7 @@ import ( "log" articulateOkta "github.com/articulate/oktasdk-go/okta" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourcePolicySignon() *schema.Resource { diff --git a/okta/resource_okta_policy_sign_on_test.go b/okta/resource_okta_policy_sign_on_test.go index 722aa5a4..6d2ef6c2 100644 --- a/okta/resource_okta_policy_sign_on_test.go +++ b/okta/resource_okta_policy_sign_on_test.go @@ -5,8 +5,8 @@ import ( "regexp" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func deleteSignOnPolicies(client *testClient) error { diff --git a/okta/resource_okta_template_email.go b/okta/resource_okta_template_email.go index 7e67e0d4..01f62b56 100644 --- a/okta/resource_okta_template_email.go +++ b/okta/resource_okta_template_email.go @@ -2,7 +2,7 @@ package okta import ( "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) var translationResource = &schema.Resource{ diff --git a/okta/resource_okta_template_email_test.go b/okta/resource_okta_template_email_test.go index 0cb894e6..fee32e6c 100644 --- a/okta/resource_okta_template_email_test.go +++ b/okta/resource_okta_template_email_test.go @@ -4,8 +4,8 @@ import ( "fmt" "testing" - "github.com/hashicorp/terraform/helper/acctest" - "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) func TestAccOktaEmailTemplate_crud(t *testing.T) { diff --git a/okta/resource_okta_trusted_origin.go b/okta/resource_okta_trusted_origin.go index ca8c078a..70e5d7e4 100644 --- a/okta/resource_okta_trusted_origin.go +++ b/okta/resource_okta_trusted_origin.go @@ -5,7 +5,7 @@ import ( "log" articulateOkta "github.com/articulate/oktasdk-go/okta" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func resourceTrustedOrigin() *schema.Resource { diff --git a/okta/resource_okta_trusted_origin_test.go b/okta/resource_okta_trusted_origin_test.go index 3f5559d0..19971a20 100644 --- a/okta/resource_okta_trusted_origin_test.go +++ b/okta/resource_okta_trusted_origin_test.go @@ -4,9 +4,9 @@ import ( "fmt" "testing" - "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" ) func TestAccOktaTrustedOrigin_crud(t *testing.T) { diff --git a/okta/resource_okta_user.go b/okta/resource_okta_user.go index 57f23262..6dd6cc5a 100644 --- a/okta/resource_okta_user.go +++ b/okta/resource_okta_user.go @@ -6,8 +6,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/okta/okta-sdk-golang/okta" "github.com/okta/okta-sdk-golang/okta/query" ) diff --git a/okta/resource_okta_user_base_schema.go b/okta/resource_okta_user_base_schema.go index 33a7f5b6..e7ab3d33 100644 --- a/okta/resource_okta_user_base_schema.go +++ b/okta/resource_okta_user_base_schema.go @@ -2,7 +2,7 @@ package okta import ( "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) const baseSchema = "base" diff --git a/okta/resource_okta_user_base_schema_test.go b/okta/resource_okta_user_base_schema_test.go index aca56fe6..cc81e191 100644 --- a/okta/resource_okta_user_base_schema_test.go +++ b/okta/resource_okta_user_base_schema_test.go @@ -5,10 +5,10 @@ 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" - "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" ) const baseTestProp = "firstName" diff --git a/okta/resource_okta_user_schema.go b/okta/resource_okta_user_schema.go index 7b787194..088475c0 100644 --- a/okta/resource_okta_user_schema.go +++ b/okta/resource_okta_user_schema.go @@ -2,7 +2,7 @@ package okta import ( "github.com/articulate/terraform-provider-okta/sdk" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) const customSchema = "custom" diff --git a/okta/resource_okta_user_schema_test.go b/okta/resource_okta_user_schema_test.go index cee86a37..72ec3ea1 100644 --- a/okta/resource_okta_user_schema_test.go +++ b/okta/resource_okta_user_schema_test.go @@ -7,9 +7,9 @@ import ( "strings" "testing" - "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" ) func sweepUserSchema(client *testClient) error { diff --git a/okta/resource_okta_user_test.go b/okta/resource_okta_user_test.go index 34738771..798a175b 100644 --- a/okta/resource_okta_user_test.go +++ b/okta/resource_okta_user_test.go @@ -10,9 +10,9 @@ import ( "github.com/okta/okta-sdk-golang/okta/query" - "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" ) func sweepUsers(client *testClient) error { diff --git a/okta/saml.go b/okta/saml.go index 98f56bd9..4c3f405e 100644 --- a/okta/saml.go +++ b/okta/saml.go @@ -4,7 +4,7 @@ import ( "strings" "github.com/crewjam/saml" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func syncSamlIndexEndpointBinding(d *schema.ResourceData, services []saml.IndexedEndpoint) { diff --git a/okta/test_utils.go b/okta/test_utils.go index e652e137..1331954b 100644 --- a/okta/test_utils.go +++ b/okta/test_utils.go @@ -4,10 +4,10 @@ import ( "fmt" "strconv" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "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" ) type ( diff --git a/okta/user.go b/okta/user.go index 9ea3d187..45ac9a81 100644 --- a/okta/user.go +++ b/okta/user.go @@ -4,8 +4,8 @@ import ( "encoding/json" "fmt" "github.com/articulate/terraform-provider-okta/sdk" - "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/okta/okta-sdk-golang/okta" "log" "net/http" diff --git a/okta/user_schema.go b/okta/user_schema.go index 12bdac09..aaafc288 100644 --- a/okta/user_schema.go +++ b/okta/user_schema.go @@ -2,8 +2,8 @@ package okta import ( "github.com/articulate/terraform-provider-okta/sdk" - "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" ) var ( diff --git a/okta/utils.go b/okta/utils.go index a154a055..30f34341 100644 --- a/okta/utils.go +++ b/okta/utils.go @@ -15,7 +15,7 @@ import ( "github.com/peterhellberg/link" articulateOkta "github.com/articulate/oktasdk-go/okta" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" ) func buildSchema(s, t map[string]*schema.Schema) map[string]*schema.Schema { diff --git a/sdk/idp_models.go b/sdk/idp_models.go index d4374d48..cac629e2 100644 --- a/sdk/idp_models.go +++ b/sdk/idp_models.go @@ -3,7 +3,7 @@ package sdk import ( "fmt" - "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/okta/okta-sdk-golang/okta" ) diff --git a/vendor/github.com/blang/semver/.travis.yml b/vendor/github.com/blang/semver/.travis.yml deleted file mode 100644 index 102fb9a6..00000000 --- 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 5ba5c86f..00000000 --- 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 08b2e4a3..00000000 --- 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 a74bf7c4..00000000 --- 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 1cf8ebdd..00000000 --- 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 fca406d4..00000000 --- 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 8ee0842e..00000000 --- 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 e18f8808..00000000 --- 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 eb4d8026..00000000 --- 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/.gitignore b/vendor/github.com/bmatcuk/doublestar/.gitignore deleted file mode 100644 index af212ecc..00000000 --- a/vendor/github.com/bmatcuk/doublestar/.gitignore +++ /dev/null @@ -1,32 +0,0 @@ -# vi -*~ -*.swp -*.swo - -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof - -# test directory -test/ diff --git a/vendor/github.com/bmatcuk/doublestar/.travis.yml b/vendor/github.com/bmatcuk/doublestar/.travis.yml deleted file mode 100644 index ec4fee88..00000000 --- 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 309c9d1d..00000000 --- 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 8e365c5e..00000000 --- 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 0044dfa8..00000000 --- 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 ce1688f7..00000000 --- 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/hashicorp/go-getter/README.md b/vendor/github.com/hashicorp/go-getter/README.md index ba4df6f4..3de23c70 100644 --- a/vendor/github.com/hashicorp/go-getter/README.md +++ b/vendor/github.com/hashicorp/go-getter/README.md @@ -128,14 +128,14 @@ go-getter will first download the URL specified _before_ the double-slash path after the double slash into the target directory. For example, if you're downloading this GitHub repository, but you only -want to download the `test-fixtures` directory, you can do the following: +want to download the `testdata` directory, you can do the following: ``` -https://github.com/hashicorp/go-getter.git//test-fixtures +https://github.com/hashicorp/go-getter.git//testdata ``` If you downloaded this to the `/tmp` directory, then the file -`/tmp/archive.gz` would exist. Notice that this file is in the `test-fixtures` +`/tmp/archive.gz` would exist. Notice that this file is in the `testdata` directory in this repository, but because we specified a subdirectory, go-getter automatically copied only that directory contents. diff --git a/vendor/github.com/hashicorp/go-getter/get_git.go b/vendor/github.com/hashicorp/go-getter/get_git.go index 67e8b2f4..bb1ec316 100644 --- a/vendor/github.com/hashicorp/go-getter/get_git.go +++ b/vendor/github.com/hashicorp/go-getter/get_git.go @@ -37,6 +37,9 @@ func (g *GitGetter) Get(dst string, u *url.URL) error { // The port number must be parseable as an integer. If not, the user // was probably trying to use a scp-style address, in which case the // ssh:// prefix must be removed to indicate that. + // + // This is not necessary in versions of Go which have patched + // CVE-2019-14809 (e.g. Go 1.12.8+) if portStr := u.Port(); portStr != "" { if _, err := strconv.ParseUint(portStr, 10, 16); err != nil { return fmt.Errorf("invalid port number %q; if using the \"scp-like\" git address scheme where a colon introduces the path instead, remove the ssh:// portion and use just the git:: prefix", portStr) diff --git a/vendor/github.com/hashicorp/go-getter/go.mod b/vendor/github.com/hashicorp/go-getter/go.mod index 807c0a23..a869e8f8 100644 --- a/vendor/github.com/hashicorp/go-getter/go.mod +++ b/vendor/github.com/hashicorp/go-getter/go.mod @@ -1,10 +1,11 @@ module github.com/hashicorp/go-getter require ( - cloud.google.com/go v0.36.0 + cloud.google.com/go v0.45.1 github.com/aws/aws-sdk-go v1.15.78 github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d github.com/cheggaaa/pb v1.0.27 + github.com/davecgh/go-spew v1.1.1 // indirect github.com/fatih/color v1.7.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.0 github.com/hashicorp/go-safetemp v1.0.0 @@ -14,9 +15,9 @@ require ( github.com/mattn/go-runewidth v0.0.4 // indirect github.com/mitchellh/go-homedir v1.0.0 github.com/mitchellh/go-testing-interface v1.0.0 + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/testify v1.2.2 // indirect github.com/ulikunitz/xz v0.5.5 - golang.org/x/net v0.0.0-20181114220301-adae6a3d119a // indirect - golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06 // indirect - google.golang.org/api v0.1.0 + google.golang.org/api v0.9.0 gopkg.in/cheggaaa/pb.v1 v1.0.27 // indirect ) diff --git a/vendor/github.com/hashicorp/go-getter/go.sum b/vendor/github.com/hashicorp/go-getter/go.sum index 0fc50882..b88c747c 100644 --- a/vendor/github.com/hashicorp/go-getter/go.sum +++ b/vendor/github.com/hashicorp/go-getter/go.sum @@ -1,182 +1,162 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.36.0 h1:+aCSj7tOo2LODWVEuZDZeGCckdt6MlSF+X/rB3wUiS8= -cloud.google.com/go v0.36.0/go.mod h1:RUoy9p/M4ge0HzT8L+SDZ8jg+Q6fth0CiBuhFJpSV40= -dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= -dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= -dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= -dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= -git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +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/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/aws/aws-sdk-go v1.15.78 h1:LaXy6lWR0YK7LKyuU0QWy2ws/LWTPfYV/UgfiBu4tvY= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= 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/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/cheggaaa/pb v1.0.27 h1:wIkZHkNfC7R6GI5w7l/PdAdzXzlrbcI3p8OAlnkTsnc= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= 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/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= -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/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= -github.com/gogo/protobuf v1.1.1/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/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= 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/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= 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/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/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-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +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/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/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= -github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= -github.com/googleapis/gax-go/v2 v2.0.3 h1:siORttZ36U2R/WjiJuDz8znElWBiAlO9rVt+mqJt0Cc= -github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= -github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +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/hashicorp/go-cleanhttp v0.5.0 h1:wvCrVc9TjDls6+YGAF2hAifE1E5U1+b4tH6KdvN3Gig= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= 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-version v1.1.0 h1:bPIoEKD27tNdebFGGxxYwcL4nepeY4j1QP23PFRGzg0= github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Aowv3l/EQUlocDHW2Cp4G9WJVH7uyH8QFJE= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -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/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= 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-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= 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/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= -github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= -github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= 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/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= -github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= -github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= -github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= -github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= -github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= -github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= -github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= -github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= -github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= -github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= -github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= -github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= -github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= -github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= -github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= -github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= -github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= -github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= -github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= -github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= -github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= -go.opencensus.io v0.18.0 h1:Mk5rgZcggtbvtAun5aJzAtjKKN/t0R3jJPlWILlv938= -go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= -go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= -golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +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= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +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= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/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-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a h1:gOpx8G595UYyvj8UK4+OFyY4rx037g3fmfhe5SasG3U= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/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-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= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +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 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/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-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890 h1:uESlIz09WIHT2I+pasSXcpLYqYK8wHcdCetU3VuMBJE= -golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= +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= +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-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/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-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06 h1:0oC8rFnE+74kEmuHZ46F6KHsMr5Gx2gUQPuNz28iQZM= -golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/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-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-20190502145724-3ef323f4f1fd/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/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.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +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/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= -google.golang.org/api v0.1.0 h1:K6z2u68e86TPdSdefXdzvXgR1zEMa+459vBSfWYAZkI= -google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +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-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= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0 h1:jbyannxz0XFD3zdjgrSUsaJbgpH4eTrkdhRChkHPfO8= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.3.0 h1:FBSsiFRMz3LBeXIomRnVzrQwSDj4ibvcRexLG0LZGQk= -google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= -google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922 h1:mBVYJnbrXLA/ZCBTCe7PtEgAUP+1bg92qTaFoPHdz+8= -google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922/go.mod h1:L3J43x8/uS+qIUoksaLKe6OS3nUKxOKuIFz1sl2/jx4= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= -google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk= -google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +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/cheggaaa/pb.v1 v1.0.27 h1:kJdccidYzt3CaHD1crCFTS1hxyhSi059NhOFUf03YFo= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= -gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= -honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +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= -sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= -sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/vendor/github.com/hashicorp/go-hclog/README.md b/vendor/github.com/hashicorp/go-hclog/README.md index 1153e285..9b6845e9 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 00000000..7815f501 --- /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 55ce4396..3efc54c1 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 2aaa1f89..219656c4 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 d98714e0..080ed799 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 0942361a..7ad6b351 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 8af1a3be..9b27bd3d 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 2bb927fc..044a4696 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 00000000..7e8ec729 --- /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/hil/.gitignore b/vendor/github.com/hashicorp/hil/.gitignore deleted file mode 100644 index 9d6e5df3..00000000 --- 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 a7854442..00000000 --- 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 97d2292a..00000000 --- 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 grammar 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 feaf7a34..00000000 --- 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 909c788a..00000000 --- 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 474f5058..00000000 --- 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 f16da391..00000000 --- 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 184e029b..00000000 --- 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 27820769..00000000 --- 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 6946ecd2..00000000 --- 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 b107ddd4..00000000 --- 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 45719a69..00000000 --- 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 83639b69..00000000 --- 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 ecbe1fdb..00000000 --- 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 2e013e01..00000000 --- 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 bacd6964..00000000 --- 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 de954f38..00000000 --- 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 376f1c49..00000000 --- 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 4de37283..00000000 --- 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 86085de0..00000000 --- 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 b6c82ae9..00000000 --- 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 a602f5fd..00000000 --- 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 e69df294..00000000 --- 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 0ace8306..00000000 --- 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/hashicorp/terraform/LICENSE b/vendor/github.com/hashicorp/terraform-plugin-sdk/LICENSE similarity index 100% rename from vendor/github.com/hashicorp/terraform/LICENSE rename to vendor/github.com/hashicorp/terraform-plugin-sdk/LICENSE 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 100% rename from vendor/github.com/hashicorp/terraform/helper/logging/logging.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/logging/logging.go 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 0742e993..db12cee2 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 a465136f..02a993d6 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 0d9c831a..80782413 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 90% 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 7cf06dd9..1e322593 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 @@ -81,9 +81,10 @@ func shimNewState(newState *states.State, providers map[string]terraform.Resourc } if i.Current.SchemaVersion != 0 { - resState.Primary.Meta = map[string]interface{}{ - "schema_version": i.Current.SchemaVersion, + if resState.Primary.Meta == nil { + resState.Primary.Meta = map[string]interface{}{} } + resState.Primary.Meta["schema_version"] = i.Current.SchemaVersion } for _, dep := range i.Current.Dependencies { 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 98% 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 576ef31f..b2a323ce 100644 --- a/vendor/github.com/hashicorp/terraform/helper/resource/testing.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/resource/testing.go @@ -21,16 +21,16 @@ import ( "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 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 e3da9bc0..e21525de 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 96% 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 e1b7aea8..9e547e2a 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 @@ -10,10 +10,10 @@ import ( "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 imort state test step 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 42c2bed9..609c208b 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 875677eb..fa03d833 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 6ad3f13c..dc2ae1af 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 3e70acf0..c099029a 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 9efc90e7..bbea5dbd 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 8cd2703a..406dcdf7 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 1c390709..0793524a 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 82% 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 index 7dd655de..8bfb079b 100644 --- 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 @@ -1,6 +1,6 @@ package schema -//go:generate stringer -type=getSource resource_data_get_source.go +//go:generate go run golang.org/x/tools/cmd/stringer -type=getSource resource_data_get_source.go // getSource represents the level we want to get for a value (internally). // Any source less than or equal to the level will be loaded (whichever 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 47b54810..f55a66e1 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 5ad7aafc..f12bf725 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 089e6b21..033b0684 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 8ee89e47..daa431dd 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 d2dbff53..93c601f8 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 12278217..4d0fd736 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 81% rename from vendor/github.com/hashicorp/terraform/helper/schema/valuetype.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/valuetype.go index 9286987d..0f65d692 100644 --- a/vendor/github.com/hashicorp/terraform/helper/schema/valuetype.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/helper/schema/valuetype.go @@ -1,6 +1,6 @@ package schema -//go:generate stringer -type=ValueType valuetype.go +//go:generate go run golang.org/x/tools/cmd/stringer -type=ValueType valuetype.go // ValueType is an enum of the type that can be represented by a schema. type ValueType int 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 46f794a7..e23707f5 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 efded892..fd3dbd95 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 99% 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 67e73e52..1353622a 100644 --- a/vendor/github.com/hashicorp/terraform/addrs/module_instance.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/module_instance.go @@ -9,7 +9,7 @@ import ( "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 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 99% 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 a230d0cd..eccbcda4 100644 --- a/vendor/github.com/hashicorp/terraform/addrs/parse_ref.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/parse_ref.go @@ -5,7 +5,7 @@ import ( "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" ) // Reference describes a reference to an address with source location 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 99% 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 057443af..4f043098 100644 --- a/vendor/github.com/hashicorp/terraform/addrs/parse_target.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/parse_target.go @@ -6,7 +6,7 @@ import ( "github.com/hashicorp/hcl2/hcl/hclsyntax" "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/tfdiags" + "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 99% 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 340dd19e..4d1ed255 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,7 +3,7 @@ package addrs import ( "fmt" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/hcl/hclsyntax" 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 00000000..64b8ac86 --- /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 28667708..b075a6d1 100644 --- a/vendor/github.com/hashicorp/terraform/addrs/resource.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/addrs/resource.go @@ -253,7 +253,7 @@ func (r AbsResourceInstance) Less(o AbsResourceInstance) bool { // resource lifecycle has a slightly different address format. type ResourceMode rune -//go:generate stringer -type ResourceMode +//go:generate go run golang.org/x/tools/cmd/stringer -type ResourceMode const ( // InvalidResourceMode is the zero value of ResourceMode and is not 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 99% 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 3dd9238d..6f64f6c9 100644 --- a/vendor/github.com/hashicorp/terraform/command/format/diagnostic.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/diagnostic.go @@ -10,7 +10,7 @@ import ( "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/hcled" "github.com/hashicorp/hcl2/hclparse" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/mitchellh/colorstring" wordwrap "github.com/mitchellh/go-wordwrap" "github.com/zclconf/go-cty/cty" 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 99% 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 c726f0ed..0a2aa7d0 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 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/command/format/plan.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/plan.go similarity index 96% rename from vendor/github.com/hashicorp/terraform/command/format/plan.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/plan.go index ef129a92..7d303004 100644 --- a/vendor/github.com/hashicorp/terraform/command/format/plan.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/command/format/plan.go @@ -9,10 +9,10 @@ import ( "github.com/mitchellh/colorstring" - "github.com/hashicorp/terraform/addrs" - "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/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 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 be1ea24d..14869ad3 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 95% rename from vendor/github.com/hashicorp/terraform/configs/backend.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/backend.go index 6df7ddd0..6c7848d2 100644 --- a/vendor/github.com/hashicorp/terraform/configs/backend.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/backend.go @@ -3,7 +3,7 @@ package configs import ( "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/hcldec" - "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/configs/compat_shim.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/compat_shim.go similarity index 100% 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 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 99% rename from vendor/github.com/hashicorp/terraform/configs/config.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/config.go index 82943122..c90b51a1 100644 --- a/vendor/github.com/hashicorp/terraform/configs/config.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/config.go @@ -5,7 +5,7 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // A Config is a node in the tree of modules within a configuration. 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 99% 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 1ca1d77e..f1129bc1 100644 --- a/vendor/github.com/hashicorp/terraform/configs/config_build.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/config_build.go @@ -5,7 +5,7 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/addrs" + "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 100% 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 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 416b48fc..302b6b5d 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/configs" - "github.com/hashicorp/terraform/registry" - "github.com/hashicorp/terraform/svchost/disco" + "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 98% 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 0e6cba93..64219bb7 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 @@ -5,7 +5,7 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/configs" + "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 99% 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 44c64397..0eb2c376 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 @@ -10,8 +10,8 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/configs" - "github.com/hashicorp/terraform/internal/modsdir" + "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 3c410eeb..17032026 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/internal/modsdir" - "github.com/hashicorp/terraform/registry" - "github.com/hashicorp/terraform/svchost/disco" + "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 100% 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 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 100% 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 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 98% 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 index 5a67334d..f4702d36 100644 --- a/vendor/github.com/hashicorp/terraform/configs/configschema/schema.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/configschema/schema.go @@ -83,7 +83,7 @@ type NestedBlock struct { // blocks. type NestingMode int -//go:generate stringer -type=NestingMode +//go:generate go run golang.org/x/tools/cmd/stringer -type=NestingMode const ( nestingModeInvalid NestingMode = iota 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 97% 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 a41e930b..2873830c 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 @@ -8,8 +8,8 @@ import ( "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 100% 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 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 100% 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 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 daeb0b8e..c0c81641 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 99% rename from vendor/github.com/hashicorp/terraform/configs/module.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module.go index 250f9d34..d45ed8a9 100644 --- a/vendor/github.com/hashicorp/terraform/configs/module.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/module.go @@ -5,7 +5,7 @@ import ( "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // Module is a container for a set of configuration constructs that are 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 100% 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 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 99% 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 12614c1d..12916ef8 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,7 +3,7 @@ package configs import ( "fmt" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" "github.com/hashicorp/hcl2/hcl" "github.com/zclconf/go-cty/cty" 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 100% 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 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 99% 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 6f6b469f..66468c3b 100644 --- a/vendor/github.com/hashicorp/terraform/configs/named_values.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/named_values.go @@ -10,7 +10,7 @@ import ( "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. 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 100% rename from vendor/github.com/hashicorp/terraform/configs/parser.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/parser.go 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 100% 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 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 100% 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 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 100% 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 diff --git a/vendor/github.com/hashicorp/terraform/configs/provider.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provider.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/configs/provider.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provider.go index d01d5cf2..99f0f26d 100644 --- a/vendor/github.com/hashicorp/terraform/configs/provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provider.go @@ -7,7 +7,7 @@ import ( "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // Provider represents a "provider" block in a module or file. A provider 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 96% rename from vendor/github.com/hashicorp/terraform/configs/provisioner.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provisioner.go index b031dd0b..311f107f 100644 --- a/vendor/github.com/hashicorp/terraform/configs/provisioner.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/provisioner.go @@ -118,7 +118,7 @@ type Connection struct { // ProvisionerWhen is an enum for valid values for when to run provisioners. type ProvisionerWhen int -//go:generate stringer -type ProvisionerWhen +//go:generate go run golang.org/x/tools/cmd/stringer -type ProvisionerWhen const ( ProvisionerWhenInvalid ProvisionerWhen = iota @@ -130,7 +130,7 @@ const ( // for provisioners. type ProvisionerOnFailure int -//go:generate stringer -type ProvisionerOnFailure +//go:generate go run golang.org/x/tools/cmd/stringer -type ProvisionerOnFailure const ( ProvisionerOnFailureInvalid ProvisionerOnFailure = iota 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 99% rename from vendor/github.com/hashicorp/terraform/configs/resource.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/resource.go index edf822c1..22657fad 100644 --- a/vendor/github.com/hashicorp/terraform/configs/resource.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/resource.go @@ -7,7 +7,7 @@ import ( "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. 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 100% 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 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 100% rename from vendor/github.com/hashicorp/terraform/configs/util.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/configs/util.go 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 96% 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 index 458e75e1..c02ad4b5 100644 --- 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 @@ -19,7 +19,7 @@ package configs // TypeHintMap requires a type that could be converted to an object type VariableTypeHint rune -//go:generate stringer -type VariableTypeHint +//go:generate go run golang.org/x/tools/cmd/stringer -type VariableTypeHint // TypeHintNone indicates the absence of a type hint. Values specified in // ambiguous contexts will be treated as literal strings, as if TypeHintString 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 100% 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 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 77c67eff..a150af96 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 1c926c2c..5ddf8ef3 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 a9b8f988..98b159b4 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 770d5dfb..3707f273 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 9b2fd7f7..b2e1807e 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 d2d62879..11eff2eb 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 b9d15461..1bb7b9f2 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 1a6e023b..35a3e7a4 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 f32610c6..388f1ed5 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 64a6784e..a22a264f 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 536703c6..ad8d626c 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 6b40d08d..641e71de 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 2f306be7..8dc0374b 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 6f77dcd8..02c3c6f7 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 531310ab..8e055756 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 8cef80a3..c4c67fd1 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 104840b9..803fb4b5 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 98% 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 d8c2e775..18db2018 100644 --- a/vendor/github.com/hashicorp/terraform/lang/blocktoattr/fixup.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/fixup.go @@ -3,7 +3,7 @@ package blocktoattr import ( "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/hcldec" - "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/lang/blocktoattr/schema.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/schema.go similarity index 98% 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 47a02565..d6048cf1 100644 --- a/vendor/github.com/hashicorp/terraform/lang/blocktoattr/schema.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/schema.go @@ -2,7 +2,7 @@ package blocktoattr import ( "github.com/hashicorp/hcl2/hcl" - "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/lang/blocktoattr/variables.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/variables.go similarity index 96% 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 59ba47bf..065139b9 100644 --- a/vendor/github.com/hashicorp/terraform/lang/blocktoattr/variables.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/blocktoattr/variables.go @@ -4,7 +4,7 @@ import ( "github.com/hashicorp/hcl2/ext/dynblock" "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/hcldec" - "github.com/hashicorp/terraform/configs/configschema" + "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 93% rename from vendor/github.com/hashicorp/terraform/lang/data.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/data.go index eca588ec..f7d0246f 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" ) 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 98% rename from vendor/github.com/hashicorp/terraform/lang/eval.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/eval.go index a8fe8b66..28552bb5 100644 --- a/vendor/github.com/hashicorp/terraform/lang/eval.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/eval.go @@ -8,10 +8,10 @@ import ( "github.com/hashicorp/hcl2/ext/dynblock" "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/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/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" ) 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 53% 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 index 6ce8aa9f..8c075148 100644 --- a/vendor/github.com/hashicorp/terraform/lang/funcs/cidr.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/cidr.go @@ -113,6 +113,86 @@ var CidrSubnetFunc = function.New(&function.Spec{ }, }) +// CidrSubnetsFunc is similar to CidrSubnetFunc but calculates many consecutive +// subnet addresses at once, rather than just a single subnet extension. +var CidrSubnetsFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "prefix", + Type: cty.String, + }, + }, + VarParam: &function.Parameter{ + Name: "newbits", + Type: cty.Number, + }, + Type: function.StaticReturnType(cty.List(cty.String)), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + _, network, err := net.ParseCIDR(args[0].AsString()) + if err != nil { + return cty.UnknownVal(cty.String), function.NewArgErrorf(0, "invalid CIDR expression: %s", err) + } + startPrefixLen, _ := network.Mask.Size() + + prefixLengthArgs := args[1:] + if len(prefixLengthArgs) == 0 { + return cty.ListValEmpty(cty.String), nil + } + + var firstLength int + if err := gocty.FromCtyValue(prefixLengthArgs[0], &firstLength); err != nil { + return cty.UnknownVal(cty.String), function.NewArgError(1, err) + } + firstLength += startPrefixLen + + retVals := make([]cty.Value, len(prefixLengthArgs)) + + current, _ := cidr.PreviousSubnet(network, firstLength) + for i, lengthArg := range prefixLengthArgs { + var length int + if err := gocty.FromCtyValue(lengthArg, &length); err != nil { + return cty.UnknownVal(cty.String), function.NewArgError(i+1, err) + } + + if length < 1 { + return cty.UnknownVal(cty.String), function.NewArgErrorf(i+1, "must extend prefix by at least one bit") + } + // For portability with 32-bit systems where the subnet number + // will be a 32-bit int, we only allow extension of 32 bits in + // one call even if we're running on a 64-bit machine. + // (Of course, this is significant only for IPv6.) + if length > 32 { + return cty.UnknownVal(cty.String), function.NewArgErrorf(i+1, "may not extend prefix by more than 32 bits") + } + length += startPrefixLen + if length > (len(network.IP) * 8) { + protocol := "IP" + switch len(network.IP) * 8 { + case 32: + protocol = "IPv4" + case 128: + protocol = "IPv6" + } + return cty.UnknownVal(cty.String), function.NewArgErrorf(i+1, "would extend prefix to %d bits, which is too long for an %s address", length, protocol) + } + + next, rollover := cidr.NextSubnet(current, length) + if rollover || !network.Contains(next.IP) { + // If we run out of suffix bits in the base CIDR prefix then + // NextSubnet will start incrementing the prefix bits, which + // we don't allow because it would then allocate addresses + // outside of the caller's given prefix. + return cty.UnknownVal(cty.String), function.NewArgErrorf(i+1, "not enough remaining address space for a subnet with a prefix of %d bits after %s", length, current.String()) + } + + current = next + retVals[i] = cty.StringVal(current.String()) + } + + return cty.ListVal(retVals), nil + }, +}) + // CidrHost calculates a full host IP address within a given IP network address prefix. func CidrHost(prefix, hostnum cty.Value) (cty.Value, error) { return CidrHostFunc.Call([]cty.Value{prefix, hostnum}) @@ -127,3 +207,12 @@ func CidrNetmask(prefix cty.Value) (cty.Value, error) { func CidrSubnet(prefix, newbits, netnum cty.Value) (cty.Value, error) { return CidrSubnetFunc.Call([]cty.Value{prefix, newbits, netnum}) } + +// CidrSubnets calculates a sequence of consecutive subnet prefixes that may +// be of different prefix lengths under a common base prefix. +func CidrSubnets(prefix cty.Value, newbits ...cty.Value) (cty.Value, error) { + args := make([]cty.Value, len(newbits)+1) + args[0] = prefix + copy(args[1:], newbits) + return CidrSubnetsFunc.Call(args) +} 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 100% 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 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 35c07b65..016b102d 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,7 +8,6 @@ import ( "path/filepath" "unicode/utf8" - "github.com/bmatcuk/doublestar" "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/hcl/hclsyntax" homedir "github.com/mitchellh/go-homedir" @@ -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 72% 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 index 15cfe718..c813f47b 100644 --- a/vendor/github.com/hashicorp/terraform/lang/funcs/number.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/funcs/number.go @@ -2,6 +2,7 @@ package funcs import ( "math" + "math/big" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/function" @@ -128,6 +129,62 @@ var SignumFunc = function.New(&function.Spec{ }, }) +// ParseIntFunc contructs a function that parses a string argument and returns an integer of the specified base. +var ParseIntFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "number", + Type: cty.DynamicPseudoType, + }, + { + Name: "base", + Type: cty.Number, + }, + }, + + Type: func(args []cty.Value) (cty.Type, error) { + if !args[0].Type().Equals(cty.String) { + return cty.Number, function.NewArgErrorf(0, "first argument must be a string, not %s", args[0].Type().FriendlyName()) + } + return cty.Number, nil + }, + + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + var numstr string + var base int + var err error + + if err = gocty.FromCtyValue(args[0], &numstr); err != nil { + return cty.UnknownVal(cty.String), function.NewArgError(0, err) + } + + if err = gocty.FromCtyValue(args[1], &base); err != nil { + return cty.UnknownVal(cty.Number), function.NewArgError(1, err) + } + + if base < 2 || base > 62 { + return cty.UnknownVal(cty.Number), function.NewArgErrorf( + 1, + "base must be a whole number between 2 and 62 inclusive", + ) + } + + num, ok := (&big.Int{}).SetString(numstr, base) + if !ok { + return cty.UnknownVal(cty.Number), function.NewArgErrorf( + 0, + "cannot parse %q as a base %d integer", + numstr, + base, + ) + } + + parsedNum := cty.NumberVal((&big.Float{}).SetInt(num)) + + return parsedNum, nil + }, +}) + // Ceil returns the closest whole number greater than or equal to the given value. func Ceil(num cty.Value) (cty.Value, error) { return CeilFunc.Call([]cty.Value{num}) @@ -153,3 +210,8 @@ func Pow(num, power cty.Value) (cty.Value, error) { func Signum(num cty.Value) (cty.Value, error) { return SignumFunc.Call([]cty.Value{num}) } + +// ParseInt parses a string argument and returns an integer of the specified base. +func ParseInt(num cty.Value, base cty.Value) (cty.Value, error) { + return ParseIntFunc.Call([]cty.Value{num, base}) +} 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 100% 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 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 93% rename from vendor/github.com/hashicorp/terraform/lang/functions.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/functions.go index abd76c09..a3c49066 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{ @@ -44,6 +42,7 @@ func (s *Scope) Functions() map[string]function.Function { "cidrhost": funcs.CidrHostFunc, "cidrnetmask": funcs.CidrNetmaskFunc, "cidrsubnet": funcs.CidrSubnetFunc, + "cidrsubnets": funcs.CidrSubnetsFunc, "coalesce": funcs.CoalesceFunc, "coalescelist": funcs.CoalesceListFunc, "compact": funcs.CompactFunc, @@ -56,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), @@ -86,6 +84,7 @@ func (s *Scope) Functions() map[string]function.Function { "md5": funcs.Md5Func, "merge": funcs.MergeFunc, "min": stdlib.MinFunc, + "parseint": funcs.ParseIntFunc, "pathexpand": funcs.PathExpandFunc, "pow": funcs.PowFunc, "range": stdlib.RangeFunc, @@ -145,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 91% rename from vendor/github.com/hashicorp/terraform/lang/references.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/references.go index d688477a..8df09e9a 100644 --- a/vendor/github.com/hashicorp/terraform/lang/references.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/lang/references.go @@ -2,10 +2,10 @@ package lang import ( "github.com/hashicorp/hcl2/hcl" - "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/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 98fca6ba..a720cca6 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 36f6c033..2d45c852 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 87c8431e..c8058871 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 d6cbaf5c..388a2ce1 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 88% rename from vendor/github.com/hashicorp/terraform/plans/action.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/action.go index c3e6a32a..c653b106 100644 --- a/vendor/github.com/hashicorp/terraform/plans/action.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/plans/action.go @@ -12,7 +12,7 @@ const ( Delete Action = '-' ) -//go:generate stringer -type Action +//go:generate go run golang.org/x/tools/cmd/stringer -type Action // IsReplace returns true if the action is one of the two actions that // represents replacing an existing object with a new object: 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 d7e0dcdb..5c2028c8 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 90153ea7..97bc8da7 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 543e6c2b..c4fd3b0f 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 6b4ff98f..89cc1ab2 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 18a7e99a..ba9cc961 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 d85086c9..36a7d496 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 c23f44da..a8629046 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 5a8af148..879fc93a 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 69acb897..905a9114 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 5a3e4548..0abed56a 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 51cb2fe2..f20f0507 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 6a45f54c..105c32c6 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 92% 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 c1d9e3be..ff90a266 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,24 +16,21 @@ import ( "github.com/hashicorp/errwrap" getter "github.com/hashicorp/go-getter" multierror "github.com/hashicorp/go-multierror" - "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/svchost/disco" - "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() @@ -49,7 +46,7 @@ func init() { // An Installer maintains a local cache of plugins by downloading plugins // from an online repository. type Installer interface { - Get(name string, 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) } @@ -106,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 string, 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. @@ -231,7 +228,7 @@ func (i *ProviderInstaller) Get(provider string, req Constraints) (PluginMeta, t } } - printedProviderName := fmt.Sprintf("%q (%s)", provider, 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) @@ -243,11 +240,11 @@ func (i *ProviderInstaller) Get(provider string, req Constraints) (PluginMeta, t // (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, 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).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 @@ -275,18 +272,18 @@ func (i *ProviderInstaller) Get(provider string, req Constraints) (PluginMeta, t return metas.Newest(), diags, nil } -func (i *ProviderInstaller) install(provider string, 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, version) - cached := i.Cache.CachedPluginPath("provider", provider, 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, 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, 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. @@ -307,7 +304,7 @@ func (i *ProviderInstaller) install(provider string, version Version, url string return err } - log.Printf("[DEBUG] installing %s %s to %s from local cache %s", provider, 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 @@ -365,7 +362,7 @@ func (i *ProviderInstaller) install(provider string, version Version, url string // 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, 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 @@ -471,9 +468,9 @@ func (i *ProviderInstaller) hostname() (string, error) { } // list all versions available for the named provider -func (i *ProviderInstaller) listProviderVersions(name string) (*response.TerraformProviderVersions, error) { - provider := regsrc.NewTerraformProvider(name, i.OS, i.Arch) - versions, err := i.registry.TerraformProviderVersions(provider) +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 } @@ -569,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 94% 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 7ed523f1..0f48f244 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 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 7e0a74c5..3d0aa8ec 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 98% rename from vendor/github.com/hashicorp/terraform/providers/resolver.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/resolver.go index 4de8e0ac..f5529ff3 100644 --- a/vendor/github.com/hashicorp/terraform/providers/resolver.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/providers/resolver.go @@ -3,7 +3,7 @@ package providers import ( "fmt" - "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 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 e53c8848..7d8f4076 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 93424d17..313951b3 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/httpclient" - "github.com/hashicorp/terraform/registry/regsrc" - "github.com/hashicorp/terraform/registry/response" - "github.com/hashicorp/terraform/svchost" - "github.com/hashicorp/terraform/svchost/disco" - "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 ( 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 5a6a31b0..8b22ec14 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/registry/regsrc" - "github.com/hashicorp/terraform/svchost/disco" + "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 14b4dce9..e67942a7 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 325706ec..4c83afad 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 58dedee5..42ab3f77 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 617ad4ea..891adc00 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 97% 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 1374c59d..3bb717d3 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 @@ -40,7 +40,7 @@ type ResourceInstanceObject struct { // ObjectStatus represents the status of a RemoteObject. type ObjectStatus rune -//go:generate stringer -type ObjectStatus +//go:generate go run golang.org/x/tools/cmd/stringer -type ObjectStatus const ( // ObjectReady is an object status for an object that is ready to use. 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 97% 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 62907ab7..728ad80d 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 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 99% rename from vendor/github.com/hashicorp/terraform/states/module.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/module.go index d89e7878..8c89278c 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. 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 98% rename from vendor/github.com/hashicorp/terraform/states/resource.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/states/resource.go index e2a2b858..aacdb9d2 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. @@ -175,7 +175,7 @@ const ( EachMap EachMode = 'M' ) -//go:generate stringer -type EachMode +//go:generate go run golang.org/x/tools/cmd/stringer -type EachMode func eachModeForInstanceKey(key addrs.InstanceKey) EachMode { switch key.(type) { 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 1f842359..328dd53d 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 99% 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 8664f3be..6266aca7 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" ) 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 8be3d01a..dffd650d 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 a6d88ecd..042ce51c 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 6e202401..9f7ae00e 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 4948b39b..41f485d1 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 d691c029..f1899cd2 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 80d711bc..85b422ad 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 be93924a..6d10166b 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 ab6414b0..1c81e716 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 98% 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 fbec5477..f08a62b2 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 @@ -9,9 +9,9 @@ import ( "github.com/zclconf/go-cty/cty" 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 upgradeStateV3ToV4(old *stateV3) (*stateV4, error) { 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 98% 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 ee8b6523..164b57f8 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) { 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 548ba8a8..8fdca458 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 47fb16d6..8675efc3 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 509d89fd..99e2c030 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 d86492c5..00042a0a 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 00000000..f91006ae --- /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 5b7281bd..93f52604 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 ba5252a2..b5108a4a 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 00000000..9358bcb6 --- /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 92% 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 5d8e4693..c770338b 100644 --- a/vendor/github.com/hashicorp/terraform/svchost/disco/disco.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/svchost/disco/disco.go @@ -18,9 +18,9 @@ import ( "time" cleanhttp "github.com/hashicorp/go-cleanhttp" - "github.com/hashicorp/terraform/httpclient" - "github.com/hashicorp/terraform/svchost" - "github.com/hashicorp/terraform/svchost/auth" + "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 ( @@ -75,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) { 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 228eadee..0d6ef038 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,7 +12,7 @@ import ( "time" "github.com/hashicorp/go-version" - "github.com/hashicorp/terraform/httpclient" + "github.com/hashicorp/terraform-plugin-sdk/internal/httpclient" ) const versionServiceID = "versions.v1" @@ -111,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. @@ -272,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 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 af8ccbab..6e0e47b7 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 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/contextual.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/contextual.go 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 90% rename from vendor/github.com/hashicorp/terraform/tfdiags/diagnostic.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostic.go index c91ba9a5..f3b0ea1e 100644 --- a/vendor/github.com/hashicorp/terraform/tfdiags/diagnostic.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostic.go @@ -17,7 +17,7 @@ type Diagnostic interface { type Severity rune -//go:generate stringer -type=Severity +//go:generate go run golang.org/x/tools/cmd/stringer -type=Severity const ( Error Severity = 'E' 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 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/diagnostics.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/diagnostics.go 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 100% rename from vendor/github.com/hashicorp/terraform/tfdiags/hcl.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags/hcl.go 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 96% 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 index b2bdf888..86fd21e4 100644 --- a/vendor/github.com/hashicorp/terraform/internal/tfplugin5/tfplugin5.pb.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5/tfplugin5.pb.go @@ -4,10 +4,12 @@ package tfplugin5 import ( + context "context" fmt "fmt" proto "github.com/golang/protobuf/proto" - context "golang.org/x/net/context" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" math "math" ) @@ -20,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type Diagnostic_Severity int32 @@ -324,86 +326,15 @@ func (m *AttributePath_Step) GetElementKeyInt() int64 { return 0 } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*AttributePath_Step) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _AttributePath_Step_OneofMarshaler, _AttributePath_Step_OneofUnmarshaler, _AttributePath_Step_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*AttributePath_Step) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*AttributePath_Step_AttributeName)(nil), (*AttributePath_Step_ElementKeyString)(nil), (*AttributePath_Step_ElementKeyInt)(nil), } } -func _AttributePath_Step_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*AttributePath_Step) - // selector - switch x := m.Selector.(type) { - case *AttributePath_Step_AttributeName: - b.EncodeVarint(1<<3 | proto.WireBytes) - b.EncodeStringBytes(x.AttributeName) - case *AttributePath_Step_ElementKeyString: - b.EncodeVarint(2<<3 | proto.WireBytes) - b.EncodeStringBytes(x.ElementKeyString) - case *AttributePath_Step_ElementKeyInt: - b.EncodeVarint(3<<3 | proto.WireVarint) - b.EncodeVarint(uint64(x.ElementKeyInt)) - case nil: - default: - return fmt.Errorf("AttributePath_Step.Selector has unexpected type %T", x) - } - return nil -} - -func _AttributePath_Step_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*AttributePath_Step) - switch tag { - case 1: // selector.attribute_name - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Selector = &AttributePath_Step_AttributeName{x} - return true, err - case 2: // selector.element_key_string - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.Selector = &AttributePath_Step_ElementKeyString{x} - return true, err - case 3: // selector.element_key_int - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.Selector = &AttributePath_Step_ElementKeyInt{int64(x)} - return true, err - default: - return false, nil - } -} - -func _AttributePath_Step_OneofSizer(msg proto.Message) (n int) { - m := msg.(*AttributePath_Step) - // selector - switch x := m.Selector.(type) { - case *AttributePath_Step_AttributeName: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.AttributeName))) - n += len(x.AttributeName) - case *AttributePath_Step_ElementKeyString: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.ElementKeyString))) - n += len(x.ElementKeyString) - case *AttributePath_Step_ElementKeyInt: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.ElementKeyInt)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type Stop struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -2906,21 +2837,21 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type ProviderClient interface { - // ////// Information about what a provider supports/expects + //////// Information about what a provider supports/expects GetSchema(ctx context.Context, in *GetProviderSchema_Request, opts ...grpc.CallOption) (*GetProviderSchema_Response, error) PrepareProviderConfig(ctx context.Context, in *PrepareProviderConfig_Request, opts ...grpc.CallOption) (*PrepareProviderConfig_Response, error) ValidateResourceTypeConfig(ctx context.Context, in *ValidateResourceTypeConfig_Request, opts ...grpc.CallOption) (*ValidateResourceTypeConfig_Response, error) ValidateDataSourceConfig(ctx context.Context, in *ValidateDataSourceConfig_Request, opts ...grpc.CallOption) (*ValidateDataSourceConfig_Response, error) UpgradeResourceState(ctx context.Context, in *UpgradeResourceState_Request, opts ...grpc.CallOption) (*UpgradeResourceState_Response, error) - // ////// One-time initialization, called before other functions below + //////// One-time initialization, called before other functions below Configure(ctx context.Context, in *Configure_Request, opts ...grpc.CallOption) (*Configure_Response, error) - // ////// Managed Resource Lifecycle + //////// Managed Resource Lifecycle ReadResource(ctx context.Context, in *ReadResource_Request, opts ...grpc.CallOption) (*ReadResource_Response, error) PlanResourceChange(ctx context.Context, in *PlanResourceChange_Request, opts ...grpc.CallOption) (*PlanResourceChange_Response, error) ApplyResourceChange(ctx context.Context, in *ApplyResourceChange_Request, opts ...grpc.CallOption) (*ApplyResourceChange_Response, error) ImportResourceState(ctx context.Context, in *ImportResourceState_Request, opts ...grpc.CallOption) (*ImportResourceState_Response, error) ReadDataSource(ctx context.Context, in *ReadDataSource_Request, opts ...grpc.CallOption) (*ReadDataSource_Response, error) - // ////// Graceful Shutdown + //////// Graceful Shutdown Stop(ctx context.Context, in *Stop_Request, opts ...grpc.CallOption) (*Stop_Response, error) } @@ -3042,24 +2973,65 @@ func (c *providerClient) Stop(ctx context.Context, in *Stop_Request, opts ...grp // ProviderServer is the server API for Provider service. type ProviderServer interface { - // ////// Information about what a provider supports/expects + //////// Information about what a provider supports/expects GetSchema(context.Context, *GetProviderSchema_Request) (*GetProviderSchema_Response, error) PrepareProviderConfig(context.Context, *PrepareProviderConfig_Request) (*PrepareProviderConfig_Response, error) ValidateResourceTypeConfig(context.Context, *ValidateResourceTypeConfig_Request) (*ValidateResourceTypeConfig_Response, error) ValidateDataSourceConfig(context.Context, *ValidateDataSourceConfig_Request) (*ValidateDataSourceConfig_Response, error) UpgradeResourceState(context.Context, *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) - // ////// One-time initialization, called before other functions below + //////// One-time initialization, called before other functions below Configure(context.Context, *Configure_Request) (*Configure_Response, error) - // ////// Managed Resource Lifecycle + //////// Managed Resource Lifecycle ReadResource(context.Context, *ReadResource_Request) (*ReadResource_Response, error) PlanResourceChange(context.Context, *PlanResourceChange_Request) (*PlanResourceChange_Response, error) ApplyResourceChange(context.Context, *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) ImportResourceState(context.Context, *ImportResourceState_Request) (*ImportResourceState_Response, error) ReadDataSource(context.Context, *ReadDataSource_Request) (*ReadDataSource_Response, error) - // ////// Graceful Shutdown + //////// Graceful Shutdown Stop(context.Context, *Stop_Request) (*Stop_Response, error) } +// UnimplementedProviderServer can be embedded to have forward compatible implementations. +type UnimplementedProviderServer struct { +} + +func (*UnimplementedProviderServer) GetSchema(ctx context.Context, req *GetProviderSchema_Request) (*GetProviderSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") +} +func (*UnimplementedProviderServer) PrepareProviderConfig(ctx context.Context, req *PrepareProviderConfig_Request) (*PrepareProviderConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PrepareProviderConfig not implemented") +} +func (*UnimplementedProviderServer) ValidateResourceTypeConfig(ctx context.Context, req *ValidateResourceTypeConfig_Request) (*ValidateResourceTypeConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateResourceTypeConfig not implemented") +} +func (*UnimplementedProviderServer) ValidateDataSourceConfig(ctx context.Context, req *ValidateDataSourceConfig_Request) (*ValidateDataSourceConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateDataSourceConfig not implemented") +} +func (*UnimplementedProviderServer) UpgradeResourceState(ctx context.Context, req *UpgradeResourceState_Request) (*UpgradeResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpgradeResourceState not implemented") +} +func (*UnimplementedProviderServer) Configure(ctx context.Context, req *Configure_Request) (*Configure_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Configure not implemented") +} +func (*UnimplementedProviderServer) ReadResource(ctx context.Context, req *ReadResource_Request) (*ReadResource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadResource not implemented") +} +func (*UnimplementedProviderServer) PlanResourceChange(ctx context.Context, req *PlanResourceChange_Request) (*PlanResourceChange_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method PlanResourceChange not implemented") +} +func (*UnimplementedProviderServer) ApplyResourceChange(ctx context.Context, req *ApplyResourceChange_Request) (*ApplyResourceChange_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ApplyResourceChange not implemented") +} +func (*UnimplementedProviderServer) ImportResourceState(ctx context.Context, req *ImportResourceState_Request) (*ImportResourceState_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImportResourceState not implemented") +} +func (*UnimplementedProviderServer) ReadDataSource(ctx context.Context, req *ReadDataSource_Request) (*ReadDataSource_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReadDataSource not implemented") +} +func (*UnimplementedProviderServer) Stop(ctx context.Context, req *Stop_Request) (*Stop_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") +} + func RegisterProviderServer(s *grpc.Server, srv ProviderServer) { s.RegisterService(&_Provider_serviceDesc, srv) } @@ -3422,6 +3394,23 @@ type ProvisionerServer interface { Stop(context.Context, *Stop_Request) (*Stop_Response, error) } +// UnimplementedProvisionerServer can be embedded to have forward compatible implementations. +type UnimplementedProvisionerServer struct { +} + +func (*UnimplementedProvisionerServer) GetSchema(ctx context.Context, req *GetProvisionerSchema_Request) (*GetProvisionerSchema_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSchema not implemented") +} +func (*UnimplementedProvisionerServer) ValidateProvisionerConfig(ctx context.Context, req *ValidateProvisionerConfig_Request) (*ValidateProvisionerConfig_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method ValidateProvisionerConfig not implemented") +} +func (*UnimplementedProvisionerServer) ProvisionResource(req *ProvisionResource_Request, srv Provisioner_ProvisionResourceServer) error { + return status.Errorf(codes.Unimplemented, "method ProvisionResource not implemented") +} +func (*UnimplementedProvisionerServer) Stop(ctx context.Context, req *Stop_Request) (*Stop_Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Stop not implemented") +} + func RegisterProvisionerServer(s *grpc.Server, srv ProvisionerServer) { s.RegisterService(&_Provisioner_serviceDesc, srv) } 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 00000000..9875d9ba --- /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 8802846e..7341b533 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.8" +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 0eab5385..5a99e900 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 1abdbe29..e4520975 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 136c88d6..c0e6f549 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 459661a5..bfd62e2e 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 8d056c59..cbe9fc63 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 3469e6a9..b24b03eb 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 c222b00c..07c13d03 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 93% rename from vendor/github.com/hashicorp/terraform/terraform/context.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context.go index 065cf929..eb05c68a 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" ) @@ -39,17 +39,6 @@ const ( InputModeStd = InputModeVar | 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 -) - // ContextOpts are the user-configurable options to create a context with // NewContext. type ContextOpts struct { @@ -104,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 @@ -467,6 +455,17 @@ func (c *Context) Apply() (*states.State, tfdiags.Diagnostics) { c.state.PruneResourceHusks() } + if len(c.targets) > 0 { + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Warning, + "Applied changes may be incomplete", + `The plan was created with the -target option in effect, so some changes requested in the configuration may have been ignored and the output values may not be fully updated. Run the following command to verify that no other changes are pending: + terraform plan + +Note that the -target option is not suitable for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.`, + )) + } + return c.state, diags } @@ -483,6 +482,16 @@ func (c *Context) Plan() (*plans.Plan, tfdiags.Diagnostics) { var diags tfdiags.Diagnostics + if len(c.targets) > 0 { + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Warning, + "Resource targeting is in effect", + `You are creating a plan with the -target option, which means that the result of this plan may not represent all of the changes requested by the current configuration. + +The -target option is not for routine use, and is provided only for exceptional situations such as recovering from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.`, + )) + } + varVals := make(map[string]plans.DynamicValue, len(c.variables)) for k, iv := range c.variables { // We use cty.DynamicPseudoType here so that we'll save both the 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 93% 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 26ec9959..a627996e 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/context_components.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_components.go @@ -3,8 +3,8 @@ package terraform import ( "fmt" - "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 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 91% 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 index 0a424a01..4448d870 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/context_graph_type.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_graph_type.go @@ -1,6 +1,6 @@ package terraform -//go:generate stringer -type=GraphType context_graph_type.go +//go:generate go run golang.org/x/tools/cmd/stringer -type=GraphType context_graph_type.go // GraphType is an enum of the type of graph to create with a Context. // The values of the constants may change so they shouldn't be depended on; 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 313e9094..9a9cd962 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 97% 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 6c7be881..b92fce12 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/context_input.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/context_input.go @@ -10,9 +10,9 @@ import ( "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 variables and provider configurations. diff --git a/vendor/github.com/hashicorp/terraform/terraform/diff.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/diff.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/terraform/diff.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/diff.go index 00cfdac5..e2f54883 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 { @@ -513,6 +503,12 @@ func (d *InstanceDiff) applyBlockDiff(path []string, attrs map[string]string, sc } for k, diff := range d.Attributes { + // helper/schema should not insert nil diff values, but don't panic + // if it does. + if diff == nil { + continue + } + if strings.HasPrefix(k, blockKey) { nextDot := strings.Index(k[len(blockKey):], ".") if nextDot < 0 { @@ -539,6 +535,12 @@ func (d *InstanceDiff) applyBlockDiff(path []string, attrs map[string]string, sc // that we're dropping. Since we're only applying the "New" // portion of the set, we can ignore diffs that only contain "Old" for attr, diff := range d.Attributes { + // helper/schema should not insert nil diff values, but don't panic + // if it does. + if diff == nil { + continue + } + if !strings.HasPrefix(attr, indexPrefix) { continue } 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 bc9d638a..17464bc0 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 48ed3533..c490c3bc 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 97% 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 7178f003..eb0d4fea 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_apply.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_apply.go @@ -9,14 +9,14 @@ import ( "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 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 74% 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 4dff0c84..bcc3c531 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/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 08f3059e..ac354350 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_context.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_context.go @@ -2,14 +2,14 @@ package terraform import ( "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/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/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 90% 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 3ca02ad8..7347a80d 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/hcl2/hcl" - "github.com/hashicorp/terraform/configs/configschema" - "github.com/hashicorp/terraform/lang" - "github.com/hashicorp/terraform/tfdiags" + "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" ) @@ -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 23c90879..b7b8722d 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 @@ -3,14 +3,14 @@ package terraform import ( "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/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/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 97% 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 8083105b..52205fec 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_count.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_count.go @@ -5,8 +5,8 @@ import ( "log" "github.com/hashicorp/hcl2/hcl" - "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" "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 647c58d1..aac38063 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 81% 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 695b5fe0..afab5790 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_diff.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_diff.go @@ -1,7 +1,6 @@ package terraform import ( - "bytes" "fmt" "log" "strings" @@ -9,13 +8,13 @@ import ( "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 @@ -189,7 +188,16 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) { } // The provider gets an opportunity to customize the proposed new value, - // which in turn produces the _planned_ new value. + // which in turn produces the _planned_ new value. But before + // we send back this information, we need to process ignore_changes + // so that CustomizeDiff will not act on them + var ignoreChangeDiags tfdiags.Diagnostics + proposedNewVal, ignoreChangeDiags = n.processIgnoreChanges(priorVal, proposedNewVal) + diags = diags.Append(ignoreChangeDiags) + if ignoreChangeDiags.HasErrors() { + return nil, diags.Err() + } + resp := provider.PlanResourceChange(providers.PlanResourceChangeRequest{ TypeName: n.Addr.Resource.Type, Config: configVal, @@ -258,13 +266,14 @@ func (n *EvalDiff) Eval(ctx EvalContext) (interface{}, error) { } } - { - var moreDiags tfdiags.Diagnostics - plannedNewVal, moreDiags = n.processIgnoreChanges(priorVal, plannedNewVal) - diags = diags.Append(moreDiags) - if moreDiags.HasErrors() { - return nil, diags.Err() - } + // TODO: We should be able to remove this repeat of processing ignored changes + // after the plan, which helps providers relying on old behavior "just work" + // in the next major version, such that we can be stricter about ignore_changes + // values + plannedNewVal, ignoreChangeDiags = n.processIgnoreChanges(priorVal, plannedNewVal) + diags = diags.Append(ignoreChangeDiags) + if ignoreChangeDiags.HasErrors() { + return nil, diags.Err() } // The provider produces a list of paths to attributes whose changes mean @@ -557,200 +566,6 @@ func processIgnoreChangesIndividual(prior, proposed cty.Value, ignoreChanges []h return ret, diags } -func (n *EvalDiff) processIgnoreChangesOld(diff *InstanceDiff) error { - if diff == nil || n.Config == nil || n.Config.Managed == nil { - return nil - } - ignoreChanges := n.Config.Managed.IgnoreChanges - ignoreAll := n.Config.Managed.IgnoreAllChanges - - if len(ignoreChanges) == 0 && !ignoreAll { - return nil - } - - // If we're just creating the resource, we shouldn't alter the - // Diff at all - if diff.ChangeType() == DiffCreate { - return nil - } - - // If the resource has been tainted then we don't process ignore changes - // since we MUST recreate the entire resource. - if diff.GetDestroyTainted() { - return nil - } - - attrs := diff.CopyAttributes() - - // get the complete set of keys we want to ignore - ignorableAttrKeys := make(map[string]bool) - for k := range attrs { - if ignoreAll { - ignorableAttrKeys[k] = true - continue - } - for _, ignoredTraversal := range ignoreChanges { - ignoredKey := legacyFlatmapKeyForTraversal(ignoredTraversal) - if k == ignoredKey || strings.HasPrefix(k, ignoredKey+".") { - ignorableAttrKeys[k] = true - } - } - } - - // If the resource was being destroyed, check to see if we can ignore the - // reason for it being destroyed. - if diff.GetDestroy() { - for k, v := range attrs { - if k == "id" { - // id will always be changed if we intended to replace this instance - continue - } - if v.Empty() || v.NewComputed { - continue - } - - // If any RequiresNew attribute isn't ignored, we need to keep the diff - // as-is to be able to replace the resource. - if v.RequiresNew && !ignorableAttrKeys[k] { - return nil - } - } - - // Now that we know that we aren't replacing the instance, we can filter - // out all the empty and computed attributes. There may be a bunch of - // extraneous attribute diffs for the other non-requires-new attributes - // going from "" -> "configval" or "" -> "". - // We must make sure any flatmapped containers are filterred (or not) as a - // whole. - containers := groupContainers(diff) - keep := map[string]bool{} - for _, v := range containers { - if v.keepDiff(ignorableAttrKeys) { - // At least one key has changes, so list all the sibling keys - // to keep in the diff - for k := range v { - keep[k] = true - // this key may have been added by the user to ignore, but - // if it's a subkey in a container, we need to un-ignore it - // to keep the complete containter. - delete(ignorableAttrKeys, k) - } - } - } - - for k, v := range attrs { - if (v.Empty() || v.NewComputed) && !keep[k] { - ignorableAttrKeys[k] = true - } - } - } - - // Here we undo the two reactions to RequireNew in EvalDiff - the "id" - // attribute diff and the Destroy boolean field - log.Printf("[DEBUG] Removing 'id' diff and setting Destroy to false " + - "because after ignore_changes, this diff no longer requires replacement") - diff.DelAttribute("id") - diff.SetDestroy(false) - - // If we didn't hit any of our early exit conditions, we can filter the diff. - for k := range ignorableAttrKeys { - log.Printf("[DEBUG] [EvalIgnoreChanges] %s: Ignoring diff attribute: %s", n.Addr.String(), k) - diff.DelAttribute(k) - } - - return nil -} - -// legacyFlagmapKeyForTraversal constructs a key string compatible with what -// the flatmap package would generate for an attribute addressable by the given -// traversal. -// -// This is used only to shim references to attributes within the diff and -// state structures, which have not (at the time of writing) yet been updated -// to use the newer HCL-based representations. -func legacyFlatmapKeyForTraversal(traversal hcl.Traversal) string { - var buf bytes.Buffer - first := true - for _, step := range traversal { - if !first { - buf.WriteByte('.') - } - switch ts := step.(type) { - case hcl.TraverseRoot: - buf.WriteString(ts.Name) - case hcl.TraverseAttr: - buf.WriteString(ts.Name) - case hcl.TraverseIndex: - val := ts.Key - switch val.Type() { - case cty.Number: - bf := val.AsBigFloat() - buf.WriteString(bf.String()) - case cty.String: - s := val.AsString() - buf.WriteString(s) - default: - // should never happen, since no other types appear in - // traversals in practice. - buf.WriteByte('?') - } - default: - // should never happen, since we've covered all of the types - // that show up in parsed traversals in practice. - buf.WriteByte('?') - } - first = false - } - return buf.String() -} - -// 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 -} - -// sets, lists and maps need to be compared for diff inclusion as a whole, so -// group the flatmapped keys together for easier comparison. -func groupContainers(d *InstanceDiff) map[string]flatAttrDiff { - isIndex := multiVal.MatchString - containers := map[string]flatAttrDiff{} - attrs := d.CopyAttributes() - // we need to loop once to find the index key - for k := range attrs { - if isIndex(k) { - // add the key, always including the final dot to fully qualify it - containers[k[:len(k)-1]] = flatAttrDiff{} - } - } - - // loop again to find all the sub keys - for prefix, values := range containers { - for k, attrDiff := range attrs { - // we include the index value as well, since it could be part of the diff - if strings.HasPrefix(k, prefix) { - values[k] = attrDiff - } - } - } - - return containers -} - // EvalDiffDestroy is an EvalNode implementation that returns a plain // destroy diff. type EvalDiffDestroy struct { 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 f03e02c2..4f7c340d 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 @@ -4,7 +4,7 @@ import ( "fmt" "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" ) @@ -19,8 +19,9 @@ 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(), }) } return forEachMap, diags @@ -64,6 +65,12 @@ func evaluateResourceForEachExpressionKnown(expr hcl.Expression, ctx EvalContext return nil, true, diags } + // If the map is empty ({}), return an empty map, because cty will return nil when representing {} AsValueMap + // This also covers an empty set (toset([])) + if forEachVal.LengthInt() == 0 { + return map[string]cty.Value{}, true, diags + } + if forEachVal.Type().IsSetType() { if forEachVal.Type().ElementType() != cty.String { diags = diags.Append(&hcl.Diagnostic{ @@ -74,19 +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 - } - } - - // If the map is empty ({}), return an empty map, because cty will return nil when representing {} AsValueMap - if forEachVal.LengthInt() == 0 { - return map[string]cty.Value{}, true, 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 a60f4a0a..25a2aae0 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 92% 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 0c051f76..fe99847b 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/hcl2/hcl" - "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/terraform/eval_local.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_local.go similarity index 90% 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 bad9ac5b..28eaf5fd 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_local.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_local.go @@ -6,9 +6,9 @@ import ( "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 10573971..6d2db068 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_output.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_output.go @@ -7,9 +7,9 @@ import ( "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 94% 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 7df6584a..9c29aafd 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_provider.go @@ -6,10 +6,10 @@ import ( "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 { 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 bc6b5cc7..405ce9d0 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 96% 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 4999480f..0b734b79 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 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 4dfb5b4e..6a834445 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 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 3485e4f1..7d6bb660 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 98% 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 b611113e..70a72bbd 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_state.go @@ -4,11 +4,11 @@ import ( "fmt" "log" - "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 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 e1940005..27d5f212 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 e2c79871..e11cac7f 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/eval_validate.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/eval_validate.go @@ -5,12 +5,12 @@ import ( "log" "github.com/hashicorp/hcl2/hcl" - "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/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 88% 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 edd604fa..ae883b42 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 @@ -5,10 +5,10 @@ import ( "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 76% 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 7d9115c7..0df4a4af 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/hcl2/hcl" - "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" "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 91% 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 6b4df67a..d4a8d3cf 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 diff --git a/vendor/github.com/hashicorp/terraform/terraform/evaluate.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaluate.go similarity index 98% rename from vendor/github.com/hashicorp/terraform/terraform/evaluate.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaluate.go index 9bb60094..81645d7d 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/evaluate.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaluate.go @@ -13,13 +13,13 @@ import ( "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 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 4255102d..6badb154 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/evaluate_valid.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/evaluate_valid.go @@ -6,10 +6,10 @@ import ( "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 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 58d45a7b..36e295b6 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 94% 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 66b21f30..ee2c5857 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/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" - "github.com/hashicorp/terraform/addrs" + "github.com/hashicorp/terraform-plugin-sdk/internal/addrs" ) // GraphBuilder is an interface that can be implemented and used with 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 94% 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 7182dd7d..a4041d13 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 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 a6047a9b..32fe5f97 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 eb6c897b..8a0bcf5b 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 88% 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 7b0e39f4..dcbb10e6 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 @@ -55,6 +55,9 @@ func (b *ImportGraphBuilder) Steps() []GraphTransformer { // Create all our resources from the configuration and state &ConfigTransformer{Config: config}, + // Attach the configuration to any resources + &AttachResourceConfigTransformer{Config: b.Config}, + // Add the import steps &ImportStateTransformer{Targets: b.ImportTargets}, 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 17adfd27..bcd119b3 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 0342cdbe..fad7bf16 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 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 1881f95f..0aa8b915 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 73e3821f..5dbf415f 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 768590fb..a005ea5a 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 e980e0c6..d699376f 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 03c192a8..11fb2fd0 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 77% 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 index a3756e76..859f6fb1 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/graph_walk_operation.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/graph_walk_operation.go @@ -1,6 +1,6 @@ package terraform -//go:generate stringer -type=walkOperation graph_walk_operation.go +//go:generate go run golang.org/x/tools/cmd/stringer -type=walkOperation graph_walk_operation.go // walkOperation is an enum which tells the walkContext what to do. type walkOperation byte 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 c0bb23ab..b5be9482 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 6efa3196..74a29bde 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 811fb337..42c3d20c 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 69% rename from vendor/github.com/hashicorp/terraform/terraform/instancetype.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/instancetype.go index 08959717..375a8638 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/instancetype.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/instancetype.go @@ -1,6 +1,6 @@ package terraform -//go:generate stringer -type=InstanceType instancetype.go +//go:generate go run golang.org/x/tools/cmd/stringer -type=InstanceType instancetype.go // InstanceType is an enum of the various types of instances store in the State type InstanceType int 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 66a68c7d..f1434e62 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 e4952039..acd8262b 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 6ba39904..56a33bce 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 90% 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 12f8bbce..60bcdb74 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() } @@ -163,22 +162,6 @@ func (n *NodeRefreshableDataResourceInstance) EvalTree() EvalNode { ProviderSchema: &providerSchema, }, - &EvalIf{ - If: func(ctx EvalContext) (bool, error) { - // If the config explicitly has a depends_on for this - // data source, assume the intention is to prevent - // refreshing ahead of that dependency, and therefore - // we need to deal with this resource during the apply - // phase.. - if len(n.Config.DependsOn) > 0 { - return true, EvalEarlyExitError{} - } - - return true, nil - }, - Then: EvalNoop{}, - }, - // EvalReadData will _attempt_ to read the data source, but may // generate an incomplete planned object if the configuration // includes values that won't be known until apply. @@ -192,6 +175,12 @@ func (n *NodeRefreshableDataResourceInstance) EvalTree() EvalNode { OutputChange: &change, OutputConfigValue: &configVal, OutputState: &state, + // If the config explicitly has a depends_on for this data + // source, assume the intention is to prevent refreshing ahead + // of that dependency, and therefore we need to deal with this + // resource during the apply phase. We do that by forcing this + // read to result in a plan. + ForcePlanRead: len(n.Config.DependsOn) > 0, }, &EvalIf{ 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 591eb305..38681d83 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 97% 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 cb55a1a8..441d2632 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 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 94% 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 aca5a6a3..03653359 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 @@ -2,10 +2,10 @@ package terraform import ( "github.com/hashicorp/hcl2/hcl" - "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" "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 bb3d0653..75305712 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 518b8aa0..a76d1742 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 a0cdcfe0..afdd4741 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 30d8813a..51335654 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 100% 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 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 cf51cf06..573f030d 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 95% 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 d147b42e..c7b0e3c8 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 @@ -5,13 +5,13 @@ import ( "log" "sort" - "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" + "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 @@ -245,7 +245,7 @@ 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()) } else { @@ -274,20 +274,6 @@ 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)) - } - return tr.Resource.String() + suffix -} - // StateReferences returns the dependencies to put into the state for // this resource. func (n *NodeAbstractResourceInstance) StateReferences() []addrs.Referenceable { 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 3e2fff3a..68d438d7 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 96% 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 d7953246..acdda45e 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 @@ -104,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 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 ca2267e4..049e5e99 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 97% 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 67c46913..269c7980 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 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 ec4aa932..2dc0df90 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 89% 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 38746f0d..2c3a7012 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 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 95% 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 0f74bbe6..ac4b24cf 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" ) 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 84166949..8e4f7148 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 96% 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 9daeabfa..dcab3727 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,14 +4,14 @@ 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 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 efa657bf..f0eb18a0 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 1c302903..844d060c 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 00000000..19e3469c --- /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 af04c6cd..5c19f6e7 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 d82dc0f4..7e401f33 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 f5958916..93b19be5 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 fcf28aa6..bd577460 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 ca833fe1..8a683012 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 65% rename from vendor/github.com/hashicorp/terraform/terraform/resource_mode.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_mode.go index 70d441df..c83643a6 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/resource_mode.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_mode.go @@ -1,6 +1,6 @@ package terraform -//go:generate stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go +//go:generate go run golang.org/x/tools/cmd/stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go // ResourceMode is deprecated, use addrs.ResourceMode instead. // It has been preserved for backwards compatibility. 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 98% 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 3455ad88..670bcba2 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/resource_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/resource_provider.go @@ -3,10 +3,10 @@ package terraform import ( "fmt" - "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 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 2743dd7e..74ee2a94 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 7b88cf73..ed6f241b 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 62991c82..8bc3b017 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 c973980b..e70e8ab2 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/state.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/state.go @@ -22,13 +22,13 @@ import ( version "github.com/hashicorp/go-version" "github.com/hashicorp/hcl2/hcl" "github.com/hashicorp/hcl2/hcl/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/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 97% rename from vendor/github.com/hashicorp/terraform/terraform/transform.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform.go index fd3f5c7d..f9559f41 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform.go @@ -3,7 +3,7 @@ package terraform import ( "log" - "github.com/hashicorp/terraform/dag" + "github.com/hashicorp/terraform-plugin-sdk/internal/dag" ) // GraphTransformer is the interface that transformers implement. This 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 897a7e79..cbac1338 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 03f8564d..23578c78 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 96% 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 c7695dd4..fee220b5 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 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 3af7b989..f8749487 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 9d3b6f4b..8920761e 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/terraform/transform_config_flat.go b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_config_flat.go similarity index 94% rename from vendor/github.com/hashicorp/terraform/terraform/transform_config_flat.go rename to vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_config_flat.go index 866c9175..4dbdcb74 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_config_flat.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_config_flat.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" ) // FlatConfigTransformer is a GraphTransformer that adds the configuration 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 01601bdd..892f75ec 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 98% 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 2f4d5ede..44c60640 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 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 97% 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 7fb415bd..ab4ba156 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. 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 96% 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 6fb915f8..773aad7c 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 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 982c098b..03eac685 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 90% 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 c1945f02..aa00e020 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 @@ -4,8 +4,8 @@ import ( "fmt" "github.com/hashicorp/hcl2/hcl" - "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" ) // 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 97% 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 ab0ecae0..7dd2c487 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 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 84eb26b2..b97dea2a 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 97% 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 a994bd4f..1b6531fe 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 @@ -4,11 +4,11 @@ import ( "fmt" "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/hashicorp/terraform/tfdiags" + "github.com/hashicorp/terraform-plugin-sdk/internal/tfdiags" "github.com/zclconf/go-cty/cty" "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/configs" + "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 40163cf9..4d1323fb 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 c6754093..cab10da1 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 50df1781..f927b108 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 ed93cdb8..e2979ac5 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 6a4fb47c..77af1fbb 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_provider.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_provider.go @@ -5,10 +5,10 @@ import ( "log" "github.com/hashicorp/hcl2/hcl" - "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" ) func TransformProviders(providers []string, concrete ConcreteProviderNodeFunc, config *configs.Config) GraphTransformer { @@ -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 } 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 b3102665..e6fe25da 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 96% 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 11196b84..8ae1fa75 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/transform_reference.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/transform_reference.go @@ -5,10 +5,10 @@ import ( "log" "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/addrs" - "github.com/hashicorp/terraform/configs/configschema" - "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/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 @@ -444,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 ee71387e..327950d8 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 c70a3c14..51d9466a 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 aee053d1..485c1c8a 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 0b52347d..e7d95be9 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 d25274e6..beb1eed9 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 05daa513..3afce566 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 6b1293fc..6b3c62d1 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 fff964f4..0d7d4ce0 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 75531b2b..0b0c1d28 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/variables.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/variables.go @@ -7,8 +7,8 @@ import ( "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 @@ -78,7 +78,7 @@ func (v ValueSourceType) GoString() string { return fmt.Sprintf("terraform.%s", v) } -//go:generate stringer -type ValueSourceType +//go:generate go run golang.org/x/tools/cmd/stringer -type ValueSourceType // InputValues is a map of InputValue instances. type InputValues map[string]*InputValue 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 91% 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 61423c21..d2ee4816 100644 --- a/vendor/github.com/hashicorp/terraform/terraform/version_required.go +++ b/vendor/github.com/hashicorp/terraform-plugin-sdk/terraform/version_required.go @@ -4,11 +4,11 @@ import ( "fmt" "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/terraform/tfdiags" + "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/config/append.go b/vendor/github.com/hashicorp/terraform/config/append.go deleted file mode 100644 index 9d80c42b..00000000 --- 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 f13a046c..00000000 --- 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/hcl2/hcl" - "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 a6933c2a..00000000 --- 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 8535c964..00000000 --- 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 08dc0fe9..00000000 --- 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/hcl2_shim_util.go b/vendor/github.com/hashicorp/terraform/config/hcl2_shim_util.go deleted file mode 100644 index 80561b6c..00000000 --- a/vendor/github.com/hashicorp/terraform/config/hcl2_shim_util.go +++ /dev/null @@ -1,134 +0,0 @@ -package config - -import ( - "fmt" - - "github.com/zclconf/go-cty/cty/function/stdlib" - - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/terraform/configs/hcl2shim" - - hcl2 "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" -) - -// --------------------------------------------------------------------------- -// This file contains some helper functions that are used to shim between -// HCL2 concepts and HCL/HIL concepts, to help us mostly preserve the existing -// public API that was built around HCL/HIL-oriented approaches. -// --------------------------------------------------------------------------- - -func hcl2InterpolationFuncs() map[string]function.Function { - hcl2Funcs := map[string]function.Function{} - - for name, hilFunc := range Funcs() { - hcl2Funcs[name] = hcl2InterpolationFuncShim(hilFunc) - } - - // Some functions in the old world are dealt with inside langEvalConfig - // due to their legacy reliance on direct access to the symbol table. - // Since 0.7 they don't actually need it anymore and just ignore it, - // so we're cheating a bit here and exploiting that detail by passing nil. - hcl2Funcs["lookup"] = hcl2InterpolationFuncShim(interpolationFuncLookup(nil)) - hcl2Funcs["keys"] = hcl2InterpolationFuncShim(interpolationFuncKeys(nil)) - hcl2Funcs["values"] = hcl2InterpolationFuncShim(interpolationFuncValues(nil)) - - // As a bonus, we'll provide the JSON-handling functions from the cty - // function library since its "jsonencode" is more complete (doesn't force - // weird type conversions) and HIL's type system can't represent - // "jsondecode" at all. The result of jsondecode will eventually be forced - // to conform to the HIL type system on exit into the rest of Terraform due - // to our shimming right now, but it should be usable for decoding _within_ - // an expression. - hcl2Funcs["jsonencode"] = stdlib.JSONEncodeFunc - hcl2Funcs["jsondecode"] = stdlib.JSONDecodeFunc - - return hcl2Funcs -} - -func hcl2InterpolationFuncShim(hilFunc ast.Function) function.Function { - spec := &function.Spec{} - - for i, hilArgType := range hilFunc.ArgTypes { - spec.Params = append(spec.Params, function.Parameter{ - Type: hcl2shim.HCL2TypeForHILType(hilArgType), - Name: fmt.Sprintf("arg%d", i+1), // HIL args don't have names, so we'll fudge it - }) - } - - if hilFunc.Variadic { - spec.VarParam = &function.Parameter{ - Type: hcl2shim.HCL2TypeForHILType(hilFunc.VariadicType), - Name: "varargs", // HIL args don't have names, so we'll fudge it - } - } - - spec.Type = func(args []cty.Value) (cty.Type, error) { - return hcl2shim.HCL2TypeForHILType(hilFunc.ReturnType), nil - } - spec.Impl = func(args []cty.Value, retType cty.Type) (cty.Value, error) { - hilArgs := make([]interface{}, len(args)) - for i, arg := range args { - hilV := hcl2shim.HILVariableFromHCL2Value(arg) - - // Although the cty function system does automatic type conversions - // to match the argument types, cty doesn't distinguish int and - // float and so we may need to adjust here to ensure that the - // wrapped function gets exactly the Go type it was expecting. - var wantType ast.Type - if i < len(hilFunc.ArgTypes) { - wantType = hilFunc.ArgTypes[i] - } else { - wantType = hilFunc.VariadicType - } - switch { - case hilV.Type == ast.TypeInt && wantType == ast.TypeFloat: - hilV.Type = wantType - hilV.Value = float64(hilV.Value.(int)) - case hilV.Type == ast.TypeFloat && wantType == ast.TypeInt: - hilV.Type = wantType - hilV.Value = int(hilV.Value.(float64)) - } - - // HIL functions actually expect to have the outermost variable - // "peeled" but any nested values (in lists or maps) will - // still have their ast.Variable wrapping. - hilArgs[i] = hilV.Value - } - - hilResult, err := hilFunc.Callback(hilArgs) - if err != nil { - return cty.DynamicVal, err - } - - // Just as on the way in, we get back a partially-peeled ast.Variable - // which we need to re-wrap in order to convert it back into what - // we're calling a "config value". - rv := hcl2shim.HCL2ValueFromHILVariable(ast.Variable{ - Type: hilFunc.ReturnType, - Value: hilResult, - }) - - return convert.Convert(rv, retType) // if result is unknown we'll force the correct type here - } - return function.New(spec) -} - -func hcl2EvalWithUnknownVars(expr hcl2.Expression) (cty.Value, hcl2.Diagnostics) { - trs := expr.Variables() - vars := map[string]cty.Value{} - val := cty.DynamicVal - - for _, tr := range trs { - name := tr.RootName() - vars[name] = val - } - - ctx := &hcl2.EvalContext{ - Variables: vars, - Functions: hcl2InterpolationFuncs(), - } - return expr.Value(ctx) -} 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 08cbc773..00000000 --- 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 599e5ecd..00000000 --- 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 6a2050c9..00000000 --- a/vendor/github.com/hashicorp/terraform/config/interpolate_funcs.go +++ /dev/null @@ -1,1761 +0,0 @@ -package config - -import ( - "bytes" - "compress/gzip" - "crypto/md5" - "crypto/rsa" - "crypto/sha1" - "crypto/sha256" - "crypto/sha512" - "crypto/x509" - "encoding/base64" - "encoding/hex" - "encoding/json" - "encoding/pem" - "fmt" - "io/ioutil" - "math" - "net" - "net/url" - "path/filepath" - "regexp" - "sort" - "strconv" - "strings" - "time" - - "github.com/apparentlymart/go-cidr/cidr" - "github.com/hashicorp/go-uuid" - "github.com/hashicorp/hil" - "github.com/hashicorp/hil/ast" - "github.com/mitchellh/go-homedir" - "golang.org/x/crypto/bcrypt" -) - -// 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 is the mapping of built-in functions for configuration. -func Funcs() map[string]ast.Function { - return map[string]ast.Function{ - "abs": interpolationFuncAbs(), - "basename": interpolationFuncBasename(), - "base64decode": interpolationFuncBase64Decode(), - "base64encode": interpolationFuncBase64Encode(), - "base64gzip": interpolationFuncBase64Gzip(), - "base64sha256": interpolationFuncBase64Sha256(), - "base64sha512": interpolationFuncBase64Sha512(), - "bcrypt": interpolationFuncBcrypt(), - "ceil": interpolationFuncCeil(), - "chomp": interpolationFuncChomp(), - "cidrhost": interpolationFuncCidrHost(), - "cidrnetmask": interpolationFuncCidrNetmask(), - "cidrsubnet": interpolationFuncCidrSubnet(), - "coalesce": interpolationFuncCoalesce(), - "coalescelist": interpolationFuncCoalesceList(), - "compact": interpolationFuncCompact(), - "concat": interpolationFuncConcat(), - "contains": interpolationFuncContains(), - "dirname": interpolationFuncDirname(), - "distinct": interpolationFuncDistinct(), - "element": interpolationFuncElement(), - "chunklist": interpolationFuncChunklist(), - "file": interpolationFuncFile(), - "matchkeys": interpolationFuncMatchKeys(), - "flatten": interpolationFuncFlatten(), - "floor": interpolationFuncFloor(), - "format": interpolationFuncFormat(), - "formatlist": interpolationFuncFormatList(), - "indent": interpolationFuncIndent(), - "index": interpolationFuncIndex(), - "join": interpolationFuncJoin(), - "jsonencode": interpolationFuncJSONEncode(), - "length": interpolationFuncLength(), - "list": interpolationFuncList(), - "log": interpolationFuncLog(), - "lower": interpolationFuncLower(), - "map": interpolationFuncMap(), - "max": interpolationFuncMax(), - "md5": interpolationFuncMd5(), - "merge": interpolationFuncMerge(), - "min": interpolationFuncMin(), - "pathexpand": interpolationFuncPathExpand(), - "pow": interpolationFuncPow(), - "uuid": interpolationFuncUUID(), - "replace": interpolationFuncReplace(), - "reverse": interpolationFuncReverse(), - "rsadecrypt": interpolationFuncRsaDecrypt(), - "sha1": interpolationFuncSha1(), - "sha256": interpolationFuncSha256(), - "sha512": interpolationFuncSha512(), - "signum": interpolationFuncSignum(), - "slice": interpolationFuncSlice(), - "sort": interpolationFuncSort(), - "split": interpolationFuncSplit(), - "substr": interpolationFuncSubstr(), - "timestamp": interpolationFuncTimestamp(), - "timeadd": interpolationFuncTimeAdd(), - "title": interpolationFuncTitle(), - "transpose": interpolationFuncTranspose(), - "trimspace": interpolationFuncTrimSpace(), - "upper": interpolationFuncUpper(), - "urlencode": interpolationFuncURLEncode(), - "zipmap": interpolationFuncZipMap(), - } -} - -// interpolationFuncList creates a list from the parameters passed -// to it. -func interpolationFuncList() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{}, - ReturnType: ast.TypeList, - Variadic: true, - VariadicType: ast.TypeAny, - Callback: func(args []interface{}) (interface{}, error) { - var outputList []ast.Variable - - for i, val := range args { - switch v := val.(type) { - case string: - outputList = append(outputList, ast.Variable{Type: ast.TypeString, Value: v}) - case []ast.Variable: - outputList = append(outputList, ast.Variable{Type: ast.TypeList, Value: v}) - case map[string]ast.Variable: - outputList = append(outputList, ast.Variable{Type: ast.TypeMap, Value: v}) - default: - return nil, fmt.Errorf("unexpected type %T for argument %d in list", v, i) - } - } - - // we don't support heterogeneous types, so make sure all types match the first - if len(outputList) > 0 { - firstType := outputList[0].Type - for i, v := range outputList[1:] { - if v.Type != firstType { - return nil, fmt.Errorf("unexpected type %s for argument %d in list", v.Type, i+1) - } - } - } - - return outputList, nil - }, - } -} - -// interpolationFuncMap creates a map from the parameters passed -// to it. -func interpolationFuncMap() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{}, - ReturnType: ast.TypeMap, - Variadic: true, - VariadicType: ast.TypeAny, - Callback: func(args []interface{}) (interface{}, error) { - outputMap := make(map[string]ast.Variable) - - if len(args)%2 != 0 { - return nil, fmt.Errorf("requires an even number of arguments, got %d", len(args)) - } - - var firstType *ast.Type - for i := 0; i < len(args); i += 2 { - key, ok := args[i].(string) - if !ok { - return nil, fmt.Errorf("argument %d represents a key, so it must be a string", i+1) - } - val := args[i+1] - variable, err := hil.InterfaceToVariable(val) - if err != nil { - return nil, err - } - // Enforce map type homogeneity - if firstType == nil { - firstType = &variable.Type - } else if variable.Type != *firstType { - return nil, fmt.Errorf("all map values must have the same type, got %s then %s", firstType.Printable(), variable.Type.Printable()) - } - // Check for duplicate keys - if _, ok := outputMap[key]; ok { - return nil, fmt.Errorf("argument %d is a duplicate key: %q", i+1, key) - } - outputMap[key] = variable - } - - return outputMap, nil - }, - } -} - -// interpolationFuncCompact strips a list of multi-variable values -// (e.g. as returned by "split") of any empty strings. -func interpolationFuncCompact() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList}, - ReturnType: ast.TypeList, - Variadic: false, - Callback: func(args []interface{}) (interface{}, error) { - inputList := args[0].([]ast.Variable) - - var outputList []string - for _, val := range inputList { - strVal, ok := val.Value.(string) - if !ok { - return nil, fmt.Errorf( - "compact() may only be used with flat lists, this list contains elements of %s", - val.Type.Printable()) - } - if strVal == "" { - continue - } - - outputList = append(outputList, strVal) - } - return stringSliceToVariableValue(outputList), nil - }, - } -} - -// interpolationFuncCidrHost implements the "cidrhost" function that -// fills in the host part of a CIDR range address to create a single -// host address -func interpolationFuncCidrHost() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ - ast.TypeString, // starting CIDR mask - ast.TypeInt, // host number to insert - }, - ReturnType: ast.TypeString, - Variadic: false, - Callback: func(args []interface{}) (interface{}, error) { - hostNum := args[1].(int) - _, network, err := net.ParseCIDR(args[0].(string)) - if err != nil { - return nil, fmt.Errorf("invalid CIDR expression: %s", err) - } - - ip, err := cidr.Host(network, hostNum) - if err != nil { - return nil, err - } - - return ip.String(), nil - }, - } -} - -// interpolationFuncCidrNetmask implements the "cidrnetmask" function -// that returns the subnet mask in IP address notation. -func interpolationFuncCidrNetmask() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ - ast.TypeString, // CIDR mask - }, - ReturnType: ast.TypeString, - Variadic: false, - Callback: func(args []interface{}) (interface{}, error) { - _, network, err := net.ParseCIDR(args[0].(string)) - if err != nil { - return nil, fmt.Errorf("invalid CIDR expression: %s", err) - } - - return net.IP(network.Mask).String(), nil - }, - } -} - -// interpolationFuncCidrSubnet implements the "cidrsubnet" function that -// adds an additional subnet of the given length onto an existing -// IP block expressed in CIDR notation. -func interpolationFuncCidrSubnet() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ - ast.TypeString, // starting CIDR mask - ast.TypeInt, // number of bits to extend the prefix - ast.TypeInt, // network number to append to the prefix - }, - ReturnType: ast.TypeString, - Variadic: false, - Callback: func(args []interface{}) (interface{}, error) { - extraBits := args[1].(int) - subnetNum := args[2].(int) - _, network, err := net.ParseCIDR(args[0].(string)) - if err != nil { - return nil, fmt.Errorf("invalid CIDR expression: %s", err) - } - - // For portability with 32-bit systems where the subnet number - // will be a 32-bit int, we only allow extension of 32 bits in - // one call even if we're running on a 64-bit machine. - // (Of course, this is significant only for IPv6.) - if extraBits > 32 { - return nil, fmt.Errorf("may not extend prefix by more than 32 bits") - } - - newNetwork, err := cidr.Subnet(network, extraBits, subnetNum) - if err != nil { - return nil, err - } - - return newNetwork.String(), nil - }, - } -} - -// interpolationFuncCoalesce implements the "coalesce" function that -// returns the first non null / empty string from the provided input -func interpolationFuncCoalesce() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Variadic: true, - VariadicType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - if len(args) < 2 { - return nil, fmt.Errorf("must provide at least two arguments") - } - for _, arg := range args { - argument := arg.(string) - - if argument != "" { - return argument, nil - } - } - return "", nil - }, - } -} - -// interpolationFuncCoalesceList implements the "coalescelist" function that -// returns the first non empty list from the provided input -func interpolationFuncCoalesceList() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList}, - ReturnType: ast.TypeList, - Variadic: true, - VariadicType: ast.TypeList, - Callback: func(args []interface{}) (interface{}, error) { - if len(args) < 2 { - return nil, fmt.Errorf("must provide at least two arguments") - } - for _, arg := range args { - argument := arg.([]ast.Variable) - - if len(argument) > 0 { - return argument, nil - } - } - return make([]ast.Variable, 0), nil - }, - } -} - -// interpolationFuncContains returns true if an element is in the list -// and return false otherwise -func interpolationFuncContains() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList, ast.TypeString}, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - _, err := interpolationFuncIndex().Callback(args) - if err != nil { - return false, nil - } - return true, nil - }, - } -} - -// interpolationFuncConcat implements the "concat" function that concatenates -// multiple lists. -func interpolationFuncConcat() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList}, - ReturnType: ast.TypeList, - Variadic: true, - VariadicType: ast.TypeList, - Callback: func(args []interface{}) (interface{}, error) { - var outputList []ast.Variable - - for _, arg := range args { - for _, v := range arg.([]ast.Variable) { - switch v.Type { - case ast.TypeString: - outputList = append(outputList, v) - case ast.TypeList: - outputList = append(outputList, v) - case ast.TypeMap: - outputList = append(outputList, v) - default: - return nil, fmt.Errorf("concat() does not support lists of %s", v.Type.Printable()) - } - } - } - - // we don't support heterogeneous types, so make sure all types match the first - if len(outputList) > 0 { - firstType := outputList[0].Type - for _, v := range outputList[1:] { - if v.Type != firstType { - return nil, fmt.Errorf("unexpected %s in list of %s", v.Type.Printable(), firstType.Printable()) - } - } - } - - return outputList, nil - }, - } -} - -// interpolationFuncPow returns base x exponential of y. -func interpolationFuncPow() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat, ast.TypeFloat}, - ReturnType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - return math.Pow(args[0].(float64), args[1].(float64)), nil - }, - } -} - -// interpolationFuncFile implements the "file" function that allows -// loading contents from a file. -func interpolationFuncFile() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - path, err := homedir.Expand(args[0].(string)) - if err != nil { - return "", err - } - data, err := ioutil.ReadFile(path) - if err != nil { - return "", err - } - - return string(data), nil - }, - } -} - -// interpolationFuncFormat implements the "format" function that does -// string formatting. -func interpolationFuncFormat() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - Variadic: true, - VariadicType: ast.TypeAny, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - format := args[0].(string) - return fmt.Sprintf(format, args[1:]...), nil - }, - } -} - -// interpolationFuncMax returns the maximum of the numeric arguments -func interpolationFuncMax() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat}, - ReturnType: ast.TypeFloat, - Variadic: true, - VariadicType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - max := args[0].(float64) - - for i := 1; i < len(args); i++ { - max = math.Max(max, args[i].(float64)) - } - - return max, nil - }, - } -} - -// interpolationFuncMin returns the minimum of the numeric arguments -func interpolationFuncMin() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat}, - ReturnType: ast.TypeFloat, - Variadic: true, - VariadicType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - min := args[0].(float64) - - for i := 1; i < len(args); i++ { - min = math.Min(min, args[i].(float64)) - } - - return min, nil - }, - } -} - -// interpolationFuncPathExpand will expand any `~`'s found with the full file path -func interpolationFuncPathExpand() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return homedir.Expand(args[0].(string)) - }, - } -} - -// interpolationFuncCeil returns the the least integer value greater than or equal to the argument -func interpolationFuncCeil() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat}, - ReturnType: ast.TypeInt, - Callback: func(args []interface{}) (interface{}, error) { - return int(math.Ceil(args[0].(float64))), nil - }, - } -} - -// interpolationFuncLog returns the logarithnm. -func interpolationFuncLog() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat, ast.TypeFloat}, - ReturnType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - return math.Log(args[0].(float64)) / math.Log(args[1].(float64)), nil - }, - } -} - -// interpolationFuncChomp removes trailing newlines from the given string -func interpolationFuncChomp() ast.Function { - newlines := regexp.MustCompile(`(?:\r\n?|\n)*\z`) - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return newlines.ReplaceAllString(args[0].(string), ""), nil - }, - } -} - -// interpolationFuncFloorreturns returns the greatest integer value less than or equal to the argument -func interpolationFuncFloor() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat}, - ReturnType: ast.TypeInt, - Callback: func(args []interface{}) (interface{}, error) { - return int(math.Floor(args[0].(float64))), nil - }, - } -} - -func interpolationFuncZipMap() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ - ast.TypeList, // Keys - ast.TypeList, // Values - }, - ReturnType: ast.TypeMap, - Callback: func(args []interface{}) (interface{}, error) { - keys := args[0].([]ast.Variable) - values := args[1].([]ast.Variable) - - if len(keys) != len(values) { - return nil, fmt.Errorf("count of keys (%d) does not match count of values (%d)", - len(keys), len(values)) - } - - for i, val := range keys { - if val.Type != ast.TypeString { - return nil, fmt.Errorf("keys must be strings. value at position %d is %s", - i, val.Type.Printable()) - } - } - - result := map[string]ast.Variable{} - for i := 0; i < len(keys); i++ { - result[keys[i].Value.(string)] = values[i] - } - - return result, nil - }, - } -} - -// interpolationFuncFormatList implements the "formatlist" function that does -// string formatting on lists. -func interpolationFuncFormatList() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeAny}, - Variadic: true, - VariadicType: ast.TypeAny, - ReturnType: ast.TypeList, - Callback: func(args []interface{}) (interface{}, error) { - // Make a copy of the variadic part of args - // to avoid modifying the original. - varargs := make([]interface{}, len(args)-1) - copy(varargs, args[1:]) - - // Verify we have some arguments - if len(varargs) == 0 { - return nil, fmt.Errorf("no arguments to formatlist") - } - - // Convert arguments that are lists into slices. - // Confirm along the way that all lists have the same length (n). - var n int - listSeen := false - for i := 1; i < len(args); i++ { - s, ok := args[i].([]ast.Variable) - if !ok { - continue - } - - // Mark that we've seen at least one list - listSeen = true - - // Convert the ast.Variable to a slice of strings - parts, err := listVariableValueToStringSlice(s) - if err != nil { - return nil, err - } - - // otherwise the list is sent down to be indexed - varargs[i-1] = parts - - // Check length - if n == 0 { - // first list we've seen - n = len(parts) - continue - } - if n != len(parts) { - return nil, fmt.Errorf("format: mismatched list lengths: %d != %d", n, len(parts)) - } - } - - // If we didn't see a list this is an error because we - // can't determine the return value length. - if !listSeen { - return nil, fmt.Errorf( - "formatlist requires at least one list argument") - } - - // Do the formatting. - format := args[0].(string) - - // Generate a list of formatted strings. - list := make([]string, n) - fmtargs := make([]interface{}, len(varargs)) - for i := 0; i < n; i++ { - for j, arg := range varargs { - switch arg := arg.(type) { - default: - fmtargs[j] = arg - case []string: - fmtargs[j] = arg[i] - } - } - list[i] = fmt.Sprintf(format, fmtargs...) - } - return stringSliceToVariableValue(list), nil - }, - } -} - -// interpolationFuncIndent indents a multi-line string with the -// specified number of spaces -func interpolationFuncIndent() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt, ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - spaces := args[0].(int) - data := args[1].(string) - pad := strings.Repeat(" ", spaces) - return strings.Replace(data, "\n", "\n"+pad, -1), nil - }, - } -} - -// interpolationFuncIndex implements the "index" function that allows one to -// find the index of a specific element in a list -func interpolationFuncIndex() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList, ast.TypeString}, - ReturnType: ast.TypeInt, - Callback: func(args []interface{}) (interface{}, error) { - haystack := args[0].([]ast.Variable) - needle := args[1].(string) - for index, element := range haystack { - if needle == element.Value { - return index, nil - } - } - return nil, fmt.Errorf("Could not find '%s' in '%s'", needle, haystack) - }, - } -} - -// interpolationFuncBasename implements the "dirname" function. -func interpolationFuncDirname() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return filepath.Dir(args[0].(string)), nil - }, - } -} - -// interpolationFuncDistinct implements the "distinct" function that -// removes duplicate elements from a list. -func interpolationFuncDistinct() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList}, - ReturnType: ast.TypeList, - Variadic: true, - VariadicType: ast.TypeList, - Callback: func(args []interface{}) (interface{}, error) { - var list []string - - if len(args) != 1 { - return nil, fmt.Errorf("accepts only one argument.") - } - - if argument, ok := args[0].([]ast.Variable); ok { - for _, element := range argument { - if element.Type != ast.TypeString { - return nil, fmt.Errorf( - "only works for flat lists, this list contains elements of %s", - element.Type.Printable()) - } - list = appendIfMissing(list, element.Value.(string)) - } - } - - return stringSliceToVariableValue(list), nil - }, - } -} - -// helper function to add an element to a list, if it does not already exsit -func appendIfMissing(slice []string, element string) []string { - for _, ele := range slice { - if ele == element { - return slice - } - } - return append(slice, element) -} - -// for two lists `keys` and `values` of equal length, returns all elements -// from `values` where the corresponding element from `keys` is in `searchset`. -func interpolationFuncMatchKeys() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList, ast.TypeList, ast.TypeList}, - ReturnType: ast.TypeList, - Callback: func(args []interface{}) (interface{}, error) { - output := make([]ast.Variable, 0) - - values, _ := args[0].([]ast.Variable) - keys, _ := args[1].([]ast.Variable) - searchset, _ := args[2].([]ast.Variable) - - if len(keys) != len(values) { - return nil, fmt.Errorf("length of keys and values should be equal") - } - - for i, key := range keys { - for _, search := range searchset { - if res, err := compareSimpleVariables(key, search); err != nil { - return nil, err - } else if res == true { - output = append(output, values[i]) - break - } - } - } - // if searchset is empty, then output is an empty list as well. - // if we haven't matched any key, then output is an empty list. - return output, nil - }, - } -} - -// compare two variables of the same type, i.e. non complex one, such as TypeList or TypeMap -func compareSimpleVariables(a, b ast.Variable) (bool, error) { - if a.Type != b.Type { - return false, fmt.Errorf( - "won't compare items of different types %s and %s", - a.Type.Printable(), b.Type.Printable()) - } - switch a.Type { - case ast.TypeString: - return a.Value.(string) == b.Value.(string), nil - default: - return false, fmt.Errorf( - "can't compare items of type %s", - a.Type.Printable()) - } -} - -// interpolationFuncJoin implements the "join" function that allows -// multi-variable values to be joined by some character. -func interpolationFuncJoin() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - Variadic: true, - VariadicType: ast.TypeList, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - var list []string - - if len(args) < 2 { - return nil, fmt.Errorf("not enough arguments to join()") - } - - for _, arg := range args[1:] { - for _, part := range arg.([]ast.Variable) { - if part.Type != ast.TypeString { - return nil, fmt.Errorf( - "only works on flat lists, this list contains elements of %s", - part.Type.Printable()) - } - list = append(list, part.Value.(string)) - } - } - - return strings.Join(list, args[0].(string)), nil - }, - } -} - -// interpolationFuncJSONEncode implements the "jsonencode" function that encodes -// a string, list, or map as its JSON representation. -func interpolationFuncJSONEncode() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeAny}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - var toEncode interface{} - - switch typedArg := args[0].(type) { - case string: - toEncode = typedArg - - case []ast.Variable: - strings := make([]string, len(typedArg)) - - for i, v := range typedArg { - if v.Type != ast.TypeString { - variable, _ := hil.InterfaceToVariable(typedArg) - toEncode, _ = hil.VariableToInterface(variable) - - jEnc, err := json.Marshal(toEncode) - if err != nil { - return "", fmt.Errorf("failed to encode JSON data '%s'", toEncode) - } - return string(jEnc), nil - - } - strings[i] = v.Value.(string) - } - toEncode = strings - - case map[string]ast.Variable: - stringMap := make(map[string]string) - for k, v := range typedArg { - if v.Type != ast.TypeString { - variable, _ := hil.InterfaceToVariable(typedArg) - toEncode, _ = hil.VariableToInterface(variable) - - jEnc, err := json.Marshal(toEncode) - if err != nil { - return "", fmt.Errorf("failed to encode JSON data '%s'", toEncode) - } - return string(jEnc), nil - } - stringMap[k] = v.Value.(string) - } - toEncode = stringMap - - default: - return "", fmt.Errorf("unknown type for JSON encoding: %T", args[0]) - } - - jEnc, err := json.Marshal(toEncode) - if err != nil { - return "", fmt.Errorf("failed to encode JSON data '%s'", toEncode) - } - return string(jEnc), nil - }, - } -} - -// interpolationFuncReplace implements the "replace" function that does -// string replacement. -func interpolationFuncReplace() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString, ast.TypeString, ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - search := args[1].(string) - replace := args[2].(string) - - // We search/replace using a regexp if the string is surrounded - // in forward slashes. - if len(search) > 1 && search[0] == '/' && search[len(search)-1] == '/' { - re, err := regexp.Compile(search[1 : len(search)-1]) - if err != nil { - return nil, err - } - - return re.ReplaceAllString(s, replace), nil - } - - return strings.Replace(s, search, replace, -1), nil - }, - } -} - -// interpolationFuncReverse implements the "reverse" function that does list reversal -func interpolationFuncReverse() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList}, - ReturnType: ast.TypeList, - Variadic: false, - Callback: func(args []interface{}) (interface{}, error) { - inputList := args[0].([]ast.Variable) - - reversedList := make([]ast.Variable, len(inputList)) - for idx := range inputList { - reversedList[len(inputList)-1-idx] = inputList[idx] - } - - return reversedList, nil - }, - } -} - -func interpolationFuncLength() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeAny}, - ReturnType: ast.TypeInt, - Variadic: false, - Callback: func(args []interface{}) (interface{}, error) { - subject := args[0] - - switch typedSubject := subject.(type) { - case string: - return len(typedSubject), nil - case []ast.Variable: - return len(typedSubject), nil - case map[string]ast.Variable: - return len(typedSubject), nil - } - - return 0, fmt.Errorf("arguments to length() must be a string, list, or map") - }, - } -} - -func interpolationFuncSignum() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - ReturnType: ast.TypeInt, - Variadic: false, - Callback: func(args []interface{}) (interface{}, error) { - num := args[0].(int) - switch { - case num < 0: - return -1, nil - case num > 0: - return +1, nil - default: - return 0, nil - } - }, - } -} - -// interpolationFuncSlice returns a portion of the input list between from, inclusive and to, exclusive. -func interpolationFuncSlice() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ - ast.TypeList, // inputList - ast.TypeInt, // from - ast.TypeInt, // to - }, - ReturnType: ast.TypeList, - Variadic: false, - Callback: func(args []interface{}) (interface{}, error) { - inputList := args[0].([]ast.Variable) - from := args[1].(int) - to := args[2].(int) - - if from < 0 { - return nil, fmt.Errorf("from index must be >= 0") - } - if to > len(inputList) { - return nil, fmt.Errorf("to index must be <= length of the input list") - } - if from > to { - return nil, fmt.Errorf("from index must be <= to index") - } - - var outputList []ast.Variable - for i, val := range inputList { - if i >= from && i < to { - outputList = append(outputList, val) - } - } - return outputList, nil - }, - } -} - -// interpolationFuncSort sorts a list of a strings lexographically -func interpolationFuncSort() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList}, - ReturnType: ast.TypeList, - Variadic: false, - Callback: func(args []interface{}) (interface{}, error) { - inputList := args[0].([]ast.Variable) - - // Ensure that all the list members are strings and - // create a string slice from them - members := make([]string, len(inputList)) - for i, val := range inputList { - if val.Type != ast.TypeString { - return nil, fmt.Errorf( - "sort() may only be used with lists of strings - %s at index %d", - val.Type.String(), i) - } - - members[i] = val.Value.(string) - } - - sort.Strings(members) - return stringSliceToVariableValue(members), nil - }, - } -} - -// interpolationFuncSplit implements the "split" function that allows -// strings to split into multi-variable values -func interpolationFuncSplit() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString, ast.TypeString}, - ReturnType: ast.TypeList, - Callback: func(args []interface{}) (interface{}, error) { - sep := args[0].(string) - s := args[1].(string) - elements := strings.Split(s, sep) - return stringSliceToVariableValue(elements), nil - }, - } -} - -// interpolationFuncLookup implements the "lookup" function that allows -// dynamic lookups of map types within a Terraform configuration. -func interpolationFuncLookup(vs map[string]ast.Variable) ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeMap, ast.TypeString}, - ReturnType: ast.TypeString, - Variadic: true, - VariadicType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - defaultValue := "" - defaultValueSet := false - if len(args) > 2 { - defaultValue = args[2].(string) - defaultValueSet = true - } - if len(args) > 3 { - return "", fmt.Errorf("lookup() takes no more than three arguments") - } - index := args[1].(string) - mapVar := args[0].(map[string]ast.Variable) - - v, ok := mapVar[index] - if !ok { - if defaultValueSet { - return defaultValue, nil - } else { - return "", fmt.Errorf( - "lookup failed to find '%s'", - args[1].(string)) - } - } - if v.Type != ast.TypeString { - return nil, fmt.Errorf( - "lookup() may only be used with flat maps, this map contains elements of %s", - v.Type.Printable()) - } - - return v.Value.(string), nil - }, - } -} - -// interpolationFuncElement implements the "element" function that allows -// a specific index to be looked up in a multi-variable value. Note that this will -// wrap if the index is larger than the number of elements in the multi-variable value. -func interpolationFuncElement() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList, ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - list := args[0].([]ast.Variable) - if len(list) == 0 { - return nil, fmt.Errorf("element() may not be used with an empty list") - } - - index, err := strconv.Atoi(args[1].(string)) - if err != nil || index < 0 { - return "", fmt.Errorf( - "invalid number for index, got %s", args[1]) - } - - resolvedIndex := index % len(list) - - v := list[resolvedIndex] - if v.Type != ast.TypeString { - return nil, fmt.Errorf( - "element() may only be used with flat lists, this list contains elements of %s", - v.Type.Printable()) - } - return v.Value, nil - }, - } -} - -// returns the `list` items chunked by `size`. -func interpolationFuncChunklist() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ - ast.TypeList, // inputList - ast.TypeInt, // size - }, - ReturnType: ast.TypeList, - Callback: func(args []interface{}) (interface{}, error) { - output := make([]ast.Variable, 0) - - values, _ := args[0].([]ast.Variable) - size, _ := args[1].(int) - - // errors if size is negative - if size < 0 { - return nil, fmt.Errorf("The size argument must be positive") - } - - // if size is 0, returns a list made of the initial list - if size == 0 { - output = append(output, ast.Variable{ - Type: ast.TypeList, - Value: values, - }) - return output, nil - } - - variables := make([]ast.Variable, 0) - chunk := ast.Variable{ - Type: ast.TypeList, - Value: variables, - } - l := len(values) - for i, v := range values { - variables = append(variables, v) - - // Chunk when index isn't 0, or when reaching the values's length - if (i+1)%size == 0 || (i+1) == l { - chunk.Value = variables - output = append(output, chunk) - variables = make([]ast.Variable, 0) - } - } - - return output, nil - }, - } -} - -// interpolationFuncKeys implements the "keys" function that yields a list of -// keys of map types within a Terraform configuration. -func interpolationFuncKeys(vs map[string]ast.Variable) ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeMap}, - ReturnType: ast.TypeList, - Callback: func(args []interface{}) (interface{}, error) { - mapVar := args[0].(map[string]ast.Variable) - keys := make([]string, 0) - - for k, _ := range mapVar { - keys = append(keys, k) - } - - sort.Strings(keys) - - // Keys are guaranteed to be strings - return stringSliceToVariableValue(keys), nil - }, - } -} - -// interpolationFuncValues implements the "values" function that yields a list of -// keys of map types within a Terraform configuration. -func interpolationFuncValues(vs map[string]ast.Variable) ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeMap}, - ReturnType: ast.TypeList, - Callback: func(args []interface{}) (interface{}, error) { - mapVar := args[0].(map[string]ast.Variable) - keys := make([]string, 0) - - for k, _ := range mapVar { - keys = append(keys, k) - } - - sort.Strings(keys) - - values := make([]string, len(keys)) - for index, key := range keys { - if value, ok := mapVar[key].Value.(string); ok { - values[index] = value - } else { - return "", fmt.Errorf("values(): %q has element with bad type %s", - key, mapVar[key].Type) - } - } - - variable, err := hil.InterfaceToVariable(values) - if err != nil { - return nil, err - } - - return variable.Value, nil - }, - } -} - -// interpolationFuncBasename implements the "basename" function. -func interpolationFuncBasename() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return filepath.Base(args[0].(string)), nil - }, - } -} - -// interpolationFuncBase64Encode implements the "base64encode" function that -// allows Base64 encoding. -func interpolationFuncBase64Encode() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - return base64.StdEncoding.EncodeToString([]byte(s)), nil - }, - } -} - -// interpolationFuncBase64Decode implements the "base64decode" function that -// allows Base64 decoding. -func interpolationFuncBase64Decode() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - sDec, err := base64.StdEncoding.DecodeString(s) - if err != nil { - return "", fmt.Errorf("failed to decode base64 data '%s'", s) - } - return string(sDec), nil - }, - } -} - -// interpolationFuncBase64Gzip implements the "gzip" function that allows gzip -// compression encoding the result using base64 -func interpolationFuncBase64Gzip() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - - var b bytes.Buffer - gz := gzip.NewWriter(&b) - if _, err := gz.Write([]byte(s)); err != nil { - return "", fmt.Errorf("failed to write gzip raw data: '%s'", s) - } - if err := gz.Flush(); err != nil { - return "", fmt.Errorf("failed to flush gzip writer: '%s'", s) - } - if err := gz.Close(); err != nil { - return "", fmt.Errorf("failed to close gzip writer: '%s'", s) - } - - return base64.StdEncoding.EncodeToString(b.Bytes()), nil - }, - } -} - -// interpolationFuncLower implements the "lower" function that does -// string lower casing. -func interpolationFuncLower() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - toLower := args[0].(string) - return strings.ToLower(toLower), nil - }, - } -} - -func interpolationFuncMd5() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - h := md5.New() - h.Write([]byte(s)) - hash := hex.EncodeToString(h.Sum(nil)) - return hash, nil - }, - } -} - -func interpolationFuncMerge() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeMap}, - ReturnType: ast.TypeMap, - Variadic: true, - VariadicType: ast.TypeMap, - Callback: func(args []interface{}) (interface{}, error) { - outputMap := make(map[string]ast.Variable) - - for _, arg := range args { - for k, v := range arg.(map[string]ast.Variable) { - outputMap[k] = v - } - } - - return outputMap, nil - }, - } -} - -// interpolationFuncUpper implements the "upper" function that does -// string upper casing. -func interpolationFuncUpper() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - toUpper := args[0].(string) - return strings.ToUpper(toUpper), nil - }, - } -} - -func interpolationFuncSha1() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - h := sha1.New() - h.Write([]byte(s)) - hash := hex.EncodeToString(h.Sum(nil)) - return hash, nil - }, - } -} - -// hexadecimal representation of sha256 sum -func interpolationFuncSha256() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - h := sha256.New() - h.Write([]byte(s)) - hash := hex.EncodeToString(h.Sum(nil)) - return hash, nil - }, - } -} - -func interpolationFuncSha512() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - h := sha512.New() - h.Write([]byte(s)) - hash := hex.EncodeToString(h.Sum(nil)) - return hash, nil - }, - } -} - -func interpolationFuncTrimSpace() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - trimSpace := args[0].(string) - return strings.TrimSpace(trimSpace), nil - }, - } -} - -func interpolationFuncBase64Sha256() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - h := sha256.New() - h.Write([]byte(s)) - shaSum := h.Sum(nil) - encoded := base64.StdEncoding.EncodeToString(shaSum[:]) - return encoded, nil - }, - } -} - -func interpolationFuncBase64Sha512() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - h := sha512.New() - h.Write([]byte(s)) - shaSum := h.Sum(nil) - encoded := base64.StdEncoding.EncodeToString(shaSum[:]) - return encoded, nil - }, - } -} - -func interpolationFuncBcrypt() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - Variadic: true, - VariadicType: ast.TypeString, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - defaultCost := 10 - - if len(args) > 1 { - costStr := args[1].(string) - cost, err := strconv.Atoi(costStr) - if err != nil { - return "", err - } - - defaultCost = cost - } - - if len(args) > 2 { - return "", fmt.Errorf("bcrypt() takes no more than two arguments") - } - - input := args[0].(string) - out, err := bcrypt.GenerateFromPassword([]byte(input), defaultCost) - if err != nil { - return "", fmt.Errorf("error occured generating password %s", err.Error()) - } - - return string(out), nil - }, - } -} - -func interpolationFuncUUID() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return uuid.GenerateUUID() - }, - } -} - -// interpolationFuncTimestamp -func interpolationFuncTimestamp() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return time.Now().UTC().Format(time.RFC3339), nil - }, - } -} - -func interpolationFuncTimeAdd() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ - ast.TypeString, // input timestamp string in RFC3339 format - ast.TypeString, // duration to add to input timestamp that should be parsable by time.ParseDuration - }, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - - ts, err := time.Parse(time.RFC3339, args[0].(string)) - if err != nil { - return nil, err - } - duration, err := time.ParseDuration(args[1].(string)) - if err != nil { - return nil, err - } - - return ts.Add(duration).Format(time.RFC3339), nil - }, - } -} - -// interpolationFuncTitle implements the "title" function that returns a copy of the -// string in which first characters of all the words are capitalized. -func interpolationFuncTitle() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - toTitle := args[0].(string) - return strings.Title(toTitle), nil - }, - } -} - -// interpolationFuncSubstr implements the "substr" function that allows strings -// to be truncated. -func interpolationFuncSubstr() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ - ast.TypeString, // input string - ast.TypeInt, // offset - ast.TypeInt, // length - }, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - str := args[0].(string) - offset := args[1].(int) - length := args[2].(int) - - // Interpret a negative offset as being equivalent to a positive - // offset taken from the end of the string. - if offset < 0 { - offset += len(str) - } - - // Interpret a length of `-1` as indicating that the substring - // should start at `offset` and continue until the end of the - // string. Any other negative length (other than `-1`) is invalid. - if length == -1 { - length = len(str) - } else if length >= 0 { - length += offset - } else { - return nil, fmt.Errorf("length should be a non-negative integer") - } - - if offset > len(str) || offset < 0 { - return nil, fmt.Errorf("offset cannot be larger than the length of the string") - } - - if length > len(str) { - return nil, fmt.Errorf("'offset + length' cannot be larger than the length of the string") - } - - return str[offset:length], nil - }, - } -} - -// Flatten until it's not ast.TypeList -func flattener(finalList []ast.Variable, flattenList []ast.Variable) []ast.Variable { - for _, val := range flattenList { - if val.Type == ast.TypeList { - finalList = flattener(finalList, val.Value.([]ast.Variable)) - } else { - finalList = append(finalList, val) - } - } - return finalList -} - -// Flatten to single list -func interpolationFuncFlatten() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeList}, - ReturnType: ast.TypeList, - Variadic: false, - Callback: func(args []interface{}) (interface{}, error) { - inputList := args[0].([]ast.Variable) - - var outputList []ast.Variable - return flattener(outputList, inputList), nil - }, - } -} - -func interpolationFuncURLEncode() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - return url.QueryEscape(s), nil - }, - } -} - -// interpolationFuncTranspose implements the "transpose" function -// that converts a map (string,list) to a map (string,list) where -// the unique values of the original lists become the keys of the -// new map and the keys of the original map become values for the -// corresponding new keys. -func interpolationFuncTranspose() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeMap}, - ReturnType: ast.TypeMap, - Callback: func(args []interface{}) (interface{}, error) { - - inputMap := args[0].(map[string]ast.Variable) - outputMap := make(map[string]ast.Variable) - tmpMap := make(map[string][]string) - - for inKey, inVal := range inputMap { - if inVal.Type != ast.TypeList { - return nil, fmt.Errorf("transpose requires a map of lists of strings") - } - values := inVal.Value.([]ast.Variable) - for _, listVal := range values { - if listVal.Type != ast.TypeString { - return nil, fmt.Errorf("transpose requires the given map values to be lists of strings") - } - outKey := listVal.Value.(string) - if _, ok := tmpMap[outKey]; !ok { - tmpMap[outKey] = make([]string, 0) - } - outVal := tmpMap[outKey] - outVal = append(outVal, inKey) - sort.Strings(outVal) - tmpMap[outKey] = outVal - } - } - - for outKey, outVal := range tmpMap { - values := make([]ast.Variable, 0) - for _, v := range outVal { - values = append(values, ast.Variable{Type: ast.TypeString, Value: v}) - } - outputMap[outKey] = ast.Variable{Type: ast.TypeList, Value: values} - } - return outputMap, nil - }, - } -} - -// interpolationFuncAbs returns the absolute value of a given float. -func interpolationFuncAbs() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat}, - ReturnType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - return math.Abs(args[0].(float64)), nil - }, - } -} - -// interpolationFuncRsaDecrypt implements the "rsadecrypt" function that does -// RSA decryption. -func interpolationFuncRsaDecrypt() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString, ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - s := args[0].(string) - key := args[1].(string) - - b, err := base64.StdEncoding.DecodeString(s) - if err != nil { - return "", fmt.Errorf("Failed to decode input %q: cipher text must be base64-encoded", s) - } - - block, _ := pem.Decode([]byte(key)) - if block == nil { - return "", fmt.Errorf("Failed to read key %q: no key found", key) - } - if block.Headers["Proc-Type"] == "4,ENCRYPTED" { - return "", fmt.Errorf( - "Failed to read key %q: password protected keys are\n"+ - "not supported. Please decrypt the key prior to use.", key) - } - - x509Key, err := x509.ParsePKCS1PrivateKey(block.Bytes) - if err != nil { - return "", err - } - - out, err := rsa.DecryptPKCS1v15(nil, x509Key, b) - if err != nil { - return "", err - } - - return string(out), 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 f152d800..00000000 --- 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 890d30be..00000000 --- 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 612e25b9..00000000 --- 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 68cffe2c..00000000 --- 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 d6b7ac12..00000000 --- a/vendor/github.com/hashicorp/terraform/config/loader_hcl2.go +++ /dev/null @@ -1,473 +0,0 @@ -package config - -import ( - "fmt" - "sort" - "strings" - - gohcl2 "github.com/hashicorp/hcl2/gohcl" - hcl2 "github.com/hashicorp/hcl2/hcl" - hcl2parse "github.com/hashicorp/hcl2/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 55fc864f..00000000 --- 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 eeddabc3..00000000 --- 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 00fd43fc..00000000 --- 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 c5ac86d7..00000000 --- a/vendor/github.com/hashicorp/terraform/config/raw_config.go +++ /dev/null @@ -1,450 +0,0 @@ -package config - -import ( - "bytes" - "encoding/gob" - "errors" - "strconv" - "sync" - - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" - - hcl2 "github.com/hashicorp/hcl2/hcl" - "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 { - // HCL2 experiment path: using the HCL2 API via shims - // - // This path catches fewer situations because we have to assume all - // variables are entirely unknown in HCL2, rather than the assumption - // above that all variables can be numbers because names like "var.foo" - // are considered a single variable rather than an attribute access. - // This is fine in practice, because we get a definitive answer - // during the graph walk when we have real values to work with. - attrs, diags := r.Body.JustAttributes() - if diags.HasErrors() { - // This body is not just a single attribute with a value, so - // this can't be a number. - return false - } - attr, hasAttr := attrs[r.Key] - if !hasAttr { - return false - } - result, diags := hcl2EvalWithUnknownVars(attr.Expr) - if diags.HasErrors() { - // We'll conservatively assume that this error is a result of - // us not being ready to fully-populate the scope, and catch - // any further problems during the main graph walk. - return true - } - - // If the result is convertable to number then we'll allow it. - // We do this because an unknown string is optimistically convertable - // to number (might be "5") but a _known_ string "hello" is not. - _, err := convert.Convert(result, cty.Number) - return err == nil - } -} - -// 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. -func langEvalConfig(vs map[string]ast.Variable) *hil.EvalConfig { - funcMap := make(map[string]ast.Function) - for k, v := range Funcs() { - funcMap[k] = v - } - funcMap["lookup"] = interpolationFuncLookup(vs) - funcMap["keys"] = interpolationFuncKeys(vs) - funcMap["values"] = interpolationFuncValues(vs) - - 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 877c6e84..00000000 --- a/vendor/github.com/hashicorp/terraform/config/resource_mode.go +++ /dev/null @@ -1,9 +0,0 @@ -package config - -//go:generate 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 01052782..00000000 --- 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 831fc778..00000000 --- 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 75c7ef1f..00000000 --- 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 594cf640..00000000 --- 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/helper/hilmapstructure/hilmapstructure.go b/vendor/github.com/hashicorp/terraform/helper/hilmapstructure/hilmapstructure.go deleted file mode 100644 index 67be1df1..00000000 --- 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/plugin/grpc_provisioner.go b/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provisioner.go deleted file mode 100644 index 14494e46..00000000 --- a/vendor/github.com/hashicorp/terraform/helper/plugin/grpc_provisioner.go +++ /dev/null @@ -1,147 +0,0 @@ -package plugin - -import ( - "log" - - "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: s, - }) - 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 -} 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 eee155bf..00000000 --- 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 bb06beb4..00000000 --- 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 f0cc341f..00000000 --- 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/svchost/auth/from_map.go b/vendor/github.com/hashicorp/terraform/svchost/auth/from_map.go deleted file mode 100644 index 7198c674..00000000 --- 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 1d36553a..00000000 --- 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/oauth_client.go b/vendor/github.com/hashicorp/terraform/svchost/disco/oauth_client.go deleted file mode 100644 index 9308bbf7..00000000 --- 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/terraform/user_agent.go b/vendor/github.com/hashicorp/terraform/terraform/user_agent.go deleted file mode 100644 index 97f1ec1f..00000000 --- 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 0caeca0a..00000000 --- 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/mitchellh/hashstructure/LICENSE b/vendor/github.com/mitchellh/hashstructure/LICENSE deleted file mode 100644 index a3866a29..00000000 --- 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 28ce45a3..00000000 --- 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 966582aa..00000000 --- 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 ea13a158..00000000 --- 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 b6289c0b..00000000 --- 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/golang.org/x/tools/go/analysis/analysis.go b/vendor/golang.org/x/tools/go/analysis/analysis.go index e375484f..bc58c31c 100644 --- a/vendor/golang.org/x/tools/go/analysis/analysis.go +++ b/vendor/golang.org/x/tools/go/analysis/analysis.go @@ -128,11 +128,13 @@ type Pass struct { // See comments for ExportObjectFact. ExportPackageFact func(fact Fact) - // AllPackageFacts returns a new slice containing all package facts in unspecified order. + // AllPackageFacts returns a new slice containing all package facts of the analysis's FactTypes + // in unspecified order. // WARNING: This is an experimental API and may change in the future. AllPackageFacts func() []PackageFact - // AllObjectFacts returns a new slice containing all object facts in unspecified order. + // AllObjectFacts returns a new slice containing all object facts of the analysis's FactTypes + // in unspecified order. // WARNING: This is an experimental API and may change in the future. AllObjectFacts func() []ObjectFact diff --git a/vendor/golang.org/x/tools/go/analysis/diagnostic.go b/vendor/golang.org/x/tools/go/analysis/diagnostic.go index e7debe93..744072cd 100644 --- a/vendor/golang.org/x/tools/go/analysis/diagnostic.go +++ b/vendor/golang.org/x/tools/go/analysis/diagnostic.go @@ -1,5 +1,3 @@ -// +build !experimental - package analysis import "go/token" @@ -17,4 +15,34 @@ type Diagnostic struct { End token.Pos // optional Category string // optional Message string + + // SuggestedFixes contains suggested fixes for a diagnostic which can be used to perform + // edits to a file that address the diagnostic. + // TODO(matloob): Should multiple SuggestedFixes be allowed for a diagnostic? + // Diagnostics should not contain SuggestedFixes that overlap. + // Experimental: This API is experimental and may change in the future. + SuggestedFixes []SuggestedFix // optional +} + +// A SuggestedFix is a code change associated with a Diagnostic that a user can choose +// to apply to their code. Usually the SuggestedFix is meant to fix the issue flagged +// by the diagnostic. +// TextEdits for a SuggestedFix should not overlap. TextEdits for a SuggestedFix +// should not contain edits for other packages. +// Experimental: This API is experimental and may change in the future. +type SuggestedFix struct { + // A description for this suggested fix to be shown to a user deciding + // whether to accept it. + Message string + TextEdits []TextEdit +} + +// A TextEdit represents the replacement of the code between Pos and End with the new text. +// Each TextEdit should apply to a single file. End should not be earlier in the file than Pos. +// Experimental: This API is experimental and may change in the future. +type TextEdit struct { + // For a pure insertion, End can either be set to Pos or token.NoPos. + Pos token.Pos + End token.Pos + NewText []byte } diff --git a/vendor/golang.org/x/tools/go/analysis/diagnostic_experimental.go b/vendor/golang.org/x/tools/go/analysis/diagnostic_experimental.go deleted file mode 100644 index 2e9ebb20..00000000 --- a/vendor/golang.org/x/tools/go/analysis/diagnostic_experimental.go +++ /dev/null @@ -1,41 +0,0 @@ -// +build experimental - -package analysis - -import "go/token" - -// A Diagnostic is a message associated with a source location or range. -// -// An Analyzer may return a variety of diagnostics; the optional Category, -// which should be a constant, may be used to classify them. -// It is primarily intended to make it easy to look up documentation. -// -// If End is provided, the diagnostic is specified to apply to the range between -// Pos and End. -type Diagnostic struct { - Pos token.Pos - End token.Pos // optional - Category string // optional - Message string - - // TODO(matloob): Should multiple SuggestedFixes be allowed for a diagnostic? - SuggestedFixes []SuggestedFix // optional -} - -// A SuggestedFix is a code change associated with a Diagnostic that a user can choose -// to apply to their code. Usually the SuggestedFix is meant to fix the issue flagged -// by the diagnostic. -type SuggestedFix struct { - // A description for this suggested fix to be shown to a user deciding - // whether to accept it. - Message string - TextEdits []TextEdit -} - -// A TextEdit represents the replacement of the code between Pos and End with the new text. -type TextEdit struct { - // For a pure insertion, End can either be set to Pos or token.NoPos. - Pos token.Pos - End token.Pos - NewText []byte -} diff --git a/vendor/golang.org/x/tools/go/analysis/doc.go b/vendor/golang.org/x/tools/go/analysis/doc.go index 2d44b045..a2353fc8 100644 --- a/vendor/golang.org/x/tools/go/analysis/doc.go +++ b/vendor/golang.org/x/tools/go/analysis/doc.go @@ -67,7 +67,7 @@ To add a new Analyzer to an existing driver, add another item to the list: } A driver may use the name, flags, and documentation to provide on-line -help that describes the analyses its performs. +help that describes the analyses it performs. The doc comment contains a brief one-line summary, optionally followed by paragraphs of explanation. The vet command, shown below, is an example of a driver that runs @@ -169,7 +169,7 @@ type information, and source positions for a single package of Go code. The OtherFiles field provides the names, but not the contents, of non-Go files such as assembly that are part of this package. See the "asmdecl" -or "buildtags" analyzers for examples of loading non-Go files and report +or "buildtags" analyzers for examples of loading non-Go files and reporting diagnostics against them. The ResultOf field provides the results computed by the analyzers @@ -231,7 +231,7 @@ understood as alternative or non-standard type systems. For example, vet's printf checker infers whether a function has the "printf wrapper" type, and it applies stricter checks to calls of such functions. In addition, it records which functions are printf wrappers for use by -later analysis units to identify other printf wrappers by induction. +later analysis passes to identify other printf wrappers by induction. A result such as “f is a printf wrapper” that is not interesting by itself but serves as a stepping stone to an interesting result (such as a diagnostic) is called a "fact". @@ -252,9 +252,9 @@ An Analyzer that uses facts must declare their types: type isWrapper struct{} // => *types.Func f “is a printf wrapper” -A driver program ensures that facts for a pass’s dependencies are -generated before analyzing the pass and are responsible for propagating -facts between from one pass to another, possibly across address spaces. +The driver program ensures that facts for a pass’s dependencies are +generated before analyzing the package and is responsible for propagating +facts from one package to another, possibly across address spaces. Consequently, Facts must be serializable. The API requires that drivers use the gob encoding, an efficient, robust, self-describing binary protocol. A fact type may implement the GobEncoder/GobDecoder interfaces @@ -288,10 +288,10 @@ not currently apply analyzers to packages of the standard library. Therefore, for best results, analyzer authors should not rely on analysis facts being available for standard packages. For example, although the printf checker is capable of deducing during -analysis of the log package that log.Printf is a printf-wrapper, +analysis of the log package that log.Printf is a printf wrapper, this fact is built in to the analyzer so that it correctly checks calls to log.Printf even when run in a driver that does not apply -it to standard packages. We plan to remove this limitation in future. +it to standard packages. We would like to remove this limitation in future. Testing an Analyzer diff --git a/vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags.go b/vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags.go index a3c2f096..0778f422 100644 --- a/vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags.go +++ b/vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags.go @@ -168,10 +168,10 @@ func printFlags() { var flags []jsonFlag = nil flag.VisitAll(func(f *flag.Flag) { // Don't report {single,multi}checker debugging - // flags as these have no effect on unitchecker + // flags or fix as these have no effect on unitchecker // (as invoked by 'go vet'). switch f.Name { - case "debug", "cpuprofile", "memprofile", "trace": + case "debug", "cpuprofile", "memprofile", "trace", "fix": return } @@ -209,7 +209,7 @@ func (versionFlag) Set(s string) error { log.Fatalf("unsupported flag value: -V=%s", s) } - // This replicates the miminal subset of + // This replicates the minimal subset of // cmd/internal/objabi.AddVersionFlag, which is private to the // go tool yet forms part of our command-line interface. // TODO(adonovan): clarify the contract. diff --git a/vendor/golang.org/x/tools/go/analysis/internal/checker/checker.go b/vendor/golang.org/x/tools/go/analysis/internal/checker/checker.go index e3b05066..8802e9a8 100644 --- a/vendor/golang.org/x/tools/go/analysis/internal/checker/checker.go +++ b/vendor/golang.org/x/tools/go/analysis/internal/checker/checker.go @@ -15,6 +15,7 @@ import ( "fmt" "go/token" "go/types" + "io/ioutil" "log" "os" "reflect" @@ -44,6 +45,9 @@ var ( // Log files for optional performance tracing. CPUProfile, MemProfile, Trace string + + // Fix determines whether to apply all suggested fixes. + Fix bool ) // RegisterFlags registers command-line flags used by the analysis driver. @@ -56,6 +60,8 @@ func RegisterFlags() { flag.StringVar(&CPUProfile, "cpuprofile", "", "write CPU profile to this file") flag.StringVar(&MemProfile, "memprofile", "", "write memory profile to this file") flag.StringVar(&Trace, "trace", "", "write trace log to this file") + + flag.BoolVar(&Fix, "fix", false, "apply all suggested fixes") } // Run loads the packages specified by args using go/packages, @@ -126,6 +132,10 @@ func Run(args []string, analyzers []*analysis.Analyzer) (exitcode int) { // Print the results. roots := analyze(initial, analyzers) + if Fix { + applyFixes(roots) + } + return printDiagnostics(roots) } @@ -250,6 +260,125 @@ func analyze(pkgs []*packages.Package, analyzers []*analysis.Analyzer) []*action return roots } +func applyFixes(roots []*action) { + visited := make(map[*action]bool) + var apply func(*action) error + var visitAll func(actions []*action) error + visitAll = func(actions []*action) error { + for _, act := range actions { + if !visited[act] { + visited[act] = true + visitAll(act.deps) + if err := apply(act); err != nil { + return err + } + } + } + return nil + } + + // TODO(matloob): Is this tree business too complicated? (After all this is Go!) + // Just create a set (map) of edits, sort by pos and call it a day? + type offsetedit struct { + start, end int + newText []byte + } // TextEdit using byteOffsets instead of pos + type node struct { + edit offsetedit + left, right *node + } + + var insert func(tree **node, edit offsetedit) error + insert = func(treeptr **node, edit offsetedit) error { + if *treeptr == nil { + *treeptr = &node{edit, nil, nil} + return nil + } + tree := *treeptr + if edit.end <= tree.edit.start { + return insert(&tree.left, edit) + } else if edit.start >= tree.edit.end { + return insert(&tree.right, edit) + } + + // Overlapping text edit. + return fmt.Errorf("analyses applying overlapping text edits affecting pos range (%v, %v) and (%v, %v)", + edit.start, edit.end, tree.edit.start, tree.edit.end) + + } + + editsForFile := make(map[*token.File]*node) + + apply = func(act *action) error { + for _, diag := range act.diagnostics { + for _, sf := range diag.SuggestedFixes { + for _, edit := range sf.TextEdits { + // Validate the edit. + if edit.Pos > edit.End { + return fmt.Errorf( + "diagnostic for analysis %v contains Suggested Fix with malformed edit: pos (%v) > end (%v)", + act.a.Name, edit.Pos, edit.End) + } + file, endfile := act.pkg.Fset.File(edit.Pos), act.pkg.Fset.File(edit.End) + if file == nil || endfile == nil || file != endfile { + return (fmt.Errorf( + "diagnostic for analysis %v contains Suggested Fix with malformed spanning files %v and %v", + act.a.Name, file.Name(), endfile.Name())) + } + start, end := file.Offset(edit.Pos), file.Offset(edit.End) + + // TODO(matloob): Validate that edits do not affect other packages. + root := editsForFile[file] + if err := insert(&root, offsetedit{start, end, edit.NewText}); err != nil { + return err + } + editsForFile[file] = root // In case the root changed + } + } + } + return nil + } + + visitAll(roots) + + // Now we've got a set of valid edits for each file. Get the new file contents. + for f, tree := range editsForFile { + contents, err := ioutil.ReadFile(f.Name()) + if err != nil { + log.Fatal(err) + } + + cur := 0 // current position in the file + + var out bytes.Buffer + + var recurse func(*node) + recurse = func(node *node) { + if node.left != nil { + recurse(node.left) + } + + edit := node.edit + if edit.start > cur { + out.Write(contents[cur:edit.start]) + out.Write(edit.newText) + } + cur = edit.end + + if node.right != nil { + recurse(node.right) + } + } + recurse(tree) + // Write out the rest of the file. + if cur < len(contents) { + out.Write(contents[cur:]) + } + + ioutil.WriteFile(f.Name(), out.Bytes(), 0644) + } +} + // printDiagnostics prints the diagnostics for the root packages in either // plain text or JSON format. JSON format also includes errors for any // dependencies. @@ -328,7 +457,7 @@ func printDiagnostics(roots []*action) (exitcode int) { visitAll(roots) if exitcode == 0 && len(seen) > 0 { - exitcode = 3 // successfuly produced diagnostics + exitcode = 3 // successfully produced diagnostics } } diff --git a/vendor/golang.org/x/tools/go/analysis/internal/facts/facts.go b/vendor/golang.org/x/tools/go/analysis/internal/facts/facts.go index 468f1489..bcc6bd8e 100644 --- a/vendor/golang.org/x/tools/go/analysis/internal/facts/facts.go +++ b/vendor/golang.org/x/tools/go/analysis/internal/facts/facts.go @@ -29,7 +29,7 @@ // The notion of "exportedness" that matters here is that of the // compiler. According to the language spec, a method pkg.T.f is // unexported simply because its name starts with lowercase. But the -// compiler must nonethless export f so that downstream compilations can +// compiler must nonetheless export f so that downstream compilations can // accurately ascertain whether pkg.T implements an interface pkg.I // defined as interface{f()}. Exported thus means "described in export // data". @@ -99,6 +99,16 @@ func (s *Set) ExportObjectFact(obj types.Object, fact analysis.Fact) { s.mu.Unlock() } +func (s *Set) AllObjectFacts(filter map[reflect.Type]bool) []analysis.ObjectFact { + var facts []analysis.ObjectFact + for k, v := range s.m { + if k.obj != nil && filter[k.t] { + facts = append(facts, analysis.ObjectFact{k.obj, v}) + } + } + return facts +} + // ImportPackageFact implements analysis.Pass.ImportPackageFact. func (s *Set) ImportPackageFact(pkg *types.Package, ptr analysis.Fact) bool { if pkg == nil { @@ -122,6 +132,16 @@ func (s *Set) ExportPackageFact(fact analysis.Fact) { s.mu.Unlock() } +func (s *Set) AllPackageFacts(filter map[reflect.Type]bool) []analysis.PackageFact { + var facts []analysis.PackageFact + for k, v := range s.m { + if k.obj == nil && filter[k.t] { + facts = append(facts, analysis.PackageFact{k.pkg, v}) + } + } + return facts +} + // gobFact is the Gob declaration of a serialized fact. type gobFact struct { PkgPath string // path of package diff --git a/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go b/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go index ba2e66fe..2ed27494 100644 --- a/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go +++ b/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go @@ -42,6 +42,7 @@ import ( "log" "os" "path/filepath" + "reflect" "sort" "strings" "sync" @@ -322,6 +323,11 @@ func run(fset *token.FileSet, cfg *Config, analyzers []*analysis.Analyzer) ([]re return } + factFilter := make(map[reflect.Type]bool) + for _, f := range a.FactTypes { + factFilter[reflect.TypeOf(f)] = true + } + pass := &analysis.Pass{ Analyzer: a, Fset: fset, @@ -334,8 +340,10 @@ func run(fset *token.FileSet, cfg *Config, analyzers []*analysis.Analyzer) ([]re Report: func(d analysis.Diagnostic) { act.diagnostics = append(act.diagnostics, d) }, ImportObjectFact: facts.ImportObjectFact, ExportObjectFact: facts.ExportObjectFact, + AllObjectFacts: func() []analysis.ObjectFact { return facts.AllObjectFacts(factFilter) }, ImportPackageFact: facts.ImportPackageFact, ExportPackageFact: facts.ExportPackageFact, + AllPackageFacts: func() []analysis.PackageFact { return facts.AllPackageFacts(factFilter) }, } t0 := time.Now() diff --git a/vendor/golang.org/x/tools/go/analysis/validate.go b/vendor/golang.org/x/tools/go/analysis/validate.go index 6e6cf498..b984ab6c 100644 --- a/vendor/golang.org/x/tools/go/analysis/validate.go +++ b/vendor/golang.org/x/tools/go/analysis/validate.go @@ -10,7 +10,7 @@ import ( // Checks include: // that the name is a valid identifier; // that analyzer names are unique; -// that the Requires graph is acylic; +// that the Requires graph is acyclic; // that analyzer fact types are unique; // that each fact type is a pointer. func Validate(analyzers []*Analyzer) error { diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go index e3c31078..3288a0bf 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go @@ -976,10 +976,11 @@ const ( aliasTag ) +var predeclOnce sync.Once var predecl []types.Type // initialized lazily func predeclared() []types.Type { - if predecl == nil { + predeclOnce.Do(func() { // initialize lazily to be sure that all // elements have been initialized before predecl = []types.Type{ // basic types @@ -1026,7 +1027,7 @@ func predeclared() []types.Type { // used internally by gc; never used by this package or in .a files anyType{}, } - } + }) return predecl } diff --git a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go index fdc7da05..ea15d57b 100644 --- a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go +++ b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go @@ -82,15 +82,28 @@ func GetSizesGolist(ctx context.Context, buildFlags, env []string, dir string, u args = append(args, buildFlags...) args = append(args, "--", "unsafe") stdout, err := InvokeGo(ctx, env, dir, usesExportData, args...) + var goarch, compiler string if err != nil { - return nil, err - } - fields := strings.Fields(stdout.String()) - if len(fields) < 2 { - return nil, fmt.Errorf("could not determine GOARCH and Go compiler") + if strings.Contains(err.Error(), "cannot find main module") { + // User's running outside of a module. All bets are off. Get GOARCH and guess compiler is gc. + // TODO(matloob): Is this a problem in practice? + envout, enverr := InvokeGo(ctx, env, dir, usesExportData, "env", "GOARCH") + if enverr != nil { + return nil, err + } + goarch = strings.TrimSpace(envout.String()) + compiler = "gc" + } else { + return nil, err + } + } else { + fields := strings.Fields(stdout.String()) + if len(fields) < 2 { + return nil, fmt.Errorf("could not determine GOARCH and Go compiler") + } + goarch = fields[0] + compiler = fields[1] } - goarch := fields[0] - compiler := fields[1] return types.SizesFor(compiler, goarch), nil } diff --git a/vendor/golang.org/x/tools/go/packages/external.go b/vendor/golang.org/x/tools/go/packages/external.go index 22ff769e..b696b687 100644 --- a/vendor/golang.org/x/tools/go/packages/external.go +++ b/vendor/golang.org/x/tools/go/packages/external.go @@ -16,14 +16,29 @@ import ( "strings" ) -// Driver +// The Driver Protocol +// +// The driver, given the inputs to a call to Load, returns metadata about the packages specified. +// This allows for different build systems to support go/packages by telling go/packages how the +// packages' source is organized. +// The driver is a binary, either specified by the GOPACKAGESDRIVER environment variable or in +// the path as gopackagesdriver. It's given the inputs to load in its argv. See the package +// documentation in doc.go for the full description of the patterns that need to be supported. +// A driver receives as a JSON-serialized driverRequest struct in standard input and will +// produce a JSON-serialized driverResponse (see definition in packages.go) in its standard output. + +// driverRequest is used to provide the portion of Load's Config that is needed by a driver. type driverRequest struct { - Command string `json:"command"` - Mode LoadMode `json:"mode"` - Env []string `json:"env"` - BuildFlags []string `json:"build_flags"` - Tests bool `json:"tests"` - Overlay map[string][]byte `json:"overlay"` + Mode LoadMode `json:"mode"` + // Env specifies the environment the underlying build system should be run in. + Env []string `json:"env"` + // BuildFlags are flags that should be passed to the underlying build system. + BuildFlags []string `json:"build_flags"` + // Tests specifies whether the patterns should also return test packages. + Tests bool `json:"tests"` + // Overlay maps file paths (relative to the driver's working directory) to the byte contents + // of overlay files. + Overlay map[string][]byte `json:"overlay"` } // findExternalDriver returns the file path of a tool that supplies diff --git a/vendor/golang.org/x/tools/go/packages/golist.go b/vendor/golang.org/x/tools/go/packages/golist.go index 00e21a75..6b341b7e 100644 --- a/vendor/golang.org/x/tools/go/packages/golist.go +++ b/vendor/golang.org/x/tools/go/packages/golist.go @@ -13,6 +13,7 @@ import ( "log" "os" "os/exec" + "path" "path/filepath" "reflect" "regexp" @@ -20,6 +21,7 @@ import ( "strings" "sync" "time" + "unicode" "golang.org/x/tools/go/internal/packagesdriver" "golang.org/x/tools/internal/gopathwalk" @@ -71,6 +73,28 @@ func (r *responseDeduper) addRoot(id string) { r.dr.Roots = append(r.dr.Roots, id) } +// goInfo contains global information from the go tool. +type goInfo struct { + rootDirs map[string]string + env goEnv +} + +type goEnv struct { + modulesOn bool +} + +func determineEnv(cfg *Config) goEnv { + buf, err := invokeGo(cfg, "env", "GOMOD") + if err != nil { + return goEnv{} + } + gomod := bytes.TrimSpace(buf.Bytes()) + + env := goEnv{} + env.modulesOn = len(gomod) > 0 + return env +} + // goListDriver uses the go list command to interpret the patterns and produce // the build system package structure. // See driver for more details. @@ -86,6 +110,28 @@ func goListDriver(cfg *Config, patterns ...string) (*driverResponse, error) { }() } + // start fetching rootDirs + var info goInfo + var rootDirsReady, envReady = make(chan struct{}), make(chan struct{}) + go func() { + info.rootDirs = determineRootDirs(cfg) + close(rootDirsReady) + }() + go func() { + info.env = determineEnv(cfg) + close(envReady) + }() + getGoInfo := func() *goInfo { + <-rootDirsReady + <-envReady + return &info + } + + // always pass getGoInfo to golistDriver + golistDriver := func(cfg *Config, patterns ...string) (*driverResponse, error) { + return golistDriver(cfg, getGoInfo, patterns...) + } + // Determine files requested in contains patterns var containFiles []string var packagesNamed []string @@ -147,7 +193,7 @@ extractQueries: var containsCandidates []string if len(containFiles) != 0 { - if err := runContainsQueries(cfg, golistDriver, response, containFiles); err != nil { + if err := runContainsQueries(cfg, golistDriver, response, containFiles, getGoInfo); err != nil { return nil, err } } @@ -158,7 +204,7 @@ extractQueries: } } - modifiedPkgs, needPkgs, err := processGolistOverlay(cfg, response) + modifiedPkgs, needPkgs, err := processGolistOverlay(cfg, response, getGoInfo) if err != nil { return nil, err } @@ -166,7 +212,7 @@ extractQueries: containsCandidates = append(containsCandidates, modifiedPkgs...) containsCandidates = append(containsCandidates, needPkgs...) } - if err := addNeededOverlayPackages(cfg, golistDriver, response, needPkgs); err != nil { + if err := addNeededOverlayPackages(cfg, golistDriver, response, needPkgs, getGoInfo); err != nil { return nil, err } // Check candidate packages for containFiles. @@ -198,28 +244,33 @@ extractQueries: return response.dr, nil } -func addNeededOverlayPackages(cfg *Config, driver driver, response *responseDeduper, pkgs []string) error { +func addNeededOverlayPackages(cfg *Config, driver driver, response *responseDeduper, pkgs []string, getGoInfo func() *goInfo) error { if len(pkgs) == 0 { return nil } - dr, err := driver(cfg, pkgs...) + drivercfg := *cfg + if getGoInfo().env.modulesOn { + drivercfg.BuildFlags = append(drivercfg.BuildFlags, "-mod=readonly") + } + dr, err := driver(&drivercfg, pkgs...) + if err != nil { return err } for _, pkg := range dr.Packages { response.addPackage(pkg) } - _, needPkgs, err := processGolistOverlay(cfg, response) + _, needPkgs, err := processGolistOverlay(cfg, response, getGoInfo) if err != nil { return err } - if err := addNeededOverlayPackages(cfg, driver, response, needPkgs); err != nil { + if err := addNeededOverlayPackages(cfg, driver, response, needPkgs, getGoInfo); err != nil { return err } return nil } -func runContainsQueries(cfg *Config, driver driver, response *responseDeduper, queries []string) error { +func runContainsQueries(cfg *Config, driver driver, response *responseDeduper, queries []string, goInfo func() *goInfo) error { for _, query := range queries { // TODO(matloob): Do only one query per directory. fdir := filepath.Dir(query) @@ -240,6 +291,21 @@ func runContainsQueries(cfg *Config, driver driver, response *responseDeduper, q // Return the original error if the attempt to fall back failed. return err } + // Special case to handle issue #33482: + // If this is a file= query for ad-hoc packages where the file only exists on an overlay, + // and exists outside of a module, add the file in for the package. + if len(dirResponse.Packages) == 1 && len(dirResponse.Packages) == 1 && + dirResponse.Packages[0].ID == "command-line-arguments" && len(dirResponse.Packages[0].GoFiles) == 0 { + filename := filepath.Join(pattern, filepath.Base(query)) // avoid recomputing abspath + // TODO(matloob): check if the file is outside of a root dir? + for path := range cfg.Overlay { + if path == filename { + dirResponse.Packages[0].Errors = nil + dirResponse.Packages[0].GoFiles = []string{path} + dirResponse.Packages[0].CompiledGoFiles = []string{path} + } + } + } } isRoot := make(map[string]bool, len(dirResponse.Roots)) for _, root := range dirResponse.Roots { @@ -316,9 +382,7 @@ func runNamedQueries(cfg *Config, driver driver, response *responseDeduper, quer startWalk := time.Now() gopathwalk.Walk(roots, add, gopathwalk.Options{ModulesEnabled: modRoot != "", Debug: debug}) - if debug { - log.Printf("%v for walk", time.Since(startWalk)) - } + cfg.Logf("%v for walk", time.Since(startWalk)) // Weird special case: the top-level package in a module will be in // whatever directory the user checked the repository out into. It's @@ -569,7 +633,7 @@ func otherFiles(p *jsonPackage) [][]string { // golistDriver uses the "go list" command to expand the pattern // words and return metadata for the specified packages. dir may be // "" and env may be nil, as per os/exec.Command. -func golistDriver(cfg *Config, words ...string) (*driverResponse, error) { +func golistDriver(cfg *Config, rootsDirs func() *goInfo, words ...string) (*driverResponse, error) { // go list uses the following identifiers in ImportPath and Imports: // // "p" -- importable package or main (command) @@ -610,6 +674,20 @@ func golistDriver(cfg *Config, words ...string) (*driverResponse, error) { return nil, fmt.Errorf("package missing import path: %+v", p) } + // Work around https://golang.org/issue/33157: + // go list -e, when given an absolute path, will find the package contained at + // that directory. But when no package exists there, it will return a fake package + // with an error and the ImportPath set to the absolute path provided to go list. + // Try to convert that absolute path to what its package path would be if it's + // contained in a known module or GOPATH entry. This will allow the package to be + // properly "reclaimed" when overlays are processed. + if filepath.IsAbs(p.ImportPath) && p.Error != nil { + pkgPath, ok := getPkgPath(p.ImportPath, rootsDirs) + if ok { + p.ImportPath = pkgPath + } + } + if old, found := seen[p.ImportPath]; found { if !reflect.DeepEqual(p, old) { return nil, fmt.Errorf("internal error: go list gives conflicting information for package %v", p.ImportPath) @@ -713,6 +791,27 @@ func golistDriver(cfg *Config, words ...string) (*driverResponse, error) { return &response, nil } +// getPkgPath finds the package path of a directory if it's relative to a root directory. +func getPkgPath(dir string, goInfo func() *goInfo) (string, bool) { + for rdir, rpath := range goInfo().rootDirs { + // TODO(matloob): This doesn't properly handle symlinks. + r, err := filepath.Rel(rdir, dir) + if err != nil { + continue + } + if rpath != "" { + // We choose only ore root even though the directory even it can belong in multiple modules + // or GOPATH entries. This is okay because we only need to work with absolute dirs when a + // file is missing from disk, for instance when gopls calls go/packages in an overlay. + // Once the file is saved, gopls, or the next invocation of the tool will get the correct + // result straight from golist. + // TODO(matloob): Implement module tiebreaking? + return path.Join(rpath, filepath.ToSlash(r)), true + } + } + return "", false +} + // absJoin absolutizes and flattens the lists of files. func absJoin(dir string, fileses ...[]string) (res []string) { for _, files := range fileses { @@ -733,7 +832,7 @@ func golistargs(cfg *Config, words []string) []string { fmt.Sprintf("-compiled=%t", cfg.Mode&(NeedCompiledGoFiles|NeedSyntax|NeedTypesInfo|NeedTypesSizes) != 0), fmt.Sprintf("-test=%t", cfg.Tests), fmt.Sprintf("-export=%t", usesExportData(cfg)), - fmt.Sprintf("-deps=%t", cfg.Mode&NeedDeps != 0), + fmt.Sprintf("-deps=%t", cfg.Mode&NeedImports != 0), // go list doesn't let you pass -test and -find together, // probably because you'd just get the TestMain. fmt.Sprintf("-find=%t", !cfg.Tests && cfg.Mode&findFlags == 0), @@ -759,11 +858,9 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { cmd.Dir = cfg.Dir cmd.Stdout = stdout cmd.Stderr = stderr - if debug { - defer func(start time.Time) { - log.Printf("%s for %v, stderr: <<%s>>\n", time.Since(start), cmdDebugStr(cmd, args...), stderr) - }(time.Now()) - } + defer func(start time.Time) { + cfg.Logf("%s for %v, stderr: <<%s>>\n", time.Since(start), cmdDebugStr(cmd, args...), stderr) + }(time.Now()) if err := cmd.Run(); err != nil { // Check for 'go' executable not being found. @@ -783,6 +880,30 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { return nil, goTooOldError{fmt.Errorf("unsupported version of go: %s: %s", exitErr, stderr)} } + // Related to #24854 + if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "unexpected directory layout") { + return nil, fmt.Errorf("%s", stderr.String()) + } + + // Is there an error running the C compiler in cgo? This will be reported in the "Error" field + // and should be suppressed by go list -e. + // + // This condition is not perfect yet because the error message can include other error messages than runtime/cgo. + isPkgPathRune := func(r rune) bool { + // From https://golang.org/ref/spec#Import_declarations: + // Implementation restriction: A compiler may restrict ImportPaths to non-empty strings + // using only characters belonging to Unicode's L, M, N, P, and S general categories + // (the Graphic characters without spaces) and may also exclude the + // characters !"#$%&'()*,:;<=>?[\]^`{|} and the Unicode replacement character U+FFFD. + return unicode.IsOneOf([]*unicode.RangeTable{unicode.L, unicode.M, unicode.N, unicode.P, unicode.S}, r) && + strings.IndexRune("!\"#$%&'()*,:;<=>?[\\]^`{|}\uFFFD", r) == -1 + } + if len(stderr.String()) > 0 && strings.HasPrefix(stderr.String(), "# ") { + if strings.HasPrefix(strings.TrimLeftFunc(stderr.String()[len("# "):], isPkgPathRune), "\n") { + return stdout, nil + } + } + // This error only appears in stderr. See golang.org/cl/166398 for a fix in go list to show // the error in the Err section of stdout in case -e option is provided. // This fix is provided for backwards compatibility. @@ -792,13 +913,43 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { return bytes.NewBufferString(output), nil } + // Similar to the previous error, but currently lacks a fix in Go. + if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "named files must all be in one directory") { + output := fmt.Sprintf(`{"ImportPath": "command-line-arguments","Incomplete": true,"Error": {"Pos": "","Err": %q}}`, + strings.Trim(stderr.String(), "\n")) + return bytes.NewBufferString(output), nil + } + + // Backwards compatibility for Go 1.11 because 1.12 and 1.13 put the directory in the ImportPath. + // If the package doesn't exist, put the absolute path of the directory into the error message, + // as Go 1.13 list does. + const noSuchDirectory = "no such directory" + if len(stderr.String()) > 0 && strings.Contains(stderr.String(), noSuchDirectory) { + errstr := stderr.String() + abspath := strings.TrimSpace(errstr[strings.Index(errstr, noSuchDirectory)+len(noSuchDirectory):]) + output := fmt.Sprintf(`{"ImportPath": %q,"Incomplete": true,"Error": {"Pos": "","Err": %q}}`, + abspath, strings.Trim(stderr.String(), "\n")) + return bytes.NewBufferString(output), nil + } + // Workaround for #29280: go list -e has incorrect behavior when an ad-hoc package doesn't exist. + // Note that the error message we look for in this case is different that the one looked for above. if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "no such file or directory") { output := fmt.Sprintf(`{"ImportPath": "command-line-arguments","Incomplete": true,"Error": {"Pos": "","Err": %q}}`, strings.Trim(stderr.String(), "\n")) return bytes.NewBufferString(output), nil } + // Workaround for #34273. go list -e with GO111MODULE=on has incorrect behavior when listing a + // directory outside any module. + if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "outside available modules") { + output := fmt.Sprintf(`{"ImportPath": %q,"Incomplete": true,"Error": {"Pos": "","Err": %q}}`, + // TODO(matloob): command-line-arguments isn't correct here. + "command-line-arguments", strings.Trim(stderr.String(), "\n")) + return bytes.NewBufferString(output), nil + + } + // Workaround for an instance of golang.org/issue/26755: go list -e will return a non-zero exit // status if there's a dependency on a package that doesn't exist. But it should return // a zero exit status and set an error on that package. diff --git a/vendor/golang.org/x/tools/go/packages/golist_overlay.go b/vendor/golang.org/x/tools/go/packages/golist_overlay.go index ffc7a367..308e79c5 100644 --- a/vendor/golang.org/x/tools/go/packages/golist_overlay.go +++ b/vendor/golang.org/x/tools/go/packages/golist_overlay.go @@ -10,7 +10,6 @@ import ( "path/filepath" "strconv" "strings" - "sync" ) // processGolistOverlay provides rudimentary support for adding @@ -18,7 +17,7 @@ import ( // sometimes incorrect. // TODO(matloob): Handle unsupported cases, including the following: // - determining the correct package to add given a new import path -func processGolistOverlay(cfg *Config, response *responseDeduper) (modifiedPkgs, needPkgs []string, err error) { +func processGolistOverlay(cfg *Config, response *responseDeduper, rootDirs func() *goInfo) (modifiedPkgs, needPkgs []string, err error) { havePkgs := make(map[string]string) // importPath -> non-test package ID needPkgsSet := make(map[string]bool) modifiedPkgsSet := make(map[string]bool) @@ -29,9 +28,6 @@ func processGolistOverlay(cfg *Config, response *responseDeduper) (modifiedPkgs, havePkgs[pkg.PkgPath] = pkg.ID } - var rootDirs map[string]string - var onceGetRootDirs sync.Once - // If no new imports are added, it is safe to avoid loading any needPkgs. // Otherwise, it's hard to tell which package is actually being loaded // (due to vendoring) and whether any modified package will show up @@ -42,10 +38,10 @@ func processGolistOverlay(cfg *Config, response *responseDeduper) (modifiedPkgs, for opath, contents := range cfg.Overlay { base := filepath.Base(opath) dir := filepath.Dir(opath) - var pkg *Package + var pkg *Package // if opath belongs to both a package and its test variant, this will be the test variant var testVariantOf *Package // if opath is a test file, this is the package it is testing var fileExists bool - isTest := strings.HasSuffix(opath, "_test.go") + isTestFile := strings.HasSuffix(opath, "_test.go") pkgName, ok := extractPackageName(opath, contents) if !ok { // Don't bother adding a file that doesn't even have a parsable package statement @@ -54,20 +50,33 @@ func processGolistOverlay(cfg *Config, response *responseDeduper) (modifiedPkgs, } nextPackage: for _, p := range response.dr.Packages { - if pkgName != p.Name { + if pkgName != p.Name && p.ID != "command-line-arguments" { continue } for _, f := range p.GoFiles { if !sameFile(filepath.Dir(f), dir) { continue } - if isTest && !hasTestFiles(p) { + // Make sure to capture information on the package's test variant, if needed. + if isTestFile && !hasTestFiles(p) { // TODO(matloob): Are there packages other than the 'production' variant // of a package that this can match? This shouldn't match the test main package // because the file is generated in another directory. testVariantOf = p continue nextPackage } + if pkg != nil && p != pkg && pkg.PkgPath == p.PkgPath { + // If we've already seen the test variant, + // make sure to label which package it is a test variant of. + if hasTestFiles(pkg) { + testVariantOf = p + continue nextPackage + } + // If we have already seen the package of which this is a test variant. + if hasTestFiles(p) { + testVariantOf = pkg + } + } pkg = p if filepath.Base(f) == base { fileExists = true @@ -76,13 +85,10 @@ func processGolistOverlay(cfg *Config, response *responseDeduper) (modifiedPkgs, } // The overlay could have included an entirely new package. if pkg == nil { - onceGetRootDirs.Do(func() { - rootDirs = determineRootDirs(cfg) - }) // Try to find the module or gopath dir the file is contained in. // Then for modules, add the module opath to the beginning. var pkgPath string - for rdir, rpath := range rootDirs { + for rdir, rpath := range rootDirs().rootDirs { // TODO(matloob): This doesn't properly handle symlinks. r, err := filepath.Rel(rdir, dir) if err != nil { @@ -106,7 +112,7 @@ func processGolistOverlay(cfg *Config, response *responseDeduper) (modifiedPkgs, pkgPath += "_test" } id := pkgPath - if isTest && !isXTest { + if isTestFile && !isXTest { id = fmt.Sprintf("%s [%s.test]", pkgPath, pkgPath) } // Try to reclaim a package with the same id if it exists in the response. @@ -122,7 +128,7 @@ func processGolistOverlay(cfg *Config, response *responseDeduper) (modifiedPkgs, response.addPackage(pkg) havePkgs[pkg.PkgPath] = id // Add the production package's sources for a test variant. - if isTest && !isXTest && testVariantOf != nil { + if isTestFile && !isXTest && testVariantOf != nil { pkg.GoFiles = append(pkg.GoFiles, testVariantOf.GoFiles...) pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, testVariantOf.CompiledGoFiles...) } @@ -145,12 +151,16 @@ func processGolistOverlay(cfg *Config, response *responseDeduper) (modifiedPkgs, if !found { overlayAddsImports = true // TODO(matloob): Handle cases when the following block isn't correct. - // These include imports of test variants, imports of vendored packages, etc. + // These include imports of vendored packages, etc. id, ok := havePkgs[imp] if !ok { id = imp } pkg.Imports[imp] = &Package{ID: id} + // Add dependencies to the non-test variant version of this package as wel. + if testVariantOf != nil { + testVariantOf.Imports[imp] = &Package{ID: id} + } } } continue diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go index f20e444f..50b93c85 100644 --- a/vendor/golang.org/x/tools/go/packages/packages.go +++ b/vendor/golang.org/x/tools/go/packages/packages.go @@ -48,8 +48,7 @@ const ( // "placeholder" Packages with only the ID set. NeedImports - // NeedDeps adds the fields requested by the LoadMode in the packages in Imports. If NeedImports - // is not set NeedDeps has no effect. + // NeedDeps adds the fields requested by the LoadMode in the packages in Imports. NeedDeps // NeedExportsFile adds ExportsFile. @@ -75,7 +74,7 @@ const ( // Deprecated: LoadImports exists for historical compatibility // and should not be used. Please directly specify the needed fields using the Need values. - LoadImports = LoadFiles | NeedImports | NeedDeps + LoadImports = LoadFiles | NeedImports // Deprecated: LoadTypes exists for historical compatibility // and should not be used. Please directly specify the needed fields using the Need values. @@ -87,7 +86,7 @@ const ( // Deprecated: LoadAllSyntax exists for historical compatibility // and should not be used. Please directly specify the needed fields using the Need values. - LoadAllSyntax = LoadSyntax + LoadAllSyntax = LoadSyntax | NeedDeps ) // A Config specifies details about how packages should be loaded. @@ -103,6 +102,12 @@ type Config struct { // If Context is nil, the load cannot be cancelled. Context context.Context + // Logf is the logger for the config. + // If the user provides a logger, debug logging is enabled. + // If the GOPACKAGESDEBUG environment variable is set to true, + // but the logger is nil, default to log.Printf. + Logf func(format string, args ...interface{}) + // Dir is the directory in which to run the build system's query tool // that provides information about the packages. // If Dir is empty, the tool is run in the current directory. @@ -410,11 +415,13 @@ type loader struct { parseCacheMu sync.Mutex exportMu sync.Mutex // enforces mutual exclusion of exportdata operations - // TODO(matloob): Add an implied mode here and use that instead of mode. - // Implied mode would contain all the fields we need the data for so we can - // get the actually requested fields. We'll zero them out before returning - // packages to the user. This will make it easier for us to get the conditions - // where we need certain modes right. + // Config.Mode contains the implied mode (see impliedLoadMode). + // Implied mode contains all the fields we need the data for. + // In requestedMode there are the actually requested fields. + // We'll zero them out before returning packages to the user. + // This makes it easier for us to get the conditions where + // we need certain modes right. + requestedMode LoadMode } type parseValue struct { @@ -429,6 +436,17 @@ func newLoader(cfg *Config) *loader { } if cfg != nil { ld.Config = *cfg + // If the user has provided a logger, use it. + ld.Config.Logf = cfg.Logf + } + if ld.Config.Logf == nil { + // If the GOPACKAGESDEBUG environment variable is set to true, + // but the user has not provided a logger, default to log.Printf. + if debug { + ld.Config.Logf = log.Printf + } else { + ld.Config.Logf = func(format string, args ...interface{}) {} + } } if ld.Config.Mode == 0 { ld.Config.Mode = NeedName | NeedFiles | NeedCompiledGoFiles // Preserve zero behavior of Mode for backwards compatibility. @@ -445,6 +463,10 @@ func newLoader(cfg *Config) *loader { } } + // Save the actually requested fields. We'll zero them out before returning packages to the user. + ld.requestedMode = ld.Mode + ld.Mode = impliedLoadMode(ld.Mode) + if ld.Mode&NeedTypes != 0 { if ld.Fset == nil { ld.Fset = token.NewFileSet() @@ -459,6 +481,7 @@ func newLoader(cfg *Config) *loader { } } } + return ld } @@ -479,8 +502,8 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { } lpkg := &loaderPackage{ Package: pkg, - needtypes: (ld.Mode&(NeedTypes|NeedTypesInfo) != 0 && rootIndex < 0) || rootIndex >= 0, - needsrc: (ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && rootIndex < 0) || rootIndex >= 0 || + needtypes: (ld.Mode&(NeedTypes|NeedTypesInfo) != 0 && ld.Mode&NeedDeps != 0 && rootIndex < 0) || rootIndex >= 0, + needsrc: (ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && ld.Mode&NeedDeps != 0 && rootIndex < 0) || rootIndex >= 0 || len(ld.Overlay) > 0 || // Overlays can invalidate export data. TODO(matloob): make this check fine-grained based on dependencies on overlaid files pkg.ExportFile == "" && pkg.PkgPath != "unsafe", } @@ -528,8 +551,7 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { stack = append(stack, lpkg) // push stubs := lpkg.Imports // the structure form has only stubs with the ID in the Imports // If NeedImports isn't set, the imports fields will all be zeroed out. - // If NeedDeps isn't also set we want to keep the stubs. - if ld.Mode&NeedImports != 0 && ld.Mode&NeedDeps != 0 { + if ld.Mode&NeedImports != 0 { lpkg.Imports = make(map[string]*Package, len(stubs)) for importPath, ipkg := range stubs { var importErr error @@ -566,7 +588,7 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { return lpkg.needsrc } - if ld.Mode&(NeedImports|NeedDeps) == 0 { + if ld.Mode&NeedImports == 0 { // We do this to drop the stub import packages that we are not even going to try to resolve. for _, lpkg := range initial { lpkg.Imports = nil @@ -577,7 +599,7 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { visit(lpkg) } } - if ld.Mode&NeedDeps != 0 { // TODO(matloob): This is only the case if NeedTypes is also set, right? + if ld.Mode&NeedImports != 0 && ld.Mode&NeedTypes != 0 { for _, lpkg := range srcPkgs { // Complete type information is required for the // immediate dependencies of each source package. @@ -602,54 +624,44 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { } result := make([]*Package, len(initial)) - importPlaceholders := make(map[string]*Package) for i, lpkg := range initial { result[i] = lpkg.Package } for i := range ld.pkgs { // Clear all unrequested fields, for extra de-Hyrum-ization. - if ld.Mode&NeedName == 0 { + if ld.requestedMode&NeedName == 0 { ld.pkgs[i].Name = "" ld.pkgs[i].PkgPath = "" } - if ld.Mode&NeedFiles == 0 { + if ld.requestedMode&NeedFiles == 0 { ld.pkgs[i].GoFiles = nil ld.pkgs[i].OtherFiles = nil } - if ld.Mode&NeedCompiledGoFiles == 0 { + if ld.requestedMode&NeedCompiledGoFiles == 0 { ld.pkgs[i].CompiledGoFiles = nil } - if ld.Mode&NeedImports == 0 { + if ld.requestedMode&NeedImports == 0 { ld.pkgs[i].Imports = nil } - if ld.Mode&NeedExportsFile == 0 { + if ld.requestedMode&NeedExportsFile == 0 { ld.pkgs[i].ExportFile = "" } - if ld.Mode&NeedTypes == 0 { + if ld.requestedMode&NeedTypes == 0 { ld.pkgs[i].Types = nil ld.pkgs[i].Fset = nil ld.pkgs[i].IllTyped = false } - if ld.Mode&NeedSyntax == 0 { + if ld.requestedMode&NeedSyntax == 0 { ld.pkgs[i].Syntax = nil } - if ld.Mode&NeedTypesInfo == 0 { + if ld.requestedMode&NeedTypesInfo == 0 { ld.pkgs[i].TypesInfo = nil } - if ld.Mode&NeedTypesSizes == 0 { + if ld.requestedMode&NeedTypesSizes == 0 { ld.pkgs[i].TypesSizes = nil } - if ld.Mode&NeedDeps == 0 { - for j, pkg := range ld.pkgs[i].Imports { - ph, ok := importPlaceholders[pkg.ID] - if !ok { - ph = &Package{ID: pkg.ID} - importPlaceholders[pkg.ID] = ph - } - ld.pkgs[i].Imports[j] = ph - } - } } + return result, nil } @@ -670,7 +682,6 @@ func (ld *loader) loadRecursive(lpkg *loaderPackage) { }(imp) } wg.Wait() - ld.loadPackage(lpkg) }) } @@ -759,6 +770,14 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) { lpkg.Errors = append(lpkg.Errors, errs...) } + if len(lpkg.CompiledGoFiles) == 0 && lpkg.ExportFile != "" { + // The config requested loading sources and types, but sources are missing. + // Add an error to the package and fall back to loading from export data. + appendError(Error{"-", fmt.Sprintf("sources missing for package %s", lpkg.ID), ParseError}) + ld.loadFromExportData(lpkg) + return // can't get syntax trees for this package + } + files, errs := ld.parseFiles(lpkg.CompiledGoFiles) for _, err := range errs { appendError(err) @@ -797,7 +816,7 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) { if ipkg.Types != nil && ipkg.Types.Complete() { return ipkg.Types, nil } - log.Fatalf("internal error: nil Pkg importing %q from %q", path, lpkg) + log.Fatalf("internal error: package %q without types was imported from %q", path, lpkg) panic("unreachable") }) @@ -808,7 +827,7 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) { // Type-check bodies of functions only in non-initial packages. // Example: for import graph A->B->C and initial packages {A,C}, // we can ignore function bodies in B. - IgnoreFuncBodies: (ld.Mode&(NeedDeps|NeedTypesInfo) == 0) && !lpkg.initial, + IgnoreFuncBodies: ld.Mode&NeedDeps == 0 && !lpkg.initial, Error: appendError, Sizes: ld.sizes, @@ -1070,6 +1089,25 @@ func (ld *loader) loadFromExportData(lpkg *loaderPackage) (*types.Package, error return tpkg, nil } +// impliedLoadMode returns loadMode with it's dependencies +func impliedLoadMode(loadMode LoadMode) LoadMode { + if loadMode&NeedTypesInfo != 0 && loadMode&NeedImports == 0 { + // If NeedTypesInfo, go/packages needs to do typechecking itself so it can + // associate type info with the AST. To do so, we need the export data + // for dependencies, which means we need to ask for the direct dependencies. + // NeedImports is used to ask for the direct dependencies. + loadMode |= NeedImports + } + + if loadMode&NeedDeps != 0 && loadMode&NeedImports == 0 { + // With NeedDeps we need to load at least direct dependencies. + // NeedImports is used to ask for the direct dependencies. + loadMode |= NeedImports + } + + return loadMode +} + func usesExportData(cfg *Config) bool { - return cfg.Mode&NeedExportsFile != 0 || cfg.Mode&NeedTypes != 0 && cfg.Mode&NeedTypesInfo == 0 + return cfg.Mode&NeedExportsFile != 0 || cfg.Mode&NeedTypes != 0 && cfg.Mode&NeedDeps == 0 } diff --git a/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go b/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go index 0d85488e..882e3b3d 100644 --- a/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go +++ b/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go @@ -376,7 +376,7 @@ func Object(pkg *types.Package, p Path) (types.Object, error) { return nil, fmt.Errorf("package %s does not contain %q", pkg.Path(), pkgobj) } - // abtraction of *types.{Pointer,Slice,Array,Chan,Map} + // abstraction of *types.{Pointer,Slice,Array,Chan,Map} type hasElem interface { Elem() types.Type } diff --git a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go index 04bb96a3..60eb67b6 100644 --- a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go +++ b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go @@ -59,15 +59,27 @@ func SrcDirsRoots(ctx *build.Context) []Root { // paths of the containing source directory and the package directory. // add will be called concurrently. func Walk(roots []Root, add func(root Root, dir string), opts Options) { + WalkSkip(roots, add, func(Root, string) bool { return false }, opts) +} + +// WalkSkip walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. +// For each package found, add will be called (concurrently) with the absolute +// paths of the containing source directory and the package directory. +// For each directory that will be scanned, skip will be called (concurrently) +// with the absolute paths of the containing source directory and the directory. +// If skip returns false on a directory it will be processed. +// add will be called concurrently. +// skip will be called concurrently. +func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, opts Options) { for _, root := range roots { - walkDir(root, add, opts) + walkDir(root, add, skip, opts) } } -func walkDir(root Root, add func(Root, string), opts Options) { +func walkDir(root Root, add func(Root, string), skip func(root Root, dir string) bool, opts Options) { if _, err := os.Stat(root.Path); os.IsNotExist(err) { if opts.Debug { - log.Printf("skipping nonexistant directory: %v", root.Path) + log.Printf("skipping nonexistent directory: %v", root.Path) } return } @@ -77,6 +89,7 @@ func walkDir(root Root, add func(Root, string), opts Options) { w := &walker{ root: root, add: add, + skip: skip, opts: opts, } w.init() @@ -91,9 +104,10 @@ func walkDir(root Root, add func(Root, string), opts Options) { // walker is the callback for fastwalk.Walk. type walker struct { - root Root // The source directory to scan. - add func(Root, string) // The callback that will be invoked for every possible Go package dir. - opts Options // Options passed to Walk by the user. + root Root // The source directory to scan. + add func(Root, string) // The callback that will be invoked for every possible Go package dir. + skip func(Root, string) bool // The callback that will be invoked for every dir. dir is skipped if it returns true. + opts Options // Options passed to Walk by the user. ignoredDirs []os.FileInfo // The ignored directories, loaded from .goimportsignore files. } @@ -151,12 +165,16 @@ func (w *walker) getIgnoredDirs(path string) []string { return ignoredDirs } -func (w *walker) shouldSkipDir(fi os.FileInfo) bool { +func (w *walker) shouldSkipDir(fi os.FileInfo, dir string) bool { for _, ignoredDir := range w.ignoredDirs { if os.SameFile(fi, ignoredDir) { return true } } + if w.skip != nil { + // Check with the user specified callback. + return w.skip(w.root, dir) + } return false } @@ -184,7 +202,7 @@ func (w *walker) walk(path string, typ os.FileMode) error { return filepath.SkipDir } fi, err := os.Lstat(path) - if err == nil && w.shouldSkipDir(fi) { + if err == nil && w.shouldSkipDir(fi, path) { return filepath.SkipDir } return nil @@ -224,7 +242,7 @@ func (w *walker) shouldTraverse(dir string, fi os.FileInfo) bool { if !ts.IsDir() { return false } - if w.shouldSkipDir(ts) { + if w.shouldSkipDir(ts, dir) { return false } // Check for symlink loops by statting each directory component diff --git a/vendor/modules.txt b/vendor/modules.txt index 958f9cac..7c981902 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -97,10 +97,6 @@ github.com/bflad/tfproviderlint/passes/schemaschema 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/client9/misspell v0.3.4 github.com/client9/misspell github.com/client9/misspell/cmd/misspell @@ -139,10 +135,10 @@ github.com/googleapis/gax-go/v2 github.com/hashicorp/errwrap # github.com/hashicorp/go-cleanhttp v0.5.1 github.com/hashicorp/go-cleanhttp -# github.com/hashicorp/go-getter v1.3.1-0.20190627223108-da0323b9545e +# 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 @@ -177,62 +173,57 @@ github.com/hashicorp/hcl2/hcled github.com/hashicorp/hcl2/hclparse github.com/hashicorp/hcl2/hclwrite # github.com/hashicorp/hil v0.0.0-20190212132231-97b3a9cdfa93 -github.com/hashicorp/hil github.com/hashicorp/hil/ast -github.com/hashicorp/hil/parser -github.com/hashicorp/hil/scanner # github.com/hashicorp/logutils v1.0.0 github.com/hashicorp/logutils -# github.com/hashicorp/terraform v0.12.8 -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/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/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/svchost -github.com/hashicorp/terraform/svchost/auth -github.com/hashicorp/terraform/svchost/disco -github.com/hashicorp/terraform/terraform -github.com/hashicorp/terraform/tfdiags -github.com/hashicorp/terraform/version # github.com/hashicorp/terraform-config-inspect v0.0.0-20190821133035-82a99dc22ef4 github.com/hashicorp/terraform-config-inspect/tfconfig +# github.com/hashicorp/terraform-plugin-sdk v1.1.1 +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 @@ -257,8 +248,6 @@ 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.1 @@ -362,7 +351,7 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 +# golang.org/x/tools v0.0.0-20190918214516-5a1a30219888 golang.org/x/tools/go/analysis golang.org/x/tools/go/analysis/internal/analysisflags golang.org/x/tools/go/analysis/internal/checker