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

Add Terraform cloud support in Atmos #416

Closed
jamengual opened this issue Jul 28, 2023 · 3 comments
Closed

Add Terraform cloud support in Atmos #416

jamengual opened this issue Jul 28, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@jamengual
Copy link

jamengual commented Jul 28, 2023

Describe the Feature

When using TFC the plan output, plan and apply runs, workspace, and state are managed by TFC remotely which is not compatible with the way Atmos treat workspaces, plan output, and remote state generation today.

  1. TFC requires the use of the cloud {} block for the state instead of the currently supported backend types in atmos:
terraform {
  cloud {
    organization = "PePeInc"

    workspaces {
      name = "my-poc"
    }
  }
}

The use of remote {} id not recommended as it is not being maintained by hashicorp
https://hangops.slack.com/archives/C0Z93TPFX/p1690241979618549

The workspace with the name my-poc will be created automatically if it does not exist, therefore Atmos should create this backend.tf file automatically based on a unique identifier that could be maybe something like {workspace} or a combination of {name_pattern}+{workspace} the important distinction here is that these names need to be unique across all the Org inside TFC, Ideally, this could be configurable inside atmos.yaml

  1. TFC does not support terraform plan -out flag so this will have to be disabled when TFC mode is enabled.

  2. Atmos terraform apply should not look for a saved plan since this is handled by the terraform binary as a API call automatically.

  3. Atmos should not look for the workspace locally if that is what is doing today, instead when TFC is enabled it should just run terraform init and that will create the workspace automatically:
    https://developer.hashicorp.com/terraform/cloud-docs/run/cli

Implicit Workspace Creation
If you configure the cloud block to use a workspace that doesn't yet exist in your organization, Terraform Cloud will create a new workspace with that name when you run terraform init. The output of terraform init will inform you when this happens.

Expected Behavior

no error when running using the cloud block.

Use Case

Currently manual steps are required to make it work with TFC

Describe Ideal Solution

Ideally this will be added as a new intgration

Alternatives Considered

No response

Additional Context

https://developer.hashicorp.com/terraform/tutorials/automation/github-actions

@osterman
Copy link
Member

Could you clarify if you're strictly referring to using TFC as a state backend or TFC also as a GitOps platform?

@jamengual
Copy link
Author

jamengual commented Jul 28, 2023 via email

@osterman osterman added the enhancement New feature or request label Feb 3, 2024
@jamengual
Copy link
Author

#572 closing

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

No branches or pull requests

2 participants