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

feat: added billing view and initial test #41075

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

Conversation

hjoshi123
Copy link
Contributor

@hjoshi123 hjoshi123 commented Jan 25, 2025

Description

This PR is regarding a new resource aws_billing_view associated with the billing service that was created recently. This PR is part of broader request of the billing package which involves more data sources and resources to come.

Relations

Relates #40677

References

Output from Acceptance Testing

 make testacc TESTS=TestAccBillingView_ PKG=billing
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/billing/... -v -count 1 -parallel 20 -run='TestAccBillingView_'  -timeout 360m -vet=off
2025/01/31 23:59:38 Initializing Terraform AWS Provider...
=== RUN   TestAccBillingView_basic
=== PAUSE TestAccBillingView_basic
=== RUN   TestAccBillingView_update
=== PAUSE TestAccBillingView_update
=== RUN   TestAccBillingView_disappears
=== PAUSE TestAccBillingView_disappears
=== CONT  TestAccBillingView_basic
=== CONT  TestAccBillingView_disappears
=== CONT  TestAccBillingView_update
--- PASS: TestAccBillingView_disappears (11.81s)
--- PASS: TestAccBillingView_basic (13.86s)
--- PASS: TestAccBillingView_update (23.28s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/billing	28.238s

...

@hjoshi123 hjoshi123 requested a review from a team as a code owner January 25, 2025 05:55
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/billing Issues and PRs that pertain to the billing service. needs-triage Waiting for first response or review from a maintainer. labels Jan 25, 2025
@jar-b jar-b added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 27, 2025
@hjoshi123
Copy link
Contributor Author

@jar-b

    billing_view_test.go:32: Step 1/2 error: Error running pre-apply plan: exit status 1
        
        Error: Invalid resource type
        
          on terraform_plugin_test.tf line 16, in resource "aws_billing_view" "test":
          16: resource "aws_billing_view" "test" {
        
        The provider hashicorp/aws does not support resource type "aws_billing_view".
=== NAME  TestAccBillingView_update
    billing_view_test.go:68: Step 1/2 error: Error running pre-apply plan: exit status 1
        
        Error: Invalid resource type
        
          on terraform_plugin_test.tf line 16, in resource "aws_billing_view" "test":
          16: resource "aws_billing_view" "test" {
        
        The provider hashicorp/aws does not support resource type "aws_billing_view".
=== NAME  TestAccBillingView_disappears
    billing_view_test.go:106: Step 1/1 error: Error running pre-apply plan: exit status 1
        
        Error: Invalid resource type
        
          on terraform_plugin_test.tf line 16, in resource "aws_billing_view" "test":
          16: resource "aws_billing_view" "test" {
        
        The provider hashicorp/aws does not support resource type "aws_billing_view".
--- FAIL: TestAccBillingView_update (2.08s)
--- FAIL: TestAccBillingView_basic (2.08s)
--- FAIL: TestAccBillingView_disappears (2.09s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/billing	6.815s
FAIL

Getting this error while running acceptance tests.. how do I tell the tests to use my branch for the provider?

@jar-b
Copy link
Member

jar-b commented Jan 30, 2025

@hjoshi123 - the resource is failing to register because you've included the @Tags annotation without a tags attribute defined in the resource schema. If you enable warning level logs, you'll see a line like the following when running acceptance tests.

2025-01-30T13:30:46.842-0500 [WARN]  aws: registering resources: tf_req_id=bb0096ca-7c0a-1be0-e702-4374921fce06 tf_provider_addr=registry.terraform.io/hashicorp/aws tf_rpc=GetProviderS
chema tf_mux_provider="*proto5server.Server" error="no `tags` attribute defined in schema: aws_billing_view"

Because the tags used on this resource have a non-standard name, you can remove the @Tags annotation and instead manually get/set the resource tags values within the CRUD handlers as necessary.

hjoshi123 and others added 2 commits January 30, 2025 19:44
@hjoshi123
Copy link
Contributor Author

@jar-b that helps.. thank you

@hjoshi123
Copy link
Contributor Author

 make testacc TESTS=TestAccBillingView_ PKG=billing
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/billing/... -v -count 1 -parallel 20 -run='TestAccBillingView_'  -timeout 360m -vet=off
2025/01/31 23:59:38 Initializing Terraform AWS Provider...
=== RUN   TestAccBillingView_basic
=== PAUSE TestAccBillingView_basic
=== RUN   TestAccBillingView_update
=== PAUSE TestAccBillingView_update
=== RUN   TestAccBillingView_disappears
=== PAUSE TestAccBillingView_disappears
=== CONT  TestAccBillingView_basic
=== CONT  TestAccBillingView_disappears
=== CONT  TestAccBillingView_update
--- PASS: TestAccBillingView_disappears (11.81s)
--- PASS: TestAccBillingView_basic (13.86s)
--- PASS: TestAccBillingView_update (23.28s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/billing	28.238s

@github-actions github-actions bot added the tags Pertains to resource tagging. label Feb 1, 2025
@github-actions github-actions bot added the generators Relates to code generators. label Feb 1, 2025
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. generators Relates to code generators. new-resource Introduces a new resource. service/billing Issues and PRs that pertain to the billing service. 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.

2 participants