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

Issue handling 'io2' and 'gp3' volume types #114

Closed
Nexus357ZA opened this issue Oct 8, 2021 · 1 comment · Fixed by #136
Closed

Issue handling 'io2' and 'gp3' volume types #114

Nexus357ZA opened this issue Oct 8, 2021 · 1 comment · Fixed by #136
Labels
bug 🐛 An issue with the system

Comments

@Nexus357ZA
Copy link

Description

When using provisioned IOPS SSD other than io1 the specified iops value for root_iops and/or ebs_iops get set to 0

Expected Behavior

'io2' and 'gp3' volume types should also set the given iops value when supplied

Steps to Reproduce

Steps to reproduce the behavior:

With a module used

module "instance" {
  source  = "cloudposse/ec2-instance/aws"
  version = "0.39.0"
  
  #Other required parameters

  root_volume_type = "gp3"
  root_iops                = 6000
  
  ...
 }

The instance will be created, however the default value of 0 will be applied on subsequent runs

Screenshots

Example of subsequent runs

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.instance.aws_instance.default[0] will be updated in-place
  ~ resource "aws_instance" "default" {
        id                                   = "i-00000000000000000"
        tags                                 = {
            "Environment" = "xxx"
            "Name"        = "xxx"
            "Namespace"   = "xxx"
        }
        # (30 unchanged attributes hidden)

      ~ root_block_device {
          ~ iops                  = 3000 -> 0
            tags                  = {}
            # (8 unchanged attributes hidden)
        }
        # (4 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
@Nexus357ZA Nexus357ZA added the bug 🐛 An issue with the system label Oct 8, 2021
@Nexus357ZA
Copy link
Author

The issue lies with the following two lines in the locals declaration :

root_iops              = var.root_volume_type == "io1" ? var.root_iops : "0"
ebs_iops               = var.ebs_volume_type == "io1" ? var.ebs_iops : "0"

The root_iops and ebs_iops variables default to 0 already in the variable description, it might be safe to remove these lines from the localsblock and reference the variables directly. This should have no impact on other volume types unless the variables get set to any other value other than 0 in which case an appropriate error will be displayed anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
1 participant