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

Provider fails to upgrade MWAA Environments from Airflow version 1.10.12 to 2.0.2 #21640

Closed
flyjorgemadrid opened this issue Nov 4, 2021 · 11 comments · Fixed by #31833
Closed
Labels
bug Addresses a defect in current functionality. service/mwaa Issues and PRs that pertain to the mwaa service.

Comments

@flyjorgemadrid
Copy link

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

Terraform CLI and Terraform AWS Provider Version

Terraform v1.0.2

AWS Provider Version:

terraform providers          

Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/aws]
├── module.airflow_security_group
│   └── provider[registry.terraform.io/hashicorp/aws] >= 2.42.0
├── module.airflow_policy
│   └── provider[registry.terraform.io/hashicorp/aws] >= 3.35.0
└── module.airflow_role
    └── provider[registry.terraform.io/hashicorp/aws] >= 3.34.0

Providers required by state:

    provider[registry.terraform.io/hashicorp/aws]

Affected Resource(s)

  • aws_mwaa

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_mwaa_environment" "this" {
  name                  = "${var.name}"
  dag_s3_path           = "${var.dag_s3_path}"
  requirements_s3_path  = "${var.requirements_s3_path}"
  execution_role_arn    = module.airflow_role.iam_role_arn
  airflow_version       = "2.0.2" # <- Create a cluster using version "1.10.12" first, then try to upgrade to 2.0.2
  max_workers           = var.airflow_max_workers
  min_workers           = var.airflow_min_workers
  source_bucket_arn     = aws_s3_bucket.airflow.arn
  webserver_access_mode = "PUBLIC_ONLY"

  airflow_configuration_options = {}

  logging_configuration {
    dag_processing_logs {
      enabled   = var.airflow_dag_processing_log_enabled
      log_level = var.airflow_dag_processing_log_level
    }

    scheduler_logs {
      enabled   = var.airflow_scheduler_log_enabled
      log_level = var.airflow_scheduler_log_level
    }

    task_logs {
      enabled   = var.airflow_task_log_enabled
      log_level = var.airflow_task_log_level
    }

    webserver_logs {
      enabled   = var.airflow_webserver_log_enabled
      log_level = var.airflow_webserver_log_level
    }

    worker_logs {
      enabled   = var.airflow_worker_log_enabled
      log_level = var.airflow_worker_log_level
    }
  }

  network_configuration {
    security_group_ids = concat(
      [module.airflow_security_group.security_group_id],
      var.security_group_ids
    )
    subnet_ids = var.private_subnet_ids
  }
}

Expected Behavior

It should replace the existing MWAA Environment using version 1.10.12 with a new environment using the requested version 2.0.2.

Actual Behavior

Terraform fails to try to apply the requested upgrade.

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:

  # aws_mwaa_environment.this will be updated in-place
  ~ resource "aws_mwaa_environment" "this" {
      ~ airflow_version                 = "1.10.12" -> "2.0.2"
        id                              = "myenv-prod"
        name                            = "myenv-prod"
        tags                            = {
            "CreatedBy"    = "my"
            "Environment"  = "production"
            "InfraVersion" = "1.0"
            "Module"       = "airflow"
            "Terraform"    = "true"
        }
        # (18 unchanged attributes hidden)

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_mwaa_environment.this: Modifying... [id=myenv-prod]

│ Error: error updating MWAA Environment (myenv-prod): ValidationException: Airflow version 1.10.12 does not support updates to version 2.0.2.

│   with aws_mwaa_environment.this,
│   on main.tf line 197, in resource "aws_mwaa_environment" "this":
│  197: resource "aws_mwaa_environment" "this" {


ERRO[0052] 1 error occurred:
        * exit status 1
          

Steps to Reproduce

  1. Create a new MWAA environment using airflow_version = "1.10.12"
  2. Once the environment is provisioned try to upgrade to version 2.0.2 documented here.
  3. terraform plan && terraform apply

Related

#19816

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/mwaa Issues and PRs that pertain to the mwaa service. labels Nov 4, 2021
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 4, 2021
@manugarri
Copy link

manugarri commented Jan 6, 2023

Any updates on this? Given how AWS just announced a new Airflow MWAA version (2.4.3) Im sure many Devops will see this error in the following weeks.

Im getting the error

│ Error: error updating MWAA Environment : ValidationException: Airflow version 2.2.2 does not support updates to version 2.4.3.

@manugarri
Copy link

update to my previous message

Seems like AWS itself doesnt let us update the MWAA environment version, so seems like is not a terraform issue.
image

@sumeeterito
Copy link

update to my previous message

Seems like AWS itself doesnt let us update the MWAA environment version, so seems like is not a terraform issue. image

Any updates on this? Given how AWS just announced a new Airflow MWAA version (2.4.3) Im sure many Devops will see this error in the following weeks.

Im getting the error

│ Error: error updating MWAA Environment : ValidationException: Airflow version 2.2.2 does not support updates to version 2.4.3.

Encountered the same issue. I think the only option is to delete the airflow instance and then reinstantiate to an updated version. A real pain when you have a bunch of stored variables already

@sumanbk92
Copy link

sumanbk92 commented Feb 6, 2023

Is there any update on this issue ?
Even I face the same issue upgrading from v2.2.2 to v2.4.3 !!

@Ravindrakumar383
Copy link

we are also facing same issue upgrading from v2.2.2 to v2.4.3 !!

@manugarri
Copy link

@sumanbk92 @Ravindrakumar383 There is no issue in terraform. AWS doesnt allow upgrading :(.

@koberlag-vizio
Copy link

koberlag-vizio commented Apr 11, 2023

According to the note at the top of this doc, you cannot perform an in-place upgrade: https://docs.aws.amazon.com/mwaa/latest/migrationguide/migrating-to-new-mwaa.html

"You cannot perform an in-place upgrade of your existing Amazon MWAA environment to another Apache Airflow version. You must create a new environment to use the newest supported Apache Airflow version on Amazon MWAA."

That page also provides python code for creating a clone of the env, which makes things slightly easier than manually creating a new one.

@rchui
Copy link

rchui commented Jun 7, 2023

As of June 5, 2023 in place upgrades are now possible in 2.x+ environments: https://aws.amazon.com/about-aws/whats-new/2023/06/amazon-mwaa-in-place-version-upgrades/

@sumanbk92
Copy link

As of June 5, 2023 in place upgrades are now possible in 2.x+ environments: https://aws.amazon.com/about-aws/whats-new/2023/06/amazon-mwaa-in-place-version-upgrades/

This is indeed a great news. Thanks for posting the update

@MayurHadole
Copy link
Contributor

Submitted enhancement request. #31825

@github-actions
Copy link

github-actions bot commented Jul 9, 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 Jul 9, 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. service/mwaa Issues and PRs that pertain to the mwaa service.
Projects
None yet
9 participants