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.83k stars 9.19k forks source link

[Bug]: aws_batch_job_queue generateConfigForImport throw error Missing Attribute Configuration #38481

Open canle1404 opened 3 months ago

canle1404 commented 3 months ago

Terraform Core Version

1.9.2

AWS Provider Version

5.59.0

Affected Resource(s)

aws_batch_job_queue

Expected Behavior

Generate attributes of imported resource successfully

Actual Behavior

│ Error: Missing Attribute Configuration
│ 
│   with aws_batch_job_queue.job-queue,
│   on generated_resources.tf line 1:
│   (source code not available)
│ 
│ Exactly one of these attributes must be configured:
│ [compute_environments,compute_environment_order]

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

Default CDKTF setup

Steps to Reproduce

CDKTF Code:

import { Construct } from "constructs";
import { App, S3Backend, TerraformStack } from "cdktf";
import { AwsProvider } from "@cdktf/provider-aws/lib/provider";
import { BatchJobQueue } from "@cdktf/provider-aws/lib/batch-job-queue";

class Stack extends TerraformStack {
  constructor(scope: Construct, id: string) {
    super(scope, id);
    new AwsProvider(this, "aws", {
      region: "us-east-2",
    });

    new S3Backend(this, {
      bucket: "XXXXXXXXXXXXXXXXX-terraform-state",
      key: "terraform.tfstate",
      region: "us-east-2",
      dynamodbTable: "terraform-lock",
    });

    BatchJobQueue.generateConfigForImport(
      this,
      "job-queue",
      "arn:aws:batch:us-east-2:XXXXXXXXX:job-queue/job-queue-asdfasdfasdf",
    );
  }
}

const app = new App();
new Stack(app, "stack");
app.synth();

Then run cdktf diff

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 3 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue