Skip to content

Commit

Permalink
Merge pull request #1553 from linode/dev
Browse files Browse the repository at this point in the history
Release v2.26.0
  • Loading branch information
lgarber-akamai committed Aug 15, 2024
2 parents 5b71f65 + dc811ba commit 9c97673
Show file tree
Hide file tree
Showing 103 changed files with 1,286 additions and 339 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/integration_tests_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
run_long_tests:
description: 'Setting this value will skip long running tests (e.g. Database related cases): (true|false)'
required: false
default: false


name: Integration tests on PR
Expand Down Expand Up @@ -49,6 +50,8 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}
fetch-depth: 0
submodules: 'recursive'

- run: make deps

Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,69 @@ jobs:
gpg-private-key-passphrase: ${{ secrets.PASSPHRASE }}
with:
setup-go-version-file: 'go.mod'

verify-publications:
needs: terraform-provider-release
runs-on: ubuntu-latest
name: Verifying TF Registry Publications
strategy:
matrix:
registry:
- "https://registry.opentofu.org/v1"
- "https://registry.terraform.io/v1"
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v7
env:
REGISTRY: ${{ matrix.registry }}
with:
script: |
async function verifyPublication(targetVersion, registry) {
const url = `${registry}/providers/linode/linode/versions`;
const response = await fetch(url);
if (!response.ok) {
console.log(`Error response status: ${response.status}`);
}
const json = await response.json();
return json.versions.find((v) => v.version == targetVersion) != null;
}
let prefix = "refs/tags/v";
if (!context.ref.startsWith(prefix)) {
throw new Error(`Invalid ref: ${context.ref}`);
}
const TARGET_VERSION = context.ref.slice(prefix.length);
const REGISTRY = process.env.REGISTRY;
// 1 retry request per minute, 3 hours in total
const REGISTRY_POLL_RETRIES = ${{ vars.REGISTRY_POLL_RETRIES }};
const REGISTRY_POLL_INTERVAL = ${{ vars.REGISTRY_POLL_INTERVAL }};
console.log(`Verifying publication of v${TARGET_VERSION} on ${REGISTRY}`);
let found = false;
let count = 0;
while (!found && count < REGISTRY_POLL_RETRIES) {
count++;
found = await verifyPublication(TARGET_VERSION, REGISTRY);
if (found) {
break;
}
console.log(
`Publication of v${TARGET_VERSION} on ${REGISTRY} isn't found, retrying in ${REGISTRY_POLL_INTERVAL} ms...`
);
await new Promise((r) => setTimeout(r, REGISTRY_POLL_INTERVAL));
}
if (found) {
console.log(
`Verified that Linode Provider v${TARGET_VERSION} has been successfully published on ${REGISTRY}.`
);
} else {
throw new Error(
`Timeout waiting for Linode Provider v${TARGET_VERSION} publication on ${REGISTRY}`
);
}
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ COUNT?=1
PARALLEL?=10
PKG_NAME=linode/...
TIMEOUT?=240m
RUN_LONG_TESTS?=False
RUN_LONG_TESTS?=false
SWEEP?="tf_test,tf-test"
TEST_TAGS="integration"

Expand Down Expand Up @@ -61,7 +61,7 @@ test: fmt-check smoke-test unit-test int-test

.PHONY: unit-test
unit-test: fmt-check
go test -v --tags=unit ./$(PKG_NAME) | grep -v "\[no test files\]"
go test -v --tags=unit ./$(PKG_NAME)

.PHONY: int-test
int-test: fmt-check generate-ip-env-fw-e2e include-env
Expand All @@ -70,7 +70,7 @@ int-test: fmt-check generate-ip-env-fw-e2e include-env
RUN_LONG_TESTS=$(RUN_LONG_TESTS) \
TF_VAR_ipv4_addr=${PUBLIC_IPV4} \
TF_VAR_ipv6_addr=${PUBLIC_IPV6} \
go test --tags="$(TEST_TAGS)" -v ./$(PKG_NAME) -count $(COUNT) -timeout $(TIMEOUT) -ldflags="-X=github.com/linode/terraform-provider-linode/v2/version.ProviderVersion=acc" -parallel=$(PARALLEL) $(ARGS) | grep -v "\[no test files\]"
go test --tags="$(TEST_TAGS)" -v ./$(PKG_NAME) -count $(COUNT) -timeout $(TIMEOUT) -ldflags="-X=github.com/linode/terraform-provider-linode/v2/version.ProviderVersion=acc" -parallel=$(PARALLEL) $(ARGS)

.PHONY: include-env
include-env: $(IP_ENV_FILE)
Expand All @@ -87,7 +87,7 @@ smoke-test: fmt-check
TF_ACC=1 \
LINODE_API_VERSION="v4beta" \
RUN_LONG_TESTS=$(RUN_LONG_TESTS) \
go test -v -run smoke ./linode/... -count $(COUNT) -timeout $(TIMEOUT) -parallel=$(PARALLEL) -ldflags="-X=github.com/linode/terraform-provider-linode/v2/version.ProviderVersion=acc" | grep -v "\[no test files\]"
go test -v -run smoke ./linode/... -count $(COUNT) -timeout $(TIMEOUT) -parallel=$(PARALLEL) -ldflags="-X=github.com/linode/terraform-provider-linode/v2/version.ProviderVersion=acc"

.PHONY: docs-check
docs-check:
Expand Down
8 changes: 8 additions & 0 deletions docs/data-sources/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,11 @@ The Linode Image resource exports the following attributes:
* `type` - How the Image was created. Manual Images can be created at any time. "Automatic" Images are created automatically from a deleted Linode. (`manual`, `automatic`)

* `vendor` - The upstream distribution vendor. `None` for private Images.

* `tags` - A list of customized tags.

* `total_size` - The total size of the image in all available regions.

* `replications` - A list of image replication regions and corresponding status.
* `region` - The region of an image replica.
* `status` - The status of an image replica.
10 changes: 10 additions & 0 deletions docs/data-sources/images.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ Each Linode image will be stored in the `images` attribute and will export the f

* `vendor` - The upstream distribution vendor. `None` for private Images.

* `tags` - A list of customized tags.

* `total_size` - The total size of the image in all available regions.

* `replications` - A list of image replication regions and corresponding status.
* `region` - The region of an image replica.
* `status` - The status of an image replica.

## Filterable Fields

* `created_by`
Expand All @@ -106,3 +114,5 @@ Each Linode image will be stored in the `images` attribute and will export the f
* `status`

* `vendor`

* `tags`
16 changes: 15 additions & 1 deletion docs/data-sources/instances.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ Each Linode instance will be stored in the `instances` attribute and will export

* [`backups`](#backups) - Information about the Linode's backup status.

* [`placement_group`](#placement-groups) - Information about the Linode's Placement Groups.

### Disks

* `disk`
Expand Down Expand Up @@ -214,7 +216,19 @@ The following arguments are available in an `ipv4` configuration block of an `in
* `day` - The day of the week that your Linode's weekly Backup is taken. If not set manually, a day will be chosen for you. Backups are taken every day, but backups taken on this day are preferred when selecting backups to retain for a longer period. If not set manually, then when backups are initially enabled, this may come back as "Scheduling" until the day is automatically selected.

* `window` - The window ('W0'-'W22') in which your backups will be taken, in UTC. A backups window is a two-hour span of time in which the backup may occur. For example, 'W10' indicates that your backups should be taken between 10:00 and 12:00. If you do not choose a backup window, one will be selected for you automatically. If not set manually, when backups are initially enabled this may come back as Scheduling until the window is automatically selected.


### Placement Groups

* `placement_group`

* `id` - The ID of the Placement Group in the Linode API.

* `placement_group_type` - The placement group type to use when placing Linodes in this group.

* `placement_group_policy` - Whether Linodes must be able to become compliant during assignment. (Default `strict`)

* `label` - The label of the Placement Group. This field can only contain ASCII letters, digits and dashes.

## Filterable Fields

* `group`
Expand Down
35 changes: 33 additions & 2 deletions docs/resources/image.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ resource "linode_image" "bar" {
description = "Image taken from foo"
disk_id = linode_instance.foo.disk.0.id
linode_id = linode_instance.foo.id
tags = ["image-tag", "test"]
}
resource "linode_instance" "bar_based" {
Expand All @@ -43,12 +44,30 @@ resource "linode_image" "foobar" {
label = "foobar-image"
description = "An image uploaded from Terraform!"
region = "us-southeast"
tags = ["image-tag", "test"]
file_path = "path/to/image.img.gz"
file_hash = filemd5("path/to/image.img.gz")
}
```

Upload and replicate an image from a local file:

```hcl
resource "linode_image" "foobar" {
label = "foobar-image"
description = "An image uploaded from Terraform!"
region = "us-southeast"
tags = ["image-tag", "test"]
file_path = "path/to/image.img.gz"
file_hash = filemd5("path/to/image.img.gz")
// Note: Image replication may not be available to all users.
replica_regions = ["us-southeast", "us-east", "eu-west"]
}
```

## Argument Reference

The following arguments are supported:
Expand All @@ -57,6 +76,12 @@ The following arguments are supported:

* `description` - (Optional) A detailed description of this Image.

* `tags` - (Optional) A list of customized tags.

* `replica_regions` - (Optional) A list of regions that customer wants to replicate this image in. At least one valid region is required and only core regions allowed. Existing images in the regions not passed will be removed. **Note:** Image replication may not be available to all users. See Replicate an Image [here](https://techdocs.akamai.com/linode-api/reference/post-replicate-image) for more details.

* `wait_for_replications` - (Optional) Whether to wait for all image replications become `available`. Default to false.

- - -

The following arguments apply to creating an image from an existing Linode Instance:
Expand All @@ -75,13 +100,13 @@ The following arguments apply to uploading an image:

* `file_hash` - (Optional) The MD5 hash of the file to be uploaded. This is used to trigger file updates.

* `region` - (Required) The region of the image. See all regions [here](https://api.linode.com/v4/regions).
* `region` - (Required) The region of the image. See all regions [here](https://techdocs.akamai.com/linode-api/reference/get-regions).

### Timeouts

The `timeouts` block allows you to specify [timeouts](https://developer.hashicorp.com/terraform/language/resources/syntax#operation-timeouts) for certain actions:

* `create` - (Defaults to 20 mins) Used when creating the instance image (until the instance is available)
* `create` - (Defaults to 30 mins) Used when creating the instance image (until the instance is available)

## Attributes Reference

Expand All @@ -105,6 +130,12 @@ This resource exports the following attributes:

* `vendor` - The upstream distribution vendor. Nil for private Images.

* `total_size` - The total size of the image in all available regions.

* `replications` - A list of image replications region and corresponding status.
* `region` - The region of an image replica.
* `status` - The status of an image replica.

## Import

Linodes Images can be imported using the Linode Image `id`, e.g.
Expand Down
33 changes: 17 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ require (
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.4
github.com/aws/aws-sdk-go-v2/service/s3 v1.58.2
github.com/aws/smithy-go v1.20.3
github.com/go-resty/resty/v2 v2.13.1
github.com/go-resty/resty/v2 v2.14.0
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-version v1.7.0
github.com/hashicorp/terraform-plugin-framework v1.10.0
github.com/hashicorp/terraform-plugin-framework v1.11.0
github.com/hashicorp/terraform-plugin-framework-timeouts v0.4.1
github.com/hashicorp/terraform-plugin-framework-timetypes v0.4.0
github.com/hashicorp/terraform-plugin-framework-timetypes v0.5.0
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-mux v0.16.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
github.com/hashicorp/terraform-plugin-testing v1.9.0
github.com/linode/linodego v1.38.0
github.com/hashicorp/terraform-plugin-testing v1.10.0
github.com/linode/linodego v1.39.0
github.com/linode/linodego/k8s v1.25.2
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.25.0
golang.org/x/net v0.27.0
golang.org/x/sync v0.7.0
golang.org/x/crypto v0.26.0
golang.org/x/net v0.28.0
golang.org/x/sync v0.8.0
)

require (
Expand Down Expand Up @@ -66,8 +66,9 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/hc-install v0.7.0 // indirect
github.com/hashicorp/hc-install v0.8.0 // indirect
github.com/hashicorp/hcl/v2 v2.21.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.21.0 // indirect
Expand Down Expand Up @@ -95,13 +96,13 @@ require (
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
github.com/zclconf/go-cty v1.15.0 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/time v0.6.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
Expand Down
Loading

0 comments on commit 9c97673

Please sign in to comment.