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

EC2-Classic Retirement #23625

Closed
breathingdust opened this issue Mar 10, 2022 · 6 comments
Closed

EC2-Classic Retirement #23625

breathingdust opened this issue Mar 10, 2022 · 6 comments
Labels
service/autoscaling Issues and PRs that pertain to the autoscaling service. service/ec2 Issues and PRs that pertain to the ec2 service. service/elasticache Issues and PRs that pertain to the elasticache service. service/elb Issues and PRs that pertain to the elb service. service/opsworks Issues and PRs that pertain to the opsworks service. service/rds Issues and PRs that pertain to the rds service. service/redshift Issues and PRs that pertain to the redshift service. technical-debt Addresses areas of the codebase that need refactoring or redesign.

Comments

@breathingdust
Copy link
Member

breathingdust commented Mar 10, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • 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
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

On August 15, 2022 AWS will retire EC2-Classic Networking

The provider has always supported EC2-Classic, but inline with this retirement we will remove for support for it in v5.0 of the provider. At this time we have no date for this next major version, but we expect it to land sometime in 2023.

In order to ensure that users are well aware of this change, we will add deprecation notices to resources/attributes which configure elements of EC2-Classic Networking and over time remove the EC2-Classic-specific functionality from the codebase.

New or Affected Resource(s)

  • aws_eip
  • aws_eip_association
  • aws_security_group
  • aws_default_security_group
  • aws_vpc
  • aws_vpc_peering_connection
  • aws_vpc_peering_connection_accepter
  • aws_vpc_peering_connection_options
  • aws_launch_configuration
  • aws_db_instance
  • aws_db_security_group
  • aws_reshift_cluster
  • aws_redshift_security_group
  • aws_elasticache_cluster
  • aws_elasticache_security_group
  • aws_opsworks_stack

References

Phases

This work will be done in a phased approach with a number of PRs submitted.

Phase 1 - Resource and attribute deprecation

In this phase those resources and attributes which apply only to EC2-Classic functionality will be marked as deprecated, following documented best practices.

Add DeprecationMessage to these resources’ schemas (and document):

  • aws_db_security_group
  • aws_elasticache_security_group
  • aws_redshift_security_group

Add Deprecated to these resource attributes:

  • aws_db_instance.security_group_names
  • aws_elasticache_cluster.security_group_names
  • aws_redshift_cluster.cluster_security_groups
  • aws_launch_configuration.vpc_classic_link_id
  • aws_launch_configuration.vpc_classic_link_security_groups
  • aws_vpc.enable_classiclink
  • aws_vpc.enable_classiclink_dns_support
  • aws_vpc_peering_connection.allow_classic_link_to_remote_vpc
  • aws_vpc_peering_connection.allow_vpc_to_remote_classic_link
  • aws_vpc_peering_connection_accepter.allow_classic_link_to_remote_vpc
  • aws_vpc_peering_connection_accepter.allow_vpc_to_remote_classic_link
  • aws_vpc_peering_connection_options.allow_classic_link_to_remote_vpc
  • aws_vpc_peering_connection_options.allow_vpc_to_remote_classic_link

Phase 2 - Prevent creation of new EC2-Classic resources

In this phase attempting to create new EC2-Classic resources will result in an error during terraform apply. Existing EC2-Classic resources can be read, updated and deleted.

No new instances of these resources can be created:

  • aws_db_security_group
  • aws_elasticache_security_group
  • aws_redshift_security_group

Creation/update of these resources will be modified:

  • aws_eip - Error if vpc is false
    Reverted via resource/aws_eip: Default to default domain when vpc not set #26716.
  • aws_security_group - Error if vpc_id is not configured
    Reverted via resource/aws_security_group: Use default VPC when no VPC ID passed #26697.
  • aws_vpc - Error if enable_classiclink or enable_classiclink_dns_support is true
  • aws_vpc_peering_connection - Error if allow_classic_link_to_remote_vpc or allow_vpc_to_remote_classic_link is true
  • aws_vpc_peering_connection_accepter - Error if allow_classic_link_to_remote_vpc or allow_vpc_to_remote_classic_link is true
  • aws_vpc_peering_connection_options - Error if allow_classic_link_to_remote_vpc or allow_vpc_to_remote_classic_link is true
  • aws_launch_configuration - Error if vpc_classic_link_id or vpc_classic_link_security_groups is configured
  • aws_db_instance - Error if security_group_names is configured
  • aws_redshift_cluster - Error if cluster_security_groups is configured
  • aws_elasticache_cluster - Error if security_group_names is configured
  • aws_opsworks_stack - Error if vpc_id or default_subnet_id is not configured
    Reverted via resource/aws_opsworks_stack: Use Default VPC when no VPC ID passed #26711.

Phase 3 - Remove acceptance testing infrastructure

@breathingdust breathingdust added the enhancement Requests to existing resources that expand the functionality or scope. label Mar 10, 2022
@github-actions github-actions bot added service/autoscaling Issues and PRs that pertain to the autoscaling service. service/ec2 Issues and PRs that pertain to the ec2 service. service/elb Issues and PRs that pertain to the elb service. service/rds Issues and PRs that pertain to the rds service. labels Mar 10, 2022
@ewbankkit ewbankkit changed the title EC2-Classic: Configure deprecation notices EC2-Classic Retirement Aug 22, 2022
@ewbankkit ewbankkit added service/redshift Issues and PRs that pertain to the redshift service. service/opsworks Issues and PRs that pertain to the opsworks service. service/elasticache Issues and PRs that pertain to the elasticache service. technical-debt Addresses areas of the codebase that need refactoring or redesign. and removed enhancement Requests to existing resources that expand the functionality or scope. labels Aug 29, 2022
davidkelliott added a commit to ministryofjustice/modernisation-platform that referenced this issue Sep 5, 2022
EC2-Classic networking has been retired and references to it have been
deprecated in the AWS provider -

hashicorp/terraform-provider-aws#23625

This change fixes deprecation warnings we started getting -

```
Warning: Argument is deprecated

  with module.vpc.aws_vpc.default,
  on ../../modules/vpc-hub/main.tf line 105, in resource "aws_vpc" "default":
 105:   enable_classiclink             = false

With the retirement of EC2-Classic the enable_classiclink attribute has been
deprecated and will be removed in a future version.
```
@brikis98
Copy link
Contributor

brikis98 commented Sep 6, 2022

My apologies if I'm missing some context, but isn't Phase 2 a massively backward incompatible change? For example, with all Terraform versions so far, it was possible to create a security group with the following code:

resource "aws_security_group" "instance" {
  name = "example"
  ingress {
    from_port   = 22
    to_port     = 22
    protocol    = "tcp"
    cidr_blocks = ["0.0.0.0/0"]
  }
}

Now, with AWS provider 4.29.0, this suddenly produces an error:

╷
│ Error: with the retirement of EC2-Classic no new Security Groups can be created without referencing a VPC
│
│   with aws_security_group.instance,
│   on main.tf line 5, in resource "aws_security_group" "instance":
│    5: resource "aws_security_group" "instance" {
│
╵

That feels like a major breaking change, so shouldn't it be in AWS provider v5 only? Or some other way to indicate that end-users are now going to do a huge refactor to many, many resources?

@brikis98
Copy link
Contributor

brikis98 commented Sep 6, 2022

One thought: instead of this breaking change, would it be possible to update those resources to automatically use the Default VPC if vpc_id isn't specified? At least in v4 of the provider? And then in v5, you can do the breaking change where vpc_id is required?

@brikis98
Copy link
Contributor

brikis98 commented Sep 6, 2022

I've decided to file this as a new issue to ensure it gets visibility and isn't lost in a comment thread here: #26666

@ewbankkit
Copy link
Contributor

ewbankkit commented Sep 8, 2022

@brikis98 Thanks for raising a separate issue.
For those resources where we are now failing to create new resources without a configured vpc_id, but use of the AWS Region's default VPC in fact occurs (and is (or was) undocumented in the API 😄), we will revert the changes and accept no configured vpc_id.

@brikis98
Copy link
Contributor

brikis98 commented Sep 9, 2022

@brikis98 Thanks for raising a separate issue. For those resources where we are now failing to create new resources without a configured vpc_id, but use of the AWS Region's default VPC in fact occurs (and is (or was) undocumented in the API 😄), we will revert the changes and accept no configured vpc_id.

Woohoo! I just tried it out with provider 4.30.0, and it seems to work just fine. Thank you 👍

@github-actions
Copy link

github-actions bot commented Feb 6, 2023

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 Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/autoscaling Issues and PRs that pertain to the autoscaling service. service/ec2 Issues and PRs that pertain to the ec2 service. service/elasticache Issues and PRs that pertain to the elasticache service. service/elb Issues and PRs that pertain to the elb service. service/opsworks Issues and PRs that pertain to the opsworks service. service/rds Issues and PRs that pertain to the rds service. service/redshift Issues and PRs that pertain to the redshift service. technical-debt Addresses areas of the codebase that need refactoring or redesign.
Projects
None yet
Development

No branches or pull requests

3 participants