-
Notifications
You must be signed in to change notification settings - Fork 53
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
cli: add --generate-config
flag to constellation iam create
command, which creates a config file with IAM values filled in
#782
Conversation
✅ Deploy Preview for constellation-docs canceled.
|
RFC |
Short summary from today's stand-up discussion:
|
(Maybe it wont be necessary, but) I like the solution. The goal of What do you think is not clean about the solution or should be improved? You could share more code between |
I think it might be better to keep the "working (at that point in time)" validation steps (such as checking if all fields are there and if the file is not corrupted generally) could be kept to prevent errors when the values are later on inserted into the file. But with the proposed rework, that would not be necessary i guess ;-) |
Since the values created by the
We could also tackle this by using the environment variable |
Last consensus was (iirc):
@katexochen are you OK with that? |
Yes, sounds good! :) |
Any1 got an idea on how to implement this in a "clean" manner? I think adding all IAM-flags for every CP to config generate would be ugly and redundant as we have them on iam create already. But how could we get around it? Have subcommands for config generate? Seems ugly as well. Any ideas are welcome 😄 |
Iirc Thomas and I were also okay with adding an opt-in option to iam command to generate config instead, but you didn't like it this way? Would solve the problem imo... |
Sounds good. Maybe I mixed something up, I thought you were against doing it that way. Then I'll go work on that! Thank you :) |
I was just against doing that opt-out. |
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.
Yes, the chosen approach works for me as well!
I have built & tested the current state locally for Azure. I have two comments, but they are unrelated to this PR (so we can choose to fix this here or in another PR):
The output when creating resources for Azure is misaligned. I think it would be more readable to have a consistent indentation for region, resource group & service principal:
./constellation iam create azure --region westus --resourceGroup fabian-delete-me-iam --servicePrincipal fabian-delete-me-iam --generate-config
The following IAM configuration will be created:
Region: westus
Resource Group: fabian-delete-me-iam
Service Principal: fabian-delete-me-iam
The configuration file constellation-conf.yaml will be automatically generated and populated with the IAM values.
Do you want to create the configuration? [y/n]: y
Creating
Your IAM configuration was created and filled into constellation-conf.yaml successfully.
The help text for resource group is not correct:
--resourceGroup string Name of the resource group your IAM resources will be created in.
When I run iam create
two resource groups seem to be created. The one I provided and an additional with suffix -identity
. The suffixed one contains the IAM resources mentioned in helptext. I think we should mention both in helptext.
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.
Only some minor architecture and language comments, idea looks good so far.
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.
lgtm, well done. 🐳
Some minor follow ups that shouldn't be done in this PR:
- The IAM commands currently lack debug logging, we should add some lines, at least the parsed flags etc
- Look if we can reducing redundancy in the IAM commands, maybe by introducing an interface that the the flags fullfill, so that that the core logic doesn't have to be duplicated
I forgot to mention this in our conversation today. I only discovered this today, think we had a bad timing between merging IAM and Debug logging so that they "missed" each other.
Agreed. I will bring up both points in the next backlog refinement. |
Feel free to already create tickets for this and start implementation in a separate PR as you like. |
@katexochen am I missing something or could we omit the second "if"-clause here? Just noticed it constellation/cli/internal/cmd/configgenerate.go Lines 67 to 88 in 372e4b9
|
* AB#2706 Automatically add IAM values to config (cherry picked from commit 64ec040)
* AB#2706 Automatically add IAM values to config (cherry picked from commit 64ec040)
--generate-config
flag to constellation iam create
command, which creates a config file with IAM values filled in
Proposed change(s)
generate-config
flag to theconstellation iam create
command which enables automatic generation of a config file (path specified by theconfig
flag. By default,constellation-conf.yaml
) and automatic filling of the resulting IAM values into said file.Checklist