harness.ApplicationGitSync
Explore with Pulumi AI
Resource for configuring application git sync.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";
const default = harness.getSecretManager({
"default": true,
});
const githubToken = new harness.EncryptedText("github_token", {
name: "github_token",
value: "<TOKEN>",
secretManagerId: _default.then(_default => _default.id),
});
const myrepo = new harness.GitConnector("myrepo", {
name: "myrepo",
url: "https://github.com/someorg/myrepo",
branch: "main",
generateWebhookUrl: true,
username: "someuser",
passwordSecretId: githubToken.id,
urlType: "REPO",
});
const example = new harness.Application("example", {name: "example-app"});
const exampleApplicationGitSync = new harness.ApplicationGitSync("example", {
appId: example.id,
connectorId: myrepo.id,
branch: "main",
enabled: false,
});
import pulumi
import pulumi_harness as harness
default = harness.get_secret_manager(default=True)
github_token = harness.EncryptedText("github_token",
name="github_token",
value="<TOKEN>",
secret_manager_id=default.id)
myrepo = harness.GitConnector("myrepo",
name="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 = harness.Application("example", name="example-app")
example_application_git_sync = harness.ApplicationGitSync("example",
app_id=example.id,
connector_id=myrepo.id,
branch="main",
enabled=False)
package main
import (
"github.com/pulumi/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, "github_token", &harness.EncryptedTextArgs{
Name: pulumi.String("github_token"),
Value: pulumi.String("<TOKEN>"),
SecretManagerId: pulumi.String(_default.Id),
})
if err != nil {
return err
}
myrepo, err := harness.NewGitConnector(ctx, "myrepo", &harness.GitConnectorArgs{
Name: pulumi.String("myrepo"),
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
}
example, err := harness.NewApplication(ctx, "example", &harness.ApplicationArgs{
Name: pulumi.String("example-app"),
})
if err != nil {
return err
}
_, err = harness.NewApplicationGitSync(ctx, "example", &harness.ApplicationGitSyncArgs{
AppId: example.ID(),
ConnectorId: myrepo.ID(),
Branch: pulumi.String("main"),
Enabled: pulumi.Bool(false),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Harness = Pulumi.Harness;
return await Deployment.RunAsync(() =>
{
var @default = Harness.GetSecretManager.Invoke(new()
{
Default = true,
});
var githubToken = new Harness.EncryptedText("github_token", new()
{
Name = "github_token",
Value = "<TOKEN>",
SecretManagerId = @default.Apply(@default => @default.Apply(getSecretManagerResult => getSecretManagerResult.Id)),
});
var myrepo = new Harness.GitConnector("myrepo", new()
{
Name = "myrepo",
Url = "https://github.com/someorg/myrepo",
Branch = "main",
GenerateWebhookUrl = true,
Username = "someuser",
PasswordSecretId = githubToken.Id,
UrlType = "REPO",
});
var example = new Harness.Application("example", new()
{
Name = "example-app",
});
var exampleApplicationGitSync = new Harness.ApplicationGitSync("example", new()
{
AppId = example.Id,
ConnectorId = myrepo.Id,
Branch = "main",
Enabled = false,
});
});
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.ApplicationArgs;
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()
.name("github_token")
.value("<TOKEN>")
.secretManagerId(default_.id())
.build());
var myrepo = new GitConnector("myrepo", GitConnectorArgs.builder()
.name("myrepo")
.url("https://github.com/someorg/myrepo")
.branch("main")
.generateWebhookUrl(true)
.username("someuser")
.passwordSecretId(githubToken.id())
.urlType("REPO")
.build());
var example = new Application("example", ApplicationArgs.builder()
.name("example-app")
.build());
var exampleApplicationGitSync = new ApplicationGitSync("exampleApplicationGitSync", ApplicationGitSyncArgs.builder()
.appId(example.id())
.connectorId(myrepo.id())
.branch("main")
.enabled(false)
.build());
}
}
resources:
githubToken:
type: harness:EncryptedText
name: github_token
properties:
name: github_token
value: <TOKEN>
secretManagerId: ${default.id}
myrepo:
type: harness:GitConnector
properties:
name: myrepo
url: https://github.com/someorg/myrepo
branch: main
generateWebhookUrl: true
username: someuser
passwordSecretId: ${githubToken.id}
urlType: REPO
example:
type: harness:Application
properties:
name: example-app
exampleApplicationGitSync:
type: harness:ApplicationGitSync
name: example
properties:
appId: ${example.id}
connectorId: ${myrepo.id}
branch: main
enabled: false
variables:
default:
fn::invoke:
Function: harness:getSecretManager
Arguments:
default: true
Create ApplicationGitSync Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApplicationGitSync(name: string, args: ApplicationGitSyncArgs, opts?: CustomResourceOptions);
@overload
def ApplicationGitSync(resource_name: str,
args: ApplicationGitSyncArgs,
opts: Optional[ResourceOptions] = None)
@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)
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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var applicationGitSyncResource = new Harness.ApplicationGitSync("applicationGitSyncResource", new()
{
AppId = "string",
Branch = "string",
ConnectorId = "string",
Enabled = false,
RepositoryName = "string",
});
example, err := harness.NewApplicationGitSync(ctx, "applicationGitSyncResource", &harness.ApplicationGitSyncArgs{
AppId: pulumi.String("string"),
Branch: pulumi.String("string"),
ConnectorId: pulumi.String("string"),
Enabled: pulumi.Bool(false),
RepositoryName: pulumi.String("string"),
})
var applicationGitSyncResource = new ApplicationGitSync("applicationGitSyncResource", ApplicationGitSyncArgs.builder()
.appId("string")
.branch("string")
.connectorId("string")
.enabled(false)
.repositoryName("string")
.build());
application_git_sync_resource = harness.ApplicationGitSync("applicationGitSyncResource",
app_id="string",
branch="string",
connector_id="string",
enabled=False,
repository_name="string")
const applicationGitSyncResource = new harness.ApplicationGitSync("applicationGitSyncResource", {
appId: "string",
branch: "string",
connectorId: "string",
enabled: false,
repositoryName: "string",
});
type: harness:ApplicationGitSync
properties:
appId: string
branch: string
connectorId: string
enabled: false
repositoryName: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ApplicationGitSync resource accepts the following input properties:
- App
Id string - The id of the application.
- Branch string
- The branch of the git repository to sync to.
- Connector
Id string - The id of the git connector to use.
- Enabled bool
- Whether or not to enable git sync.
- Repository
Name 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 string - The id of the application.
- Branch string
- The branch of the git repository to sync to.
- Connector
Id string - The id of the git connector to use.
- Enabled bool
- Whether or not to enable git sync.
- Repository
Name 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 String - The id of the application.
- branch String
- The branch of the git repository to sync to.
- connector
Id String - The id of the git connector to use.
- enabled Boolean
- Whether or not to enable git sync.
- repository
Name 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 string - The id of the application.
- branch string
- The branch of the git repository to sync to.
- connector
Id string - The id of the git connector to use.
- enabled boolean
- Whether or not to enable git sync.
- repository
Name 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.
- app
Id String - The id of the application.
- branch String
- The branch of the git repository to sync to.
- connector
Id String - The id of the git connector to use.
- enabled Boolean
- Whether or not to enable git sync.
- repository
Name 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.
- App
Id string - The id of the application.
- Branch string
- The branch of the git repository to sync to.
- Connector
Id string - The id of the git connector to use.
- Enabled bool
- Whether or not to enable git sync.
- Repository
Name 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 string - The id of the application.
- Branch string
- The branch of the git repository to sync to.
- Connector
Id string - The id of the git connector to use.
- Enabled bool
- Whether or not to enable git sync.
- Repository
Name 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 String - The id of the application.
- branch String
- The branch of the git repository to sync to.
- connector
Id String - The id of the git connector to use.
- enabled Boolean
- Whether or not to enable git sync.
- repository
Name 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 string - The id of the application.
- branch string
- The branch of the git repository to sync to.
- connector
Id string - The id of the git connector to use.
- enabled boolean
- Whether or not to enable git sync.
- repository
Name 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.
- app
Id String - The id of the application.
- branch String
- The branch of the git repository to sync to.
- connector
Id String - The id of the git connector to use.
- enabled Boolean
- Whether or not to enable git sync.
- repository
Name 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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- harness pulumi/pulumi-harness
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
harness
Terraform Provider.