Skip to content

Conversation

@davidcheung
Copy link
Contributor

@davidcheung davidcheung commented Mar 3, 2021

feature changes includes:

  • removing global config [breaking change]
  • module config’s parameter to support conditions (all conditions must be true)
  • module config’s parameter to support custom typed prompts (eg. AWS prompt - [x]ype)
  • module config parameter to support overwriting the env-var used when apply
  • module config parameter to support processing used parameters (OmitFromProjectFile default's to false)

behaviour changes includes:

  • prompts(function) to not return value, instead update map(can support multi-value)
  • some parameter names improved (so the code is more readable)

changes includes
- removing global config
- module config’s parameter to support condition
- module config’s parameter to support custom typed prompts
- prompts to not return value, instead update map(can support multi-value)
@davidcheung davidcheung marked this pull request as ready for review March 9, 2021 01:06
@davidcheung davidcheung force-pushed the remove-credential-file branch from 0d6aec2 to 7713479 Compare March 9, 2021 01:06
@bmonkman
Copy link
Contributor

bmonkman commented Mar 9, 2021

Go convention - can you please add comments on public functions starting with the name of the function?

})
}

func getParameterDefinition(modConfig moduleconfig.ModuleConfig, field string) moduleconfig.Parameter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function not actually used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah looks like it, will remove

@bmonkman
Copy link
Contributor

bmonkman commented Mar 9, 2021

Can you add a new file in docs to capture the schema and usage of the module.yml now that it's getting more complex?

SecretAccessKey string `yaml:"secretAccessKey,omitempty" env:"AWS_SECRET_ACCESS_KEY,omitempty"`
}

var GetAWSCredsPath = awsCredsPath
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why assign here rather than calling the function directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the tests i'm overwriting the function so it fetches the mock path, it only lets me do it if its a variable
what's the proper way to

I guess I should just have the function receive the credentials path as well?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah how about you accept an optional base path, and if it's not supplied we default to the home dir?


func AwsCredsPath() string {
type AWSResourceConfig struct {
AccessKeyID string `yaml:"accessKeyId,omitempty" env:"AWS_ACCESS_KEY_ID,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "yaml"? If this annotation is just to be used by the ReflectStructValueIntoMap function we might as well use our own identifier so it's clear that it's not supposed to be used in some other way to generate yaml.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason, mostly just because I reused the struct from before (global creds)
what should we change it to, should we just call it zero?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just key or something? If we control this struct entirely in code and don't need to worry about parsing it to/from a file it might be a bit overkill to even use an annotation for this.

| `data` | list(string) | Supply extra data for condition to run |


### Validation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing info on some of the other things like the contitions and template fields related to templating.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely good call to add this documentation, I looked at conditions and thought oh its there, but theres actually 2 types

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the naming might be a bit confusing..

err, result = promptParameter(p)
}
if err != nil {
exit.Fatal("Exiting prompt: %v\n", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind adding a bit more info here? Maybe say that it's related to the module properties, and if possible, say which module the problem is with? I'm thinking for CustomPromptHandler for example, if the module specifies an invalid string, it's gonna be hard for a user to understand what's going on.

Co-authored-by: Bill Monkman <bmonkman@gmail.com>
@davidcheung davidcheung merged commit 7f4c7a3 into main Mar 11, 2021
@davidcheung davidcheung deleted the remove-credential-file branch March 11, 2021 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants