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

Tracking: remove tags related patches #4230

Open
4 tasks
corymhall opened this issue Jul 15, 2024 · 4 comments
Open
4 tasks

Tracking: remove tags related patches #4230

corymhall opened this issue Jul 15, 2024 · 4 comments
Labels
area/patch An issue describing an existing patch on upstream and the criteria to close it. kind/engineering Work that is not visible to an external user

Comments

@corymhall
Copy link
Contributor

This is a tracking ticket to track what needs to be done in order to remove all of our patches / bridge hooks related to tagging and revert to upstream's tagging behavior.

An initial draft PR was done here #4219.

Background

The original work to fix tagging on the Pulumi side was done in #2655. There was a lot of limitations in using default_tags in Terraform which we decided to circumvent be merging default_tags into the resource's tags via a PreCheckCallback function. Since then most of the upstream issues (hashicorp/terraform-provider-aws#29747, hashicorp/terraform-provider-aws#29842, hashicorp/terraform-provider-aws#24449) have been fixed.

The additional patches / custom code adds to the maintenance burden and makes upgrades much harder due to merge conflicts. Since many of the original upstream issues have been fixed, it may be possible to remove our custom tag handling and revert back to upstream behavior.

Patches to remove

Patches to update (switch tags_all back to Computed)

Tasks

Preview Give feedback
@corymhall corymhall added kind/engineering Work that is not visible to an external user area/patch An issue describing an existing patch on upstream and the criteria to close it. labels Jul 15, 2024
@t0yv0
Copy link
Member

t0yv0 commented Jul 15, 2024

The was an attempt to consolidate these patches which reduces the burden a bit #4151 but we decided to first ensure upstream tests run on the result of patching.

I think also extending testing to cover refresh and import scenarios as sketched out in #4169 could be highly advantageous here to avoid surprises with that part of the life-cycle.

@t0yv0
Copy link
Member

t0yv0 commented Jul 17, 2024

@iwahbe had a comment that upstream tag behavior relies critically on running refresh as part of apply. Since Pulumi bridged providers target imitating terraform -refresh=false behavior this may imply that removing tagging custom code would regress some functionality. Is it possible to file or reference an example TF program that demonstrates tagging bugs under -refresh=false?

@iwahbe
Copy link
Member

iwahbe commented Jul 18, 2024

I just checked, and it seems like upstream's behavior has improved radically here. Retrying on the latest version of hashicorp/aws, this now works (with terraform apply -refresh=false):

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

# Configure the AWS Provider
provider "aws" {
  region = "us-east-1"
  default_tags {
    tags = {
      Test = "example"
    }
  }
}

resource "aws_s3_bucket" "example" {}

Updating "example" to "example2" now works as expected without refresh. Neither used to work without refresh. Adding another default tag works as expected as well (even without refresh):

 provider "aws" {
   region = "us-east-1"
   default_tags {
     tags = {
       Test = "example"
+      Test2 = "example2"
     }
   }
 }

Removing all default tags does not work at all (it shows no diff) without refresh:

 provider "aws" {
   region = "us-east-1"
   default_tags {
     tags = {
-       Test = "example"
     }
   }
 }

I didn't get to the point where I manually compared how the tags property on resources interacts with the default_tags property on the provider.

@t0yv0
Copy link
Member

t0yv0 commented Sep 27, 2024

There is still a few failing tests I am slightly worried about around the use of empty values for tags "", possibly aggravated by the underlying TF machinery confusing empty and unknown values. Some of our customers find these behaviors important and we need to tread carefully to not regress. Might be worth revisiting at some point, as the patches are indeed quite uncomfortable to maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/patch An issue describing an existing patch on upstream and the criteria to close it. kind/engineering Work that is not visible to an external user
Projects
None yet
Development

No branches or pull requests

3 participants