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

New resource: aws_costoptimizationhub_enrollment_status #36440

Conversation

madhavvishnubhatta
Copy link
Contributor

@madhavvishnubhatta madhavvishnubhatta commented Mar 18, 2024

Description

This change adds a new resource to Cost Optimization Hub

Relations

Related #34588

References

https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/costoptimizationhub
https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_Operations_Cost_Optimization_Hub.html

Output from Acceptance Testing

bash-3.2$ make testacc PKG=costoptimizationhub
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/costoptimizationhub/... -v -count 1 -parallel 20   -timeout 360m
=== RUN   TestAccCostOptimizationHub_serial
=== PAUSE TestAccCostOptimizationHub_serial
=== RUN   TestEndpointConfiguration
=== RUN   TestEndpointConfiguration/package_name_endpoint_config_overrides_service_config_file
=== RUN   TestEndpointConfiguration/service_aws_envvar_overrides_service_config_file
=== RUN   TestEndpointConfiguration/service_config_file
=== RUN   TestEndpointConfiguration/package_name_endpoint_config
=== RUN   TestEndpointConfiguration/package_name_endpoint_config_overrides_aws_service_envvar
=== RUN   TestEndpointConfiguration/base_endpoint_envvar_overrides_base_config_file
=== RUN   TestEndpointConfiguration/service_config_file_overrides_base_config_file
=== RUN   TestEndpointConfiguration/no_config
=== RUN   TestEndpointConfiguration/service_aws_envvar_overrides_base_envvar
=== RUN   TestEndpointConfiguration/base_endpoint_envvar
=== RUN   TestEndpointConfiguration/package_name_endpoint_config_overrides_base_config_file
=== RUN   TestEndpointConfiguration/service_aws_envvar
=== RUN   TestEndpointConfiguration/service_aws_envvar_overrides_base_config_file
=== RUN   TestEndpointConfiguration/base_endpoint_envvar_overrides_service_config_file
=== RUN   TestEndpointConfiguration/base_endpoint_config_file
=== RUN   TestEndpointConfiguration/package_name_endpoint_config_overrides_base_envvar
--- PASS: TestEndpointConfiguration (0.71s)
    --- PASS: TestEndpointConfiguration/package_name_endpoint_config_overrides_service_config_file (0.06s)
    --- PASS: TestEndpointConfiguration/service_aws_envvar_overrides_service_config_file (0.04s)
    --- PASS: TestEndpointConfiguration/service_config_file (0.04s)
    --- PASS: TestEndpointConfiguration/package_name_endpoint_config (0.09s)
    --- PASS: TestEndpointConfiguration/package_name_endpoint_config_overrides_aws_service_envvar (0.05s)
    --- PASS: TestEndpointConfiguration/base_endpoint_envvar_overrides_base_config_file (0.03s)
    --- PASS: TestEndpointConfiguration/service_config_file_overrides_base_config_file (0.03s)
    --- PASS: TestEndpointConfiguration/no_config (0.03s)
    --- PASS: TestEndpointConfiguration/service_aws_envvar_overrides_base_envvar (0.04s)
    --- PASS: TestEndpointConfiguration/base_endpoint_envvar (0.04s)
    --- PASS: TestEndpointConfiguration/package_name_endpoint_config_overrides_base_config_file (0.05s)
    --- PASS: TestEndpointConfiguration/service_aws_envvar (0.03s)
    --- PASS: TestEndpointConfiguration/service_aws_envvar_overrides_base_config_file (0.04s)
    --- PASS: TestEndpointConfiguration/base_endpoint_envvar_overrides_service_config_file (0.04s)
    --- PASS: TestEndpointConfiguration/base_endpoint_config_file (0.04s)
    --- PASS: TestEndpointConfiguration/package_name_endpoint_config_overrides_base_envvar (0.06s)
=== CONT  TestAccCostOptimizationHub_serial
=== RUN   TestAccCostOptimizationHub_serial/EnrollmentStatus
=== RUN   TestAccCostOptimizationHub_serial/EnrollmentStatus/basic
=== RUN   TestAccCostOptimizationHub_serial/EnrollmentStatus/disappears
=== RUN   TestAccCostOptimizationHub_serial/EnrollmentStatus/includeMemberAccounts
--- PASS: TestAccCostOptimizationHub_serial (42.65s)
    --- PASS: TestAccCostOptimizationHub_serial/EnrollmentStatus (42.65s)
        --- PASS: TestAccCostOptimizationHub_serial/EnrollmentStatus/basic (15.21s)
        --- PASS: TestAccCostOptimizationHub_serial/EnrollmentStatus/disappears (13.73s)
        --- PASS: TestAccCostOptimizationHub_serial/EnrollmentStatus/includeMemberAccounts (13.71s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/costoptimizationhub        48.111s

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 size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/costoptimizationhub Issues and PRs that pertain to the costoptimizationhub service. labels Mar 18, 2024
@terraform-aws-provider terraform-aws-provider bot added needs-triage Waiting for first response or review from a maintainer. partner Contribution from a partner. labels Mar 18, 2024
@justinretzolk justinretzolk added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 18, 2024
@madhavvishnubhatta madhavvishnubhatta marked this pull request as ready for review March 19, 2024 09:37
@github-actions github-actions bot added the generators Relates to code generators. label Mar 19, 2024
@YakDriver YakDriver self-assigned this Sep 10, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Sep 10, 2024
@YakDriver YakDriver force-pushed the f-aws_costoptimizationhub_enrollment_status branch from 3b1a939 to db0e1db Compare September 10, 2024 21:52
@YakDriver YakDriver requested a review from a team as a code owner September 10, 2024 21:52
@YakDriver
Copy link
Member

YakDriver commented Sep 11, 2024

I don't know if the service previously returned a value for includeMemberAccounts or not. However, the service no longer does in the AWS for Go SDK v2 nor in the AWS CLI:

% aws cost-optimization-hub update-enrollment-status --status Active --include-member-accounts
{
    "status": "Active"
}
% aws cost-optimization-hub list-enrollment-statuses
{
    "items": [
        {
            "accountId": "012345678901",
            "status": "Active",
            "lastUpdatedTimestamp": "2024-09-11T15:31:18.684000-04:00",
            "createdTimestamp": "2024-09-11T08:32:31.502000-04:00"
        }
    ],
    "includeMemberAccounts": null
}
% aws cost-optimization-hub update-enrollment-status --status Active --no-include-member-accounts
{
    "status": "Active"
}
% aws cost-optimization-hub list-enrollment-statuses
{
    "items": [
        {
            "accountId": "012345678901",
            "status": "Active",
            "lastUpdatedTimestamp": "2024-09-11T15:37:10.419000-04:00",
            "createdTimestamp": "2024-09-11T08:32:31.502000-04:00"
        }
    ],
    "includeMemberAccounts": null
}

@YakDriver YakDriver changed the title F aws costoptimizationhub enrollment status New resource: aws_costoptimizationhub_enrollment_status Sep 11, 2024
Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this! LGTM 🎉

% make t K=costoptimizationhub 
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.0 test ./internal/service/costoptimizationhub/... -v -count 1 -parallel 20   -timeout 360m
=== RUN   TestAccCostOptimizationHub_serial
=== PAUSE TestAccCostOptimizationHub_serial
=== RUN   TestEndpointConfiguration
=== RUN   TestEndpointConfiguration/base_endpoint_envvar
=== RUN   TestEndpointConfiguration/package_name_endpoint_config
=== RUN   TestEndpointConfiguration/package_name_endpoint_config_overrides_service_config_file
=== RUN   TestEndpointConfiguration/service_config_file_overrides_base_config_file
=== RUN   TestEndpointConfiguration/use_fips_config
=== RUN   TestEndpointConfiguration/service_aws_envvar_overrides_service_config_file
=== RUN   TestEndpointConfiguration/base_endpoint_envvar_overrides_service_config_file
=== RUN   TestEndpointConfiguration/package_name_endpoint_config_overrides_base_config_file
=== RUN   TestEndpointConfiguration/service_aws_envvar_overrides_base_envvar
=== RUN   TestEndpointConfiguration/service_aws_envvar_overrides_base_config_file
=== RUN   TestEndpointConfiguration/base_endpoint_envvar_overrides_base_config_file
=== RUN   TestEndpointConfiguration/base_endpoint_config_file
=== RUN   TestEndpointConfiguration/no_config
=== RUN   TestEndpointConfiguration/package_name_endpoint_config_overrides_base_envvar
=== RUN   TestEndpointConfiguration/service_config_file
=== RUN   TestEndpointConfiguration/use_fips_config_with_package_name_endpoint_config
=== RUN   TestEndpointConfiguration/package_name_endpoint_config_overrides_aws_service_envvar
=== RUN   TestEndpointConfiguration/service_aws_envvar
--- PASS: TestEndpointConfiguration (0.60s)
    --- PASS: TestEndpointConfiguration/base_endpoint_envvar (0.03s)
    --- PASS: TestEndpointConfiguration/package_name_endpoint_config (0.04s)
    --- PASS: TestEndpointConfiguration/package_name_endpoint_config_overrides_service_config_file (0.04s)
    --- PASS: TestEndpointConfiguration/service_config_file_overrides_base_config_file (0.03s)
    --- PASS: TestEndpointConfiguration/use_fips_config (0.03s)
    --- PASS: TestEndpointConfiguration/service_aws_envvar_overrides_service_config_file (0.03s)
    --- PASS: TestEndpointConfiguration/base_endpoint_envvar_overrides_service_config_file (0.03s)
    --- PASS: TestEndpointConfiguration/package_name_endpoint_config_overrides_base_config_file (0.04s)
    --- PASS: TestEndpointConfiguration/service_aws_envvar_overrides_base_envvar (0.03s)
    --- PASS: TestEndpointConfiguration/service_aws_envvar_overrides_base_config_file (0.03s)
    --- PASS: TestEndpointConfiguration/base_endpoint_envvar_overrides_base_config_file (0.03s)
    --- PASS: TestEndpointConfiguration/base_endpoint_config_file (0.02s)
    --- PASS: TestEndpointConfiguration/no_config (0.03s)
    --- PASS: TestEndpointConfiguration/package_name_endpoint_config_overrides_base_envvar (0.04s)
    --- PASS: TestEndpointConfiguration/service_config_file (0.03s)
    --- PASS: TestEndpointConfiguration/use_fips_config_with_package_name_endpoint_config (0.04s)
    --- PASS: TestEndpointConfiguration/package_name_endpoint_config_overrides_aws_service_envvar (0.04s)
    --- PASS: TestEndpointConfiguration/service_aws_envvar (0.02s)
=== CONT  TestAccCostOptimizationHub_serial
=== RUN   TestAccCostOptimizationHub_serial/EnrollmentStatus
=== RUN   TestAccCostOptimizationHub_serial/EnrollmentStatus/basic
=== RUN   TestAccCostOptimizationHub_serial/EnrollmentStatus/disappears
=== RUN   TestAccCostOptimizationHub_serial/EnrollmentStatus/includeMemberAccounts
--- PASS: TestAccCostOptimizationHub_serial (57.65s)
    --- PASS: TestAccCostOptimizationHub_serial/EnrollmentStatus (57.65s)
        --- PASS: TestAccCostOptimizationHub_serial/EnrollmentStatus/basic (16.12s)
        --- PASS: TestAccCostOptimizationHub_serial/EnrollmentStatus/disappears (16.62s)
        --- PASS: TestAccCostOptimizationHub_serial/EnrollmentStatus/includeMemberAccounts (24.90s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/costoptimizationhub	63.344s

@YakDriver YakDriver merged commit d63599c into hashicorp:main Sep 11, 2024
40 checks passed
@github-actions github-actions bot added this to the v5.67.0 milestone Sep 11, 2024
@madhavvishnubhatta
Copy link
Contributor Author

I don't know if the service previously returned a value for includeMemberAccounts or not. However, the service no longer does in the AWS for Go SDK v2 nor in the AWS CLI:

includeMemberAccounts is returned with a value only on Management accounts. Not on member accounts. See below the output on a management account.

$ aws cost-optimization-hub update-enrollment-status --status Active --include-member-accounts
{
    "status": "Active"
}
$  aws cost-optimization-hub list-enrollment-statuses
{
    "items": [
        {
            "accountId": "012345678901",
            "createdTimestamp": "2024-01-19T11:33:44.570000+00:00",
            "lastUpdatedTimestamp": "2024-09-12T08:49:17.249000+01:00",
            "status": "Active"
        }
    ],
    "includeMemberAccounts": true
}
$ aws cost-optimization-hub update-enrollment-status --status Active --no-include-member-accounts
{
    "status": "Active"
}
$  aws cost-optimization-hub list-enrollment-statuses
{
    "items": [
        {
            "accountId": "012345678901",
            "createdTimestamp": "2024-01-19T11:33:44.570000+00:00",
            "lastUpdatedTimestamp": "2024-09-12T08:50:56.208000+01:00",
            "status": "Active"
        }
    ],
    "includeMemberAccounts": false
}

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Sep 13, 2024
Copy link

This functionality has been released in v5.67.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 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 Oct 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. generators Relates to code generators. new-resource Introduces a new resource. partner Contribution from a partner. service/costoptimizationhub Issues and PRs that pertain to the costoptimizationhub 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.

3 participants