1. Packages
  2. Azuredevops Provider
  3. API Docs
  4. VariableGroupPermissions
Azure DevOps v3.3.0 published on Wednesday, Sep 4, 2024 by Pulumi

azuredevops.VariableGroupPermissions

Explore with Pulumi AI

azuredevops logo
Azure DevOps v3.3.0 published on Wednesday, Sep 4, 2024 by Pulumi

    Manages permissions for a Variable Group

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azuredevops from "@pulumi/azuredevops";
    
    const project = new azuredevops.Project("project", {
        name: "Testing",
        description: "Testing-description",
        visibility: "private",
        versionControl: "Git",
        workItemTemplate: "Agile",
    });
    const example = new azuredevops.VariableGroup("example", {
        projectId: project.id,
        name: "test",
        description: "Test Description",
        allowAccess: true,
        variables: [{
            name: "key1",
            value: "val1",
        }],
    });
    const tf-project-readers = azuredevops.getGroupOutput({
        projectId: project.id,
        name: "Readers",
    });
    const permissions = new azuredevops.VariableGroupPermissions("permissions", {
        projectId: project.id,
        variableGroupId: example.id,
        principal: tf_project_readers.apply(tf_project_readers => tf_project_readers.id),
        permissions: {
            View: "allow",
            Administer: "allow",
            Use: "allow",
        },
    });
    
    import pulumi
    import pulumi_azuredevops as azuredevops
    
    project = azuredevops.Project("project",
        name="Testing",
        description="Testing-description",
        visibility="private",
        version_control="Git",
        work_item_template="Agile")
    example = azuredevops.VariableGroup("example",
        project_id=project.id,
        name="test",
        description="Test Description",
        allow_access=True,
        variables=[{
            "name": "key1",
            "value": "val1",
        }])
    tf_project_readers = azuredevops.get_group_output(project_id=project.id,
        name="Readers")
    permissions = azuredevops.VariableGroupPermissions("permissions",
        project_id=project.id,
        variable_group_id=example.id,
        principal=tf_project_readers.id,
        permissions={
            "View": "allow",
            "Administer": "allow",
            "Use": "allow",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azuredevops/sdk/v3/go/azuredevops"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		project, err := azuredevops.NewProject(ctx, "project", &azuredevops.ProjectArgs{
    			Name:             pulumi.String("Testing"),
    			Description:      pulumi.String("Testing-description"),
    			Visibility:       pulumi.String("private"),
    			VersionControl:   pulumi.String("Git"),
    			WorkItemTemplate: pulumi.String("Agile"),
    		})
    		if err != nil {
    			return err
    		}
    		example, err := azuredevops.NewVariableGroup(ctx, "example", &azuredevops.VariableGroupArgs{
    			ProjectId:   project.ID(),
    			Name:        pulumi.String("test"),
    			Description: pulumi.String("Test Description"),
    			AllowAccess: pulumi.Bool(true),
    			Variables: azuredevops.VariableGroupVariableArray{
    				&azuredevops.VariableGroupVariableArgs{
    					Name:  pulumi.String("key1"),
    					Value: pulumi.String("val1"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		tf_project_readers := azuredevops.LookupGroupOutput(ctx, azuredevops.GetGroupOutputArgs{
    			ProjectId: project.ID(),
    			Name:      pulumi.String("Readers"),
    		}, nil)
    		_, err = azuredevops.NewVariableGroupPermissions(ctx, "permissions", &azuredevops.VariableGroupPermissionsArgs{
    			ProjectId:       project.ID(),
    			VariableGroupId: example.ID(),
    			Principal: pulumi.String(tf_project_readers.ApplyT(func(tf_project_readers azuredevops.GetGroupResult) (*string, error) {
    				return &tf_project_readers.Id, nil
    			}).(pulumi.StringPtrOutput)),
    			Permissions: pulumi.StringMap{
    				"View":       pulumi.String("allow"),
    				"Administer": pulumi.String("allow"),
    				"Use":        pulumi.String("allow"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureDevOps = Pulumi.AzureDevOps;
    
    return await Deployment.RunAsync(() => 
    {
        var project = new AzureDevOps.Project("project", new()
        {
            Name = "Testing",
            Description = "Testing-description",
            Visibility = "private",
            VersionControl = "Git",
            WorkItemTemplate = "Agile",
        });
    
        var example = new AzureDevOps.VariableGroup("example", new()
        {
            ProjectId = project.Id,
            Name = "test",
            Description = "Test Description",
            AllowAccess = true,
            Variables = new[]
            {
                new AzureDevOps.Inputs.VariableGroupVariableArgs
                {
                    Name = "key1",
                    Value = "val1",
                },
            },
        });
    
        var tf_project_readers = AzureDevOps.GetGroup.Invoke(new()
        {
            ProjectId = project.Id,
            Name = "Readers",
        });
    
        var permissions = new AzureDevOps.VariableGroupPermissions("permissions", new()
        {
            ProjectId = project.Id,
            VariableGroupId = example.Id,
            Principal = tf_project_readers.Apply(tf_project_readers => tf_project_readers.Apply(getGroupResult => getGroupResult.Id)),
            Permissions = 
            {
                { "View", "allow" },
                { "Administer", "allow" },
                { "Use", "allow" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azuredevops.Project;
    import com.pulumi.azuredevops.ProjectArgs;
    import com.pulumi.azuredevops.VariableGroup;
    import com.pulumi.azuredevops.VariableGroupArgs;
    import com.pulumi.azuredevops.inputs.VariableGroupVariableArgs;
    import com.pulumi.azuredevops.AzuredevopsFunctions;
    import com.pulumi.azuredevops.inputs.GetGroupArgs;
    import com.pulumi.azuredevops.VariableGroupPermissions;
    import com.pulumi.azuredevops.VariableGroupPermissionsArgs;
    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 project = new Project("project", ProjectArgs.builder()
                .name("Testing")
                .description("Testing-description")
                .visibility("private")
                .versionControl("Git")
                .workItemTemplate("Agile")
                .build());
    
            var example = new VariableGroup("example", VariableGroupArgs.builder()
                .projectId(project.id())
                .name("test")
                .description("Test Description")
                .allowAccess(true)
                .variables(VariableGroupVariableArgs.builder()
                    .name("key1")
                    .value("val1")
                    .build())
                .build());
    
            final var tf-project-readers = AzuredevopsFunctions.getGroup(GetGroupArgs.builder()
                .projectId(project.id())
                .name("Readers")
                .build());
    
            var permissions = new VariableGroupPermissions("permissions", VariableGroupPermissionsArgs.builder()
                .projectId(project.id())
                .variableGroupId(example.id())
                .principal(tf_project_readers.applyValue(tf_project_readers -> tf_project_readers.id()))
                .permissions(Map.ofEntries(
                    Map.entry("View", "allow"),
                    Map.entry("Administer", "allow"),
                    Map.entry("Use", "allow")
                ))
                .build());
    
        }
    }
    
    resources:
      project:
        type: azuredevops:Project
        properties:
          name: Testing
          description: Testing-description
          visibility: private
          versionControl: Git
          workItemTemplate: Agile
      example:
        type: azuredevops:VariableGroup
        properties:
          projectId: ${project.id}
          name: test
          description: Test Description
          allowAccess: true
          variables:
            - name: key1
              value: val1
      permissions:
        type: azuredevops:VariableGroupPermissions
        properties:
          projectId: ${project.id}
          variableGroupId: ${example.id}
          principal: ${["tf-project-readers"].id}
          permissions:
            View: allow
            Administer: allow
            Use: allow
    variables:
      tf-project-readers:
        fn::invoke:
          Function: azuredevops:getGroup
          Arguments:
            projectId: ${project.id}
            name: Readers
    

    Roles

    The Azure DevOps UI uses roles to assign permissions for variable groups.

    RoleAllow Permissions
    ReaderView
    UserView, Use
    AdministratorView, Use, Administer

    PAT Permissions Required

    • Project & Team: vso.security_manage - Grants the ability to read, write, and manage security permissions.

    Create VariableGroupPermissions Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new VariableGroupPermissions(name: string, args: VariableGroupPermissionsArgs, opts?: CustomResourceOptions);
    @overload
    def VariableGroupPermissions(resource_name: str,
                                 args: VariableGroupPermissionsArgs,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def VariableGroupPermissions(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 permissions: Optional[Mapping[str, str]] = None,
                                 principal: Optional[str] = None,
                                 project_id: Optional[str] = None,
                                 variable_group_id: Optional[str] = None,
                                 replace: Optional[bool] = None)
    func NewVariableGroupPermissions(ctx *Context, name string, args VariableGroupPermissionsArgs, opts ...ResourceOption) (*VariableGroupPermissions, error)
    public VariableGroupPermissions(string name, VariableGroupPermissionsArgs args, CustomResourceOptions? opts = null)
    public VariableGroupPermissions(String name, VariableGroupPermissionsArgs args)
    public VariableGroupPermissions(String name, VariableGroupPermissionsArgs args, CustomResourceOptions options)
    
    type: azuredevops:VariableGroupPermissions
    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 VariableGroupPermissionsArgs
    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 VariableGroupPermissionsArgs
    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 VariableGroupPermissionsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VariableGroupPermissionsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VariableGroupPermissionsArgs
    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 variableGroupPermissionsResource = new AzureDevOps.VariableGroupPermissions("variableGroupPermissionsResource", new()
    {
        Permissions = 
        {
            { "string", "string" },
        },
        Principal = "string",
        ProjectId = "string",
        VariableGroupId = "string",
        Replace = false,
    });
    
    example, err := azuredevops.NewVariableGroupPermissions(ctx, "variableGroupPermissionsResource", &azuredevops.VariableGroupPermissionsArgs{
    	Permissions: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Principal:       pulumi.String("string"),
    	ProjectId:       pulumi.String("string"),
    	VariableGroupId: pulumi.String("string"),
    	Replace:         pulumi.Bool(false),
    })
    
    var variableGroupPermissionsResource = new VariableGroupPermissions("variableGroupPermissionsResource", VariableGroupPermissionsArgs.builder()
        .permissions(Map.of("string", "string"))
        .principal("string")
        .projectId("string")
        .variableGroupId("string")
        .replace(false)
        .build());
    
    variable_group_permissions_resource = azuredevops.VariableGroupPermissions("variableGroupPermissionsResource",
        permissions={
            "string": "string",
        },
        principal="string",
        project_id="string",
        variable_group_id="string",
        replace=False)
    
    const variableGroupPermissionsResource = new azuredevops.VariableGroupPermissions("variableGroupPermissionsResource", {
        permissions: {
            string: "string",
        },
        principal: "string",
        projectId: "string",
        variableGroupId: "string",
        replace: false,
    });
    
    type: azuredevops:VariableGroupPermissions
    properties:
        permissions:
            string: string
        principal: string
        projectId: string
        replace: false
        variableGroupId: string
    

    VariableGroupPermissions 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 VariableGroupPermissions resource accepts the following input properties:

    Permissions Dictionary<string, string>
    the permissions to assign. The following permissions are available.
    Principal string
    The group principal to assign the permissions.
    ProjectId string
    The ID of the project.
    VariableGroupId string
    The id of the variable group to assign the permissions.
    Replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    Permissions map[string]string
    the permissions to assign. The following permissions are available.
    Principal string
    The group principal to assign the permissions.
    ProjectId string
    The ID of the project.
    VariableGroupId string
    The id of the variable group to assign the permissions.
    Replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions Map<String,String>
    the permissions to assign. The following permissions are available.
    principal String
    The group principal to assign the permissions.
    projectId String
    The ID of the project.
    variableGroupId String
    The id of the variable group to assign the permissions.
    replace Boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions {[key: string]: string}
    the permissions to assign. The following permissions are available.
    principal string
    The group principal to assign the permissions.
    projectId string
    The ID of the project.
    variableGroupId string
    The id of the variable group to assign the permissions.
    replace boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions Mapping[str, str]
    the permissions to assign. The following permissions are available.
    principal str
    The group principal to assign the permissions.
    project_id str
    The ID of the project.
    variable_group_id str
    The id of the variable group to assign the permissions.
    replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    permissions Map<String>
    the permissions to assign. The following permissions are available.
    principal String
    The group principal to assign the permissions.
    projectId String
    The ID of the project.
    variableGroupId String
    The id of the variable group to assign the permissions.
    replace Boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VariableGroupPermissions 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 VariableGroupPermissions Resource

    Get an existing VariableGroupPermissions 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?: VariableGroupPermissionsState, opts?: CustomResourceOptions): VariableGroupPermissions
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            permissions: Optional[Mapping[str, str]] = None,
            principal: Optional[str] = None,
            project_id: Optional[str] = None,
            replace: Optional[bool] = None,
            variable_group_id: Optional[str] = None) -> VariableGroupPermissions
    func GetVariableGroupPermissions(ctx *Context, name string, id IDInput, state *VariableGroupPermissionsState, opts ...ResourceOption) (*VariableGroupPermissions, error)
    public static VariableGroupPermissions Get(string name, Input<string> id, VariableGroupPermissionsState? state, CustomResourceOptions? opts = null)
    public static VariableGroupPermissions get(String name, Output<String> id, VariableGroupPermissionsState 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:
    Permissions Dictionary<string, string>
    the permissions to assign. The following permissions are available.
    Principal string
    The group principal to assign the permissions.
    ProjectId string
    The ID of the project.
    Replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    VariableGroupId string
    The id of the variable group to assign the permissions.
    Permissions map[string]string
    the permissions to assign. The following permissions are available.
    Principal string
    The group principal to assign the permissions.
    ProjectId string
    The ID of the project.
    Replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    VariableGroupId string
    The id of the variable group to assign the permissions.
    permissions Map<String,String>
    the permissions to assign. The following permissions are available.
    principal String
    The group principal to assign the permissions.
    projectId String
    The ID of the project.
    replace Boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    variableGroupId String
    The id of the variable group to assign the permissions.
    permissions {[key: string]: string}
    the permissions to assign. The following permissions are available.
    principal string
    The group principal to assign the permissions.
    projectId string
    The ID of the project.
    replace boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    variableGroupId string
    The id of the variable group to assign the permissions.
    permissions Mapping[str, str]
    the permissions to assign. The following permissions are available.
    principal str
    The group principal to assign the permissions.
    project_id str
    The ID of the project.
    replace bool

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    variable_group_id str
    The id of the variable group to assign the permissions.
    permissions Map<String>
    the permissions to assign. The following permissions are available.
    principal String
    The group principal to assign the permissions.
    projectId String
    The ID of the project.
    replace Boolean

    Replace (true) or merge (false) the permissions. Default: true

    | Permission | Description | | ----------------- | ----------------------------------- | | View | View library item | | Administer | Administer library item | | Create | Create library item | | ViewSecrets | View library item secrets | | Use | Use library item | | Owner | Owner library item |

    variableGroupId String
    The id of the variable group to assign the permissions.

    Import

    The resource does not support import.

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure DevOps pulumi/pulumi-azuredevops
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azuredevops Terraform Provider.
    azuredevops logo
    Azure DevOps v3.3.0 published on Wednesday, Sep 4, 2024 by Pulumi