Skip to content

Commit 570e9af

Browse files
jerjakoMonitob
authored andcommitted
feat(domain): Add domain record data source (scaleway#874)
* feat(domain): Add domain record data source * fix tests Co-authored-by: Jeremy JACQUEMIN <[email protected]> Co-authored-by: jaime Bernabe <[email protected]> chore: add support for dependabot (scaleway#877) chore(deps): bump github.com/aws/aws-sdk-go from 1.39.3 to 1.40.53 (scaleway#878) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.39.3 to 1.40.53. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.39.3...v1.40.53) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> chore(deps): bump github.com/hashicorp/terraform-plugin-sdk/v2 (scaleway#880) Bumps [github.com/hashicorp/terraform-plugin-sdk/v2](https://github.com/hashicorp/terraform-plugin-sdk) from 2.7.0 to 2.8.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-sdk/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-sdk/blob/main/CHANGELOG.md) - [Commits](hashicorp/terraform-plugin-sdk@v2.7.0...v2.8.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-sdk/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rémy Léone <[email protected]> chore(deps): bump github.com/dnaeon/go-vcr from 1.1.0 to 1.2.0 (scaleway#879) Bumps [github.com/dnaeon/go-vcr](https://github.com/dnaeon/go-vcr) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/dnaeon/go-vcr/releases) - [Commits](dnaeon/go-vcr@v1.1.0...v1.2.0) --- updated-dependencies: - dependency-name: github.com/dnaeon/go-vcr dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rémy Léone <[email protected]> chore(deps): bump github.com/aws/aws-sdk-go from 1.40.53 to 1.40.54 (scaleway#881) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.53 to 1.40.54. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.40.53...v1.40.54) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> feat(provider): add profile name from configuration file support (scaleway#875) * feat(provider): add profile name from configuration file support * feat(provider): enhance error handling * chore(provider): add section about new profile feature usage * fix(provider): fix condition * Apply suggestions from code review Co-authored-by: jaime Bernabe <[email protected]> chore(deps): bump github.com/aws/aws-sdk-go from 1.40.54 to 1.40.55 (scaleway#883) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.40.54 to 1.40.55. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.40.54...v1.40.55) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> chore: bump go version (scaleway#882)
1 parent ceb48d2 commit 570e9af

17 files changed

+3993
-38
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: gomod
9+
directory: "/"
10+
schedule:
11+
interval: daily

.github/workflows/acceptance-tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Install Go
2828
uses: actions/setup-go@v2
2929
with:
30-
go-version: 1.15.14
30+
go-version: 1.17.1
3131
- name: Checkout
3232
uses: actions/checkout@v2
3333
- name: Run Acceptance Tests

.github/workflows/documentation.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- docs/**
1212

1313
env:
14-
GO_VERSION: "1.14"
14+
GO_VERSION: "1.17"
1515
GO111MODULE: on
1616

1717
jobs:
@@ -47,5 +47,5 @@ jobs:
4747
with:
4848
path: ~/go/pkg/mod
4949
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
50-
- run: go install github.com/client9/misspell/cmd/misspell
50+
- run: go install github.com/client9/misspell/cmd/misspell@latest
5151
- run: misspell -error -source text docs/

.github/workflows/nightly.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install Go
3030
uses: actions/setup-go@v2
3131
with:
32-
go-version: 1.15.1
32+
go-version: 1.17.1
3333
- name: Checkout
3434
uses: actions/checkout@v2
3535
- name: Run Acceptance Tests
@@ -57,7 +57,7 @@ jobs:
5757
- name: Install Go
5858
uses: actions/setup-go@v2
5959
with:
60-
go-version: 1.15.1
60+
go-version: 1.17.1
6161
- name: Checkout
6262
uses: actions/checkout@v2
6363
- name: Run sweepers

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
name: Set up Go
2929
uses: actions/setup-go@v2
3030
with:
31-
go-version: 1.16
31+
go-version: 1.17
3232
-
3333
name: Import GPG key
3434
id: import_gpg

.github/workflows/unit-tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
tests:
88
strategy:
99
matrix:
10-
go-version: [1.14.x, 1.15.x, 1.16.x]
10+
go-version: [1.16.x, 1.17.x]
1111
platform: [ubuntu-latest]
1212
runs-on: ${{ matrix.platform }}
1313
steps:

.go-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.13.1
1+
1.17.1

docs/data-sources/domain_record.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
page_title: "Scaleway: scaleway_domain_record"
3+
description: |-
4+
Gets information about a domain record.
5+
---
6+
7+
# scaleway_domain_record
8+
9+
Gets information about a domain record.
10+
11+
## Example Usage
12+
13+
```hcl
14+
# Get record by name, type and data
15+
data "scaleway_domain_record" "by_content" {
16+
dns_zone = "domain.tld"
17+
name = "www"
18+
type = "A"
19+
data = "1.2.3.4"
20+
}
21+
22+
# Get info by ID
23+
data "scaleway_domain_record" "by_id" {
24+
dns_zone = "domain.tld"
25+
record_id = "11111111-1111-1111-1111-111111111111"
26+
}
27+
```
28+
29+
## Argument Reference
30+
31+
- `dns_zone` - (Optional) The IP address.
32+
33+
- `name` - (Required) The name of the record (can be an empty string for a root record).
34+
Cannot be used with `record_id`.
35+
36+
- `type` - (Required) The type of the record (`A`, `AAAA`, `MX`, `CNAME`, `ALIAS`, `NS`, `PTR`, `SRV`, `TXT`, `TLSA`, or `CAA`).
37+
Cannot be used with `record_id`.
38+
39+
- `data` - (Required) The content of the record (an IPv4 for an `A`, a string for a `TXT`...).
40+
Cannot be used with `record_id`.
41+
42+
- `record_id` - (Optional) The record ID.
43+
Cannot be used with `name`, `type` and `data`.
44+
45+
- `project_id` - (Defaults to [provider](../index.md#project_id) `project_id`) The ID of the project the domain is associated with.
46+
47+
## Attributes Reference
48+
49+
In addition to all arguments above, the following attributes are exported:
50+
51+
- `ttl` - Time To Tive of the record in seconds.
52+
- `priority` - The priority of the record (mostly used with an `MX` record)
53+
- `geo_ip` - Dynamic record base on user geolocalisation ([More information about dynamic records](../resources/domain_record.md#dynamic-records))
54+
- `http_service` - Dynamic record base on URL resolve ([More information about dynamic records](../resources/domain_record.md#dynamic-records))
55+
- `weighted` - Dynamic record base on IP weights ([More information about dynamic records](../resources/domain_record.md#dynamic-records))
56+
- `view` - Dynamic record based on the client’s (resolver) subnet ([More information about dynamic records](../resources/domain_record.md#dynamic-records))

docs/index.md

+32
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,38 @@ If it fails to detect credentials inline, or in the environment, Terraform will
178178
You can optionally specify a different location with `SCW_CONFIG_PATH` environment variable.
179179
You can find more information about this configuration [in the documentation](https://github.com/scaleway/scaleway-sdk-go/blob/master/scw/README.md#scaleway-config).
180180

181+
This method also supports a `profile` configuration:
182+
183+
Example:
184+
185+
If your shared configuration file contains:
186+
187+
```yaml
188+
profiles:
189+
myProfile:
190+
access_key: xxxxxxxxxxxxxxxxxxxx
191+
secret_key: xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx
192+
default_organization_id: xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx
193+
default_project_id: xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx
194+
default_zone: fr-par-2
195+
default_region: fr-par
196+
api_url: https://api.scaleway.com
197+
insecure: false
198+
```
199+
200+
You can invoke and use this profile in the provider declaration:
201+
202+
```hcl
203+
provider "scaleway" {
204+
alias = "p2"
205+
profile = "myProfile"
206+
}
207+
208+
resource "scaleway_instance_ip" "server_ip" {
209+
provider = scaleway.p2
210+
}
211+
```
212+
181213
## Arguments Reference
182214

183215
In addition to [generic provider arguments](https://www.terraform.io/docs/configuration/providers.html) (e.g. `alias` and `version`), the following arguments are supported in the Scaleway provider block:

docs/resources/domain_record.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ The following arguments are supported:
198198

199199
- `priority` - (Optional, default: `0`) The priority of the record (mostly used with an `MX` record)
200200

201-
**Dynamic records:**
201+
### Dynamic records
202202

203203
- `geo_ip` - (Optional) The Geo IP feature provides DNS resolution, based on the user’s geographical location. You can define a default IP that resolves if no Geo IP rule matches, and specify IPs for each geographical zone. [Documentation and usage example](https://www.scaleway.com/en/docs/scaleway-dns/#-Geo-IP-Records)
204204
- `matches` - (Required) The list of matches. *(Can be more than 1)*

go.mod

+66-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,79 @@
11
module github.com/scaleway/terraform-provider-scaleway
22

33
require (
4-
github.com/aws/aws-sdk-go v1.39.3
5-
github.com/dnaeon/go-vcr v1.1.0
4+
github.com/aws/aws-sdk-go v1.40.55
5+
github.com/dnaeon/go-vcr v1.2.0
66
github.com/dustin/go-humanize v1.0.0
77
github.com/google/go-cmp v0.5.6
88
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
99
github.com/hashicorp/go-retryablehttp v0.7.0
10-
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0
10+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.8.0
1111
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210804084528-d11825fe1059
1212
github.com/stretchr/testify v1.7.0
13-
golang.org/x/tools v0.1.6 // indirect
1413
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
14+
15+
)
16+
17+
require (
18+
cloud.google.com/go v0.61.0 // indirect
19+
cloud.google.com/go/storage v1.10.0 // indirect
20+
github.com/agext/levenshtein v1.2.2 // indirect
21+
github.com/apparentlymart/go-textseg v1.0.0 // indirect
22+
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
23+
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
24+
github.com/davecgh/go-spew v1.1.1 // indirect
25+
github.com/fatih/color v1.7.0 // indirect
26+
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
27+
github.com/golang/protobuf v1.4.2 // indirect
28+
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
29+
github.com/hashicorp/errwrap v1.0.0 // indirect
30+
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
31+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
32+
github.com/hashicorp/go-getter v1.5.3 // indirect
33+
github.com/hashicorp/go-hclog v0.15.0 // indirect
34+
github.com/hashicorp/go-multierror v1.0.0 // indirect
35+
github.com/hashicorp/go-plugin v1.4.1 // indirect
36+
github.com/hashicorp/go-safetemp v1.0.0 // indirect
37+
github.com/hashicorp/go-uuid v1.0.1 // indirect
38+
github.com/hashicorp/go-version v1.3.0 // indirect
39+
github.com/hashicorp/hcl/v2 v2.3.0 // indirect
40+
github.com/hashicorp/logutils v1.0.0 // indirect
41+
github.com/hashicorp/terraform-exec v0.14.0 // indirect
42+
github.com/hashicorp/terraform-json v0.12.0 // indirect
43+
github.com/hashicorp/terraform-plugin-go v0.4.0 // indirect
44+
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
45+
github.com/jmespath/go-jmespath v0.4.0 // indirect
46+
github.com/jstemmer/go-junit-report v0.9.1 // indirect
47+
github.com/klauspost/compress v1.11.2 // indirect
48+
github.com/mattn/go-colorable v0.1.4 // indirect
49+
github.com/mattn/go-isatty v0.0.10 // indirect
50+
github.com/mitchellh/copystructure v1.2.0 // indirect
51+
github.com/mitchellh/go-homedir v1.1.0 // indirect
52+
github.com/mitchellh/go-testing-interface v1.0.4 // indirect
53+
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
54+
github.com/mitchellh/mapstructure v1.1.2 // indirect
55+
github.com/mitchellh/reflectwalk v1.0.2 // indirect
56+
github.com/oklog/run v1.0.0 // indirect
57+
github.com/pmezard/go-difflib v1.0.0 // indirect
58+
github.com/ulikunitz/xz v0.5.8 // indirect
59+
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
60+
github.com/zclconf/go-cty v1.8.4 // indirect
61+
go.opencensus.io v0.22.4 // indirect
62+
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect
63+
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
64+
golang.org/x/mod v0.4.2 // indirect
65+
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d // indirect
66+
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
67+
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e // indirect
68+
golang.org/x/text v0.3.6 // indirect
69+
golang.org/x/tools v0.1.6 // indirect
70+
google.golang.org/api v0.29.0 // indirect
71+
google.golang.org/appengine v1.6.6 // indirect
72+
google.golang.org/genproto v0.0.0-20200711021454-869866162049 // indirect
73+
google.golang.org/grpc v1.32.0 // indirect
74+
google.golang.org/protobuf v1.25.0 // indirect
75+
gopkg.in/yaml.v2 v2.3.0 // indirect
1576
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
1677
)
1778

18-
go 1.13
79+
go 1.17

0 commit comments

Comments
 (0)