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

Fix grammatical errors & typos #237

Merged
merged 2 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ signs:
- artifacts: checksum
args:
# if you are using this in a GitHub action or some other automated pipeline, you
# need to pass the batch flag to indicate its not interactive.
# need to pass the batch flag to indicate it's not interactive.
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
Expand Down
62 changes: 22 additions & 40 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,34 @@

Each package corresponds to a product group, i.e.: `publiccloud`

## DataSources
## Data Sources

### DataSource files
### Data Source files

All code pertaining to dataSources, including models, belongs in the dataSource
All code pertaining to Data Sources, including models, belongs in the dataSource
file.
The format for this file is `<ENDPOINT>_data_source.go`.
For instances the filename would be `instances_data_source.go`

### DataSource structs
### Data Source structs

DataSource structs should adhere to the following naming convention:
`<NAME>DataSource`.
For `instances` this would be `instancesDataSource`
- Data Source structs should adhere to the following naming convention:
`<NAME>DataSource`. For `instances` this would be `instancesDataSource`
- Implement `utils.DataSourceAPI` in the struct to support `Metadata()`
& `Configuration()` functions.

### DataSource models
### Data Source models

DataSource model structs should adhere to the following convention:
Data Source model structs should adhere to the following convention:
`<MODEL_NAME>DataSourceModel`.
The `instances` data model would be named `instancesDataSourceModel`.

#### DataSource adaptation functions
#### Data Source adaptation functions

Adapt functions to convert SDK models to dataSource models have the following
naming convention: `adapt<SDK_MODEL_NAME>To<DATASOURCE_MODEL_NAME>DataSource`.
The function to adapt an SDK Instance to an Instance Datasource would be
named `adaptInstanceToInstanceDataSource`.
Adapt functions to convert SDK models to Data Source models have the following
naming convention: `adapt<SDK_MODEL_NAME>To<DataSource_MODEL_NAME>DataSource`.
The function to adapt an SDK Instance to an Instance Data Source would be
named `adaptInstanceToInstanceData Source`.

## Resources

Expand All @@ -43,9 +44,10 @@ For instances the filename would be `instance_resource.go`

### Resource structs

Resource structs should adhere to the following naming convention:
`<NAME>Resource`.
For `instance` this would be `instanceResource`.
- Resource structs should adhere to the following naming convention:
`<NAME>Resource`. For `instance` this would be `instanceResource`.
- Implement `utils.ResourceAPI` in the struct to support `Metadata()`
& `Configuration()` functions.

### Resource models

Expand All @@ -62,29 +64,9 @@ named `adaptInstanceToInstanceResource`.

## Validators

As validators are often shared between resource they belong in the `validators.go`
As validators are often shared between resources, they belong in the `validators.go`
file.

## Configure

If possible, map the SDK API as the client used by Terraform.

```go
func (i *imageResource) Configure(
_ context.Context,
request resource.ConfigureRequest,
response *resource.ConfigureResponse,
) {
...

coreClient, ok := request.ProviderData.(client.Client)

...

i.client = coreClient.PublicCloudAPI
}
```

## SDK

Where possible, use the SDK getters.
Expand Down Expand Up @@ -115,8 +97,8 @@ the following resources & data sources do not adhere to the rules:

Acceptance tests should be placed in [internal/provider/provider_test.go](internal/provider/provider_test.go).
The test functions themselves must adhere to the
`TestAcc<PRODUCT_NAME><END_POINT><TYPE>` format. An acceptance test for an
Public Cloud instance resource should be called `TestAccPublicCloudInstanceResource` and a test for an
`TestAcc<PRODUCT_NAME><END_POINT><TYPE>` format. An acceptance test for a
Public Cloud instance resource should be called `TestAccPublicCloudInstanceResource` and a test for a
Public Cloud instance data source should be called `TestAccPublicCloudInstanceDataSource`.

## Variables
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

## 1.11.0 (November 19, 2024)

* feat(docs): let end user know which actions aren't supporetd by @alrayyes in https://github.com/Leaseweb/terraform-provider-leaseweb/pull/161
* feat(docs): let end user know which actions aren't supported by @alrayyes in https://github.com/Leaseweb/terraform-provider-leaseweb/pull/161

## 1.10.0 (November 19, 2024)

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/public_cloud_instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ resource "leaseweb_public_cloud_instance" "example" {

### Optional

- `market_app_id` (String) Market App ID that must be installed into the instance.**WARNING!** Changing this value once running will cause this instance to be destroyed and a new one to be created.
- `market_app_id` (String) Market App ID that must be installed into the instance. **WARNING!** Changing this value once running will cause this instance to be destroyed and a new one to be created.
- `reference` (String) The identifying name set to the instance
- `root_disk_size` (Number) The root disk's size in GB. Must be at least 5 GB for Linux and FreeBSD instances and 50 GB for Windows instances. The maximum size is 1000 GB

Expand Down Expand Up @@ -165,7 +165,7 @@ Read-Only:

Required:

- `id` (String) Can be either an Operating System or a UUID in case of a Custom Image ID.**WARNING!** Changing this value once running will cause this instance to be destroyed and a new one to be created.
- `id` (String) Can be either an Operating System or a UUID in case of a Custom Image ID. **WARNING!** Changing this value once running will cause this instance to be destroyed and a new one to be created.

Read-Only:

Expand Down
4 changes: 2 additions & 2 deletions internal/provider/publiccloud/instance_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ func (i *instanceResource) Schema(
Attributes: map[string]schema.Attribute{
"id": schema.StringAttribute{
Required: true,
Description: "Can be either an Operating System or a UUID in case of a Custom Image ID." + warningError,
Description: "Can be either an Operating System or a UUID in case of a Custom Image ID. " + warningError,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
},
Expand Down Expand Up @@ -543,7 +543,7 @@ func (i *instanceResource) Schema(
"market_app_id": schema.StringAttribute{
Computed: true,
Optional: true,
Description: "Market App ID that must be installed into the instance." + warningError,
Description: "Market App ID that must be installed into the instance. " + warningError,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplaceIfConfigured(),
},
Expand Down
Loading