Skip to content
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

Allow policy id to be generated during apply #71

Closed
p1johnson opened this issue Jun 11, 2021 · 10 comments
Closed

Allow policy id to be generated during apply #71

p1johnson opened this issue Jun 11, 2021 · 10 comments
Labels
idle Inactive for 14 days

Comments

@p1johnson
Copy link

It is not possible to apply creation of a policy definition without specifying the "id" property in the policy.json file. As the policy id includes either the subscription id or management group id, this means they need to be stored in the repository. This means it is not possible to create a generic set of policy definitions that can be deployed to multiple repositories.

It would be nice if the subscription id or management group id could be specified as a parameter and the policy id generated by combining this with the "name" property from the policy.json file then we can avoid hard-coding subscription or management group ids in the repository.

@JBrashko
Copy link

Is there a MS style guide for how parameters or other preprocessing should be handled? I have some time allocated to be able to work on this and would like to ensure that any changes I raise would be in keeping with the MS code style.

@p1johnson
Copy link
Author

Thanks for taking the time to look into this @Meliarion . I'm afraid I'm no expert on Microsoft coding practices, so I'm hoping @tauhid621 might be able to advise.

@tauhid621
Copy link
Contributor

@p1johnson In my opinion policy.json is the source of truth and should have the hardcoded values.
In case there is a need for parameterised support we can define a new file format which supports parameters.

@Meliarion We do not have specific guidelines on how parameters and preprocessing should be handled. You can follow same format used in the existing code.

@JBrashko
Copy link

How exactly would you envision a parameterised policy working? Instead of having a policy.json file in the directory having a parameterised_policy.json file? Also as being able to deploy one set of policies to multiple tenants is a big requirement for my organisation I would like to get started on defining how we can support the kind of parameterisation that would be needed to make that possible.

@JBrashko
Copy link

Also some way of being able to tie inititive definitions to policy definitions that are both defined in code would be nice.

@tauhid621
Copy link
Contributor

@Meliarion parameterised_policy.json sounds good. We would also need to define how these parameters are needed to be filled. How about a parameter.json file which holds all required parameter values?
We will also need to handle parametrised policy assignments.

Regarding initiative definitions ? You mean parameterised initiatives?

@JBrashko
Copy link

JBrashko commented Jul 2, 2021

I imagine that these parameters would get filled dynamically from the input to the action - perhaps as a pseudomap supplied as an input. That way I can reuse as much code as possible between different deployments. Having seperate parameter files would be less ideal but still workable provided that I can supply the filename as an input to the action.

At the moment the policyset definition requires a policyDefinitionId to specify the policy, however if it is a custom policy definition then we are deploying that policy as part of this action and it would be nice to have some way to refrence the id without having to explicitly supply it.

@github-actions
Copy link

This issue is idle because it has been open for 14 days with no activity.

@github-actions github-actions bot added the idle Inactive for 14 days label Jul 16, 2021
@tauhid621
Copy link
Contributor

@Meliarion Yes, a new input can be added but it will be limiting. Perhaps a combination of an environment input and a parameters json will be best?

I believe you can modify the place where we fetch the definition/assignments json. We can have a getPolicyJson function which will get the json file then based on inputs it will substitute.

For policyset, I get your point. maybe it can be done in similar parameterised way?

@tauhid621
Copy link
Contributor

Closing this as this has been open since a long time. Feel free to create a new issue if required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idle Inactive for 14 days
Projects
None yet
Development

No branches or pull requests

3 participants