1. Packages
  2. Github Provider
  3. API Docs
  4. DependabotOrganizationSecretRepositories
GitHub v6.4.0 published on Thursday, Nov 21, 2024 by Pulumi

github.DependabotOrganizationSecretRepositories

Explore with Pulumi AI

github logo
GitHub v6.4.0 published on Thursday, Nov 21, 2024 by Pulumi

    This resource allows you to manage the repository allow list for existing GitHub Dependabot secrets within your GitHub organization. You must have write access to an organization secret to use this resource.

    This resource is only applicable when visibility of the existing organization secret has been set to selected.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const repo = github.getRepository({
        fullName: "my-org/repo",
    });
    const exampleSecret = new github.DependabotOrganizationSecret("example_secret", {
        secretName: "example_secret_name",
        visibility: "private",
        plaintextValue: someSecretString,
    });
    const orgSecretRepos = new github.DependabotOrganizationSecretRepositories("org_secret_repos", {
        secretName: exampleSecret.secretName,
        selectedRepositoryIds: [repo.then(repo => repo.repoId)],
    });
    
    import pulumi
    import pulumi_github as github
    
    repo = github.get_repository(full_name="my-org/repo")
    example_secret = github.DependabotOrganizationSecret("example_secret",
        secret_name="example_secret_name",
        visibility="private",
        plaintext_value=some_secret_string)
    org_secret_repos = github.DependabotOrganizationSecretRepositories("org_secret_repos",
        secret_name=example_secret.secret_name,
        selected_repository_ids=[repo.repo_id])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		repo, err := github.LookupRepository(ctx, &github.LookupRepositoryArgs{
    			FullName: pulumi.StringRef("my-org/repo"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleSecret, err := github.NewDependabotOrganizationSecret(ctx, "example_secret", &github.DependabotOrganizationSecretArgs{
    			SecretName:     pulumi.String("example_secret_name"),
    			Visibility:     pulumi.String("private"),
    			PlaintextValue: pulumi.Any(someSecretString),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewDependabotOrganizationSecretRepositories(ctx, "org_secret_repos", &github.DependabotOrganizationSecretRepositoriesArgs{
    			SecretName: exampleSecret.SecretName,
    			SelectedRepositoryIds: pulumi.IntArray{
    				pulumi.Int(repo.RepoId),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var repo = Github.GetRepository.Invoke(new()
        {
            FullName = "my-org/repo",
        });
    
        var exampleSecret = new Github.DependabotOrganizationSecret("example_secret", new()
        {
            SecretName = "example_secret_name",
            Visibility = "private",
            PlaintextValue = someSecretString,
        });
    
        var orgSecretRepos = new Github.DependabotOrganizationSecretRepositories("org_secret_repos", new()
        {
            SecretName = exampleSecret.SecretName,
            SelectedRepositoryIds = new[]
            {
                repo.Apply(getRepositoryResult => getRepositoryResult.RepoId),
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.GithubFunctions;
    import com.pulumi.github.inputs.GetRepositoryArgs;
    import com.pulumi.github.DependabotOrganizationSecret;
    import com.pulumi.github.DependabotOrganizationSecretArgs;
    import com.pulumi.github.DependabotOrganizationSecretRepositories;
    import com.pulumi.github.DependabotOrganizationSecretRepositoriesArgs;
    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) {
            final var repo = GithubFunctions.getRepository(GetRepositoryArgs.builder()
                .fullName("my-org/repo")
                .build());
    
            var exampleSecret = new DependabotOrganizationSecret("exampleSecret", DependabotOrganizationSecretArgs.builder()
                .secretName("example_secret_name")
                .visibility("private")
                .plaintextValue(someSecretString)
                .build());
    
            var orgSecretRepos = new DependabotOrganizationSecretRepositories("orgSecretRepos", DependabotOrganizationSecretRepositoriesArgs.builder()
                .secretName(exampleSecret.secretName())
                .selectedRepositoryIds(repo.applyValue(getRepositoryResult -> getRepositoryResult.repoId()))
                .build());
    
        }
    }
    
    resources:
      exampleSecret:
        type: github:DependabotOrganizationSecret
        name: example_secret
        properties:
          secretName: example_secret_name
          visibility: private
          plaintextValue: ${someSecretString}
      orgSecretRepos:
        type: github:DependabotOrganizationSecretRepositories
        name: org_secret_repos
        properties:
          secretName: ${exampleSecret.secretName}
          selectedRepositoryIds:
            - ${repo.repoId}
    variables:
      repo:
        fn::invoke:
          Function: github:getRepository
          Arguments:
            fullName: my-org/repo
    

    Create DependabotOrganizationSecretRepositories Resource

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

    Constructor syntax

    new DependabotOrganizationSecretRepositories(name: string, args: DependabotOrganizationSecretRepositoriesArgs, opts?: CustomResourceOptions);
    @overload
    def DependabotOrganizationSecretRepositories(resource_name: str,
                                                 args: DependabotOrganizationSecretRepositoriesArgs,
                                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def DependabotOrganizationSecretRepositories(resource_name: str,
                                                 opts: Optional[ResourceOptions] = None,
                                                 secret_name: Optional[str] = None,
                                                 selected_repository_ids: Optional[Sequence[int]] = None)
    func NewDependabotOrganizationSecretRepositories(ctx *Context, name string, args DependabotOrganizationSecretRepositoriesArgs, opts ...ResourceOption) (*DependabotOrganizationSecretRepositories, error)
    public DependabotOrganizationSecretRepositories(string name, DependabotOrganizationSecretRepositoriesArgs args, CustomResourceOptions? opts = null)
    public DependabotOrganizationSecretRepositories(String name, DependabotOrganizationSecretRepositoriesArgs args)
    public DependabotOrganizationSecretRepositories(String name, DependabotOrganizationSecretRepositoriesArgs args, CustomResourceOptions options)
    
    type: github:DependabotOrganizationSecretRepositories
    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 DependabotOrganizationSecretRepositoriesArgs
    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 DependabotOrganizationSecretRepositoriesArgs
    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 DependabotOrganizationSecretRepositoriesArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DependabotOrganizationSecretRepositoriesArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DependabotOrganizationSecretRepositoriesArgs
    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 dependabotOrganizationSecretRepositoriesResource = new Github.DependabotOrganizationSecretRepositories("dependabotOrganizationSecretRepositoriesResource", new()
    {
        SecretName = "string",
        SelectedRepositoryIds = new[]
        {
            0,
        },
    });
    
    example, err := github.NewDependabotOrganizationSecretRepositories(ctx, "dependabotOrganizationSecretRepositoriesResource", &github.DependabotOrganizationSecretRepositoriesArgs{
    	SecretName: pulumi.String("string"),
    	SelectedRepositoryIds: pulumi.IntArray{
    		pulumi.Int(0),
    	},
    })
    
    var dependabotOrganizationSecretRepositoriesResource = new DependabotOrganizationSecretRepositories("dependabotOrganizationSecretRepositoriesResource", DependabotOrganizationSecretRepositoriesArgs.builder()
        .secretName("string")
        .selectedRepositoryIds(0)
        .build());
    
    dependabot_organization_secret_repositories_resource = github.DependabotOrganizationSecretRepositories("dependabotOrganizationSecretRepositoriesResource",
        secret_name="string",
        selected_repository_ids=[0])
    
    const dependabotOrganizationSecretRepositoriesResource = new github.DependabotOrganizationSecretRepositories("dependabotOrganizationSecretRepositoriesResource", {
        secretName: "string",
        selectedRepositoryIds: [0],
    });
    
    type: github:DependabotOrganizationSecretRepositories
    properties:
        secretName: string
        selectedRepositoryIds:
            - 0
    

    DependabotOrganizationSecretRepositories Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The DependabotOrganizationSecretRepositories resource accepts the following input properties:

    SecretName string
    Name of the existing secret
    SelectedRepositoryIds List<int>
    An array of repository ids that can access the organization secret.
    SecretName string
    Name of the existing secret
    SelectedRepositoryIds []int
    An array of repository ids that can access the organization secret.
    secretName String
    Name of the existing secret
    selectedRepositoryIds List<Integer>
    An array of repository ids that can access the organization secret.
    secretName string
    Name of the existing secret
    selectedRepositoryIds number[]
    An array of repository ids that can access the organization secret.
    secret_name str
    Name of the existing secret
    selected_repository_ids Sequence[int]
    An array of repository ids that can access the organization secret.
    secretName String
    Name of the existing secret
    selectedRepositoryIds List<Number>
    An array of repository ids that can access the organization secret.

    Outputs

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

    Get an existing DependabotOrganizationSecretRepositories 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?: DependabotOrganizationSecretRepositoriesState, opts?: CustomResourceOptions): DependabotOrganizationSecretRepositories
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            secret_name: Optional[str] = None,
            selected_repository_ids: Optional[Sequence[int]] = None) -> DependabotOrganizationSecretRepositories
    func GetDependabotOrganizationSecretRepositories(ctx *Context, name string, id IDInput, state *DependabotOrganizationSecretRepositoriesState, opts ...ResourceOption) (*DependabotOrganizationSecretRepositories, error)
    public static DependabotOrganizationSecretRepositories Get(string name, Input<string> id, DependabotOrganizationSecretRepositoriesState? state, CustomResourceOptions? opts = null)
    public static DependabotOrganizationSecretRepositories get(String name, Output<String> id, DependabotOrganizationSecretRepositoriesState 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:
    SecretName string
    Name of the existing secret
    SelectedRepositoryIds List<int>
    An array of repository ids that can access the organization secret.
    SecretName string
    Name of the existing secret
    SelectedRepositoryIds []int
    An array of repository ids that can access the organization secret.
    secretName String
    Name of the existing secret
    selectedRepositoryIds List<Integer>
    An array of repository ids that can access the organization secret.
    secretName string
    Name of the existing secret
    selectedRepositoryIds number[]
    An array of repository ids that can access the organization secret.
    secret_name str
    Name of the existing secret
    selected_repository_ids Sequence[int]
    An array of repository ids that can access the organization secret.
    secretName String
    Name of the existing secret
    selectedRepositoryIds List<Number>
    An array of repository ids that can access the organization secret.

    Import

    This resource can be imported using an ID made up of the secret name:

    $ pulumi import github:index/dependabotOrganizationSecretRepositories:DependabotOrganizationSecretRepositories test_secret_repos test_secret_name
    

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

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the github Terraform Provider.
    github logo
    GitHub v6.4.0 published on Thursday, Nov 21, 2024 by Pulumi