Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_container_app Argument template: volume: storage_type Does Not Use Provided Value of EmptyDir #22132

Closed
1 task done
colinbjohnson opened this issue Jun 12, 2023 · 2 comments · Fixed by #22196
Closed
1 task done

Comments

@colinbjohnson
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.5.0

AzureRM Provider Version

3.60.0

Affected Resource(s)/Data Source(s)

azurerm_container_app

Terraform Configuration Files

resource "azurerm_container_app" "nginx" {
  name                         = "nginx"
  container_app_environment_id = "xxx"
  resource_group_name          = azurerm_resource_group.nginx.name
  revision_mode                = "Single"
  template {
    container {
      name   = "nginx"
      image  = "nginx:latest"
      cpu    = 2.0
      memory = "4Gi"
      volume_mounts {
        path = "/var/log"
        name = "logs"
      }
    }
    volume {
      name         = "logs"
      storage_type = "EmptyDir"
    }
  }
}


### Debug Output/Panic Output

```shell
I believe the stdout/stderr output should be enough to reveal the problem

azurerm_resource_group.nginx: Refreshing state... [id=/subscriptions/x/resourceGroups/nginx]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_container_app.nginx will be created
  + resource "azurerm_container_app" "nginx" {
      + container_app_environment_id  = "/subscriptions/x/resourceGroups/aca-prod/providers/Microsoft.App/managedEnvironments/aca-prod"
      + custom_domain_verification_id = (sensitive value)
      + id                            = (known after apply)
      + latest_revision_fqdn          = (known after apply)
      + latest_revision_name          = (known after apply)
      + location                      = (known after apply)
      + name                          = "nginx"
      + outbound_ip_addresses         = (known after apply)
      + resource_group_name           = "nginx"
      + revision_mode                 = "Single"

      + template {
          + max_replicas    = 10
          + min_replicas    = (known after apply)
          + revision_suffix = (known after apply)

          + container {
              + cpu               = 2
              + ephemeral_storage = (known after apply)
              + image             = "nginx:latest"
              + memory            = "4Gi"
              + name              = "nginx"

              + volume_mounts {
                  + name = "logs"
                  + path = "/var/log"
                }
            }

          + volume {
              + name         = "logs"
              + storage_type = "EmptyDir"
            }
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

azurerm_container_app.nginx: Creating...
╷
│ Error: creating Container App (Subscription: "x"
│ Resource Group Name: "nginx"
│ Container App Name: "nginx"): performing CreateOrUpdate: containerapps.ContainerAppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: Code="ContainerAppVolumeStorageNameRequired" Message="Invalid Request: a storageName is required when creating volume 'logs' of storageType AzureFile."
│ 
│   with azurerm_container_app.nginx,
│   on main.tf line 19, in resource "azurerm_container_app" "nginx":
│   19: resource "azurerm_container_app" "nginx" {
│ 
│ creating Container App (Subscription: "x"
│ Resource Group Name: "nginx"
│ Container App Name: "nginx"): performing CreateOrUpdate: containerapps.ContainerAppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error:
│ Code="ContainerAppVolumeStorageNameRequired" Message="Invalid Request: a storageName is required when creating volume 'logs' of storageType AzureFile."
╵


### Expected Behaviour

I would expect that the following:

template {
container {
name = "nginx"
image = "nginx:latest"
cpu = 2.0
memory = "4Gi"
volume_mounts {
path = "/var/log"
name = "logs"
}
}
volume {
name = "logs"
storage_type = "EmptyDir"
}
}


Would create a volume of storage type `EmptyDir`.

### Actual Behaviour

I got an error as follows:

│ Container App Name: "nginx"): performing CreateOrUpdate: containerapps.ContainerAppsClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error:
│ Code="ContainerAppVolumeStorageNameRequired" Message="Invalid Request: a storageName is required when creating volume 'logs' of storageType AzureFile."


### Steps to Reproduce

Using the "Terraform Configuration Files" snippet, run `terraform apply`.

### Important Factoids

_No response_

### References

_No response_
@colinbjohnson colinbjohnson changed the title azurerm_container_app Argument template: volume: storage_type Does Not Work Properly azurerm_container_app Argument template: volume: storage_type Does Not Use Provided Value of EmptyDir Jun 12, 2023
@rcskosir
Copy link
Contributor

@colinbjohnson Thank you for opening this issue. I was able to reproduce it. The error message itself is interesting because you are setting the storageType to EmptyDir, not AzureFile. I'm poking around the code to see if its a error messaging issue or a logic issue.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants