Skip to content

Module auto planning not compatible with OpenTofu syntax changes #5957

@lauraseidler

Description

@lauraseidler

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request. Searching for pre-existing feature requests helps us consolidate datapoints for identical requirements into a single place, thank you!
  • 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.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

When using ATLANTIS_AUTOPLAN_MODULES and using OpenTofu with dynamic providers (which are currently not supported by Terraform), module dependencies cannot be loaded.

Reproduction Steps

Make Atlantis run with ATLANTIS_AUTOPLAN_MODULES on a project that has a dynamic provider configuration, which is valid for OpenTofu, for example:

locals {
  projects = toset(["my-project-1", "my-project-2"])
}

provider "google" {
  for_each = local.projects

  alias   = "project"
  project = each.key
}

data "google_service_account" "all" {
  for_each = local.projects

  provider   = google.project[each.key]
  account_id = "my-service-account"
}

Logs

Logs
error(s) loading project module dependencies: my-stack/provider.tf:52 - Invalid provider reference: Provider argument requires a provider name followed by an optional alias, like \"aws.foo\".","json":{"repo":"my-repo","pull":"24"},"stacktr
ace":"github.com/runatlantis/atlantis/server/events.(*DefaultProjectCommandBuilder).getMergedProjectCfgs\n\tgithub.com/runatlantis/atlantis/server/events/project_command_builder.go:401\ngithub.com/runatlantis/atlantis/server/events.(*DefaultProjectCommandBuilder).buildAllCommandsByCfg\n\tgithub.com/runatlantis/atlantis/server/events/project_command_builder.go:532\ngithub.com/runatlantis/atlantis/server/events.(*DefaultProjectCommandBuilder).BuildAutoplanCommands\n\tgithub.com/runatlantis/atlantis/server/events/project_command_builder.go:257\ngithub.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).BuildAutoplanCommands.func1\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_builder.go:29\ngithub.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).buildAndEmitStats\n\tgithub.com/runatlantis/atlantis/server/events/instrumented_project_command_builder.go:71\ngithub.com/runatlantis/atlantis/server/events.(*InstrumentedProjectCommandBuilder).BuildAutoplanCommands\n\tgithub.com/runatlantis/atlantis/server
/events/instrumented_project_command_builder.go:26\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).runAutoplan\n\tgithub.com/runatlantis/atlantis/server/events/plan_command_runner.go:94\ngithub.com/runatlantis/atlantis/server/events.(*PlanCommandRunner).Run\n\tgithub.com/runatlantis/atlantis/server/events/plan_command_runner.go:319\ngithub.com/runatlantis/atlantis/server/events.(*DefaultCommandRunner).RunAutoplanCommand\n\tgithub.com/runatlantis/atlantis/server/events/command_runner.go:251

Environment details

  • Atlantis version: v0.37.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions