Skip to content

Instantly share code, notes, and snippets.

@slyness
Created July 22, 2015 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slyness/fa594384a126ce087b9d to your computer and use it in GitHub Desktop.
Save slyness/fa594384a126ce087b9d to your computer and use it in GitHub Desktop.
delete_something.md
            "DeviceName": {
              "Ref": "Mongodb1DeviceName"
            },
            "Ebs": {
              "VolumeSize": {
                "Ref": "Mongodb1VolumeSize"
              },
              "VolumeType": {
                "Ref": "Mongodb1VolumeType"
              },
              "SnapshotId": {
                "Fn::If": [
                  "Mongodb1UseSnapshot",
                  {
                    "Ref": "Mongodb1SnapshotId"
                  },
                  {
                    "Ref": "AWS::NoValue"
                  }
                ]
              },
              "Iops": {
                "Fn::If": [
                  "Mongodb1UseIops",
                  {
                    "Ref": "Mongodb1Iops"
                  },
                  {
                    "Ref": "AWS::NoValue"
                  }
                ]
              }
            }
          },

How close am I to deleting the above ebs iops key?

  num_ebs_devices.to_i.times do |i|
    parameters.delete!("mongodb#{i}_iops".to_sym)
    resources.delete!("mongodb#{i}_iops".to_sym)
    conditions.delete!("mongodb#{i}_use_iops".to_sym)

    resources(:mongodb_launch_config) do
      properties do | _current_properties |
        block_device_mappings _current_properties.block_device_mappings + _array(
          -> {
            device_name ref!("mongodb#{i}_device_name".to_sym)
            ebs do
              delete!(:iops)
            end
          }
        )
      end
    end
  end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment