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

[Bug]: AWS Glue Trigger #31213

Closed
markoilijoski opened this issue May 5, 2023 · 5 comments · Fixed by #38994
Closed

[Bug]: AWS Glue Trigger #31213

markoilijoski opened this issue May 5, 2023 · 5 comments · Fixed by #38994
Assignees
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/glue Issues and PRs that pertain to the glue service.
Milestone

Comments

@markoilijoski
Copy link

Terraform Core Version

1.4.6

AWS Provider Version

4.66.0_x5

Affected Resource(s)

aws_glue_trigger

Expected Behavior

no error.

Actual Behavior

terraform plan looks good, but apply give panic error

Relevant Error/Panic Output Snippet

│ Error: Plugin did not respond
│
│   with module.glue.aws_glue_trigger.initial_trigger["ft1-step_2"],
│   on ../../modules/glue/glue_trigger.tf line 1, in resource "aws_glue_trigger" "initial_trigger":
│    1: resource "aws_glue_trigger" "initial_trigger" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Releasing state lock. This may take a few moments...

Stack trace from the terraform-provider-aws_v4.66.0_x5 plugin:

panic: interface conversion: interface {} is nil, not map[string]interface {}

goroutine 383 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/glue.expandActions({0x14003db8af0?, 0x1, 0x0?})
	github.com/hashicorp/terraform-provider-aws/internal/service/glue/trigger.go:477 +0x720
github.com/hashicorp/terraform-provider-aws/internal/service/glue.resourceTriggerCreate({0x11266aae0?, 0x14004924e40}, 0x14003e4ea00, {0x112511600?, 0x140001f4c00})
	github.com/hashicorp/terraform-provider-aws/internal/service/glue/trigger.go:214 +0xfc
github.com/hashicorp/terraform-provider-aws/internal/provider.interceptedHandler[...].func1(0x0?, {0x112511600?, 0x140001f4c00?})
	github.com/hashicorp/terraform-provider-aws/internal/provider/intercept.go:95 +0x118
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x11266aae0?, {0x11266aae0?, 0x140045f3bc0?}, 0xd?, {0x112511600?, 0x140001f4c00?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:702 +0x64
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0x140012e1b20, {0x11266aae0, 0x140045f3bc0}, 0x140007e3790, 0x14003e4e880, {0x112511600, 0x140001f4c00})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:837 +0x86c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0x14001c13710, {0x11266aae0?, 0x140045f3aa0?}, 0x14003230280)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:1021 +0xb70
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.muxServer.ApplyResourceChange({0x14002c85020, 0x14002c85080, {0x14004f75940, 0x2, 0x2}, {0x0, 0x0, 0x0}, {0x0, 0x0, ...}, ...}, ...)
	github.com/hashicorp/[email protected]/tf5muxserver/mux_server_ApplyResourceChange.go:27 +0xdc
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0x1400265ab40, {0x11266aae0?, 0x140045f2870?}, 0x14003e3c1c0)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:818 +0x3b8
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1121fede0?, 0x1400265ab40}, {0x11266aae0, 0x140045f2870}, 0x14003e3c150, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:419 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0x1400497e3c0, {0x11267afc0, 0x140007da680}, 0x14003cd67e0, 0x1400507b980, 0x11913a1a0, 0x0)
	google.golang.org/[email protected]/server.go:1345 +0xc64
google.golang.org/grpc.(*Server).handleStream(0x1400497e3c0, {0x11267afc0, 0x140007da680}, 0x14003cd67e0, 0x0)
	google.golang.org/[email protected]/server.go:1722 +0x82c
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	google.golang.org/[email protected]/server.go:966 +0x84
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:964 +0x290

Error: The terraform-provider-aws_v4.66.0_x5 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Terraform Configuration Files

# autoconf tfvar file:
file_template = {
    ft1 = {
      etl_glue = {
        workflow = {
          job = {
            step_types = {
              step_1 = {
                service   = "job"
                name      = "step_1"
                type      = "ON_DEMAND"
                predicate = {}
                actions = {
                  job_name = "ft1-step_1"
                }
              },
              step_2 = {
                service = "crawler"
                name    = "step_2"
                type    = "CONDITIONAL"
                predicate = {
                  state    = "SUCCEEDED"
                  job_name = "ft1-step_1"
                }
                actions = {
                  crawler_name = "ft1"
                }
              },
            }
          }
          }
        }
      }
    }
  }
locals {
  job_steps = flatten([
    for job, atr in var.properties.file_template : [
      for job2, atr2 in atr.etl_glue.workflow.job.step_types : {
        name      = job
        service   = atr2.service
        job_step  = atr2.name
        type      = atr2.type
        predicate = atr2.predicate
        actions   = atr2.actions
      }
    ]
  ])
}
resource "aws_glue_trigger" "initial_trigger" {
  for_each      = { for step in local.job_steps : "${step.name}-${step.job_step}" => step }
  name          = "${var.tags["env"]}-${var.tags["product"]}-${var.tags["service"]}-${each.value.job_step}-job-trigger"
  type          = each.value.type
  description   = "AWS Glue Trigger for ${upper(var.tags["product"])} ETL - ${each.value.job_step}"
  workflow_name = aws_glue_workflow.glue_workflow[var.tags["process"]].name
  enabled       = true

  dynamic "actions" {
    iterator = actions
    for_each = each.value.actions
    content {
      job_name     = actions.key == "job_name" ? aws_glue_job.python_job[each.key].name : null
      crawler_name = actions.key == "crawler_name" ? aws_glue_crawler.target_aurora_db[each.value.name].name : null
    }
  }

  dynamic "predicate" {
    for_each = each.value.type == "ON_DEMAND" ? {} : var.status
    content {
      conditions {
        state    = each.value.predicate.state
        job_name = aws_glue_job.python_job[each.value.predicate.job_name].name
      }
    }
  }
  tags = var.tags
}

Steps to Reproduce

remove state lock file and init again

Debug Output

No response

Panic Output

tf_log.log

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@markoilijoski markoilijoski added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels May 5, 2023
@github-actions github-actions bot added crash Results from or addresses a Terraform crash or kernel panic. service/glue Issues and PRs that pertain to the glue service. labels May 5, 2023
@github-actions
Copy link

github-actions bot commented May 5, 2023

Community Note

Voting for Prioritization

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

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label May 5, 2023
@ewbankkit
Copy link
Contributor

ewbankkit commented May 31, 2023

for _, mRaw := range l {
m := mRaw.(map[string]interface{})
action := &glue.Action{}

Need to add:

if mRaw == nil {
	continue
}

@jar-b jar-b self-assigned this Aug 22, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 22, 2024
Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.64.0 milestone Aug 22, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Aug 22, 2024
Copy link

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

Copy link

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 Sep 23, 2024
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. crash Results from or addresses a Terraform crash or kernel panic. service/glue Issues and PRs that pertain to the glue service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants