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

missing documentation link to org #1

Closed
polly73 opened this issue Jun 14, 2024 · 4 comments
Closed

missing documentation link to org #1

polly73 opened this issue Jun 14, 2024 · 4 comments

Comments

@polly73
Copy link

polly73 commented Jun 14, 2024

hi there i dont get this to run in our lab and it seems i miss a point here, how to try out this code. It seems i miss the org definition, but i cannot find, where i have to do that

│ on .terraform/modules/policies/locals.tf line 1160, in locals:
│ 1160: name = "${local.npfx[org].port}${element(v.names, x)}${local.nsfx[org].port}"
│ ├────────────────
│ │ local.npfx is object with 6 attributes

@polly73 polly73 changed the title missing documentaiton link to org missing documentation link to org Jun 14, 2024
@scotttyso
Copy link
Collaborator

@polly73 - when you first run the script what are the existing orgs in the Intersight account? And what is your YAML configuration top level object (i.e. Organization) for your port policy?

I wish it gave more details with the error messages like this but the top-level objects under npfx are the organization names. So, the first part of the script pulls in all organization objects in Intersight. When you first run the script, you should see something similar to this.

Changes to Outputs:
  + orgs  = {
      + Asgard  = "5f6509326972652d32fa70a8"
      + RICH    = "639ffbbe6972652d3243d65f"
      + Wakanda = "60aeca786972652d32ee5e46"
      + common  = "6505cc486972653201c3bc8a"
      + default = "5ddea1e16972652d32b6493a"
    }
  + pools = {}

My guess is within your policies/ folder the org defined doesn't exist in your account. i.e. if your port policy was something like this:

---
#====================================
#   Policies -> Port - Variables
#====================================
blah:
  policies:
    port:
      - device_model: UCS-FI-6454
        names:
          - r143e-1-a
          - r143e-1-b
        port_channel_ethernet_uplinks:
          - admin_speed: Auto
            ethernet_network_group_policy: aci-uplink
            flow_control_policy: flow-ctrl
            interfaces:
              - port_id: 53
              - port_id: 54
            link_aggregation_policy: link-agg
            link_control_policy: link-ctrl
            pc_ids:
              - 53
              - 53
        port_channel_fc_uplinks:
          - admin_speed: 32Gbps
            interfaces:
              - port_id: 1
              - port_id: 2
            pc_ids:
              - 1
              - 1
            vsan_ids:
              - 100
              - 200
        port_modes:
          - custom_mode: FibreChannel
            port_list:
              - 1
              - 8
        port_role_servers:
          - port_list: 37,38

Note that blah isn't an existing organization from the output above. It would need to be Asgard, RICH, Wakanda, common, or default, if this was running against my own Intersight account.

With the configuration above I would get the exact error message you are running into.

│ Error: Invalid index
│
│   on .terraform/modules/policies/locals.tf line 1160, in locals:
│ 1160:         name = "${local.npfx[org].port}${element(v.names, x)}${local.nsfx[org].port}"
│     ├────────────────
│     │ local.npfx is object with 5 attributes
│
│ The given key does not identify an element in this collection value.

@polly73
Copy link
Author

polly73 commented Jun 18, 2024

thanks for your help!
So i need only to adjust the ezi.yaml files with definitions of my existing orgs or will be also orgs created?

For each new or existing org i need a copy in a new folder, like ...Wakanda??

A video or step by step howto would be extremly helpfull, at least for me, like your collegue did
https://www.youtube.com/watch?v=p_GNb5Ropqw
i think you did a great job here in your repo.

oh btw will you repo work with a private or connected intersight appliance too? As i have read in you other project... the APIs differ. Oh and what i have to do if i dont want to configure block devices and only want to work with iscsi?
best regards
stephan

@scotttyso
Copy link
Collaborator

scotttyso commented Jun 18, 2024

@polly73 - There is not support in the current module for Org creation. I am currently only using orgs as data source.

If you look at the ethernet.ezi.yaml file as an example:
https://github.com/terraform-cisco-modules/easy-imm/blob/main/policies/ethernet.ezi.yaml

You can see that common and default orgs are defined in the same file. The script actually supports that everything could be defined in one file if you wanted to, but it is broken apart into all the separate files to make it easier to consume. i.e. a single file isn't thousands of lines long.

The reason I put Wakanda in its own folder is to show how the module also supports data sources for pools, policies, and templates. In the Wakanda examples you can see that I am only defining the new port policy for the domain, but the server profiles and domain profile, are using the already defined policies in the root folder, instead of redefining them. This allows someone that has already deployed policies in Intersight to still use this module for just managing templates/profiles, without redefining the pre-existing pools/policies.

Please see my answer below, related to working with the CVA/PVA. The last numbers in the module release indicate the API version supported by the module. i.e. 4.2.11-17059 correlates to the API version 1.0.11-17059
CiscoDevNet/terraform-provider-intersight#254

To change the Intersight instance: in the global_settings.ezi.yaml, change the intersight_fqdn value to the CVA/PVA DNS name.

Have you followed the instructions in the README for defining the YAML Schema in Visual Studio Code? That Schema will help to provide the documentation of how to use the module and help you with formatting and auto-completion. Make sure to use that, as that contains all the instructions around required/optional attributes and will give you guidance with the Intersight API documentation on how to define pools, policies, profiles, and templates.

I will work in the near future to add some Youtube videos with instructions. Just wasn't on my priority list so far, with all the other projects I was working on.

@scotttyso
Copy link
Collaborator

On a side note, I do support organization creation with the intersight-tools ezimm.py script, using the Deploy process.

https://github.com/scotttyso/intersight-tools/blob/master/README.ezimm.md#deploy

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

No branches or pull requests

2 participants