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 utils_describe_stacks data source. Update atmos. Add tests #281

Merged
merged 20 commits into from
Apr 27, 2023

Conversation

aknysh
Copy link
Member

@aknysh aknysh commented Apr 26, 2023

what

  • Add utils_describe_stacks data source
  • Update atmos
  • Add tests

why

  • The utils_describe_stacks data source has the same functionality as the Atmos CLI command atmos describe stacks, and accepts all the parameters that the CLI command accepts, see https://atmos.tools/cli/commands/describe/stacks
  • The utils_describe_stacks data source will be used in Terraform to get configurations for stacks and components in the stacks

Terraform examples

locals {
  stack       = "tenant1-ue2-dev"
  namespace   = ""
  tenant      = "tenant1"
  environment = "ue2"
  stage       = "dev"

  env = {
    ENVIRONMENT           = local.environment
    STAGE                 = local.stage
    ATMOS_CLI_CONFIG_PATH = "."
  }

  result1 = yamldecode(data.utils_describe_stacks.example1.output)
  result2 = yamldecode(data.utils_describe_stacks.example2.output)
  result3 = yamldecode(data.utils_describe_stacks.example3.output)
  result4 = yamldecode(data.utils_describe_stacks.example4.output)
  result5 = yamldecode(data.utils_describe_stacks.example5.output)
  result6 = yamldecode(data.utils_describe_stacks.example6.output)
  result7 = yamldecode(data.utils_describe_stacks.example7.output)
}

data "utils_describe_stacks" "example1" {
}

data "utils_describe_stacks" "example2" {
  stack = local.stack
}

data "utils_describe_stacks" "example3" {
  namespace   = local.namespace
  tenant      = local.tenant
  environment = local.environment
  stage       = local.stage
  env         = local.env
}

data "utils_describe_stacks" "example4" {
  atmos_cli_config_path = "."
  atmos_base_path       = "../../complete"
  component_types       = ["terraform"]
  sections              = ["none"]
}

data "utils_describe_stacks" "example5" {
  component_types = ["terraform"]
  components      = ["top-level-component1", "test/test-component-override-3"]
  sections        = ["none"]
}

data "utils_describe_stacks" "example6" {
  tenant          = local.tenant
  environment     = local.environment
  stage           = local.stage
  component_types = ["terraform"]
  components      = ["test/test-component-override-3"]
  sections        = ["vars", "metadata", "env", "workspace"]
}

data "utils_describe_stacks" "example7" {
  component_types = ["terraform"]
  components      = ["top-level-component1"]
  sections        = ["vars", "workspace"]
}

@aknysh aknysh requested review from a team as code owners April 26, 2023 16:38
@aknysh aknysh requested review from Gowiem and korenyoni April 26, 2023 16:38
@aknysh aknysh added the minor New features that do not break anything label Apr 26, 2023
@Nuru Nuru merged commit c31757c into main Apr 27, 2023
@Nuru Nuru deleted the add-data-sources branch April 27, 2023 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor New features that do not break anything
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants