harness.cloudprovider.Azure
Explore with Pulumi AI
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
import * as pulumi from "@pulumi/pulumi";
import * as harness from "@pulumi/harness";
const default = harness.getSecretManager({
"default": true,
});
const azureKey = new harness.EncryptedText("azure_key", {
name: "azure_key",
value: "<AZURE_KEY>",
secretManagerId: _default.then(_default => _default.id),
});
const azure = new harness.cloudprovider.Azure("azure", {
name: "azure",
clientId: "<AZURE_CLIENT_ID>",
tenantId: "<AZURE_TENANT_ID>",
key: azureKey.name,
});
import pulumi
import pulumi_harness as harness
default = harness.get_secret_manager(default=True)
azure_key = harness.EncryptedText("azure_key",
name="azure_key",
value="<AZURE_KEY>",
secret_manager_id=default.id)
azure = harness.cloudprovider.Azure("azure",
name="azure",
client_id="<AZURE_CLIENT_ID>",
tenant_id="<AZURE_TENANT_ID>",
key=azure_key.name)
package main
import (
"github.com/pulumi/pulumi-harness/sdk/go/harness"
"github.com/pulumi/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, "azure_key", &harness.EncryptedTextArgs{
Name: pulumi.String("azure_key"),
Value: pulumi.String("<AZURE_KEY>"),
SecretManagerId: pulumi.String(_default.Id),
})
if err != nil {
return err
}
_, err = cloudprovider.NewAzure(ctx, "azure", &cloudprovider.AzureArgs{
Name: pulumi.String("azure"),
ClientId: pulumi.String("<AZURE_CLIENT_ID>"),
TenantId: pulumi.String("<AZURE_TENANT_ID>"),
Key: azureKey.Name,
})
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 azureKey = new Harness.EncryptedText("azure_key", new()
{
Name = "azure_key",
Value = "<AZURE_KEY>",
SecretManagerId = @default.Apply(@default => @default.Apply(getSecretManagerResult => getSecretManagerResult.Id)),
});
var azure = new Harness.Cloudprovider.Azure("azure", new()
{
Name = "azure",
ClientId = "<AZURE_CLIENT_ID>",
TenantId = "<AZURE_TENANT_ID>",
Key = azureKey.Name,
});
});
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()
.name("azure_key")
.value("<AZURE_KEY>")
.secretManagerId(default_.id())
.build());
var azure = new Azure("azure", AzureArgs.builder()
.name("azure")
.clientId("<AZURE_CLIENT_ID>")
.tenantId("<AZURE_TENANT_ID>")
.key(azureKey.name())
.build());
}
}
resources:
azureKey:
type: harness:EncryptedText
name: azure_key
properties:
name: azure_key
value: <AZURE_KEY>
secretManagerId: ${default.id}
azure:
type: harness:cloudprovider:Azure
properties:
name: azure
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)
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Azure resource accepts the following input properties:
- Client
Id string - The client id for the Azure application
- Key string
- The Name of the Harness secret containing the key for the Azure application
- Tenant
Id string - The tenant id for the Azure application
- Environment
Type string - The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
- Name string
- The name of the cloud provider.
- Client
Id string - The client id for the Azure application
- Key string
- The Name of the Harness secret containing the key for the Azure application
- Tenant
Id string - The tenant id for the Azure application
- Environment
Type string - The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
- Name string
- The name of the cloud provider.
- client
Id String - The client id for the Azure application
- key String
- The Name of the Harness secret containing the key for the Azure application
- tenant
Id String - The tenant id for the Azure application
- environment
Type String - The type of environment. Valid options are [AZURE AZUREUSGOVERNMENT]
- name String
- The name of the cloud provider.
- client
Id string - The client id for the Azure application
- key string
- The Name of the Harness secret containing the key for the Azure application
- tenant
Id string - The tenant id for the Azure application
- environment
Type 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.
- client
Id String - The client id for the Azure application
- key String
- The Name of the Harness secret containing the key for the Azure application
- tenant
Id String - The tenant id for the Azure application
- environment
Type 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.
- Client
Id string - The client id for the Azure application
- Environment
Type 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.
- Tenant
Id string - The tenant id for the Azure application
- Client
Id string - The client id for the Azure application
- Environment
Type 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.
- Tenant
Id string - The tenant id for the Azure application
- client
Id String - The client id for the Azure application
- environment
Type 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.
- tenant
Id String - The tenant id for the Azure application
- client
Id string - The client id for the Azure application
- environment
Type 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.
- tenant
Id 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
- client
Id String - The client id for the Azure application
- environment
Type 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.
- tenant
Id 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 pulumi/pulumi-harness
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
harness
Terraform Provider.