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

harness.cloudprovider.Azure

Explore with Pulumi AI

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

    Resource for creating an Azure cloud provider. This resource uses the config-as-code API’s. When updating the name or path of this resource you should typically also set the create_before_destroy = true lifecycle setting.

    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 azureKey = new Harness.EncryptedText("azureKey", new()
        {
            Value = "<AZURE_KEY>",
            SecretManagerId = @default.Apply(@default => @default.Apply(getSecretManagerResult => getSecretManagerResult.Id)),
        });
    
        var azure = new Harness.Cloudprovider.Azure("azure", new()
        {
            ClientId = "<AZURE_CLIENT_ID>",
            TenantId = "<AZURE_TENANT_ID>",
            Key = azureKey.Name,
        });
    
    });
    
    package main
    
    import (
    	"github.com/lbrlabs/pulumi-harness/sdk/go/harness"
    	"github.com/lbrlabs/pulumi-harness/sdk/go/harness/cloudprovider"
    	"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
    		}
    		azureKey, err := harness.NewEncryptedText(ctx, "azureKey", &harness.EncryptedTextArgs{
    			Value:           pulumi.String("<AZURE_KEY>"),
    			SecretManagerId: *pulumi.String(_default.Id),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = cloudprovider.NewAzure(ctx, "azure", &cloudprovider.AzureArgs{
    			ClientId: pulumi.String("<AZURE_CLIENT_ID>"),
    			TenantId: pulumi.String("<AZURE_TENANT_ID>"),
    			Key:      azureKey.Name,
    		})
    		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.cloudprovider.Azure;
    import com.pulumi.harness.cloudprovider.AzureArgs;
    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 azureKey = new EncryptedText("azureKey", EncryptedTextArgs.builder()        
                .value("<AZURE_KEY>")
                .secretManagerId(default_.id())
                .build());
    
            var azure = new Azure("azure", AzureArgs.builder()        
                .clientId("<AZURE_CLIENT_ID>")
                .tenantId("<AZURE_TENANT_ID>")
                .key(azureKey.name())
                .build());
    
        }
    }
    
    import pulumi
    import lbrlabs_pulumi_harness as harness
    import pulumi_harness as harness
    
    default = harness.get_secret_manager(default=True)
    azure_key = harness.EncryptedText("azureKey",
        value="<AZURE_KEY>",
        secret_manager_id=default.id)
    azure = harness.cloudprovider.Azure("azure",
        client_id="<AZURE_CLIENT_ID>",
        tenant_id="<AZURE_TENANT_ID>",
        key=azure_key.name)
    
    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 azureKey = new harness.EncryptedText("azureKey", {
        value: "<AZURE_KEY>",
        secretManagerId: _default.then(_default => _default.id),
    });
    const azure = new harness.cloudprovider.Azure("azure", {
        clientId: "<AZURE_CLIENT_ID>",
        tenantId: "<AZURE_TENANT_ID>",
        key: azureKey.name,
    });
    
    resources:
      azureKey:
        type: harness:EncryptedText
        properties:
          value: <AZURE_KEY>
          secretManagerId: ${default.id}
      azure:
        type: harness:cloudprovider:Azure
        properties:
          clientId: <AZURE_CLIENT_ID>
          tenantId: <AZURE_TENANT_ID>
          key: ${azureKey.name}
    variables:
      default:
        fn::invoke:
          Function: harness:getSecretManager
          Arguments:
            default: true
    

    Create Azure Resource

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

    Constructor syntax

    new Azure(name: string, args: AzureArgs, opts?: CustomResourceOptions);
    @overload
    def Azure(resource_name: str,
              args: AzureArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Azure(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              client_id: Optional[str] = None,
              key: Optional[str] = None,
              tenant_id: Optional[str] = None,
              environment_type: Optional[str] = None,
              name: Optional[str] = None)
    func NewAzure(ctx *Context, name string, args AzureArgs, opts ...ResourceOption) (*Azure, error)
    public Azure(string name, AzureArgs args, CustomResourceOptions? opts = null)
    public Azure(String name, AzureArgs args)
    public Azure(String name, AzureArgs args, CustomResourceOptions options)
    
    type: harness:cloudprovider:Azure
    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 AzureArgs
    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 AzureArgs
    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 AzureArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AzureArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AzureArgs
    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 azureResource = new Harness.Cloudprovider.Azure("azureResource", new()
    {
        ClientId = "string",
        Key = "string",
        TenantId = "string",
        EnvironmentType = "string",
        Name = "string",
    });
    
    example, err := cloudprovider.NewAzure(ctx, "azureResource", &cloudprovider.AzureArgs{
    	ClientId:        pulumi.String("string"),
    	Key:             pulumi.String("string"),
    	TenantId:        pulumi.String("string"),
    	EnvironmentType: pulumi.String("string"),
    	Name:            pulumi.String("string"),
    })
    
    var azureResource = new Azure("azureResource", AzureArgs.builder()
        .clientId("string")
        .key("string")
        .tenantId("string")
        .environmentType("string")
        .name("string")
        .build());
    
    azure_resource = harness.cloudprovider.Azure("azureResource",
        client_id="string",
        key="string",
        tenant_id="string",
        environment_type="string",
        name="string")
    
    const azureResource = new harness.cloudprovider.Azure("azureResource", {
        clientId: "string",
        key: "string",
        tenantId: "string",
        environmentType: "string",
        name: "string",
    });
    
    type: harness:cloudprovider:Azure
    properties:
        clientId: string
        environmentType: string
        key: string
        name: string
        tenantId: string
    

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

    ClientId string
    The client id for the Azure application
    Key string
    The Name of the Harness secret containing the key for the Azure application
    TenantId string
    The tenant id for the Azure application
    EnvironmentType string
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    Name string
    The name of the cloud provider.
    ClientId string
    The client id for the Azure application
    Key string
    The Name of the Harness secret containing the key for the Azure application
    TenantId string
    The tenant id for the Azure application
    EnvironmentType string
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    Name string
    The name of the cloud provider.
    clientId String
    The client id for the Azure application
    key String
    The Name of the Harness secret containing the key for the Azure application
    tenantId String
    The tenant id for the Azure application
    environmentType String
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    name String
    The name of the cloud provider.
    clientId string
    The client id for the Azure application
    key string
    The Name of the Harness secret containing the key for the Azure application
    tenantId string
    The tenant id for the Azure application
    environmentType string
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    name string
    The name of the cloud provider.
    client_id str
    The client id for the Azure application
    key str
    The Name of the Harness secret containing the key for the Azure application
    tenant_id str
    The tenant id for the Azure application
    environment_type str
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    name str
    The name of the cloud provider.
    clientId String
    The client id for the Azure application
    key String
    The Name of the Harness secret containing the key for the Azure application
    tenantId String
    The tenant id for the Azure application
    environmentType String
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    name String
    The name of the cloud provider.

    Outputs

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

    Get an existing Azure 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?: AzureState, opts?: CustomResourceOptions): Azure
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            client_id: Optional[str] = None,
            environment_type: Optional[str] = None,
            key: Optional[str] = None,
            name: Optional[str] = None,
            tenant_id: Optional[str] = None) -> Azure
    func GetAzure(ctx *Context, name string, id IDInput, state *AzureState, opts ...ResourceOption) (*Azure, error)
    public static Azure Get(string name, Input<string> id, AzureState? state, CustomResourceOptions? opts = null)
    public static Azure get(String name, Output<String> id, AzureState 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:
    ClientId string
    The client id for the Azure application
    EnvironmentType string
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    Key string
    The Name of the Harness secret containing the key for the Azure application
    Name string
    The name of the cloud provider.
    TenantId string
    The tenant id for the Azure application
    ClientId string
    The client id for the Azure application
    EnvironmentType string
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    Key string
    The Name of the Harness secret containing the key for the Azure application
    Name string
    The name of the cloud provider.
    TenantId string
    The tenant id for the Azure application
    clientId String
    The client id for the Azure application
    environmentType String
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    key String
    The Name of the Harness secret containing the key for the Azure application
    name String
    The name of the cloud provider.
    tenantId String
    The tenant id for the Azure application
    clientId string
    The client id for the Azure application
    environmentType string
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    key string
    The Name of the Harness secret containing the key for the Azure application
    name string
    The name of the cloud provider.
    tenantId string
    The tenant id for the Azure application
    client_id str
    The client id for the Azure application
    environment_type str
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    key str
    The Name of the Harness secret containing the key for the Azure application
    name str
    The name of the cloud provider.
    tenant_id str
    The tenant id for the Azure application
    clientId String
    The client id for the Azure application
    environmentType String
    The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
    key String
    The Name of the Harness secret containing the key for the Azure application
    name String
    The name of the cloud provider.
    tenantId String
    The tenant id for the Azure application

    Import

    Import using the Harness azure cloud provider id.

     $ pulumi import harness:cloudprovider/azure:Azure example <provider_id>
    

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

    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