8000 Circular dependencies cause !terraform.output function to hang and eventually die · Issue #1216 · cloudposse/atmos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Circular dependencies cause !terraform.output function to hang and eventually die #1216
Open
@BFarand

Description

@BFarand

Describe the Bug

Given the following two (example) components:

security-group-example1:
  metadata:
    component: "security-group"
  vars:
    ingress_rules:
      Allow-Example2:
        from_port: 8080
        referenced_security_group_id: !terraform.output security-group-example2 security_group_id
        to_port: 8080

security-group-example2:
  metadata:
    component: "security-group"
  vars:
    ingress_rules:
      Allow-Example1:
        from_port: 8080
        referenced_security_group_id: !terraform.output security-group-example1 security_group_id
        to_port: 8080

Attempting to apply either of the components will cause atmos to hang and eventually have its process be killed. This is the case even if the components are first applied without their co-dependency and reapplied afterwards.

Expected Behavior

Ideally, I would expect the apply to be successful if (and only if) the component(s) were first initially created before their dependency was established.

My assumption is that the !terraform.output function has atmos run a terraform output command. It makes sense why the circular dependency is a problem, though it would be ideal if this could be worked around. This issue arises if at any point during the apply a circular dependency is found. When working with security groups in a multi-account environment, this can happen surprisingly often.

If the issue cannot be worked around, the next best thing would be for atmos to detect the circular dependency, write an error to stderr describing that it can't be done, then exit with a non-zero status.

Steps to Reproduce

Apply any component that (1) uses !terraform.output to get the output of another component and (2) has that component also use 50E9 !terraform.output to get the output of the first component.

See the bug description for a practical example.

Screenshots

No response

Environment

  • Linux (Ubuntu)
  • Atmos version 1.171.0

Additional Context

I would be happy to provde additional information if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0