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

Migrate to Terraform Plugin Framework #155

Merged
merged 29 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ff5e04f
Migrate to Terraform Plugin Framework
SBGoods Nov 29, 2022
78fd8b3
Merge branch 'main' into issue-84
SBGoods Dec 5, 2022
b013edf
Remove unused method implementations in custom types
SBGoods Dec 5, 2022
cd16992
Add method to initialize type and validation tests
SBGoods Dec 6, 2022
ef931ea
Correct schema for localSensitiveFile resource
SBGoods Dec 8, 2022
7b19559
Refactor tests
SBGoods Dec 8, 2022
f0b02a1
Add implementation for localSensitiveFile resource
SBGoods Dec 12, 2022
c666d65
Add upgrade tests
SBGoods Dec 12, 2022
5c250a0
Update supporting documentation
SBGoods Dec 13, 2022
920295e
Update makefile
SBGoods Dec 13, 2022
174f623
Enable golangci-lint
SBGoods Dec 13, 2022
c2c9ef1
Migrate to terraform-plugin-docs
SBGoods Dec 13, 2022
9eb9ae9
Add Changie changelog automation
SBGoods Dec 13, 2022
bd84887
Add version prefix to Changelog
SBGoods Dec 13, 2022
6efe491
Refactor deprecated io/ioutil package references
SBGoods Dec 13, 2022
1b0f5ec
Add escape characters to file paths
SBGoods Dec 13, 2022
f9c4557
Remove Windows OS check from upgrade tests
SBGoods Dec 14, 2022
325c26c
Add Windows OS check to all steps in upgrade test
SBGoods Dec 14, 2022
7166f1f
Upgrade to Framework v1.0.0
SBGoods Dec 15, 2022
acafaa0
Clean up validate method
SBGoods Dec 15, 2022
ae2ecd8
Change Go version to 1.18
SBGoods Dec 15, 2022
5364805
Remove 'v' version prefix
SBGoods Dec 15, 2022
9a03fe6
Use temporary directory for source tests
SBGoods Jan 4, 2023
855b06b
add changelog-version job
SBGoods Jan 4, 2023
53bed45
Add commit author and email env variables
SBGoods Jan 6, 2023
b8b4a15
Add double quotes to shell commands
SBGoods Jan 10, 2023
1c69af2
Change custom Changie parameter key name to "Issue/PR Number"
SBGoods Jan 10, 2023
084774c
Add "Issue/PR Number" label to custom Changie parameter
SBGoods Jan 10, 2023
b30e24f
Remove 'v' prefix from 2.2.3 changelog version file
SBGoods Jan 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .changes/unreleased/.gitkeep
Empty file.
5 changes: 5 additions & 0 deletions .changes/unreleased/NOTES-20221213-150546.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: NOTES
body: 'provider: Rewritten to use the [`terraform-plugin-framework`](https://www.terraform.io/plugin/framework)'
time: 2022-12-13T15:05:46.163881-05:00
custom:
Issue: "84"
130 changes: 130 additions & 0 deletions .changes/v2.2.3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
## v2.2.3 (May 18, 2022)

NOTES:

* resource/local_file: Update docs to prevent confusion that exactly one of the arguments `content`,
`sensitive_content`, `content_base64`, and `source` needs to be specified ([#123](https://github.com/hashicorp/terraform-provider-local/pull/123)).

* resource/local_sensitive_file: Update docs to prevent confusion that exactly one of the arguments `content`,
`content_base64`, and `source` needs to be specified ([#123](https://github.com/hashicorp/terraform-provider-local/pull/123)).

* No functional changes from 2.2.2.

## v2.2.2 (March 11, 2022)

NOTES:

* resource/local_sensitive_file: Fixed typo in documentation (default permission is `"0700"`, not `"0777"`).
* No functional changes from 2.2.1.

## v2.2.1 (March 10, 2022)

NOTES:

* This release is a republishing of the 2.2.0 release to fix release asset checksum errors. It is identical otherwise.

## v2.2.0 (March 10, 2022)

NOTES:

* resource/local_file: Argument `sensitive_content` is `Deprecated`. For creating or accessing files containing sensitive data,
please use the new resource and data source `local_sensitive_file`.
Both are identical to their `local_file` counterparts, but `content` and `content_base64` attributes are marked as _sensitive_.

FEATURES:

* **New Data Source:** `local_sensitive_file` ([#101](https://github.com/hashicorp/terraform-provider-local/pull/101) and [#106](https://github.com/hashicorp/terraform-provider-local/pull/106))
* **New Resource:** `local_sensitive_file` ([#106](https://github.com/hashicorp/terraform-provider-local/pull/106))

## v2.1.0 (February 19, 2021)

NOTES:

* Binary releases of this provider now include the` darwin-arm64` platform.
* This version contains no further changes.

## v2.0.0 (October 14, 2020)

NOTES:

* Binary releases of this provider now include the `linux-arm64` platform.

BREAKING CHANGES:

* Upgrade to version 2 of the Terraform Plugin SDK, which drops support for Terraform 0.11.
This provider will continue to work as expected for users of Terraform 0.11, which will not download the new version.
([#42](https://github.com/terraform-providers/terraform-provider-local/issues/42))

FEATURES:

* resource/local_file: Added `source` attribute as alternative way to provide content
for the `local_file` resource.
([#44](https://github.com/terraform-providers/terraform-provider-local/issues/44))

## v1.4.0 (September 30, 2019)

NOTES:

* The provider has switched to the standalone TF SDK, there should be no noticeable impact on compatibility.
([#32](https://github.com/terraform-providers/terraform-provider-local/issues/32))

FEATURES:

* resource/local_file: Added support for configurable permissions
([#30](https://github.com/terraform-providers/terraform-provider-local/issues/30))

## v1.3.0 (June 26, 2019)

FEATURES:

* resource/local_file: Added support for base64 encoded content
([#29](https://github.com/terraform-providers/terraform-provider-local/issues/29))
* data-source/local_file: Added support for base64 encoded content
([#29](https://github.com/terraform-providers/terraform-provider-local/issues/29))

## v1.2.2 (May 01, 2019)

NOTES:

* This releases includes another Terraform SDK upgrade intended to align with that being used for other providers
as we prepare for the Core `v0.12.0` release. It should have no significant changes in behavior for this provider.

## v1.2.1 (April 11, 2019)

NOTES:

* This releases includes only a Terraform SDK upgrade intended to align with that being used for other providers
as we prepare for the Core `v0.12.0` release. It should have no significant changes in behavior for this provider.

## v1.2.0 (March 20, 2019)

FEATURES:

* The provider is now compatible with Terraform v0.12, while retaining compatibility with prior versions.
* resource/local_file: added optional `sensitive_content` attribute, which can be used instead of `content`
in situations where the content contains sensitive information that should not be displayed in a rendered diff.
([#9](https://github.com/terraform-providers/terraform-provider-local/issues/9))

## v1.1.0 (January 04, 2018)

FEATURES:

* data-source/local_file: Added for reading files in a way that participates in Terraform's dependency graph,
which allows reading of files that are created dynamically during `terraform apply`.
([#6](https://github.com/terraform-providers/terraform-provider-local/issues/6))

## v1.0.0 (September 15, 2017)

NOTES:

* No changes from 0.1.0; just adjusting to
[the new version numbering scheme](https://www.hashicorp.com/blog/hashicorp-terraform-provider-versioning/).

## v0.1.0 (June 21, 2017)

NOTES:

* Same functionality as that of Terraform 0.9.8.
Repacked as part of [Provider Splitout](https://www.hashicorp.com/blog/upcoming-provider-changes-in-terraform-0-10/)


21 changes: 21 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
changesDir: .changes
unreleasedDir: unreleased
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## {{.Version}} ({{.Time.Format "January 02, 2006"}})'
kindFormat: '{{.Kind}}:'
changeFormat: '* {{.Body}} ([#{{.Custom.Issue}}](https://github.com/hashicorp/terraform-provider-local/issues/{{.Custom.Issue}})).'
custom:
- key: Issue
type: int
minInt: 1
kinds:
- label: BREAKING CHANGES
- label: NOTES
- label: FEATURES
- label: IMPROVEMENTS
- label: BUG FIXES
newlines:
afterKind: 1
beforeKind: 1
endOfVersion: 2
146 changes: 105 additions & 41 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,135 @@
# Contributing to `terraform-provider-local`
# Contributing

**First:** if you're unsure or afraid of _anything_, just ask or submit the issue describing the problem you're aiming to solve.
Thank you for investing your time and energy by contributing to our project: please ensure you are familiar
with the [HashiCorp Code of Conduct](https://github.com/hashicorp/.github/blob/master/CODE_OF_CONDUCT.md).

The `local` provider is a HashiCorp *standard library* provider, which means we consider it part of the core Terraform experience. Our priority is stability and correctness, and any bug fix or feature has to be considered in the context of this provider's many users and the wider Terraform ecosystem.
This is great as your contribution can have a big positive impact, but we have to assess potential negative impact too.
This provider is a HashiCorp **utility provider**, which means any bug fix and feature
has to be considered in the context of the thousands/millions of configurations in which this provider is used.
This is great as your contribution can have a big positive impact, but we have to assess potential negative impact too
(e.g. breaking existing configurations). _Stability over features_.

To provide some safety to the Terraform ecosystem, we strictly follow [semantic versioning](https://semver.org/) and any changes that could be considered as breaking will only be released as part of a major release.
To provide some safety to the wider provider ecosystem, we strictly follow
[semantic versioning](https://semver.org/) and HashiCorp's own
[versioning specification](https://www.terraform.io/plugin/sdkv2/best-practices/versioning#versioning-specification).
Any changes that could be considered as breaking will only be included as part of a major release.
In case multiple breaking changes need to happen, we will group them in the next upcoming major release.

## Table of Contents
## Asking Questions

- [I just have a question](#i-just-have-a-question)
- [I want to report a vulnerability](#i-want-to-report-a-vulnerability)
- [New Issue](#new-issue)
- [New Pull Request](#new-pull-request)
For questions, curiosity, or if still unsure what you are dealing with,
please see the HashiCorp [Terraform Providers Discuss](https://discuss.hashicorp.com/c/terraform-providers/31)
forum.

## I just have a question
## Reporting Vulnerabilities

> **Note:** We use GitHub for tracking bugs and feature requests only.
Please disclose security vulnerabilities responsibly by following the
[HashiCorp Vulnerability Reporting guidelines](https://www.hashicorp.com/security#vulnerability-reporting).

For questions, please see relevant channels at https://www.terraform.io/community.html
## Raising Issues

## I want to report a vulnerability
We welcome issues of all kinds including feature requests, bug reports or documentation suggestions.
Below are guidelines for well-formed issues of each type.

Please disclose security vulnerabilities responsibly by following the procedure
described at https://www.hashicorp.com/security#vulnerability-reporting
### Bug Reports

## New Issue
* [ ] **Test against latest release**: Make sure you test against the latest available version of Terraform and the provider.
It is possible we may have already fixed the bug you're experiencing.
* [ ] **Search for duplicates**: It's helpful to keep bug reports consolidated to one thread, so do a quick search
on existing bug reports to check if anybody else has reported the same thing.
You can scope searches by the label `bug` to help narrow things down.
* [ ] **Include steps to reproduce**: Provide steps to reproduce the issue, along with code examples and/or real code,
so we can try to reproduce it. Without this, it makes it much harder (sometimes impossible) to fix the issue.

We welcome issues of all kinds including feature requests, bug reports or documentation suggestions. Below are guidelines for well-formed issues of each type.
### Feature Requests

### Bug Reports
* [ ] **Search for possible duplicate requests**: It's helpful to keep requests consolidated to one thread,
so do a quick search on existing requests to check if anybody else has reported the same thing.
You can scope searches by the label `enhancement` to help narrow things down.
* [ ] **Include a use case description**: In addition to describing the behavior of the feature you'd like to see added,
it's helpful to also make a case for why the feature would be important and how it would benefit
the provider and, potentially, the wider Terraform ecosystem.

- **Test against latest release**: Make sure you test against the latest avaiable version of both Terraform and the provider.
It is possible we already fixed the bug you're experiencing.
## New Pull Request

- **Search for duplicates**: It's helpful to keep bug reports consolidated to one thread, so do a quick search on existing bug reports to check if anybody else has reported the same thing. You can scope searches by the label `bug` to help narrow things down.
Thank you for contributing!

- **Include steps to reproduce**: Provide steps to reproduce the issue, along with code examples (both HCL and Go, where applicable) and/or real code, so we can try to reproduce it. Without this, it makes it much harder (sometimes impossible) to fix the issue.
We are happy to review pull requests without associated issues,
but we **highly recommend** starting by describing and discussing
your problem or feature and attaching use cases to an issue first
before raising a pull request.

### Feature Requests
* [ ] **Early validation of idea and implementation plan**: provider development is complicated enough that there
are often several ways to implement something, each of which has different implications and tradeoffs.
Working through a plan of attack with the team before you dive into implementation will help ensure that you're
working in the right direction.
* [ ] **Tests**: It may go without saying, but every new patch should be covered by tests wherever possible.
For bug-fixes, tests to prove the fix is valid. For features, tests to exercise the new code paths.
* [ ] **Go Modules**: We use [Go Modules](https://github.com/golang/go/wiki/Modules) to manage and version our dependencies.
Please make sure that you reflect dependency changes in your pull requests appropriately
(e.g. `go get`, `go mod tidy` or other commands).
Refer to the [dependency updates](#dependency-updates) section for more information about how
this project maintains existing dependencies.
* [ ] **Changelog**: Refer to the [changelog](#changelog) section for more information about how to create changelog entries.

- **Search for possible duplicate requests**: It's helpful to keep requests consolidated to one thread, so do a quick search on existing requests to check if anybody else has reported the same thing. You can scope searches by the label `enhancement` to help narrow things down.
### Dependency Updates

- **Include a use case description**: In addition to describing the behavior of the feature you'd like to see added, it's helpful to also lay out the reason why the feature would be important and how it would benefit the wider Terraform ecosystem. Use case in context of 1 provider is good, wider context of more providers is better.
Dependency management is performed by [Dependabot](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates).
Where possible, dependency updates should occur through that system to ensure all Go module files are appropriately
updated and to prevent duplicated effort of concurrent update submissions.
Once available, updates are expected to be verified and merged to prevent latent technical debt.

## New Pull Request
### Changelog

Thank you for contributing!
HashiCorp’s open-source projects have always maintained user-friendly, readable `CHANGELOG`s that allow
practitioners and developers to tell at a glance whether a release should have any effect on them,
and to gauge the risk of an upgrade.

We follow Terraform Plugin
[changelog specifications](https://www.terraform.io/plugin/sdkv2/best-practices/versioning#changelog-specification).

#### Changie Automation Tool
This provider uses the [Changie](https://changie.dev/) automation tool for changelog automation.
To add a new entry to the `CHANGELOG` install Changie using the following [instructions](https://changie.dev/guide/installation/)
and run
```bash
changie new
```
then choose a `kind` of change corresponding to the Terraform Plugin [changelog categories](https://developer.hashicorp.com/terraform/plugin/sdkv2/best-practices/versioning#categorization)
and then fill out the body following the entry format. Changie will then prompt for a Github issue number.
Repeat this process for any additional changes. The `.yaml` files created in the `.changes/unreleased` folder
should be pushed the repository along with any code changes.

#### Entry format

Entries that are specific to _resources_ or _data sources_, they should look like:

```markdown
* resource/RESOURCE_NAME: ENTRY DESCRIPTION

We are happy to review pull requests without associated issues, but we highly recommend starting by describing and discussing your problem or feature and attaching use cases to an issue first before raising a pull request.
* data-source/DATA-SOURCE_NAME: ENTRY DESCRIPTION
```

- **Early validation of idea and implementation plan**: Terraform's SDK is complicated enough that there are often several ways to implement something, each of which has different implications and tradeoffs. Working through a plan of attack with the team before you dive into implementation will help ensure that you're working in the right direction.
#### Pull Request Types to `CHANGELOG`

- **Acceptance Tests**: It may go without saying, but every new patch should be covered by tests wherever possible.
The `CHANGELOG` is intended to show developer-impacting changes to the codebase for a particular version.
If every change or commit to the code resulted in an entry, the `CHANGELOG` would become less useful for developers.
The lists below are general guidelines to decide whether a change should have an entry.

- **Go Modules**: We use [Go Modules](https://github.com/golang/go/wiki/Modules) to manage and version all our dependencies. Please make sure that you reflect dependency changes in your pull requests appropriately (e.g. `go get`, `go mod tidy` or other commands). Where possible it is better to raise a separate pull request with just dependency changes as it's easier to review such PR(s).
##### Changes that should not have a `CHANGELOG` entry

### Cosmetic changes, code formatting, and typos
* Documentation updates
* Testing updates
* Code refactoring

In general we do not accept PRs containing only the following changes:
##### Changes that may have a `CHANGELOG` entry

- Correcting spelling or typos
- Code formatting, including whitespace
- Other cosmetic changes that do not affect functionality

While we appreciate the effort that goes into preparing PRs, there is always a tradeoff between benefit and cost. The costs involved in accepting such contributions include the time taken for thorough review, the noise created in the git history, and the increased number of GitHub notifications that maintainers must attend to.
* Dependency updates: If the update contains relevant bug fixes or enhancements that affect developers,
those should be called out.

#### Exceptions
##### Changes that should have a `CHANGELOG` entry

We belive that one should "leave the campsite cleaner than you found it", so you are welcome to clean up cosmetic issues in the neighbourhood when submitting a patch that makes functional changes or fixes.
* Major features
* Bug fixes
* Enhancements
* Deprecations
* Breaking changes and removals
7 changes: 4 additions & 3 deletions .github/SUPPORT.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Support

Terraform is a mature project with a growing community. There are active, dedicated people willing to help you through various mediums.

Take a look at those mediums listed at https://www.terraform.io/community.html
* Project [README](../README.md)
* Official [Documentation](https://registry.terraform.io/providers/hashicorp/local/latest/docs)
* Providers [Discuss forums](https://discuss.hashicorp.com/c/terraform-providers/31)
* Terraform [Community](https://www.terraform.io/community.html) page
Loading