Skip to content

Can I have a Mapping on a Class at the top level? #1097

Answered by HT154
kaihendry asked this question in Q&A
Discussion options

You must be logged in to vote

Neither of my suggestions do what you want because that's not possible. In both cases your config would need a slightly different structure.

The first suggestion entails putting your entries under a nested property:

outputs {
  new {
    name = "Foo deployment"
    deployments {
      ["dev"] {
        bucketName = "foo-dev"
      }
      ["prd"] {
        bucketName = "foo-prd"
      }
      ["uat"] {
        bucketName = "foo-uat"
      }
    }
  }

The second would use properties instead of mapping entries:

outputs {
  new {
    name = "Foo deployment"
    dev {
      bucketName = "foo-dev"
    }
    prd {
      bucketName = "foo-prd"
    }
    uat {
      bucketName = "foo-uat"
    }
  }

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@StefMa
Comment options

@HT154
Comment options

HT154 Jun 9, 2025
Collaborator

@StefMa
Comment options

Comment options

You must be logged in to vote
1 reply
@HT154
Comment options

HT154 Jun 12, 2025
Collaborator

Answer selected by kaihendry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants