# Static Policies

Static policies will help you to maintain strict guidelines for a deployment pipeline by allowing users to validate the application configuration while creating an application in spinnaker through a policy.

### Create Policy

To create a new policy follow the steps below:

1. Click “**Compliance**” → Click “**Policy Management**” → “+**New Policy**” button as shown below:

![](https://2047464521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBEa1hoX6SqpDj-ymNs%2Fuploads%2FMcaMc8NT6hVCHeNEy456%2F32.png?alt=media\&token=be778a0c-09e5-493d-ad9e-d3bbf37f1990)

2\. The Policy Management screen appears and select "**Static**" policy type as shown below:

![](https://2047464521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBEa1hoX6SqpDj-ymNs%2Fuploads%2FYhwwPMH6Uta3AHMKnhiT%2F33.png?alt=media\&token=d89a79bb-2650-4595-99ec-29f2416370d1)

Enter the following details:

* Enter the Name of the policy in the text box.
* Select the Policy type as Static from the drop-down.
* Select the Policy Engine as OPA from the drop-down.
* Select the Policy Engine Account from the drop-down.
* Enter the Policy Description in the text box.
* Select and add any available Policy file.
* Enter the **Policy Details** in the text box. Refer to the image below:

![](https://2047464521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBEa1hoX6SqpDj-ymNs%2Fuploads%2F7iO9ySHHyuBDJiMb2GU6%2F34.png?alt=media\&token=42d114da-03a7-4efd-b99d-01fc587f2e31)

The Policy details is explained below:

* A rule is defined as the user's ability to choose the beginning of the application name. For Example, the application name must begin with “**prod**” as shown below.

```
deny["No Manual Judgement Stages"] {
 count(input.new.stages)>0
 startswith(input.new.name,"prod")
 manualStages := [d | d = input.new.stages[_].type; d == "manualJudgment"]
 count(manualStages) == 0
 }
```

* A rule is defined as requiring the user to have full execute permissions (Read, Execute, Write).

```
deny["Pipeline has no start time"] {
  startTime == 0
}
```

3\. After entering the details click “Save & Finish” to create the policy as shown in the image below:

![](https://2047464521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBEa1hoX6SqpDj-ymNs%2Fuploads%2F8vpoH3xapSByka4LnfRE%2F35.png?alt=media\&token=b0d39b19-2315-4aaa-b5b6-675681ff98cb)

### **Edit Policy**

To edit a policy follow the steps below:

1. Click the icon beside the name of the policy and select Edit as shown in the image below:

![](https://2047464521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBEa1hoX6SqpDj-ymNs%2Fuploads%2FvLNrUPuoPL5Tlj2u8NQt%2F36.png?alt=media\&token=b5aeddf3-46a7-4b35-aa1b-0e70a4de78d0)

2\. Edit the required details and click **Save & Finish.**

### **Delete Policy**

To delete a policy follow the steps given below:

1. Click the icon beside the name of the policy and select Delete as shown in the image below:

![](https://2047464521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBEa1hoX6SqpDj-ymNs%2Fuploads%2FuEKPPHEsKMbVBMCBpFVo%2F37.png?alt=media\&token=b561e4c5-81cb-40ce-b239-51d6f505b057)

2\. The confirmation pop-up appears as shown below:

![](https://2047464521-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MBEa1hoX6SqpDj-ymNs%2Fuploads%2FFcswoH4RtL5UX1hMqFv1%2F38.png?alt=media\&token=8135fae3-7f38-44c0-ba83-0e40dd6735f3)

3\. Click **Yes, delete it!** to delete the policy.
