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

lambda: add ListTags to allow computed tags #32348

Merged
merged 3 commits into from
Jul 3, 2023

Conversation

johnsonaj
Copy link
Contributor

@johnsonaj johnsonaj commented Jul 3, 2023

Description

aws_lambda_function does not set state correctly after computed and empty tags are added.

ListTags is needed to properly set state after computed tags are refreshed.

Relations

Relates #31941

References

Output from Acceptance Testing

$ make testacc TESTS='TestAccLambdaFunction_tags|TestAccLambdaFunction_basic|TestAccLambdaFunction_disappears' PKG=lambda

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lambda/... -v -count 1 -parallel 20 -run='TestAccLambdaFunction_tags|TestAccLambdaFunction_basic|TestAccLambdaFunction_disappears'  -timeout 180m
--- PASS: TestAccLambdaFunction_disappears (41.20s)
--- PASS: TestAccLambdaFunction_basic (49.04s)
--- PASS: TestAccLambdaFunction_tags (68.37s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/lambda	71.556s

@github-actions
Copy link

github-actions bot commented Jul 3, 2023

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added service/lambda Issues and PRs that pertain to the lambda service. tags Pertains to resource tagging. generators Relates to code generators. size/S Managed by automation to categorize the size of a PR. labels Jul 3, 2023
@johnsonaj johnsonaj added the bug Addresses a defect in current functionality. label Jul 3, 2023
@github-actions github-actions bot added the tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. label Jul 3, 2023
@johnsonaj johnsonaj marked this pull request as ready for review July 3, 2023 16:49
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

make testacc TESTS='TestAccLambdaFunction_tags|TestAccLambdaFunction_basic|TestAccLambdaFunction_disappears' PKG=lambda
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lambda/... -v -count 1 -parallel 20 -run='TestAccLambdaFunction_tags|TestAccLambdaFunction_basic|TestAccLambdaFunction_disappears'  -timeout 180m

--- PASS: TestAccLambdaFunction_disappears (35.77s)
--- PASS: TestAccLambdaFunction_basic (49.92s)
--- PASS: TestAccLambdaFunction_tags (76.01s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/lambda     79.420s

@johnsonaj johnsonaj merged commit c606127 into main Jul 3, 2023
@johnsonaj johnsonaj deleted the b-lambda_function_empty_tags branch July 3, 2023 20:35
@github-actions github-actions bot added this to the v5.7.0 milestone Jul 3, 2023
@github-actions
Copy link

github-actions bot commented Jul 7, 2023

This functionality has been released in v5.7.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!

@digitalkaoz
Copy link

digitalkaoz commented Jul 11, 2023

@johnsonaj @jar-b hopefully im right here. wenn importing a resource i dont see any of the attached tags:

data "aws_lambda_function" "xx" {
  function_name = "name"
}

output "xx" {
  value = data.aws_lambda_function.xx
}

output :

 xx = {
      + architectures                  = [
          + "x86_64",
        ]
      + arn                            = "arn:aws:lambda:eu-central-1:123:function:name"
      + code_signing_config_arn        = ""
      + dead_letter_config             = []
      + description                    = ""
      + environment                    = [
          + {
              + variables = {
                }
            },
        ]
      + ephemeral_storage              = [
          + {
              + size = 512
            },
        ]
      + file_system_config             = []
      + function_name                  = "name"
      + handler                        = "main"
      + id                             = "name"
      + image_uri                      = ""
      + invoke_arn                     = "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:123:function:name/invocations"
      + kms_key_arn                    = ""
      + last_modified                  = "2023-07-11T11:52:15.350+0000"
      + layers                         = []
      + memory_size                    = 256
      + qualified_arn                  = "arn:aws:lambda:eu-central-1:123:function:name:421"
      + qualified_invoke_arn           = "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:123:function:name:421/invocations"
      + qualifier                      = null
      + reserved_concurrent_executions = -1
      + role                           = "arn:aws:iam::123:role/role-name"
      + runtime                        = "go1.x"
      + signing_job_arn                = ""
      + signing_profile_version_arn    = ""
      + source_code_hash               = "Dn4/XudvjXv/wmc1tifAAct7QaQkkVOw/tHJYtYTyAU="
      + source_code_size               = 4342715
      + tags                           = {}
      + timeout                        = 30
      + tracing_config                 = [
          + {
              + mode = "PassThrough"
            },
        ]
      + version                        = "421"
      + vpc_config                     = [
          + {
              + security_group_ids = [
                  + "sg-123",
                ]
              + subnet_ids         = [
                  + "subnet-a",
                  + "subnet-b",
                  + "subnet-c",
                ]
              + vpc_id             = "vpc-629d0308"
            },
        ]
    }

but there are tags defined:

$ AWS_PROFILE=xyz AWS_REGION=eu-central-1 aws lambda  list-tags --resource arn:aws:lambda:eu-central-1:123:function:name
{
    "Tags": {
        "CRON": "1",
        "REGION": "eu-central-1",
        "STAGE": "integ"
    }
}

im pretty sure it worked like that at one point but i cant stick my finger on it. what am i doing wrong?

my user has full admin access

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, 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 Aug 11, 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. generators Relates to code generators. service/lambda Issues and PRs that pertain to the lambda service. size/S Managed by automation to categorize the size of a PR. tags Pertains to resource tagging. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants