-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(TFECO-7366) Stacks: parse terraform-sources.json
to support remote component sources
#1836
base: main
Are you sure you want to change the base?
Conversation
terraform-sources.json
to support remote component sources
@@ -350,6 +401,8 @@ func (s *RootStore) CallersOfModule(path string) ([]string, error) { | |||
if record.ModManifest.ContainsLocalModule(path) { | |||
callers = append(callers, record.path) | |||
} | |||
|
|||
// TODO: support TerraformSources as well here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to?
@@ -375,10 +428,28 @@ func (s *RootStore) InstalledModuleCalls(path string) (map[string]tfmod.Installe | |||
} | |||
} | |||
} | |||
// TODO: support TerraformSources as well here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to?
|
||
fi, err := fs.Stat(terraformSourcesPath) | ||
if err == nil && fi.Mode().IsRegular() { | ||
return terraformSourcesDirPath, true // TODO: this is a bit weird and misleading, maybe we should just use the bundle thing reading the dir and catch the proper error or sth like that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure whether we need this method at all since the go-slug parser for this file also handles it not existing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I think you can remove it and make ParseTerraformSources
a bit leaner.
180223e
to
6f517c2
Compare
terraform-sources.json
to support remote component sourcesterraform-sources.json
to support remote component sources
fe982b4
to
b491749
Compare
6bcb15e
to
21628e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I left some comments
return err | ||
} | ||
|
||
tfs, err := datadir.ParseTerraformSourcesFromFile(terraformSourcesPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we pass modPath
as an argument to this function? This will remove the need for the module path "detection" logic inside that function
normalizedSource := tfmod.ParseModuleSourceAddr(remote.String()) | ||
installedModules[normalizedSource.String()] = dir | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By iterating over sources.RegistryPackages()
, we should be able to add support for registry modules as well
@@ -350,6 +401,8 @@ func (s *RootStore) CallersOfModule(path string) ([]string, error) { | |||
if record.ModManifest.ContainsLocalModule(path) { | |||
callers = append(callers, record.path) | |||
} | |||
|
|||
// TODO: support TerraformSources as well here -> they don't contain local modules though, so we'd need to do this different here for stacks? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can leave this as is for now. I'm not sure if the module caller command makes sense in a stack context.
|
||
fi, err := fs.Stat(terraformSourcesPath) | ||
if err == nil && fi.Mode().IsRegular() { | ||
return terraformSourcesDirPath, true // TODO: this is a bit weird and misleading, maybe we should just use the bundle thing reading the dir and catch the proper error or sth like that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I think you can remove it and make ParseTerraformSources
a bit leaner.
…to support completions for remote modules in stacks projects
e57e03e
to
b599781
Compare
needs hashicorp/terraform-schema#406
Open tasks