harness.platform.Policy
Explore with Pulumi AI
Resource for creating a Harness Policy.
Create Policy Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Policy(name: string, args: PolicyArgs, opts?: CustomResourceOptions);@overload
def Policy(resource_name: str,
           args: PolicyArgs,
           opts: Optional[ResourceOptions] = None)
@overload
def Policy(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           identifier: Optional[str] = None,
           rego: Optional[str] = None,
           git_is_new_branch: Optional[bool] = None,
           git_path: Optional[str] = None,
           git_commit_sha: Optional[str] = None,
           git_connector_ref: Optional[str] = None,
           git_file_id: Optional[str] = None,
           git_import: Optional[bool] = None,
           description: Optional[str] = None,
           git_commit_msg: Optional[str] = None,
           git_repo: Optional[str] = None,
           git_branch: Optional[str] = None,
           name: Optional[str] = None,
           org_id: Optional[str] = None,
           project_id: Optional[str] = None,
           git_base_branch: Optional[str] = None,
           tags: Optional[Sequence[str]] = None)func NewPolicy(ctx *Context, name string, args PolicyArgs, opts ...ResourceOption) (*Policy, error)public Policy(string name, PolicyArgs args, CustomResourceOptions? opts = null)
public Policy(String name, PolicyArgs args)
public Policy(String name, PolicyArgs args, CustomResourceOptions options)
type: harness:platform:Policy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PolicyArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var policyResource = new Harness.Platform.Policy("policyResource", new()
{
    Identifier = "string",
    Rego = "string",
    GitIsNewBranch = false,
    GitPath = "string",
    GitCommitSha = "string",
    GitConnectorRef = "string",
    GitFileId = "string",
    GitImport = false,
    Description = "string",
    GitCommitMsg = "string",
    GitRepo = "string",
    GitBranch = "string",
    Name = "string",
    OrgId = "string",
    ProjectId = "string",
    GitBaseBranch = "string",
    Tags = new[]
    {
        "string",
    },
});
example, err := platform.NewPolicy(ctx, "policyResource", &platform.PolicyArgs{
	Identifier:      pulumi.String("string"),
	Rego:            pulumi.String("string"),
	GitIsNewBranch:  pulumi.Bool(false),
	GitPath:         pulumi.String("string"),
	GitCommitSha:    pulumi.String("string"),
	GitConnectorRef: pulumi.String("string"),
	GitFileId:       pulumi.String("string"),
	GitImport:       pulumi.Bool(false),
	Description:     pulumi.String("string"),
	GitCommitMsg:    pulumi.String("string"),
	GitRepo:         pulumi.String("string"),
	GitBranch:       pulumi.String("string"),
	Name:            pulumi.String("string"),
	OrgId:           pulumi.String("string"),
	ProjectId:       pulumi.String("string"),
	GitBaseBranch:   pulumi.String("string"),
	Tags: pulumi.StringArray{
		pulumi.String("string"),
	},
})
var policyResource = new Policy("policyResource", PolicyArgs.builder()
    .identifier("string")
    .rego("string")
    .gitIsNewBranch(false)
    .gitPath("string")
    .gitCommitSha("string")
    .gitConnectorRef("string")
    .gitFileId("string")
    .gitImport(false)
    .description("string")
    .gitCommitMsg("string")
    .gitRepo("string")
    .gitBranch("string")
    .name("string")
    .orgId("string")
    .projectId("string")
    .gitBaseBranch("string")
    .tags("string")
    .build());
policy_resource = harness.platform.Policy("policyResource",
    identifier="string",
    rego="string",
    git_is_new_branch=False,
    git_path="string",
    git_commit_sha="string",
    git_connector_ref="string",
    git_file_id="string",
    git_import=False,
    description="string",
    git_commit_msg="string",
    git_repo="string",
    git_branch="string",
    name="string",
    org_id="string",
    project_id="string",
    git_base_branch="string",
    tags=["string"])
const policyResource = new harness.platform.Policy("policyResource", {
    identifier: "string",
    rego: "string",
    gitIsNewBranch: false,
    gitPath: "string",
    gitCommitSha: "string",
    gitConnectorRef: "string",
    gitFileId: "string",
    gitImport: false,
    description: "string",
    gitCommitMsg: "string",
    gitRepo: "string",
    gitBranch: "string",
    name: "string",
    orgId: "string",
    projectId: "string",
    gitBaseBranch: "string",
    tags: ["string"],
});
type: harness:platform:Policy
properties:
    description: string
    gitBaseBranch: string
    gitBranch: string
    gitCommitMsg: string
    gitCommitSha: string
    gitConnectorRef: string
    gitFileId: string
    gitImport: false
    gitIsNewBranch: false
    gitPath: string
    gitRepo: string
    identifier: string
    name: string
    orgId: string
    projectId: string
    rego: string
    tags:
        - string
Policy Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Policy resource accepts the following input properties:
- Identifier string
- Unique identifier of the resource.
- Rego string
- Rego code for the policy.
- Description string
- Description of the resource.
- GitBase stringBranch 
- Base branch for the new git branch.
- GitBranch string
- Git branch for the policy.
- GitCommit stringMsg 
- Git commit message for the policy.
- GitCommit stringSha 
- The existing commit sha of the file being updated
- GitConnector stringRef 
- Git connector reference for the policy.
- GitFile stringId 
- The existing file id of the file being updated, not required for bitbucket files
- GitImport bool
- Flag to import the policy from git.
- GitIs boolNew Branch 
- Flag to create a new branch for the policy.
- GitPath string
- Git path for the policy.
- GitRepo string
- Git repository for the policy.
- Name string
- Name of the resource.
- OrgId string
- Unique identifier of the organization.
- ProjectId string
- Unique identifier of the project.
- List<string>
- Tags to associate with the resource.
- Identifier string
- Unique identifier of the resource.
- Rego string
- Rego code for the policy.
- Description string
- Description of the resource.
- GitBase stringBranch 
- Base branch for the new git branch.
- GitBranch string
- Git branch for the policy.
- GitCommit stringMsg 
- Git commit message for the policy.
- GitCommit stringSha 
- The existing commit sha of the file being updated
- GitConnector stringRef 
- Git connector reference for the policy.
- GitFile stringId 
- The existing file id of the file being updated, not required for bitbucket files
- GitImport bool
- Flag to import the policy from git.
- GitIs boolNew Branch 
- Flag to create a new branch for the policy.
- GitPath string
- Git path for the policy.
- GitRepo string
- Git repository for the policy.
- Name string
- Name of the resource.
- OrgId string
- Unique identifier of the organization.
- ProjectId string
- Unique identifier of the project.
- []string
- Tags to associate with the resource.
- identifier String
- Unique identifier of the resource.
- rego String
- Rego code for the policy.
- description String
- Description of the resource.
- gitBase StringBranch 
- Base branch for the new git branch.
- gitBranch String
- Git branch for the policy.
- gitCommit StringMsg 
- Git commit message for the policy.
- gitCommit StringSha 
- The existing commit sha of the file being updated
- gitConnector StringRef 
- Git connector reference for the policy.
- gitFile StringId 
- The existing file id of the file being updated, not required for bitbucket files
- gitImport Boolean
- Flag to import the policy from git.
- gitIs BooleanNew Branch 
- Flag to create a new branch for the policy.
- gitPath String
- Git path for the policy.
- gitRepo String
- Git repository for the policy.
- name String
- Name of the resource.
- orgId String
- Unique identifier of the organization.
- projectId String
- Unique identifier of the project.
- List<String>
- Tags to associate with the resource.
- identifier string
- Unique identifier of the resource.
- rego string
- Rego code for the policy.
- description string
- Description of the resource.
- gitBase stringBranch 
- Base branch for the new git branch.
- gitBranch string
- Git branch for the policy.
- gitCommit stringMsg 
- Git commit message for the policy.
- gitCommit stringSha 
- The existing commit sha of the file being updated
- gitConnector stringRef 
- Git connector reference for the policy.
- gitFile stringId 
- The existing file id of the file being updated, not required for bitbucket files
- gitImport boolean
- Flag to import the policy from git.
- gitIs booleanNew Branch 
- Flag to create a new branch for the policy.
- gitPath string
- Git path for the policy.
- gitRepo string
- Git repository for the policy.
- name string
- Name of the resource.
- orgId string
- Unique identifier of the organization.
- projectId string
- Unique identifier of the project.
- string[]
- Tags to associate with the resource.
- identifier str
- Unique identifier of the resource.
- rego str
- Rego code for the policy.
- description str
- Description of the resource.
- git_base_ strbranch 
- Base branch for the new git branch.
- git_branch str
- Git branch for the policy.
- git_commit_ strmsg 
- Git commit message for the policy.
- git_commit_ strsha 
- The existing commit sha of the file being updated
- git_connector_ strref 
- Git connector reference for the policy.
- git_file_ strid 
- The existing file id of the file being updated, not required for bitbucket files
- git_import bool
- Flag to import the policy from git.
- git_is_ boolnew_ branch 
- Flag to create a new branch for the policy.
- git_path str
- Git path for the policy.
- git_repo str
- Git repository for the policy.
- name str
- Name of the resource.
- org_id str
- Unique identifier of the organization.
- project_id str
- Unique identifier of the project.
- Sequence[str]
- Tags to associate with the resource.
- identifier String
- Unique identifier of the resource.
- rego String
- Rego code for the policy.
- description String
- Description of the resource.
- gitBase StringBranch 
- Base branch for the new git branch.
- gitBranch String
- Git branch for the policy.
- gitCommit StringMsg 
- Git commit message for the policy.
- gitCommit StringSha 
- The existing commit sha of the file being updated
- gitConnector StringRef 
- Git connector reference for the policy.
- gitFile StringId 
- The existing file id of the file being updated, not required for bitbucket files
- gitImport Boolean
- Flag to import the policy from git.
- gitIs BooleanNew Branch 
- Flag to create a new branch for the policy.
- gitPath String
- Git path for the policy.
- gitRepo String
- Git repository for the policy.
- name String
- Name of the resource.
- orgId String
- Unique identifier of the organization.
- projectId String
- Unique identifier of the project.
- List<String>
- Tags to associate with the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the Policy resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Policy Resource
Get an existing Policy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: PolicyState, opts?: CustomResourceOptions): Policy@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        git_base_branch: Optional[str] = None,
        git_branch: Optional[str] = None,
        git_commit_msg: Optional[str] = None,
        git_commit_sha: Optional[str] = None,
        git_connector_ref: Optional[str] = None,
        git_file_id: Optional[str] = None,
        git_import: Optional[bool] = None,
        git_is_new_branch: Optional[bool] = None,
        git_path: Optional[str] = None,
        git_repo: Optional[str] = None,
        identifier: Optional[str] = None,
        name: Optional[str] = None,
        org_id: Optional[str] = None,
        project_id: Optional[str] = None,
        rego: Optional[str] = None,
        tags: Optional[Sequence[str]] = None) -> Policyfunc GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)public static Policy get(String name, Output<String> id, PolicyState state, CustomResourceOptions options)resources:  _:    type: harness:platform:Policy    get:      id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Description string
- Description of the resource.
- GitBase stringBranch 
- Base branch for the new git branch.
- GitBranch string
- Git branch for the policy.
- GitCommit stringMsg 
- Git commit message for the policy.
- GitCommit stringSha 
- The existing commit sha of the file being updated
- GitConnector stringRef 
- Git connector reference for the policy.
- GitFile stringId 
- The existing file id of the file being updated, not required for bitbucket files
- GitImport bool
- Flag to import the policy from git.
- GitIs boolNew Branch 
- Flag to create a new branch for the policy.
- GitPath string
- Git path for the policy.
- GitRepo string
- Git repository for the policy.
- Identifier string
- Unique identifier of the resource.
- Name string
- Name of the resource.
- OrgId string
- Unique identifier of the organization.
- ProjectId string
- Unique identifier of the project.
- Rego string
- Rego code for the policy.
- List<string>
- Tags to associate with the resource.
- Description string
- Description of the resource.
- GitBase stringBranch 
- Base branch for the new git branch.
- GitBranch string
- Git branch for the policy.
- GitCommit stringMsg 
- Git commit message for the policy.
- GitCommit stringSha 
- The existing commit sha of the file being updated
- GitConnector stringRef 
- Git connector reference for the policy.
- GitFile stringId 
- The existing file id of the file being updated, not required for bitbucket files
- GitImport bool
- Flag to import the policy from git.
- GitIs boolNew Branch 
- Flag to create a new branch for the policy.
- GitPath string
- Git path for the policy.
- GitRepo string
- Git repository for the policy.
- Identifier string
- Unique identifier of the resource.
- Name string
- Name of the resource.
- OrgId string
- Unique identifier of the organization.
- ProjectId string
- Unique identifier of the project.
- Rego string
- Rego code for the policy.
- []string
- Tags to associate with the resource.
- description String
- Description of the resource.
- gitBase StringBranch 
- Base branch for the new git branch.
- gitBranch String
- Git branch for the policy.
- gitCommit StringMsg 
- Git commit message for the policy.
- gitCommit StringSha 
- The existing commit sha of the file being updated
- gitConnector StringRef 
- Git connector reference for the policy.
- gitFile StringId 
- The existing file id of the file being updated, not required for bitbucket files
- gitImport Boolean
- Flag to import the policy from git.
- gitIs BooleanNew Branch 
- Flag to create a new branch for the policy.
- gitPath String
- Git path for the policy.
- gitRepo String
- Git repository for the policy.
- identifier String
- Unique identifier of the resource.
- name String
- Name of the resource.
- orgId String
- Unique identifier of the organization.
- projectId String
- Unique identifier of the project.
- rego String
- Rego code for the policy.
- List<String>
- Tags to associate with the resource.
- description string
- Description of the resource.
- gitBase stringBranch 
- Base branch for the new git branch.
- gitBranch string
- Git branch for the policy.
- gitCommit stringMsg 
- Git commit message for the policy.
- gitCommit stringSha 
- The existing commit sha of the file being updated
- gitConnector stringRef 
- Git connector reference for the policy.
- gitFile stringId 
- The existing file id of the file being updated, not required for bitbucket files
- gitImport boolean
- Flag to import the policy from git.
- gitIs booleanNew Branch 
- Flag to create a new branch for the policy.
- gitPath string
- Git path for the policy.
- gitRepo string
- Git repository for the policy.
- identifier string
- Unique identifier of the resource.
- name string
- Name of the resource.
- orgId string
- Unique identifier of the organization.
- projectId string
- Unique identifier of the project.
- rego string
- Rego code for the policy.
- string[]
- Tags to associate with the resource.
- description str
- Description of the resource.
- git_base_ strbranch 
- Base branch for the new git branch.
- git_branch str
- Git branch for the policy.
- git_commit_ strmsg 
- Git commit message for the policy.
- git_commit_ strsha 
- The existing commit sha of the file being updated
- git_connector_ strref 
- Git connector reference for the policy.
- git_file_ strid 
- The existing file id of the file being updated, not required for bitbucket files
- git_import bool
- Flag to import the policy from git.
- git_is_ boolnew_ branch 
- Flag to create a new branch for the policy.
- git_path str
- Git path for the policy.
- git_repo str
- Git repository for the policy.
- identifier str
- Unique identifier of the resource.
- name str
- Name of the resource.
- org_id str
- Unique identifier of the organization.
- project_id str
- Unique identifier of the project.
- rego str
- Rego code for the policy.
- Sequence[str]
- Tags to associate with the resource.
- description String
- Description of the resource.
- gitBase StringBranch 
- Base branch for the new git branch.
- gitBranch String
- Git branch for the policy.
- gitCommit StringMsg 
- Git commit message for the policy.
- gitCommit StringSha 
- The existing commit sha of the file being updated
- gitConnector StringRef 
- Git connector reference for the policy.
- gitFile StringId 
- The existing file id of the file being updated, not required for bitbucket files
- gitImport Boolean
- Flag to import the policy from git.
- gitIs BooleanNew Branch 
- Flag to create a new branch for the policy.
- gitPath String
- Git path for the policy.
- gitRepo String
- Git repository for the policy.
- identifier String
- Unique identifier of the resource.
- name String
- Name of the resource.
- orgId String
- Unique identifier of the organization.
- projectId String
- Unique identifier of the project.
- rego String
- Rego code for the policy.
- List<String>
- Tags to associate with the resource.
Import
Import account level policy
$ pulumi import harness:platform/policy:Policy example <policy_id>
Import org level policy
$ pulumi import harness:platform/policy:Policy example <org_id>/<policy_id>
Import proj level policy
$ pulumi import harness:platform/policy:Policy example <org_id>/<project_id>/<policy_id>
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- harness pulumi/pulumi-harness
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the harnessTerraform Provider.
