Skip to content

[Experiment] provider: support core build tag#47425

Draft
jar-b wants to merge 1 commit intomainfrom
x-core-buildtag
Draft

[Experiment] provider: support core build tag#47425
jar-b wants to merge 1 commit intomainfrom
x-core-buildtag

Conversation

@jar-b
Copy link
Copy Markdown
Member

@jar-b jar-b commented Apr 13, 2026

Description

Setting the core tag will limit the services which are registered to the provider. This is an experiment to explore whether it is feasible to publish a scoped down version of the provider without maintaining an entirely separate project. The goal is to reduce binary size and corresponding memory usage in cases where only the most common services are required.


When built with the core tag, binary size reduces from 1.2GB to 179MB on an M1 MacBook Pro.

% go build && go build -tags=core -o terraform-provider-aws-core
% ls -lh terraform-provider-aws*
-rwxr-xr-x 1 jaredbaker staff 1.2G Apr 13 13:38 terraform-provider-aws
-rwxr-xr-x 1 jaredbaker staff 179M Apr 13 13:38 terraform-provider-aws-core

Planning a simple configuration with a single IAM policy document data source and IAM role with v6.40.0 and a locally built version of the provider with the core build tag exhibits a maximum resident set size savings in line with the reduction in binary size.

% /usr/bin/time -l terraform plan
<snip>

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
        9.91 real         4.12 user         0.54 sys
           555745280  maximum resident set size
<snip>
% /usr/bin/time -l make plan
TF_CLI_CONFIG_FILE=dev.tfrc terraform plan
<snip>

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
        0.84 real         0.53 user         0.11 sys
            73203712  maximum resident set size
<snip>

Maximum resident set size is reported in bytes on MacOS.

Version Max Resident Size
v6.40.0 555745280 (555MB)
core tag build 73203712 (73MB)

Future Considerations

This branch in solely intended as an experiment. Acceptance testing is non-functional with the build tag enabled, and there is no precedent (to my knowledge) for releasing multiple providers from a single repository as would be necessary to distribute the "core" variant.

This branch is merely a proof of concept as we continue to explore how to best balance API coverage with performance of the provider as the surface area of the AWS SDK continues to grow.

@github-actions
Copy link
Copy Markdown
Contributor

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • 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 prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. provider Pertains to the provider itself, rather than any interaction with AWS. sweeper Pertains to changes to or issues with the sweeper. client-connections Pertains to the AWS Client and service connections. generators Relates to code generators. size/XL Managed by automation to categorize the size of a PR. labels Apr 13, 2026
@jar-b jar-b force-pushed the x-core-buildtag branch from 15b0d52 to ef320c5 Compare April 13, 2026 20:05
Setting the `core` tag will limit the services which are registered to the provider. This is an experiment to explore whether it is feasible to publish a scoped down version of the provider without maintaining an entirely separate project. The goal is to reduce binary size and corresponding memory usage in cases where only the most common services are required.

---

When built with the `core` tag, binary size reduces from 1.2GB to 179MB
on an M1 MacBook Pro.

```console
% go build && go build -tags=core -o terraform-provider-aws-core
% ls -lh terraform-provider-aws*
-rwxr-xr-x 1 jaredbaker staff 1.2G Apr 13 13:38 terraform-provider-aws
-rwxr-xr-x 1 jaredbaker staff 179M Apr 13 13:38 terraform-provider-aws-core
```

Planning a simple configuration with a single IAM policy document data
source and IAM role with `v6.40.0` and a locally built version of the
provider with the `core` build tag exhibits a maximum resident set size
savings in line with the reduction in binary size.

```console
% /usr/bin/time -l terraform plan
<snip>

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
        9.91 real         4.12 user         0.54 sys
           555745280  maximum resident set size
<snip>
```

```console
% /usr/bin/time -l make plan
TF_CLI_CONFIG_FILE=dev.tfrc terraform plan
<snip>

Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions if you run "terraform apply" now.
        0.84 real         0.53 user         0.11 sys
            73203712  maximum resident set size
<snip>
```

Maximum resident set size is reported in bytes on MacOS.

| Version | Max Resident Size |
| --- | --- |
| `v6.40.0` | 555745280 (555MB) |
| core tag build | 73203712 (73MB) |

This branch in solely intended as an experiment. Acceptance testing is
non-functional with the build tag enabled, and there is no precedent (to
my knowledge) for releasing multiple providers from a single repository
as would be necessary to distribute the "core" variant.

This branch is merely a proof of concept as we continue to explore how
to best balance API coverage with performance of the provider as the
surface area of the AWS SDK continues to grow.
@jar-b jar-b force-pushed the x-core-buildtag branch from ef320c5 to dd91820 Compare April 13, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client-connections Pertains to the AWS Client and service connections. generators Relates to code generators. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. provider Pertains to the provider itself, rather than any interaction with AWS. size/XL Managed by automation to categorize the size of a PR. sweeper Pertains to changes to or issues with the sweeper. 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.

1 participant