UNPKG

@pulumi/consul

Version:

A Pulumi package for creating and managing consul resources.

214 lines (213 loc) 7.13 kB
import * as pulumi from "@pulumi/pulumi"; /** * [Intentions](https://www.consul.io/docs/connect/intentions.html) are used to define * rules for which services may connect to one another when using [Consul Connect](https://www.consul.io/docs/connect/index.html). * * > **NOTE:** This resource is appropriate for managing legacy intentions in * Consul version 1.8 and earlier. As of Consul 1.9, intentions should be managed * using the [`service-intentions`](https://www.consul.io/docs/connect/intentions) * configuration entry. It is recommended to migrate from the `consul.Intention` * resource to `consul.ConfigEntry` when running Consul 1.9 and later. * * It is appropriate to either reference existing services, or specify non-existent services * that will be created in the future when creating intentions. This resource can be used * in conjunction with the `consul.Service` datasource when referencing services * registered on nodes that have a running Consul agent. * * ## Example Usage * * Create a simplest intention with static service names: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as consul from "@pulumi/consul"; * * const database = new consul.Intention("database", { * sourceName: "api", * destinationName: "db", * action: "allow", * }); * ``` * * Referencing a known service via a datasource: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as consul from "@pulumi/consul"; * * const database = new consul.Intention("database", { * sourceName: "api", * destinationName: pgConsulService.name, * action: "allow", * }); * const pg = consul.getService({ * name: "postgresql", * }); * ``` * * ## Import * * `consul_intention` can be imported: * * ```sh * $ pulumi import consul:index/intention:Intention database 657a57d6-0d56-57e2-31cb-e9f1ed3c18dd * ``` */ export declare class Intention extends pulumi.CustomResource { /** * Get an existing Intention resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: IntentionState, opts?: pulumi.CustomResourceOptions): Intention; /** * Returns true if the given object is an instance of Intention. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Intention; /** * The intention action. Must be one of `allow` or `deny`. */ readonly action: pulumi.Output<string>; /** * The datacenter to use. This overrides the * agent's default datacenter and the datacenter in the provider setup. */ readonly datacenter: pulumi.Output<string>; /** * Optional description that can be used by Consul * tooling, but is not used internally. */ readonly description: pulumi.Output<string | undefined>; /** * The name of the destination service for the intention. This * service does not have to exist. */ readonly destinationName: pulumi.Output<string>; /** * The destination * namespace of the intention. */ readonly destinationNamespace: pulumi.Output<string | undefined>; /** * Key/value pairs that are opaque to Consul and are associated * with the intention. */ readonly meta: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The name of the source service for the intention. This * service does not have to exist. */ readonly sourceName: pulumi.Output<string>; /** * The source namespace of the * intention. */ readonly sourceNamespace: pulumi.Output<string | undefined>; /** * Create a Intention resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: IntentionArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Intention resources. */ export interface IntentionState { /** * The intention action. Must be one of `allow` or `deny`. */ action?: pulumi.Input<string>; /** * The datacenter to use. This overrides the * agent's default datacenter and the datacenter in the provider setup. */ datacenter?: pulumi.Input<string>; /** * Optional description that can be used by Consul * tooling, but is not used internally. */ description?: pulumi.Input<string>; /** * The name of the destination service for the intention. This * service does not have to exist. */ destinationName?: pulumi.Input<string>; /** * The destination * namespace of the intention. */ destinationNamespace?: pulumi.Input<string>; /** * Key/value pairs that are opaque to Consul and are associated * with the intention. */ meta?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The name of the source service for the intention. This * service does not have to exist. */ sourceName?: pulumi.Input<string>; /** * The source namespace of the * intention. */ sourceNamespace?: pulumi.Input<string>; } /** * The set of arguments for constructing a Intention resource. */ export interface IntentionArgs { /** * The intention action. Must be one of `allow` or `deny`. */ action: pulumi.Input<string>; /** * The datacenter to use. This overrides the * agent's default datacenter and the datacenter in the provider setup. */ datacenter?: pulumi.Input<string>; /** * Optional description that can be used by Consul * tooling, but is not used internally. */ description?: pulumi.Input<string>; /** * The name of the destination service for the intention. This * service does not have to exist. */ destinationName: pulumi.Input<string>; /** * The destination * namespace of the intention. */ destinationNamespace?: pulumi.Input<string>; /** * Key/value pairs that are opaque to Consul and are associated * with the intention. */ meta?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The name of the source service for the intention. This * service does not have to exist. */ sourceName: pulumi.Input<string>; /** * The source namespace of the * intention. */ sourceNamespace?: pulumi.Input<string>; }