Dashboard › institutional-transition-lab › Distillation
f8d49275-5cbc-452a-ac87-f7743d15348d["lore_tm_v1_X_581YI9foTJijFtQvrmA3sQRQOkXwkO70jl79ksrd8","lore_tm_v1_A3YCjdP-Ws8uJwpUFb41HaJWBowDIiCpMPVFSgwG3xk","lore_tm_v1_Lx4RiP-sL9Zb4n7mmx3JHfPXt9WC2dfKdp0Ezxwuvk8"]
terraform-github-pr-34847 envelope enumerated 18 sources: body (github_body, 6,802 bytes), pr_metadata (github_pr_metadata, 285 bytes), and patch:0 through patch:15; patch files and sizes were: internal/addrs/module_source.go (11,622), internal/configs/configtesting/synth_body.go (149), internal/configs/configtesting/synth_body_test.go (153), internal/getmodules/getter.go (2,766), internal/getmodules/moduleaddrs/detect_abs_filepath.go (2,400), internal/getmodules/moduleaddrs/detect_gcs.go (965), internal/getmodules/moduleaddrs/detect_gcs_test.go (632), internal/getmodules/moduleaddrs/detect_git.go (3,356), internal/getmodules/moduleaddrs/detect_git_test.go (2,616), internal/getmodules/moduleaddrs/detect_remote_shorthands.go (2,680), internal/getmodules/moduleaddrs/detect_remote_shorthands_test.go (711), internal/getmodules/moduleaddrs/detect_s3.go (2,119), internal/getmodules/moduleaddrs/detect_s3_test.go (1,973), internal/getmodules/moduleaddrs/package.go (3,581), internal/getmodules/moduleaddrs/source_parsing.go (9,104), and internal/getmodules/moduleaddrs/source_parsing_test.go (5,173).ParseModuleSource tries ParseModuleSourceRegistry(raw), but a failed registry parse falls through to remote-source parsing for Terraform v0.10 compatibility.legacy/terraform; 3. moving SynthBody into package configtesting. The combination was chosen because all three sever indirect remote-state-backend dependencies and splitting dependency-graph changes tends to create tangled merge conflicts.detectBitBucket can assume Git and source-address parsing no longer makes a hidden internet API request.go-getter for actual module installation because that security-sensitive layer benefits from shared upstream ownership and coordinated fixes across HashiCorp products; only shorthand interpretation/detection is brought into Terraform.legacy/terraform now exists exclusively for legacy/helper/schema, which some remote-state backends still use; provider- and provisioner-related legacy SDK code is pruned because those backends do not need it, reducing indirect backend dependencies.SynthBody, a helper for constructing synthetic hcl.Body values in configuration-related tests, moves from package configs to package configtesting so backend test utilities can use it without inheriting the larger configs dependency graph.internal/addrs/module_source.go, parsing functions and local-path normalization are removed while the address data types remain: ModuleSource, ModuleSourceLocal, ModuleSourceRegistry, and ModuleSourceRemote; comments direct parsing callers to package moduleaddrs.internal/getmodules/getter.go, goGetterDetectors and its getter.GitHubDetector, getter.GitDetector, getter.BitBucketDetector, getter.GCSDetector, getter.S3Detector, and fileDetector entries are removed; Terraform keeps its own fixed getter set but controls source syntax under Terraform v1.x compatibility promises.detectAbsFilePath should “always be the last detector.”detectAbsFilePath will “always claim everything it's given.”detectAbsFilePath(src string) in internal/getmodules/moduleaddrs/detect_abs_filepath.go returns ("", false, nil) for empty input; returns ("", true, &MaybeRelativePathErr{src}) for a non-absolute path; converts Windows separators with filepath.ToSlash; and emits file://%s on Windows or file:///%s on non-Windows systems after removing the leading slash.detectBitBucket in internal/getmodules/moduleaddrs/detect_git.go now performs only local parsing: bitbucket.org/... is parsed as HTTPS, .git is appended if absent, and the result is prefixed with git::; the obsolete Git-versus-Mercurial API lookup is not retained.detectSSH uses sshPattern = regexp.MustCompile("^(?:([^@]+)@)?([^:]+):/?(.+)$") to parse SCP-like user@host:path strings, preserves query parameters using url.ParseQuery, and returns a net.URL; detectGit accepts the result only when u.User.Username() == "git".TestDetectGit covers 9 cases: standard GitHub SSH, branch query, package subdirectory, generic query, non-GitHub hostname, non-GitHub query, non-GitHub subdirectory, non-GitHub subdirectory plus query, and already-canonical git::ssh://git@git.example.com:2222/hashicorp/foo.git; TestDetectGitHub covers 5 shorthand/query/subdirectory cases; TestDetectBitBucket covers 2 HTTP shorthand cases.detectRemoteSourceShorthands preserves an already-valid URL with a nonempty scheme unchanged; otherwise it separates any forced getter and package subdirectory, applies detectors in order, prepends detector-produced subdirectories to user-requested subdirectories, sets u.RawPath = u.Path to preserve wildcard-containing subdirectories, prefers the caller’s forced getter over the detector’s getter, and returns invalid source address: %s if nothing matches.getForcedSourceType uses forcedRegexp = regexp.MustCompile(\^([A-Za-z0-9]+)::(.+)$`)` to split a forced getter name from its source.TestDetectS3 in internal/getmodules/moduleaddrs/detect_s3_test.go contains 13 exact normalization cases: 6 virtual-hosted cases for bucket.s3.amazonaws.com and bucket.s3-eu-west-1.amazonaws.com, 1 five-host-part case for bucket.s3.eu-west-1.amazonaws.com, 6 path-style cases for s3.amazonaws.com and s3-eu-west-1.amazonaws.com, plus a query-preservation case using ?version=1234.internal/getmodules/moduleaddrs/package.go, NormalizePackageAddress(given) replaces getter.Detect(given, "", goGetterDetectors) with detectRemoteSourceShorthands(given); callers must first remove a source subdirectory using SplitPackageSubdir, and any subdirectory introduced during normalization is returned separately as subDir.internal/getmodules/moduleaddrs/source_parsing.go defines local-source prefixes exactly as ./, ../, .\\, and ..\\; local paths normalize backslashes to /, clean redundant path components and duplicate slashes with path.Clean, and retain ./ unless the result begins with ../.ParseModuleSourceRegistry(raw) rejects local-looking inputs with can't use local directory %q as a module registry address, delegates valid registry parsing to tfaddr.ParseModuleSource, and returns addrs.ModuleSourceRegistry{Package: src.Package, Subdir: src.Subdir}.parseModuleSourceRemote(raw) rejects requested subdirectories beginning with ../, calls NormalizePackageAddress(raw), prepends any detector-produced subdirectory to the requested one with path.Join, rejects combined subdirectories that escape the package, and returns addrs.ModuleSourceRemote{Package: addrs.ModulePackage(norm), Subdir: subDir}.internal/getmodules/moduleaddrs/source_parsing_test.go changes from package addrs to package moduleaddrs, imports github.com/hashicorp/terraform/internal/addrs, and qualifies expected values as addrs.ModuleSource, addrs.ModuleSourceLocal, addrs.ModuleSourceRegistry, addrs.ModuleRegistryPackage, addrs.ModuleSourceRemote, and addrs.ModulePackage.