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

Feature Request - Support Git in policies_create #1015

Open
katherineatinnablr opened this issue Jul 18, 2024 · 0 comments
Open

Feature Request - Support Git in policies_create #1015

katherineatinnablr opened this issue Jul 18, 2024 · 0 comments

Comments

@katherineatinnablr
Copy link

Summary

There is Harness API support for git as a policy store but not in the Harness terraform provider.

Would it be possible to implement this in the Harness terraform provider?

Terraform Version

not applicable

Affected Resource(s)

  • harness_platform_policy

Terraform Configuration Files

Documentation example

resource "harness_platform_policy" "test" {
  identifier  = harness_platform_policy.test.identifier
  name        = harness_platform_policy.test.name
  description = harness_platform_policy.test.description
  rego        = <<-REGO
    package pipeline

    # Deny pipelines that don't have an approval step
    # NOTE: Try removing the HarnessApproval step from your input to see the policy fail
    deny[msg] {
        # Find all stages that are Deployments ...
        input.pipeline.stages[i].stage.type == "Approval"

        # ... that are not in the set of stages with HarnessApproval steps
        not stages_with_approval[i]

        # Show a human-friendly error message
        msg := sprintf("Approval stage '%s' does not have a HarnessApproval step", [input.pipeline.stages[i].stage.name])
    }

    # Find the set of stages that contain a HarnessApproval step
    stages_with_approval[i] {
        input.pipeline.stages[i].stage.spec.execution.steps[_].step.type == "HarnessApproval"
    }
REGO
}

Expected Behavior

It would be great if we could do something like this? :

resource "harness_platform_policy" "test" {
  identifier  = harness_platform_policy.test.identifier
  name        = harness_platform_policy.test.name
  description = harness_platform_policy.test.description
  git_connector_ref = connector-ref
  git_default_branch = main
  git_path = policies
  git_repo = harness-policies
  rego        = <<-REGO
    # Not sure what to do about this, the API docs specify that this field is required
REGO
}

References

The new policy UI supports remote policy stores like this:

image
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

No branches or pull requests

1 participant