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

[spacelift_stack_processor]: Add depends_on to Spacelift YAML stack config #43

Merged
merged 4 commits into from
Jun 8, 2021

Conversation

aknysh
Copy link
Member

@aknysh aknysh commented Jun 7, 2021

what

  • [spacelift_stack_processor]: Add depends_on to Spacelift YAML stack config

why

  • For each stack, in YAML stack config, allow specifying the stack dependencies on other components in the same environment and on other stacks
  • Automatically detects if the dependency is a stack or a component in the current stack, and throws an error if it's not a valid stack and not a valid component
  • depends-on then added to labels for the Spacelift stacks
  • Will be used in Spacelift workflows (using Rego policies) to trigger the dependent stacks after the "parent" stacks finish running

test

    aurora-postgres-2:
      component: aurora-postgres
      settings:
        spacelift:
          workspace_enabled: true
          autodeploy: true
          labels:
            - "deps:config/secrets/dev-internal-secrets.yml"
          depends_on:
            - vpc
            - dns-delegated
            - gbl-dns-dns-primary
labels:
    - deps:stacks/catalog/rds-defaults.yaml
    - deps:stacks/globals.yaml
    - deps:stacks/uw2-dev.yaml
    - deps:stacks/uw2-globals.yaml
    - deps:config/secrets/dev-internal-secrets.yml
    - depends-on:uw2-dev-vpc
    - depends-on:uw2-dev-dns-delegated
    - depends-on:gbl-dns-dns-primary
    - folder:component/aurora-postgres-2
    - folder:uw2/dev

If any of the entries in depends_on is not a valid stack and not a valid component in the current stack, the following errors will be thrown:

Error: Component 'aurora-postgres-2' in stack 'uw2-dev' specifies 'depends_on' dependency 'vpc3', 
but 'vpc3' is not a stack and not a terraform component in 'uw2-dev' stack
Error: Component 'aurora-postgres-2' in stack 'uw2-dev' specifies 'depends_on' dependency 'gbl-ops-dns-primary', 
but 'gbl-ops-dns-primary' is not a stack and not a terraform component in 'uw2-dev' stack

@aknysh aknysh requested review from osterman and Nuru June 7, 2021 17:35
@aknysh aknysh self-assigned this Jun 7, 2021
@aknysh aknysh requested review from a team as code owners June 7, 2021 17:35
@aknysh aknysh requested a review from Gowiem June 7, 2021 17:35
@aknysh aknysh requested a review from Gowiem June 7, 2021 17:43
osterman
osterman previously approved these changes Jun 7, 2021
Gowiem
Gowiem previously approved these changes Jun 7, 2021
@aknysh aknysh changed the title [spacelift_stack_processor]: Add depends-on to Spacelift YAML stack config [spacelift_stack_processor]: Add depends_on_component and depends_on_stack to Spacelift YAML stack config Jun 7, 2021
@aknysh aknysh dismissed stale reviews from Gowiem and osterman via c863492 June 7, 2021 18:18
@aknysh aknysh requested review from osterman and Gowiem June 7, 2021 18:18
jamengual
jamengual previously approved these changes Jun 7, 2021
@aknysh aknysh changed the title [spacelift_stack_processor]: Add depends_on_component and depends_on_stack to Spacelift YAML stack config [spacelift_stack_processor]: Add depends_on to Spacelift YAML stack config Jun 8, 2021
@aknysh aknysh requested a review from jamengual June 8, 2021 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants