Skip to content

azurermBatchCertificate

Manages a certificate in an Azure Batch account.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "testbatch",
  }
);
const azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_1",
  {
    account_replication_type: "LRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "teststorage",
    resource_group_name: azurermResourceGroupExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermBatchAccountExample = new azurerm.batchAccount.BatchAccount(
  this,
  "example_2",
  {
    location: azurermResourceGroupExample.location,
    name: "testbatchaccount",
    pool_allocation_mode: "BatchService",
    resource_group_name: azurermResourceGroupExample.name,
    storage_account_id: azurermStorageAccountExample.id,
    tags: {
      env: "test",
    },
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermBatchAccountExample.overrideLogicalId("example");
const azurermBatchCertificateExample =
  new azurerm.batchCertificate.BatchCertificate(this, "example_3", {
    account_name: azurermBatchAccountExample.name,
    certificate: '${filebase64("certificate.pfx")}',
    format: "Pfx",
    password: "terraform",
    resource_group_name: azurermResourceGroupExample.name,
    thumbprint: "42C107874FD0E4A9583292A2F1098E8FE4B2EDDA",
    thumbprint_algorithm: "SHA1",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermBatchCertificateExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • accountName - (Required) Specifies the name of the Batch account. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which to create the Batch account. Changing this forces a new resource to be created.

  • certificate - (Required) The base64-encoded contents of the certificate.

  • format - (Required) The format of the certificate. Possible values are cer or pfx.

  • password - (Optional) The password to access the certificate's private key. This can only be specified when format is pfx.

  • thumbprint - (Required) The thumbprint of the certificate. Changing this forces a new resource to be created.

  • thumbprintAlgorithm - (Required) The algorithm of the certificate thumbprint. At this time the only supported value is sha1. Changing this forces a new resource to be created.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Batch Certificate.

  • name - The generated name of the certificate.

  • publicData - The public key of the certificate.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Batch Certificate.
  • update - (Defaults to 30 minutes) Used when updating the Batch Certificate.
  • read - (Defaults to 5 minutes) Used when retrieving the Batch Certificate.
  • delete - (Defaults to 30 minutes) Used when deleting the Batch Certificate.

Import

Batch Certificates can be imported using the resourceId, e.g.

terraform import azurerm_batch_certificate.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Batch/batchAccounts/batch1/certificates/certificate1