Skip to content

Commit

Permalink
Merge pull request #3 from ASleepyCat/fix-get-version-from-module
Browse files Browse the repository at this point in the history
Don't use strict Terraform parsing
  • Loading branch information
ASleepyCat committed Jul 18, 2023
2 parents 550e174 + 46a5c6a commit 61940be
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- target: x86_64-pc-windows-gnu
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz tar.zst
archive: tar.gz
- target: x86_64-apple-darwin
archive: zip
steps:
Expand Down
134 changes: 52 additions & 82 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tfswitcher"
version = "0.2.1"
version = "0.2.2"
edition = "2021"
authors = ["ASleepyCat dyeom340@gmail.com"]
license = "MIT"
Expand All @@ -20,5 +20,5 @@ regex = "1.8.1"
reqwest = { version = "0.11.16", features = ["json", "blocking"] }
semver = { version = "1.0.17", package = "tf-semver" }
tempdir = "0.3.7"
tfconfig = "0.1.0"
tfconfig = "0.2.0"
zip = "0.6.4"
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
error::Error,
fs::{self, File},
io::{self, Cursor},
path::PathBuf,
path::{PathBuf, Path},
str::FromStr,
};
use zip::ZipArchive;
Expand Down Expand Up @@ -132,7 +132,7 @@ fn capture_terraform_versions(args: Args, contents: &str) -> Vec<String> {
}

fn get_version_from_module(versions: &[String]) -> Result<Option<String>, Box<dyn Error>> {
let module = tfconfig::load_module(&".".into())?;
let module = tfconfig::load_module(Path::new("."), false)?;
let version_constraint = match module.required_core.first() {
Some(version) => version,
None => return Ok(None),
Expand Down

0 comments on commit 61940be

Please sign in to comment.