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
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.
- Git
Base stringBranch - Base branch for the new git branch.
- Git
Branch string - Git branch for the policy.
- Git
Commit stringMsg - Git commit message for the policy.
- Git
Commit stringSha - The existing commit sha of the file being updated
- Git
Connector stringRef - Git connector reference for the policy.
- Git
File stringId - 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 string - Git path for the policy.
- Git
Repo string - Git repository for the policy.
- Name string
- Name of the resource.
- Org
Id string - Unique identifier of the organization.
- Project
Id 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.
- Git
Base stringBranch - Base branch for the new git branch.
- Git
Branch string - Git branch for the policy.
- Git
Commit stringMsg - Git commit message for the policy.
- Git
Commit stringSha - The existing commit sha of the file being updated
- Git
Connector stringRef - Git connector reference for the policy.
- Git
File stringId - 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 string - Git path for the policy.
- Git
Repo string - Git repository for the policy.
- Name string
- Name of the resource.
- Org
Id string - Unique identifier of the organization.
- Project
Id 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.
- git
Base StringBranch - Base branch for the new git branch.
- git
Branch String - Git branch for the policy.
- git
Commit StringMsg - Git commit message for the policy.
- git
Commit StringSha - The existing commit sha of the file being updated
- git
Connector StringRef - Git connector reference for the policy.
- git
File StringId - The existing file id of the file being updated, not required for bitbucket files
- git
Import Boolean - Flag to import the policy from git.
- git
Is BooleanNew Branch - Flag to create a new branch for the policy.
- git
Path String - Git path for the policy.
- git
Repo String - Git repository for the policy.
- name String
- Name of the resource.
- org
Id String - Unique identifier of the organization.
- project
Id 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.
- git
Base stringBranch - Base branch for the new git branch.
- git
Branch string - Git branch for the policy.
- git
Commit stringMsg - Git commit message for the policy.
- git
Commit stringSha - The existing commit sha of the file being updated
- git
Connector stringRef - Git connector reference for the policy.
- git
File stringId - The existing file id of the file being updated, not required for bitbucket files
- git
Import boolean - Flag to import the policy from git.
- git
Is booleanNew Branch - Flag to create a new branch for the policy.
- git
Path string - Git path for the policy.
- git
Repo string - Git repository for the policy.
- name string
- Name of the resource.
- org
Id string - Unique identifier of the organization.
- project
Id 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.
- git
Base StringBranch - Base branch for the new git branch.
- git
Branch String - Git branch for the policy.
- git
Commit StringMsg - Git commit message for the policy.
- git
Commit StringSha - The existing commit sha of the file being updated
- git
Connector StringRef - Git connector reference for the policy.
- git
File StringId - The existing file id of the file being updated, not required for bitbucket files
- git
Import Boolean - Flag to import the policy from git.
- git
Is BooleanNew Branch - Flag to create a new branch for the policy.
- git
Path String - Git path for the policy.
- git
Repo String - Git repository for the policy.
- name String
- Name of the resource.
- org
Id String - Unique identifier of the organization.
- project
Id 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) -> Policy
func 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)
Resource lookup is not supported in YAML
- 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.
- Git
Base stringBranch - Base branch for the new git branch.
- Git
Branch string - Git branch for the policy.
- Git
Commit stringMsg - Git commit message for the policy.
- Git
Commit stringSha - The existing commit sha of the file being updated
- Git
Connector stringRef - Git connector reference for the policy.
- Git
File stringId - 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 string - Git path for the policy.
- Git
Repo string - Git repository for the policy.
- Identifier string
- Unique identifier of the resource.
- Name string
- Name of the resource.
- Org
Id string - Unique identifier of the organization.
- Project
Id 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.
- Git
Base stringBranch - Base branch for the new git branch.
- Git
Branch string - Git branch for the policy.
- Git
Commit stringMsg - Git commit message for the policy.
- Git
Commit stringSha - The existing commit sha of the file being updated
- Git
Connector stringRef - Git connector reference for the policy.
- Git
File stringId - 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 string - Git path for the policy.
- Git
Repo string - Git repository for the policy.
- Identifier string
- Unique identifier of the resource.
- Name string
- Name of the resource.
- Org
Id string - Unique identifier of the organization.
- Project
Id 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.
- git
Base StringBranch - Base branch for the new git branch.
- git
Branch String - Git branch for the policy.
- git
Commit StringMsg - Git commit message for the policy.
- git
Commit StringSha - The existing commit sha of the file being updated
- git
Connector StringRef - Git connector reference for the policy.
- git
File StringId - The existing file id of the file being updated, not required for bitbucket files
- git
Import Boolean - Flag to import the policy from git.
- git
Is BooleanNew Branch - Flag to create a new branch for the policy.
- git
Path String - Git path for the policy.
- git
Repo String - Git repository for the policy.
- identifier String
- Unique identifier of the resource.
- name String
- Name of the resource.
- org
Id String - Unique identifier of the organization.
- project
Id 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.
- git
Base stringBranch - Base branch for the new git branch.
- git
Branch string - Git branch for the policy.
- git
Commit stringMsg - Git commit message for the policy.
- git
Commit stringSha - The existing commit sha of the file being updated
- git
Connector stringRef - Git connector reference for the policy.
- git
File stringId - The existing file id of the file being updated, not required for bitbucket files
- git
Import boolean - Flag to import the policy from git.
- git
Is booleanNew Branch - Flag to create a new branch for the policy.
- git
Path string - Git path for the policy.
- git
Repo string - Git repository for the policy.
- identifier string
- Unique identifier of the resource.
- name string
- Name of the resource.
- org
Id string - Unique identifier of the organization.
- project
Id 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.
- git
Base StringBranch - Base branch for the new git branch.
- git
Branch String - Git branch for the policy.
- git
Commit StringMsg - Git commit message for the policy.
- git
Commit StringSha - The existing commit sha of the file being updated
- git
Connector StringRef - Git connector reference for the policy.
- git
File StringId - The existing file id of the file being updated, not required for bitbucket files
- git
Import Boolean - Flag to import the policy from git.
- git
Is BooleanNew Branch - Flag to create a new branch for the policy.
- git
Path String - Git path for the policy.
- git
Repo String - Git repository for the policy.
- identifier String
- Unique identifier of the resource.
- name String
- Name of the resource.
- org
Id String - Unique identifier of the organization.
- project
Id String - Unique identifier of the project.
- rego String
- Rego code for the policy.
- List<String>
- Tags to associate with the resource.
Import
Import using the organization id
$ pulumi import harness:platform/policy:Policy example <organization_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
harness
Terraform Provider.