hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.81k stars 9.16k forks source link

[Bug]: Establishing the default value in the `backup_window` property does not work #27072

Open zucchinidev opened 2 years ago

zucchinidev commented 2 years ago

Terraform Core Version

1.3.1

AWS Provider Version

4.33.0

Affected Resource(s)

Expected Behavior

Establishing a null value in the backup_window property configures the backup window with the default value associated with the region.

When creating a database with automated backups enabled, that is to say, setting the backup_retention_period property with a value between 0 and 35, AWS establish a default backup_window value depending on the region if the value is unset. See https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow. Once we set this value and we want to return to the default value, that is to say, setting the null value, the backup window must be associated with the default values related to the region.

Actual Behavior

Establishing a null value in the backup_window property does not work.

When creating a database with automated backups enabled, that is to say, setting the backup_retention_period property with a value between 0 and 35, AWS establish a default backup_window value depending on the region if the value is unset. See https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow. Once we set this value and we want to return to the default value, that is to say, setting the null value, the operation has no effect, and the previously set value continues as the value selected in the console.

Several tests were realised, as well as some initial analysis:

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files


resource "random_string" "username" {
  length  = 16
  special = false
  numeric = false
}

resource "random_password" "password" {
  length           = 32
  special          = false
  // https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Limits.html#RDS_Limits.Constraints
  override_special = "~_-."
}

resource "aws_db_instance" "db_instance" {
  skip_final_snapshot     = true
  engine                  = "mysql"
  engine_version          = "8.0"
  instance_class          = "db.t2.small"
  db_name                 = "testazucgar"
  allocated_storage       = 100
  username                = random_string.username.result
  password                = random_password.password.result
  apply_immediately       = true
  storage_encrypted       = false
  deletion_protection     = false
  backup_retention_period = 2
  backup_window           = "18:00-18:30"
#  backup_window           = null
}

provider "aws" {
  region     = "us-west-2"
  access_key = "XXXXXXXXXXXXXXX"
  secret_key = "XXXXXXXXXXXXXXX"
}

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.0"
    }
    random = {
      source  = "hashicorp/random"
      version = ">= 3.3.2"
    }
  }
}

Steps to Reproduce

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No response

github-actions[bot] commented 2 years ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

github-actions[bot] commented 6 days ago

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!