Skip to content

Change ACA containerPort parameter to int instead of string #8906

Open
@eerhardt

Description

@eerhardt

Today when we allocate the container port parameter for ACA apps we are using the default typeof(string)

private BicepValue<int> AllocateContainerPortParameter()
=> AllocateParameter(ResourceExpression.GetContainerPortExpression(resource));
private void AllocateContainerRegistryParameters()
{
_containerRegistryUrlParameter ??= AllocateParameter(_containerAppEnvironmentContext.Environment.ContainerRegistryUrl);
_containerRegistryManagedIdentityIdParameter ??= AllocateParameter(_containerAppEnvironmentContext.Environment.ContainerRegistryManagedIdentityId);
}
private ProvisioningParameter AllocateParameter(IManifestExpressionProvider parameter, Type? type = null, SecretType secretType = SecretType.None)
{
if (!_allocatedParameters.TryGetValue(parameter, out var parameterName))
{
parameterName = parameter.ValueExpression.Replace("{", "").Replace("}", "").Replace(".", "_").Replace("-", "_").ToLowerInvariant();
if (parameterName[0] == '_')
{
parameterName = parameterName[1..];
}
_allocatedParameters[parameter] = parameterName;
}
if (!_provisioningParameters.TryGetValue(parameterName, out var provisioningParameter))
{
_provisioningParameters[parameterName] = provisioningParameter = new ProvisioningParameter(parameterName, type ?? typeof(string)) { IsSecure = secretType != SecretType.None };

Instead, this should be typeof(int).

https://learn.microsoft.com/en-us/azure/templates/microsoft.app/containerapps?pivots=deployment-language-bicep#resource-format

      ingress: {
        additionalPortMappings: [
          {
            exposedPort: int
            external: bool
            targetPort: int
          }
        ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-integrationsIssues pertaining to Aspire Integrations packages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions