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

feat: add parameter to disable env replacement in module params #730

Conversation

kukushking
Copy link
Contributor

@kukushking kukushking commented Sep 29, 2024

Issue #, if available:

Description of changes:

  • add parameter to disable env replacement in module params for cases such user passing a script as module input e.g.
    - eks_ng_name: ng-gdn412xlarge
      eks_node_quantity: 0
      eks_node_max_quantity: 30
      eks_node_min_quantity: 0
      eks_node_disk_size: 500
      eks_node_instance_type: "g4dn.12xlarge"
      use_gpu_ami: True
      eks_node_labels:
        usage: g4dn.12xlarge
        fast-disk-node: pv-nvme
      privateNetworking: true
      preBootstrapCommands:
        - |
          # Install NVMe CLI
          yum install nvme-cli -y
    
          # Get list of NVMe Drives
          nvme_drives=$(nvme list | grep "Amazon EC2 NVMe Instance Storage" | cut -d " " -f 1 || true)
          readarray -t nvme_drives <<< "$nvme_drives"
          'num_drives=1'
          # Install software RAID utility
          yum install mdadm -y
    
          # Create RAID-0 array across the instance store NVMe SSDs
         'mdadm --create /dev/md0 --level=0 --name=md0 --raid-devices=$num_drives "${nvme_drives[@]}"'
          # Format drive with Ext4
          mkfs.ext4 /dev/md0

          # Get RAID array's UUID
          uuid=$(blkid -o value -s UUID /dev/md0)

          # Create a filesystem path to mount the disk
          mount_location="/mnt/fast-disks/${uuid}"
          mkdir -p $mount_location
    
          # Mount RAID device
          mount /dev/md0 $mount_location
    
          # Have disk be mounted on reboot
          mdadm --detail --scan >> /etc/mdadm.conf 
          echo /dev/md0 $mount_location ext4 defaults,noatime 0 2 >> /etc/fstab
  • supports nested parameters such as frequently used in idf/compute/eks module
  • add test cases
  • update docs

Usage:

name: test-module-1
path: modules/test-module
targetAccount: primary
targetRegion: us-west-2
parameters:
  - name: param1
    disableEnvVarResolution: True
    value:
      - |
        export VAR=test
        echo "${VAR}"

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kukushking kukushking self-assigned this Sep 29, 2024
@kukushking kukushking marked this pull request as ready for review September 29, 2024 18:47
@kukushking kukushking requested a review from a team September 29, 2024 18:50
@kukushking kukushking added this to the 5.1.0 milestone Sep 29, 2024
@kukushking kukushking linked an issue Sep 29, 2024 that may be closed by this pull request
Copy link
Contributor

@dgraeber dgraeber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the docs with and example entry of the new parameter you are proposing...

I see it now

@dgraeber dgraeber self-requested a review September 30, 2024 12:44
@malachi-constant malachi-constant merged commit 66c8853 into awslabs:main Sep 30, 2024
7 checks passed
@kukushking kukushking deleted the feat/module-param-disable-env-replacement branch September 30, 2024 16:14
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.

[BUG] disable dynamic environment variable replacement
3 participants