Giter VIP home page Giter VIP logo

terraform-utils-nac-merge's Issues

Unexpected Merge output in a specific scenario

Not sure if this is an issue, but wanted to reach out/report this just in case.

Seeing empty results for an org when the policies key is empty in one of the YAML files.

E.g. I have 2 yaml files: ntp.yaml, ssh.yaml.

  • I have an "ntp" key defined under "policies" under ntp.yaml file.
  • If I keep the "policies" key empty under ssh.yaml file, the "default" org returns an empty result even though I have ntp variables in ntp.yaml file.

Not working example:

ntp.yaml

---
intersight:
  organization:
    default:
      policies:
        ntp:
          - name: Demo-default_ntp1
            ntp_servers: ["1.1.1.1", "1.1.1.2"]
            description: Default NTP1 Policy
            enabled: false
            timezone: "America/Los_Angeles"
    prod:
      policies:
        ntp:
          - name: Demo-prod_ntp1
            ntp_servers: ["1.1.1.3", "3.3.3.3"]
            description: Prod NTP3 Policy
            enabled: true
            timezone: "America/Los_Angeles"

ssh.yaml

---
intersight:
  organization:
    default:
      policies:
        # ssh:
    prod:
      policies:
        ssh:
          - name: prod_ssh1
            description: Prod NTP1 Policy
            enabled: true
            port: 22
            timeout: 300
            tags:
              - key: Location
                value: SAN_JOSE
              - key: ENV
                value: PROD

Not Expected Output:

Sample output where the "default" key shows empty:

  + local_model  = {
      + intersight = {
          + organization = {
              + default = {}
              + prod    = {
                  + policies = {
                      + ntp = [
                          + {
                              + description = "Prod NTP3 Policy"
                              + enabled     = true
                              + name        = "Demo-prod_ntp1"
                              + ntp_servers = [
                                  + "1.1.1.3",
                                  + "3.3.3.3",
                                ]
                              + timezone    = "America/Los_Angeles"
                            },
                          + {

Working Example:

ntp.yaml

---
intersight:
  organization:
    default:
      policies:
        ntp:
          - name: Demo-default_ntp1
            ntp_servers: ["1.1.1.1", "1.1.1.2"]
            description: Default NTP1 Policy
            enabled: false
            timezone: "America/Los_Angeles"
    prod:
      policies:
        ntp:
          - name: Demo-prod_ntp1
            ntp_servers: ["1.1.1.3", "3.3.3.3"]
            description: Prod NTP3 Policy
            enabled: true
            timezone: "America/Los_Angeles"

ssh.yaml

---
intersight:
  organization:
    default:
      policies:
        ssh:
    prod:
      policies:
        ssh:
          - name: prod_ssh1
            description: Prod NTP1 Policy
            enabled: true
            port: 22
            timeout: 300
            tags:
              - key: Location
                value: SAN_JOSE
              - key: ENV
                value: PROD

Expected Output:

  + local_model  = {
      + intersight = {
          + organization = {
              + default = {
                  + policies = {
                      + ntp = [
                          + {
                              + description = "Default NTP1 Policy"
                              + enabled     = false
                              + name        = "Demo-default_ntp1"
                              + ntp_servers = [
                                  + "1.1.1.1",
                                  + "1.1.1.2",
                                ]
                              + timezone    = "America/Los_Angeles"
                            },
                          + {
                              + description = "Default NTP2 Policy"
                              + enabled     = true
                              + name        = "Demo-default_ntp2"
                              + ntp_servers = [
                                  + "2.2.2.2",
                                  + "2.2.2.1",
                                ]
                              + timezone    = "America/Los_Angeles"
                            },
                        ]
                    }
                }
              + prod    = {
                  + policies = {
                      + ntp = [
                          + {
                              + description = "Prod NTP3 Policy"
                              + enabled     = true
                              + name        = "Demo-prod_ntp1"
                              + ntp_servers = [
                                  + "1.1.1.3",
                                  + "3.3.3.3",
                                ]
                              + timezone    = "America/Los_Angeles"
                            },
                          + {

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.