examples icon indicating copy to clipboard operation
examples copied to clipboard

Ensure better Azure Container Apps integration with Pulumi IaC

Open ezYakaEagle442 opened this issue 3 years ago • 4 comments

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Pulumi docs does not show how to provision Azure Container App with latest features such as deployment to VNet.

Read https://github.com/pulumi/examples/blob/master/azure-ts-containerapps/index.ts try to deploy 1 Azure Container App with all latest features including deployment to VNet, AuthConfigs, Probes, Scaling rules, volumes, etc.

Here are some repos that provision Azure Container Apps using Azure Bicep IaC :

Affected area/feature

See also https://github.com/microsoft/azure-container-apps/issues/288

ezYakaEagle442 avatar Jul 05 '22 13:07 ezYakaEagle442

Hi @ezYakaEagle442 thanks for filing the issue! We have moved it to pulumi/examples repo since it is more about adding docs and not something that is particularly missing in the Pulumi CLI or the SDKs. If that is the case, please let us know and we will try to resolve the issue as soon as possible

Zaid-Ajaj avatar Jul 06 '22 14:07 Zaid-Ajaj

@jkodroff @Zaid-Ajaj I am trying to add a azure-files volume to my app container. As far as I can see, this feature is missing. There is no azurefiles option for volumes (also here). Thinking that it could be a documentation issue, and trying out code provided by pulumi-ai, errors appear. Am I missing something?

joaocpribeiro avatar Jan 22 '24 11:01 joaocpribeiro

I was mistaken, the feature exists. But the documentation is missing, indeed. I share my solution, which can help others arriving to this thread. Sorry for the identation.

    const storageAccountKeys = listStorageAccountKeys({
        resourceGroupName,
        accountName, // Storage account name.
      });

    const managedEnvironmentsStorage = new ManagedEnvironmentsStorage(`myManagedEnvironmentsStorage`, {
      environmentName: containerEnvResult.name, // Name of Container Apps Environment.
      properties: {
        azureFile: {
          accessMode: "ReadWrite",
          accountKey: storageAccountKeys.keys[0].value,
          accountName: accountName, // Storage account name.
          shareName: fileShareName, // The name of the Azure Files in storage account.
        },
      },
      resourceGroupName: resourceGroupName,
      storageName: `mymanagedenvstorage`,
    });

  let volumeName = `myvolume`;
  const containerApp = new ContainerApp(
    `myContainerApp`,
    {
      (...),
      template: {
        containers: [
          {
            (...)
            volumeMounts: [{
              mountPath: pathToPersistInVolume, // Path within your container app, where the volume will be mounted.
              subPath: '',
              volumeName: volumeName
            }],
          },
        ],
        (...)
        volumes: [{
          name: volumeName,
          storageType: "AzureFile",
          storageName: managedEnvironmentsStorage.name
        }],
      },
      (...)
    }
  );

Note that several names need to be lowercase, but pulumi will inform you if they are not.

joaocpribeiro avatar Jan 23 '24 15:01 joaocpribeiro

@joaocpribeiro thank you for the update. I've added @interurban to the issue for details on missing documentation for this feature.

isaac-pulumi avatar Jan 23 '24 15:01 isaac-pulumi