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

Move an azure container job from a cae to another doesn't destroy and recreate it #490

Open
btpemercier opened this issue Apr 30, 2024 · 1 comment

Comments

@btpemercier
Copy link

btpemercier commented Apr 30, 2024

Context

  • an Azure container job
  • a CAE called A
  • a CAE called B

Resource details

  • Terraform resource : azapi_resource
  • Azapi type : Microsoft.App/jobs@2023-05-01

Reproduce

  • Deploy CAE A
  • Deploy container app job on CAE A
  • Change the body.properties.environmentId to CAE B

Current behavior

  • Modify Job on CAE B
{
  "error": {
     "code": "ContainerAppsJobEnvironmentMismatch",
     "message": "Container Apps Job 'container-app-name' already exists in a different environment. To create it in the environment '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.App/managedEnvironments/container-app-name' delete it from the enviroment 'cae-a' first."
   }
}

Expected behavior

  • Destroy Job on CAE A
  • Create Job on CAE B
@ms-henglu
Copy link
Collaborator

Hello @btpemercier ,

Thank you for taking time to report this issue.

Currently the azapi provider doesn't support replacing resource when it is not able to update. For this case, please run terraform taint azapi_resource.{container app label}, then run terraform apply command and terraform destroy the container job before creating a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants