Skip to content

🚀Add functionality to use also existing agent pool in agentpool.yaml CR configuration #583

Open
@zoli-opslogic

Description

@zoli-opslogic

Description

We are in the process of migrating our whole infrastructure into HCP Terraform (Plus tier). To be IaC compliant we are using tfe Terraform provider for all the HCP Terraform related resources. In order to configure certain private agent pools to be used by a certain number of workspaces, the agent pools must be created with the TFE provider.

Our choice for running the actual agents was using the V2 hcp-terraform-operator with the agentpool custom resource on AWS EKS, but unfortunately currently you can only create/manage new agent pools, not existing ones.

Our request would be to add logic/functionality to the agentpool custom resource to be able to use existing/blank agent pools.

Currently we are using a workaround with kubectl patch (but this is not a solid solution):

kubectl patch -n hcp-tf-ns agentpool agents-eks --type=merge --subresource status --patch 'status: {agentPoolID: apool-5739FGHfhryfj355sd, observedGeneration: 1}'

Potential YAML Configuration

spec:
  agentDeployment:
    replicas: 1
    spec:
      containers:
        - image: hashicorp/tfc-agent:1.20
          name: tfc-agent
  agentTokens:
    - name: agents-eks-token
  name: agents-eks
  organization: MytfOrg

  existingAgentPool: true    <--- in this case it should check based on the name of the agent pool if it exists or not and use the ID of that agent pool.

OR

  existingAgentPoolID: apool-5739FGHfhryfj355sd   <--- in this case the agent pool name is no longer required and just use the provided agent pool ID.

References

Community Note

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions