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

[Bug]: The launch template created by Terraform defaults to the "EC2-Classic" setting #30295

Closed
MayuriD89 opened this issue Mar 28, 2023 · 6 comments
Labels
bug Addresses a defect in current functionality.
Milestone

Comments

@MayuriD89
Copy link

MayuriD89 commented Mar 28, 2023

Terraform Core Version

0.12.31

AWS Provider Version

3.70.0

Affected Resource(s)

aws_launch_template

Expected Behavior

aws_launch_template should add vpc_security_group_ids under the vpc section and not in EC2 classic settings

Actual Behavior

For aws_launch template in Provider v3.70.0 there are two parameters availability_zone (Placement block) and security_group_names.

If we specify them in terraform, on AWS Console it defaults to EC2-Classic setting which is now deprecated. And on AWS Console it shows an error, but terraform doesn't have any validation for it.

Relevant Error/Panic Output Snippet

AWS Console Error - EC2-Classic is no longer supported. Please select the VPC networking platform to continue.

Terraform Configuration Files

test-launch-template01 = {
    DataSource = {
      image_id = {
        most_recent = true
        owners      = ["amazon"]
        ami_name    = "amzn2-ami-kernel-5.10-hvm-2.0.20211201.0-x86_64-gp2"
      }
    }
    name                                 = "launch-template01"
    description                          = "Production server for my application"
    update_default_version               = true
    disable_api_termination              = false
    ebs_optimized                        = true
    instance_initiated_shutdown_behavior = "stop"
    instance_type                        = "m3.xlarge"
    kernel_id                            = "aki-f98888"
    ram_disk_id                          = "ari-a009a2a1"
    key_name                             = "key-pair01"
    user_data                            = "./files/http_script.sh"
   security_group_names                 = ["security-group06"]
    block_device_mappings = [
      {
        device_name = "/dev/sdb"
        virtual_name = "ephemeral0"
      },
      {
        device_name  = "/dev/sdd"
        virtual_name = "ephemeral1"
      }
    ]
    capacity_reservation_specification = {
      capacity_reservation_preference = "open"
    }
    cpu_options = {
      core_count       = 1
      threads_per_core = 1
    }
    credit_specification = {
      cpu_credits = "standard"
    }
    elastic_inference_accelerator = {
      type = "eia2.large"
    }
    iam_instance_profile = {
      arn = "arn:aws:iam::8992882992:instance-profile/iam-instance-profile01"
    }
    monitoring = {
      enabled = true
    }
    placement = {
      affinity          = "Host"
      availability_zone = "ap-northeast-1a"
      group_name        = "placement-group01"
      tenancy           = "dedicated"
      partition_number  = 2
    }
    hibernation_options = {
      configured = true
    }
    enclave_options = {
      enabled = false
    }
  }

Steps to Reproduce

terraform apply

Debug Output

img_sg

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@MayuriD89 MayuriD89 added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Mar 28, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@ewbankkit
Copy link
Contributor

Relates #29480.

@ewbankkit ewbankkit added this to the v5.0.0 milestone Apr 7, 2023
@MayuriD89
Copy link
Author

Ok so I understood that 'security_group_names' parameter is deprecated and no longer supported.

Also we have observed that 'availability_zone' parameter from placement group leads launch template to EC2 classic setting even when we don't specify 'security_group_names'.

If we don't specify 'availability_zone' then it works normally and gets created without any error.

So we think that 'availability_zone' parameter should be removed from terraform documentation along with 'security_group_names'.

@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Apr 27, 2023
@johnsonaj
Copy link
Contributor

Closed in #30966. Merged to main in #31392

@github-actions
Copy link

This functionality has been released in v5.0.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality.
Projects
None yet
Development

No branches or pull requests

4 participants