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

cpu property under agent_setting block is not working when agent_pool_name is set #28085

Closed
1 task done
eddy-vera opened this issue Nov 21, 2024 · 1 comment · Fixed by #28098
Closed
1 task done

Comments

@eddy-vera
Copy link

eddy-vera commented Nov 21, 2024

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 comments along the lines of "+1", "me too" or "any updates", 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 and review the contribution guide to help.

Terraform Version

1.9.8

AzureRM Provider Version

4.10.0

Affected Resource(s)/Data Source(s)

azurerm_container_registry_task

Terraform Configuration Files

resource "azurerm_container_registry_task" "example" {
  name                  = "example-task"
  container_registry_id = azurerm_container_registry.example.id
  agent_pool_name       = azurerm_container_registry_agent_pool.example.name

  agent_setting {
    cpu = 2
  }

  platform {
    os = "Linux"
  }

  docker_step {
    dockerfile_path      = "Dockerfile"
    context_path         = "https://github.com/<username>/<repository>#<branch>:<folder>"
    context_access_token = "<github personal access token>"
    image_names          = ["helloworld:{{.Run.ID}}"]
  }
}

Debug Output/Panic Output

N/A

Expected Behaviour

Agent Setting (configuration) CPU being set on the ACR task:
image

Actual Behaviour

Terraform plan and apply runs fine:
image

However, when running a TF plan again after a successful apply you get:
image

This is due to Agent Setting (Configuration) CPU not being set:
image

So either agent_setting or agent_pool_name can be set, but there is no validation in the plan/apply.
Also, the documentation does not mention this and should be updated with a note that either of the two should be set.
In addition, the only accepted value for 'cpu' under the 'agent_setting' block is 2. If any other value is provided it gives an error:
InnerErrors: AgentProperties:Invalid value for CPU core count. The supported values are (2)
The documentation should also reflect this.

Steps to Reproduce

  1. Run Terraform apply with:
resource "azurerm_container_registry_task" "example" {
  name                  = "example-task"
  container_registry_id = azurerm_container_registry.example.id
  agent_pool_name       = azurerm_container_registry_agent_pool.example.name

  agent_setting {
    cpu = 2
  }

  platform {
    os = "Linux"
  }

  docker_step {
    dockerfile_path      = "Dockerfile"
    context_path         = "https://github.com/<username>/<repository>#<branch>:<folder>"
    context_access_token = "<github personal access token>"
    image_names          = ["helloworld:{{.Run.ID}}"]
  }
}
  1. Run Terraform plan again

Important Factoids

No response

References

No response

@eddy-vera eddy-vera changed the title CPU agent_setting not working when agent_pool_name is set cpu property under agent_setting block is not working when agent_pool_name is set Nov 21, 2024
@github-actions github-actions bot added this to the v4.12.0 milestone Nov 26, 2024
@eddy-vera
Copy link
Author

Thanks @magodo for the schema validation and update of the documentation.

@rcskosir rcskosir added the bug label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants