1. Packages
  2. Harness
  3. API Docs
  4. ApplicationGitSync
Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs

harness.ApplicationGitSync

Explore with Pulumi AI

harness logo
Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs

    Resource for configuring application git sync.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Harness = Lbrlabs.PulumiPackage.Harness;
    using Harness = Pulumi.Harness;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = Harness.GetSecretManager.Invoke(new()
        {
            Default = true,
        });
    
        var githubToken = new Harness.EncryptedText("githubToken", new()
        {
            Value = "<TOKEN>",
            SecretManagerId = @default.Apply(@default => @default.Apply(getSecretManagerResult => getSecretManagerResult.Id)),
        });
    
        var myrepo = new Harness.GitConnector("myrepo", new()
        {
            Url = "https://github.com/someorg/myrepo",
            Branch = "main",
            GenerateWebhookUrl = true,
            Username = "someuser",
            PasswordSecretId = githubToken.Id,
            UrlType = "REPO",
        });
    
        var exampleApplication = new Harness.Application("exampleApplication");
    
        var exampleApplicationGitSync = new Harness.ApplicationGitSync("exampleApplicationGitSync", new()
        {
            AppId = exampleApplication.Id,
            ConnectorId = myrepo.Id,
            Branch = "main",
            Enabled = false,
        });
    
    });
    
    package main
    
    import (
    	"github.com/lbrlabs/pulumi-harness/sdk/go/harness"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_default, err := harness.GetSecretManager(ctx, &harness.GetSecretManagerArgs{
    			Default: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		githubToken, err := harness.NewEncryptedText(ctx, "githubToken", &harness.EncryptedTextArgs{
    			Value:           pulumi.String("<TOKEN>"),
    			SecretManagerId: *pulumi.String(_default.Id),
    		})
    		if err != nil {
    			return err
    		}
    		myrepo, err := harness.NewGitConnector(ctx, "myrepo", &harness.GitConnectorArgs{
    			Url:                pulumi.String("https://github.com/someorg/myrepo"),
    			Branch:             pulumi.String("main"),
    			GenerateWebhookUrl: pulumi.Bool(true),
    			Username:           pulumi.String("someuser"),
    			PasswordSecretId:   githubToken.ID(),
    			UrlType:            pulumi.String("REPO"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleApplication, err := harness.NewApplication(ctx, "exampleApplication", nil)
    		if err != nil {
    			return err
    		}
    		_, err = harness.NewApplicationGitSync(ctx, "exampleApplicationGitSync", &harness.ApplicationGitSyncArgs{
    			AppId:       exampleApplication.ID(),
    			ConnectorId: myrepo.ID(),
    			Branch:      pulumi.String("main"),
    			Enabled:     pulumi.Bool(false),
    		})
    		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.harness.HarnessFunctions;
    import com.pulumi.harness.inputs.GetSecretManagerArgs;
    import com.pulumi.harness.EncryptedText;
    import com.pulumi.harness.EncryptedTextArgs;
    import com.pulumi.harness.GitConnector;
    import com.pulumi.harness.GitConnectorArgs;
    import com.pulumi.harness.Application;
    import com.pulumi.harness.ApplicationGitSync;
    import com.pulumi.harness.ApplicationGitSyncArgs;
    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 default = HarnessFunctions.getSecretManager(GetSecretManagerArgs.builder()
                .default_(true)
                .build());
    
            var githubToken = new EncryptedText("githubToken", EncryptedTextArgs.builder()        
                .value("<TOKEN>")
                .secretManagerId(default_.id())
                .build());
    
            var myrepo = new GitConnector("myrepo", GitConnectorArgs.builder()        
                .url("https://github.com/someorg/myrepo")
                .branch("main")
                .generateWebhookUrl(true)
                .username("someuser")
                .passwordSecretId(githubToken.id())
                .urlType("REPO")
                .build());
    
            var exampleApplication = new Application("exampleApplication");
    
            var exampleApplicationGitSync = new ApplicationGitSync("exampleApplicationGitSync", ApplicationGitSyncArgs.builder()        
                .appId(exampleApplication.id())
                .connectorId(myrepo.id())
                .branch("main")
                .enabled(false)
                .build());
    
        }
    }
    
    import pulumi
    import lbrlabs_pulumi_harness as harness
    import pulumi_harness as harness
    
    default = harness.get_secret_manager(default=True)
    github_token = harness.EncryptedText("githubToken",
        value="<TOKEN>",
        secret_manager_id=default.id)
    myrepo = harness.GitConnector("myrepo",
        url="https://github.com/someorg/myrepo",
        branch="main",
        generate_webhook_url=True,
        username="someuser",
        password_secret_id=github_token.id,
        url_type="REPO")
    example_application = harness.Application("exampleApplication")
    example_application_git_sync = harness.ApplicationGitSync("exampleApplicationGitSync",
        app_id=example_application.id,
        connector_id=myrepo.id,
        branch="main",
        enabled=False)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as harness from "@lbrlabs/pulumi-harness";
    import * as harness from "@pulumi/harness";
    
    const default = harness.getSecretManager({
        "default": true,
    });
    const githubToken = new harness.EncryptedText("githubToken", {
        value: "<TOKEN>",
        secretManagerId: _default.then(_default => _default.id),
    });
    const myrepo = new harness.GitConnector("myrepo", {
        url: "https://github.com/someorg/myrepo",
        branch: "main",
        generateWebhookUrl: true,
        username: "someuser",
        passwordSecretId: githubToken.id,
        urlType: "REPO",
    });
    const exampleApplication = new harness.Application("exampleApplication", {});
    const exampleApplicationGitSync = new harness.ApplicationGitSync("exampleApplicationGitSync", {
        appId: exampleApplication.id,
        connectorId: myrepo.id,
        branch: "main",
        enabled: false,
    });
    
    resources:
      githubToken:
        type: harness:EncryptedText
        properties:
          value: <TOKEN>
          secretManagerId: ${default.id}
      myrepo:
        type: harness:GitConnector
        properties:
          url: https://github.com/someorg/myrepo
          branch: main
          generateWebhookUrl: true
          username: someuser
          passwordSecretId: ${githubToken.id}
          urlType: REPO
      exampleApplication:
        type: harness:Application
      exampleApplicationGitSync:
        type: harness:ApplicationGitSync
        properties:
          appId: ${exampleApplication.id}
          connectorId: ${myrepo.id}
          branch: main
          enabled: false
    variables:
      default:
        fn::invoke:
          Function: harness:getSecretManager
          Arguments:
            default: true
    

    Create ApplicationGitSync Resource

    new ApplicationGitSync(name: string, args: ApplicationGitSyncArgs, opts?: CustomResourceOptions);
    @overload
    def ApplicationGitSync(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           app_id: Optional[str] = None,
                           branch: Optional[str] = None,
                           connector_id: Optional[str] = None,
                           enabled: Optional[bool] = None,
                           repository_name: Optional[str] = None)
    @overload
    def ApplicationGitSync(resource_name: str,
                           args: ApplicationGitSyncArgs,
                           opts: Optional[ResourceOptions] = None)
    func NewApplicationGitSync(ctx *Context, name string, args ApplicationGitSyncArgs, opts ...ResourceOption) (*ApplicationGitSync, error)
    public ApplicationGitSync(string name, ApplicationGitSyncArgs args, CustomResourceOptions? opts = null)
    public ApplicationGitSync(String name, ApplicationGitSyncArgs args)
    public ApplicationGitSync(String name, ApplicationGitSyncArgs args, CustomResourceOptions options)
    
    type: harness:ApplicationGitSync
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args ApplicationGitSyncArgs
    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 ApplicationGitSyncArgs
    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 ApplicationGitSyncArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApplicationGitSyncArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApplicationGitSyncArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    AppId string

    The id of the application.

    Branch string

    The branch of the git repository to sync to.

    ConnectorId string

    The id of the git connector to use.

    Enabled bool

    Whether or not to enable git sync.

    RepositoryName string

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    AppId string

    The id of the application.

    Branch string

    The branch of the git repository to sync to.

    ConnectorId string

    The id of the git connector to use.

    Enabled bool

    Whether or not to enable git sync.

    RepositoryName string

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    appId String

    The id of the application.

    branch String

    The branch of the git repository to sync to.

    connectorId String

    The id of the git connector to use.

    enabled Boolean

    Whether or not to enable git sync.

    repositoryName String

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    appId string

    The id of the application.

    branch string

    The branch of the git repository to sync to.

    connectorId string

    The id of the git connector to use.

    enabled boolean

    Whether or not to enable git sync.

    repositoryName string

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    app_id str

    The id of the application.

    branch str

    The branch of the git repository to sync to.

    connector_id str

    The id of the git connector to use.

    enabled bool

    Whether or not to enable git sync.

    repository_name str

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    appId String

    The id of the application.

    branch String

    The branch of the git repository to sync to.

    connectorId String

    The id of the git connector to use.

    enabled Boolean

    Whether or not to enable git sync.

    repositoryName String

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    Outputs

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

    Get an existing ApplicationGitSync 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?: ApplicationGitSyncState, opts?: CustomResourceOptions): ApplicationGitSync
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            app_id: Optional[str] = None,
            branch: Optional[str] = None,
            connector_id: Optional[str] = None,
            enabled: Optional[bool] = None,
            repository_name: Optional[str] = None) -> ApplicationGitSync
    func GetApplicationGitSync(ctx *Context, name string, id IDInput, state *ApplicationGitSyncState, opts ...ResourceOption) (*ApplicationGitSync, error)
    public static ApplicationGitSync Get(string name, Input<string> id, ApplicationGitSyncState? state, CustomResourceOptions? opts = null)
    public static ApplicationGitSync get(String name, Output<String> id, ApplicationGitSyncState 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:
    AppId string

    The id of the application.

    Branch string

    The branch of the git repository to sync to.

    ConnectorId string

    The id of the git connector to use.

    Enabled bool

    Whether or not to enable git sync.

    RepositoryName string

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    AppId string

    The id of the application.

    Branch string

    The branch of the git repository to sync to.

    ConnectorId string

    The id of the git connector to use.

    Enabled bool

    Whether or not to enable git sync.

    RepositoryName string

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    appId String

    The id of the application.

    branch String

    The branch of the git repository to sync to.

    connectorId String

    The id of the git connector to use.

    enabled Boolean

    Whether or not to enable git sync.

    repositoryName String

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    appId string

    The id of the application.

    branch string

    The branch of the git repository to sync to.

    connectorId string

    The id of the git connector to use.

    enabled boolean

    Whether or not to enable git sync.

    repositoryName string

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    app_id str

    The id of the application.

    branch str

    The branch of the git repository to sync to.

    connector_id str

    The id of the git connector to use.

    enabled bool

    Whether or not to enable git sync.

    repository_name str

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    appId String

    The id of the application.

    branch String

    The branch of the git repository to sync to.

    connectorId String

    The id of the git connector to use.

    enabled Boolean

    Whether or not to enable git sync.

    repositoryName String

    The name of the git repository to sync to. This is only used if the git connector is for an account and not an individual repository.

    Import

    Import using the Harness application id

     $ pulumi import harness:index/applicationGitSync:ApplicationGitSync myapp Xyz123
    

    Package Details

    Repository
    harness lbrlabs/pulumi-harness
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the harness Terraform Provider.

    harness logo
    Harness v0.0.6 published on Saturday, Jul 1, 2023 by lbrlabs