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

Added resource and data source for aws ec2 capacity block reservation. #37528

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

prabhavpawar
Copy link

@prabhavpawar prabhavpawar commented May 15, 2024

Description
This PR adds a resource for aws_ec2_capacity_block_reservation and data-source for aws_ec2_capacity_block_offering. With Capacity Blocks, GPU instance capacity is available on future dates, and a Capacity Block can be scheduled to start at a time.

Relations
Closes #35358

References
Capacity Block Docs

Output from Acceptance Testing

TF_ACC=1 /opt/devshell/go/latest/bin/go test  internal/service/ec2/ec2_capacity_block_offering_data_source_test.go -v  -count 1 -parallel 1 -run=TestAccEC2CapacityBlockOffering_basic
=== RUN   TestAccEC2CapacityBlockOffering_basic
=== PAUSE TestAccEC2CapacityBlockOffering_basic
=== CONT  TestAccEC2CapacityBlockOffering_basic
--- PASS: TestAccEC2CapacityBlockOffering_basic (27.46s)
PASS
ok  command-line-arguments  29.812s

TF_ACC=1 /opt/devshell/go/latest/bin/go test  internal/service/ec2/ec2_capacity_block_reservation_test.go -v  -count 1 -parallel 1 -run=TestAccEC2CapacityBlockReservation_basic
=== RUN   TestAccEC2CapacityBlockReservation_basic
=== PAUSE TestAccEC2CapacityBlockReservation_basic
=== CONT  TestAccEC2CapacityBlockReservation_basic
    ec2_capacity_block_reservation_test.go:37: Step 1/1 error: Error running apply: exit status 1
        Error: creating EC2 Capacity Reservation: UnauthorizedOperation: You are not authorized to perform this operation. User: arn:aws:sts::878176493429:assumed-role/90467-application-engineer/O664318@ASIAPAC.AD.JPMORGANCHASE.com is not authorized to perform: ec2:PurchaseCapacityBlock on resource: arn:aws:ec2:us-west-2:878176493429:capacity-reservation/* because no identity-based policy allows the ec2:PurchaseCapacityBlock action. Encoded authorization failure message: ...
        	status code: 403, request id: 99a38e9a-cb56-4ec4-9dc8-b33eb5a4026e
          with aws_ec2_capacity_block_reservation.test,
          on terraform_plugin_test.tf line 20, in resource "aws_ec2_capacity_block_reservation" "test":
          20: resource "aws_ec2_capacity_block_reservation" "test" {
--- FAIL: TestAccEC2CapacityBlockReservation_basic (18.76s)
FAIL
FAIL	command-line-arguments	21.122s
FAIL

Copy link

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 documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ec2 Issues and PRs that pertain to the ec2 service. labels May 15, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label May 15, 2024
@github-actions github-actions bot added the size/XL Managed by automation to categorize the size of a PR. label May 15, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @prabhavpawar 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@justinretzolk justinretzolk added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Introduces or discusses updates to documentation. new-resource Introduces a new resource. service/ec2 Issues and PRs that pertain to the ec2 service. size/XL Managed by automation to categorize the size of a PR. 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.

[New Resource]: Add Capacity Block for AWS EC2 Capacity Reservation
2 participants