@pulumi/azuredevops
Version:
A Pulumi package for creating and managing Azure DevOps.
176 lines • 6.49 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.VariableGroup = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* ## Example Usage
*
* ### Basic usage
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {
* name: "Example Project",
* workItemTemplate: "Agile",
* versionControl: "Git",
* visibility: "private",
* description: "Managed by Pulumi",
* });
* const exampleVariableGroup = new azuredevops.VariableGroup("example", {
* projectId: example.id,
* name: "Example Variable Group",
* description: "Example Variable Group Description",
* allowAccess: true,
* variables: [
* {
* name: "key1",
* value: "val1",
* },
* {
* name: "key2",
* secretValue: "val2",
* isSecret: true,
* },
* ],
* });
* ```
*
* ### Link to AzureRM Key Vault
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azuredevops from "@pulumi/azuredevops";
*
* const example = new azuredevops.Project("example", {
* name: "Example Project",
* workItemTemplate: "Agile",
* versionControl: "Git",
* visibility: "private",
* description: "Managed by Pulumi",
* });
* const exampleServiceEndpointAzureRM = new azuredevops.ServiceEndpointAzureRM("example", {
* projectId: example.id,
* serviceEndpointName: "Example AzureRM",
* description: "Managed by Pulumi",
* credentials: {
* serviceprincipalid: "00000000-0000-0000-0000-000000000000",
* serviceprincipalkey: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
* },
* azurermSpnTenantid: "00000000-0000-0000-0000-000000000000",
* azurermSubscriptionId: "00000000-0000-0000-0000-000000000000",
* azurermSubscriptionName: "Example Subscription Name",
* });
* const exampleVariableGroup = new azuredevops.VariableGroup("example", {
* projectId: example.id,
* name: "Example Variable Group",
* description: "Example Variable Group Description",
* allowAccess: true,
* keyVault: {
* name: "example-kv",
* serviceEndpointId: exampleServiceEndpointAzureRM.id,
* },
* variables: [
* {
* name: "key1",
* },
* {
* name: "key2",
* },
* ],
* });
* ```
*
* ## Relevant Links
*
* - [Azure DevOps Service REST API 7.0 - Variable Groups](https://docs.microsoft.com/en-us/rest/api/azure/devops/distributedtask/variablegroups?view=azure-devops-rest-7.0)
* - [Azure DevOps Service REST API 7.0 - Authorized Resources](https://docs.microsoft.com/en-us/rest/api/azure/devops/build/authorizedresources?view=azure-devops-rest-7.0)
*
* ## PAT Permissions Required
*
* - **Variable Groups**: Read, Create, & Manage
* - **Build**: Read & execute
* - **Project and Team**: Read
* - **Token Administration**: Read & manage
* - **Tokens**: Read & manage
* - **Work Items**: Read
*
* ## Import
*
* **Variable groups containing secret values cannot be imported.**
*
* Azure DevOps Variable groups can be imported using the project name/variable group ID or by the project Guid/variable group ID, e.g.
*
* ```sh
* $ pulumi import azuredevops:index/variableGroup:VariableGroup example "Example Project/10"
* ```
*
* or
*
* ```sh
* $ pulumi import azuredevops:index/variableGroup:VariableGroup example 00000000-0000-0000-0000-000000000000/0
* ```
*
* _Note that for secret variables, the import command retrieve blank value in the tfstate._
*/
class VariableGroup extends pulumi.CustomResource {
/**
* Get an existing VariableGroup 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, id, state, opts) {
return new VariableGroup(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of VariableGroup. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === VariableGroup.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allowAccess"] = state?.allowAccess;
resourceInputs["description"] = state?.description;
resourceInputs["keyVault"] = state?.keyVault;
resourceInputs["name"] = state?.name;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["variables"] = state?.variables;
}
else {
const args = argsOrState;
if (args?.projectId === undefined && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
if (args?.variables === undefined && !opts.urn) {
throw new Error("Missing required property 'variables'");
}
resourceInputs["allowAccess"] = args?.allowAccess;
resourceInputs["description"] = args?.description;
resourceInputs["keyVault"] = args?.keyVault;
resourceInputs["name"] = args?.name;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["variables"] = args?.variables;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VariableGroup.__pulumiType, name, resourceInputs, opts);
}
}
exports.VariableGroup = VariableGroup;
/** @internal */
VariableGroup.__pulumiType = 'azuredevops:index/variableGroup:VariableGroup';
//# sourceMappingURL=variableGroup.js.map