Developer Setup
Relevant source files
The following files were used as context for generating this wiki page:
This document provides a high-level overview for developers looking to contribute to the Terraform AWS Provider. The provider is a plugin for Terraform that enables the full lifecycle management of AWS resources. It is maintained by the HashiCorp AWS Provider team, but development relies on the work of many contributors.
For detailed instructions, all potential contributors should read the official contribution guidelines. This page serves as a supplementary guide to understand the project's structure and development workflow. Key resources include the official documentation, community forum, and issue trackers. If you believe you have found a security issue, please follow the responsible disclosure process by contacting security@hashicorp.com.
Sources: README.md
Getting Started with Contributions
The primary resource for any new contributor is the contribution guide. It contains the necessary information to get your environment set up, run tests, and submit pull requests. The project is open to contributions from the community, and your help is appreciated.
Sources: README.md, internal/service/fms/README.md
Project Structure
The provider's source code is organized by AWS service. The majority of the resource and data source logic is located within the internal/service/ directory. Each subdirectory corresponds to a specific AWS service (e.g., iam, lambda, fms). This modular structure is intended to help contributors locate the relevant code for the service they wish to work on.
The diagram below illustrates the high-level directory structure for AWS services.
Each service-specific package contains a README.md file that is primarily for contributors and maintainers. These files provide quick access to essential links for development.
Sources: internal/service/appconfig/README.md, internal/service/dms/README.md, internal/service/fms/README.md
Provider Entrypoint
The execution of the provider as a Terraform plugin begins in the main.go file. This file contains the main function, which is the entry point for the binary. Its primary responsibility is to serve the provider plugin, making it available for Terraform Core to consume.
The typical flow for a Terraform provider's main function is to instantiate the provider and pass it to the plugin.Serve function from the Terraform Plugin SDK.
This diagram shows the conceptual flow where Terraform Core executes the provider binary, which starts serving the plugin via its main function.
Sources: main.go
Development Workflow
Code Formatting
The project enforces Go's standard code formatting using gofmt. A shell script, scripts/gofmtcheck.sh, is likely used in CI/CD pipelines to ensure that all submitted code adheres to this standard. Before submitting a contribution, developers should run gofmt on their code.
The check process is straightforward:
Sources: scripts/gofmtcheck.sh
Service-Specific Development
When working on a specific AWS service, the README.md file within its package directory (internal/service/<service_name>/) is the best place to start. These files provide a consistent set of handy links for developers.
The table below summarizes the resources typically linked in each service's README file.
| Link Description | Example Target | Purpose |
|---|---|---|
| Contribution Guide | ../../../docs/contributing | General guidelines for all contributors. |
| AWS Provider Docs Home | https://registry.terraform.io/.../docs | Main documentation page for the provider. |
| Service Resource Example | .../docs/resources/s3outposts_endpoint | Direct link to a resource within the service. |
| AWS SDK for Go | https://docs.aws.amazon.com/sdk-for-go/api/service/... | Official AWS SDK documentation for the service API. |
Sources: internal/service/s3outposts/README.md, internal/service/iam/README.md, internal/service/dms/README.md
This structure ensures that a developer working on the dms service, for example, has immediate access to the AWS SDK for Go documentation for the Database Migration Service, as well as an example of an existing DMS resource in the Terraform documentation.
Sources: internal/service/dms/README.md