gcp logo
Google Cloud Classic v6.52.0, Mar 22 23

gcp.dataform.Repository

Import

Repository can be imported using any of these accepted formats

 $ pulumi import gcp:dataform/repository:Repository default projects/{{project}}/locations/{{region}}/repositories/{{name}}
 $ pulumi import gcp:dataform/repository:Repository default {{project}}/{{region}}/{{name}}
 $ pulumi import gcp:dataform/repository:Repository default {{region}}/{{name}}
 $ pulumi import gcp:dataform/repository:Repository default {{name}}

Example Usage

Dataform Repository

using System.Collections.Generic;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var gitRepository = new Gcp.SourceRepo.Repository("gitRepository", new()
    {
    }, new CustomResourceOptions
    {
        Provider = google_beta,
    });

    var secret = new Gcp.SecretManager.Secret("secret", new()
    {
        SecretId = "secret",
        Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
        {
            Automatic = true,
        },
    }, new CustomResourceOptions
    {
        Provider = google_beta,
    });

    var secretVersion = new Gcp.SecretManager.SecretVersion("secretVersion", new()
    {
        Secret = secret.Id,
        SecretData = "secret-data",
    }, new CustomResourceOptions
    {
        Provider = google_beta,
    });

    var dataformRespository = new Gcp.Dataform.Repository("dataformRespository", new()
    {
        GitRemoteSettings = new Gcp.Dataform.Inputs.RepositoryGitRemoteSettingsArgs
        {
            Url = gitRepository.Url,
            DefaultBranch = "main",
            AuthenticationTokenSecretVersion = secretVersion.Id,
        },
    }, new CustomResourceOptions
    {
        Provider = google_beta,
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/dataform"
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/secretmanager"
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/sourcerepo"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		gitRepository, err := sourcerepo.NewRepository(ctx, "gitRepository", nil, pulumi.Provider(google_beta))
		if err != nil {
			return err
		}
		secret, err := secretmanager.NewSecret(ctx, "secret", &secretmanager.SecretArgs{
			SecretId: pulumi.String("secret"),
			Replication: &secretmanager.SecretReplicationArgs{
				Automatic: pulumi.Bool(true),
			},
		}, pulumi.Provider(google_beta))
		if err != nil {
			return err
		}
		secretVersion, err := secretmanager.NewSecretVersion(ctx, "secretVersion", &secretmanager.SecretVersionArgs{
			Secret:     secret.ID(),
			SecretData: pulumi.String("secret-data"),
		}, pulumi.Provider(google_beta))
		if err != nil {
			return err
		}
		_, err = dataform.NewRepository(ctx, "dataformRespository", &dataform.RepositoryArgs{
			GitRemoteSettings: &dataform.RepositoryGitRemoteSettingsArgs{
				Url:                              gitRepository.Url,
				DefaultBranch:                    pulumi.String("main"),
				AuthenticationTokenSecretVersion: secretVersion.ID(),
			},
		}, pulumi.Provider(google_beta))
		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.gcp.sourcerepo.Repository;
import com.pulumi.gcp.sourcerepo.RepositoryArgs;
import com.pulumi.gcp.secretmanager.Secret;
import com.pulumi.gcp.secretmanager.SecretArgs;
import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
import com.pulumi.gcp.secretmanager.SecretVersion;
import com.pulumi.gcp.secretmanager.SecretVersionArgs;
import com.pulumi.gcp.dataform.Repository;
import com.pulumi.gcp.dataform.RepositoryArgs;
import com.pulumi.gcp.dataform.inputs.RepositoryGitRemoteSettingsArgs;
import com.pulumi.resources.CustomResourceOptions;
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 gitRepository = new Repository("gitRepository", RepositoryArgs.Empty, CustomResourceOptions.builder()
            .provider(google_beta)
            .build());

        var secret = new Secret("secret", SecretArgs.builder()        
            .secretId("secret")
            .replication(SecretReplicationArgs.builder()
                .automatic(true)
                .build())
            .build(), CustomResourceOptions.builder()
                .provider(google_beta)
                .build());

        var secretVersion = new SecretVersion("secretVersion", SecretVersionArgs.builder()        
            .secret(secret.id())
            .secretData("secret-data")
            .build(), CustomResourceOptions.builder()
                .provider(google_beta)
                .build());

        var dataformRespository = new Repository("dataformRespository", RepositoryArgs.builder()        
            .gitRemoteSettings(RepositoryGitRemoteSettingsArgs.builder()
                .url(gitRepository.url())
                .defaultBranch("main")
                .authenticationTokenSecretVersion(secretVersion.id())
                .build())
            .build(), CustomResourceOptions.builder()
                .provider(google_beta)
                .build());

    }
}
import pulumi
import pulumi_gcp as gcp

git_repository = gcp.sourcerepo.Repository("gitRepository", opts=pulumi.ResourceOptions(provider=google_beta))
secret = gcp.secretmanager.Secret("secret",
    secret_id="secret",
    replication=gcp.secretmanager.SecretReplicationArgs(
        automatic=True,
    ),
    opts=pulumi.ResourceOptions(provider=google_beta))
secret_version = gcp.secretmanager.SecretVersion("secretVersion",
    secret=secret.id,
    secret_data="secret-data",
    opts=pulumi.ResourceOptions(provider=google_beta))
dataform_respository = gcp.dataform.Repository("dataformRespository", git_remote_settings=gcp.dataform.RepositoryGitRemoteSettingsArgs(
    url=git_repository.url,
    default_branch="main",
    authentication_token_secret_version=secret_version.id,
),
opts=pulumi.ResourceOptions(provider=google_beta))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const gitRepository = new gcp.sourcerepo.Repository("gitRepository", {}, {
    provider: google_beta,
});
const secret = new gcp.secretmanager.Secret("secret", {
    secretId: "secret",
    replication: {
        automatic: true,
    },
}, {
    provider: google_beta,
});
const secretVersion = new gcp.secretmanager.SecretVersion("secretVersion", {
    secret: secret.id,
    secretData: "secret-data",
}, {
    provider: google_beta,
});
const dataformRespository = new gcp.dataform.Repository("dataformRespository", {gitRemoteSettings: {
    url: gitRepository.url,
    defaultBranch: "main",
    authenticationTokenSecretVersion: secretVersion.id,
}}, {
    provider: google_beta,
});
resources:
  gitRepository:
    type: gcp:sourcerepo:Repository
    options:
      provider: ${["google-beta"]}
  secret:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret
      replication:
        automatic: true
    options:
      provider: ${["google-beta"]}
  secretVersion:
    type: gcp:secretmanager:SecretVersion
    properties:
      secret: ${secret.id}
      secretData: secret-data
    options:
      provider: ${["google-beta"]}
  dataformRespository:
    type: gcp:dataform:Repository
    properties:
      gitRemoteSettings:
        url: ${gitRepository.url}
        defaultBranch: main
        authenticationTokenSecretVersion: ${secretVersion.id}
    options:
      provider: ${["google-beta"]}

Create Repository Resource

new Repository(name: string, args?: RepositoryArgs, opts?: CustomResourceOptions);
@overload
def Repository(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               git_remote_settings: Optional[RepositoryGitRemoteSettingsArgs] = None,
               name: Optional[str] = None,
               project: Optional[str] = None,
               region: Optional[str] = None)
@overload
def Repository(resource_name: str,
               args: Optional[RepositoryArgs] = None,
               opts: Optional[ResourceOptions] = None)
func NewRepository(ctx *Context, name string, args *RepositoryArgs, opts ...ResourceOption) (*Repository, error)
public Repository(string name, RepositoryArgs? args = null, CustomResourceOptions? opts = null)
public Repository(String name, RepositoryArgs args)
public Repository(String name, RepositoryArgs args, CustomResourceOptions options)
type: gcp:dataform:Repository
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args RepositoryArgs
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 RepositoryArgs
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 RepositoryArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RepositoryArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args RepositoryArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

GitRemoteSettings RepositoryGitRemoteSettingsArgs

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

Name string

The repository's name.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Region string

A reference to the region

GitRemoteSettings RepositoryGitRemoteSettingsArgs

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

Name string

The repository's name.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Region string

A reference to the region

gitRemoteSettings RepositoryGitRemoteSettingsArgs

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

name String

The repository's name.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

region String

A reference to the region

gitRemoteSettings RepositoryGitRemoteSettingsArgs

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

name string

The repository's name.

project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

region string

A reference to the region

git_remote_settings RepositoryGitRemoteSettingsArgs

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

name str

The repository's name.

project str

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

region str

A reference to the region

gitRemoteSettings Property Map

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

name String

The repository's name.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

region String

A reference to the region

Outputs

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

Get an existing Repository 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?: RepositoryState, opts?: CustomResourceOptions): Repository
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        git_remote_settings: Optional[RepositoryGitRemoteSettingsArgs] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        region: Optional[str] = None) -> Repository
func GetRepository(ctx *Context, name string, id IDInput, state *RepositoryState, opts ...ResourceOption) (*Repository, error)
public static Repository Get(string name, Input<string> id, RepositoryState? state, CustomResourceOptions? opts = null)
public static Repository get(String name, Output<String> id, RepositoryState 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:
GitRemoteSettings RepositoryGitRemoteSettingsArgs

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

Name string

The repository's name.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Region string

A reference to the region

GitRemoteSettings RepositoryGitRemoteSettingsArgs

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

Name string

The repository's name.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Region string

A reference to the region

gitRemoteSettings RepositoryGitRemoteSettingsArgs

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

name String

The repository's name.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

region String

A reference to the region

gitRemoteSettings RepositoryGitRemoteSettingsArgs

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

name string

The repository's name.

project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

region string

A reference to the region

git_remote_settings RepositoryGitRemoteSettingsArgs

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

name str

The repository's name.

project str

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

region str

A reference to the region

gitRemoteSettings Property Map

Optional. If set, configures this repository to be linked to a Git remote. Structure is documented below.

name String

The repository's name.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

region String

A reference to the region

Supporting Types

RepositoryGitRemoteSettings

AuthenticationTokenSecretVersion string

The name of the Secret Manager secret version to use as an authentication token for Git operations. Must be in the format projects//secrets//versions/*.

DefaultBranch string

The Git remote's default branch name.

Url string

The Git remote's URL.

TokenStatus string

(Output) Indicates the status of the Git access token. https://cloud.google.com/dataform/reference/rest/v1beta1/projects.locations.repositories#TokenStatus

AuthenticationTokenSecretVersion string

The name of the Secret Manager secret version to use as an authentication token for Git operations. Must be in the format projects//secrets//versions/*.

DefaultBranch string

The Git remote's default branch name.

Url string

The Git remote's URL.

TokenStatus string

(Output) Indicates the status of the Git access token. https://cloud.google.com/dataform/reference/rest/v1beta1/projects.locations.repositories#TokenStatus

authenticationTokenSecretVersion String

The name of the Secret Manager secret version to use as an authentication token for Git operations. Must be in the format projects//secrets//versions/*.

defaultBranch String

The Git remote's default branch name.

url String

The Git remote's URL.

tokenStatus String

(Output) Indicates the status of the Git access token. https://cloud.google.com/dataform/reference/rest/v1beta1/projects.locations.repositories#TokenStatus

authenticationTokenSecretVersion string

The name of the Secret Manager secret version to use as an authentication token for Git operations. Must be in the format projects//secrets//versions/*.

defaultBranch string

The Git remote's default branch name.

url string

The Git remote's URL.

tokenStatus string

(Output) Indicates the status of the Git access token. https://cloud.google.com/dataform/reference/rest/v1beta1/projects.locations.repositories#TokenStatus

authentication_token_secret_version str

The name of the Secret Manager secret version to use as an authentication token for Git operations. Must be in the format projects//secrets//versions/*.

default_branch str

The Git remote's default branch name.

url str

The Git remote's URL.

token_status str

(Output) Indicates the status of the Git access token. https://cloud.google.com/dataform/reference/rest/v1beta1/projects.locations.repositories#TokenStatus

authenticationTokenSecretVersion String

The name of the Secret Manager secret version to use as an authentication token for Git operations. Must be in the format projects//secrets//versions/*.

defaultBranch String

The Git remote's default branch name.

url String

The Git remote's URL.

tokenStatus String

(Output) Indicates the status of the Git access token. https://cloud.google.com/dataform/reference/rest/v1beta1/projects.locations.repositories#TokenStatus

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.