venafi logo
Venafi v1.5.0, Feb 4 23

venafi.Policy

Explore with Pulumi AI

Provides access to read and write certificate policy in Venafi. This can be used to define a new policy (folder in Trust Protection Platform; application and/or issuing template in Venafi as a Service).

Example Usage

using System.Collections.Generic;
using System.IO;
using Pulumi;
using Venafi = Pulumi.Venafi;

return await Deployment.RunAsync(() => 
{
    var internalPolicy = new Venafi.Policy("internalPolicy", new()
    {
        Zone = "My Business App\\Enterprise Trusted Certs",
        PolicySpecification = File.ReadAllText("/path-to/internal-policy.json"),
    });

});
package main

import (
	"os"

	"github.com/pulumi/pulumi-venafi/sdk/go/venafi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := os.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := venafi.NewPolicy(ctx, "internalPolicy", &venafi.PolicyArgs{
			Zone:                pulumi.String("My Business App\\Enterprise Trusted Certs"),
			PolicySpecification: readFileOrPanic("/path-to/internal-policy.json"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.venafi.Policy;
import com.pulumi.venafi.PolicyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var internalPolicy = new Policy("internalPolicy", PolicyArgs.builder()        
            .zone("My Business App\\Enterprise Trusted Certs")
            .policySpecification(Files.readString(Paths.get("/path-to/internal-policy.json")))
            .build());

    }
}
import pulumi
import pulumi_venafi as venafi

internal_policy = venafi.Policy("internalPolicy",
    zone="My Business App\\Enterprise Trusted Certs",
    policy_specification=(lambda path: open(path).read())("/path-to/internal-policy.json"))
import * as pulumi from "@pulumi/pulumi";
import * as fs from "fs";
import * as venafi from "@pulumi/venafi";

const internalPolicy = new venafi.Policy("internalPolicy", {
    zone: "My Business App\\Enterprise Trusted Certs",
    policySpecification: fs.readFileSync("/path-to/internal-policy.json"),
});
resources:
  internalPolicy:
    type: venafi:Policy
    properties:
      zone: My Business App\Enterprise Trusted Certs
      policySpecification:
        fn::readFile: /path-to/internal-policy.json

Create Policy Resource

new Policy(name: string, args?: PolicyArgs, opts?: CustomResourceOptions);
@overload
def Policy(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           policy_specification: Optional[str] = None,
           zone: Optional[str] = None)
@overload
def Policy(resource_name: str,
           args: Optional[PolicyArgs] = None,
           opts: Optional[ResourceOptions] = None)
func NewPolicy(ctx *Context, name string, args *PolicyArgs, opts ...ResourceOption) (*Policy, error)
public Policy(string name, PolicyArgs? args = null, CustomResourceOptions? opts = null)
public Policy(String name, PolicyArgs args)
public Policy(String name, PolicyArgs args, CustomResourceOptions options)
type: venafi:Policy
properties: # The arguments to resource properties.
options: # 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.
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.

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:

PolicySpecification string

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

Zone string

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

PolicySpecification string

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

Zone string

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

policySpecification String

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

zone String

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

policySpecification string

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

zone string

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

policy_specification str

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

zone str

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

policySpecification String

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

zone String

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

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,
        policy_specification: Optional[str] = None,
        zone: Optional[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.
The following state arguments are supported:
PolicySpecification string

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

Zone string

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

PolicySpecification string

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

Zone string

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

policySpecification String

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

zone String

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

policySpecification string

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

zone string

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

policy_specification str

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

zone str

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

policySpecification String

The JSON-formatted certificate policy specification as documented here. Typically read from a file using the file function.

zone String

The Trust Protection Plaform policy folder or Venafi as a Service application and issuing template.

Import

The venafi_policy resource supports the Terraform import method.

When used, the zone and policy_specification resource arguments are not required since the zone is a required parameter of the import method and the policy specification is populated from the existing infrastructure. Policy that is successfully imported is also output to a file named after the zone that was specified. hcl resource “venafi_policy” “existing_policy” {}

 $ pulumi import venafi:index/policy:Policy existing_policy" "My Business App\\Enterprise Trusted Certs"

Package Details

Repository
Venafi pulumi/pulumi-venafi
License
Apache-2.0
Notes

This Pulumi package is based on the venafi Terraform Provider.