From a8ebeacf3ee9223d52584a22d60a7fb15a65308d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ch=C3=A1bek?= Date: Tue, 14 May 2024 11:35:33 +0200 Subject: [PATCH] tmp remove quic, bump deps, make bucket names unique --- .golangci.yml | 6 +- Makefile | 2 +- docs/data-sources/cdn.md | 1 - docs/data-sources/object_storages.md | 31 +++++++++ docs/resources/cdn.md | 1 - go.mod | 32 +++++----- go.sum | 60 +++++++++--------- internal/acctest/acctest.go | 2 +- internal/provider/cdn_data_reader.go | 2 - internal/provider/cdn_data_source_test.go | 3 - internal/provider/cdn_resource.go | 2 - internal/provider/cdn_resource_schema.go | 8 --- internal/provider/cdn_resource_test.go | 9 +-- internal/provider/origin_data_source_test.go | 11 ++-- internal/provider/origin_resource_test.go | 63 ++++++++++--------- internal/provider/origins_data_source_test.go | 3 +- 16 files changed, 124 insertions(+), 112 deletions(-) create mode 100644 docs/data-sources/object_storages.md diff --git a/.golangci.yml b/.golangci.yml index 221ca3e..104ddf1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -21,7 +21,7 @@ linters: # 2022-07-21 modified - goconst - gocritic # probably tune - godot - - goerr113 + - err113 - gofumpt - gosec # - ifshort # not yet mature, has some bugs @@ -156,9 +156,9 @@ issues: - path: _test\.go text: assignments should only be cuddled with other assignments linters: [wsl] - # ignore goerr113 dynamic errors definition error...not sure how to approach this correctly now + # ignore err113 dynamic errors definition error...not sure how to approach this correctly now - text: do not define dynamic errors, use wrapped static errors instead - linters: [goerr113] + linters: [err113] output: sort-results: true diff --git a/Makefile b/Makefile index 760a154..725dc80 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ GOLANGCI_LINT ?= go run github.com/golangci/golangci-lint/cmd/golangci-lint@late .PHONY: testacc testacc: clearacc - TF_ACC=1 go test ./internal/provider -v -cover $(TESTARGS) --timeout 10m + TF_ACC=1 go test ./internal/provider -v -cover $(TESTARGS) --timeout 10m --count 1 .PHONY: clearacc clearacc: diff --git a/docs/data-sources/cdn.md b/docs/data-sources/cdn.md index 157d0d6..b57ec4d 100644 --- a/docs/data-sources/cdn.md +++ b/docs/data-sources/cdn.md @@ -42,7 +42,6 @@ data "cdn77_cdn" "example" { - `origin_id` (String) ID (UUID) of attached Origin (content source for CDN) - `origin_protection_enabled` (Boolean) Enabled origin protection can ease the load on your server or even hide it from direct incoming traffic with our proxy servers. - `query_string` (Attributes) Enabling this feature will ignore the query string, allowing URLs with query strings to cache properly. This is particularly useful if you tag your URLs with tracking/marketing parameters, for example. (see [below for nested schema](#nestedatt--query_string)) -- `quic_enabled` (Boolean) gQUIC is a protocol created by Google. It works with chromium-based browsers and was originally designed for the transmission of HTTP/2 frames. It incentivised a new standardised transport protocol called QUIC. - `rate_limit_enabled` (Boolean) When enabled, this feature limits the data transfer rate by setting "limit_rate" based on the "rs" URL parameter and "limit_rate_after" by the value from the "ri" URL parameter. - `secure_token` (Attributes) This feature allows you to serve your content using signed URLs. You can enable your users to download secured content from the CDN with a valid hash. Note: When you check this option, make sure to generate secured links to access your content. (see [below for nested schema](#nestedatt--secure_token)) - `ssl` (Attributes) (see [below for nested schema](#nestedatt--ssl)) diff --git a/docs/data-sources/object_storages.md b/docs/data-sources/object_storages.md new file mode 100644 index 0000000..423239b --- /dev/null +++ b/docs/data-sources/object_storages.md @@ -0,0 +1,31 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "cdn77_object_storages Data Source - terraform-provider-cdn77" +subcategory: "" +description: |- + Object Storages data source allows you to read all available Object Storage clusters +--- + +# cdn77_object_storages (Data Source) + +Object Storages data source allows you to read all available Object Storage clusters + + + + +## Schema + +### Read-Only + +- `clusters` (Attributes List) List of all Object Storage clusters (see [below for nested schema](#nestedatt--clusters)) + + +### Nested Schema for `clusters` + +Read-Only: + +- `host` (String) +- `id` (String) ID (UUID) of the Object Storage cluster +- `label` (String) +- `port` (Number) +- `scheme` (String) diff --git a/docs/resources/cdn.md b/docs/resources/cdn.md index 38f46e7..0ec013c 100644 --- a/docs/resources/cdn.md +++ b/docs/resources/cdn.md @@ -41,7 +41,6 @@ resource "cdn77_cdn" "example" { - `note` (String) Optional note - `origin_headers` (Map of String) Custom HTTP headers included in requests sent to the origin server - `query_string` (Attributes) Enabling this feature will ignore the query string, allowing URLs with query strings to cache properly. This is particularly useful if you tag your URLs with tracking/marketing parameters, for example. (see [below for nested schema](#nestedatt--query_string)) -- `quic_enabled` (Boolean) gQUIC is a protocol created by Google. It works with chromium-based browsers and was originally designed for the transmission of HTTP/2 frames. It incentivised a new standardised transport protocol called QUIC. - `rate_limit_enabled` (Boolean) When enabled, this feature limits the data transfer rate by setting "limit_rate" based on the "rs" URL parameter and "limit_rate_after" by the value from the "ri" URL parameter. - `secure_token` (Attributes) This feature allows you to serve your content using signed URLs. You can enable your users to download secured content from the CDN with a valid hash. Note: When you check this option, make sure to generate secured links to access your content. (see [below for nested schema](#nestedatt--secure_token)) - `ssl` (Attributes) (see [below for nested schema](#nestedatt--ssl)) diff --git a/go.mod b/go.mod index 999a54c..629225a 100644 --- a/go.mod +++ b/go.mod @@ -3,15 +3,16 @@ module github.com/cdn77/terraform-provider-cdn77 go 1.22 require ( - github.com/cdn77/cdn77-client-go v0.0.0-20240423130134-1eda9cd8a9db - github.com/hashicorp/terraform-plugin-docs v0.19.0 - github.com/hashicorp/terraform-plugin-framework v1.7.0 + github.com/cdn77/cdn77-client-go v1.0.0 + github.com/google/uuid v1.6.0 + github.com/hashicorp/terraform-plugin-docs v0.19.2 + github.com/hashicorp/terraform-plugin-framework v1.8.0 github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 - github.com/hashicorp/terraform-plugin-go v0.22.1 + github.com/hashicorp/terraform-plugin-go v0.23.0 github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-testing v1.7.0 github.com/oapi-codegen/nullable v1.1.0 - golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f + golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 ) require ( @@ -33,9 +34,8 @@ require ( github.com/getkin/kin-openapi v0.124.0 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/cli v1.1.6 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-checkpoint v0.5.0 // indirect @@ -78,21 +78,21 @@ 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/yuin/goldmark v1.7.0 // indirect + github.com/yuin/goldmark v1.7.1 // indirect github.com/yuin/goldmark-meta v1.1.0 // indirect github.com/zclconf/go-cty v1.14.4 // indirect go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect - golang.org/x/crypto v0.22.0 // indirect + golang.org/x/crypto v0.23.0 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.24.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.20.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect + golang.org/x/tools v0.21.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect - google.golang.org/grpc v1.62.1 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/grpc v1.63.2 // indirect + google.golang.org/protobuf v1.34.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index f957b5e..e3776c4 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ github.com/bmatcuk/doublestar/v4 v4.6.1 h1:FH9SifrbvJhnlQpztAx++wlkk70QBf0iBWDwN github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= -github.com/cdn77/cdn77-client-go v0.0.0-20240423130134-1eda9cd8a9db h1:PLsdDBdFTFkbtnHjjtqqezrd+n7J4qQlL/fQkclPG4c= -github.com/cdn77/cdn77-client-go v0.0.0-20240423130134-1eda9cd8a9db/go.mod h1:j4vMPxoGnDqRBDMR/gdtXotIiKhEnWh3wJFsw3mTUQc= +github.com/cdn77/cdn77-client-go v1.0.0 h1:WU38ZXUdQmv0f8MOpLSFbKsoyRDXqwjR6J8469k/GZc= +github.com/cdn77/cdn77-client-go v1.0.0/go.mod h1:j4vMPxoGnDqRBDMR/gdtXotIiKhEnWh3wJFsw3mTUQc= github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= @@ -68,8 +68,8 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4er github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -111,14 +111,14 @@ github.com/hashicorp/terraform-exec v0.20.0 h1:DIZnPsqzPGuUnq6cH8jWcPunBfY+C+M8J github.com/hashicorp/terraform-exec v0.20.0/go.mod h1:ckKGkJWbsNqFKV1itgMnE0hY9IYf1HoiekpuN0eWoDw= github.com/hashicorp/terraform-json v0.21.0 h1:9NQxbLNqPbEMze+S6+YluEdXgJmhQykRyRNd+zTI05U= github.com/hashicorp/terraform-json v0.21.0/go.mod h1:qdeBs11ovMzo5puhrRibdD6d2Dq6TyE/28JiU4tIQxk= -github.com/hashicorp/terraform-plugin-docs v0.19.0 h1:ufXLte5Kx20LazYmGN2UZG2bN4aF0PmlDyuS1iKWSXo= -github.com/hashicorp/terraform-plugin-docs v0.19.0/go.mod h1:NPfKCSfzTtq+YCFHr2qTAMknWUxR8C4KgTbGkHULSV8= -github.com/hashicorp/terraform-plugin-framework v1.7.0 h1:wOULbVmfONnJo9iq7/q+iBOBJul5vRovaYJIu2cY/Pw= -github.com/hashicorp/terraform-plugin-framework v1.7.0/go.mod h1:jY9Id+3KbZ17OMpulgnWLSfwxNVYSoYBQFTgsx044CI= +github.com/hashicorp/terraform-plugin-docs v0.19.2 h1:YjdKa1vuqt9EnPYkkrv9HnGZz175HhSJ7Vsn8yZeWus= +github.com/hashicorp/terraform-plugin-docs v0.19.2/go.mod h1:gad2aP6uObFKhgNE8DR9nsEuEQnibp7il0jZYYOunWY= +github.com/hashicorp/terraform-plugin-framework v1.8.0 h1:P07qy8RKLcoBkCrY2RHJer5AEvJnDuXomBgou6fD8kI= +github.com/hashicorp/terraform-plugin-framework v1.8.0/go.mod h1:/CpTukO88PcL/62noU7cuyaSJ4Rsim+A/pa+3rUVufY= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0 h1:HOjBuMbOEzl7snOdOoUfE2Jgeto6JOjLVQ39Ls2nksc= github.com/hashicorp/terraform-plugin-framework-validators v0.12.0/go.mod h1:jfHGE/gzjxYz6XoUwi/aYiiKrJDeutQNUtGQXkaHklg= -github.com/hashicorp/terraform-plugin-go v0.22.1 h1:iTS7WHNVrn7uhe3cojtvWWn83cm2Z6ryIUDTRO0EV7w= -github.com/hashicorp/terraform-plugin-go v0.22.1/go.mod h1:qrjnqRghvQ6KnDbB12XeZ4FluclYwptntoWCr9QaXTI= +github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co= +github.com/hashicorp/terraform-plugin-go v0.23.0/go.mod h1:1E3Cr9h2vMlahWMbsSEcNrOCxovCZhOOIXjFHbjc/lQ= github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0= github.com/hashicorp/terraform-plugin-log v0.9.0/go.mod h1:rKL8egZQ/eXSyDqzLUuwUYLVdlYeamldAHSxjUFADow= github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh3R4yp6pKksKHcqZx5G8= @@ -230,8 +230,8 @@ github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -github.com/yuin/goldmark v1.7.0 h1:EfOIvIMZIzHdB/R/zVrikYLPPwJlfMcNczJFMs1m6sA= -github.com/yuin/goldmark v1.7.0/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U= +github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= @@ -241,10 +241,10 @@ go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= -golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= +golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -255,8 +255,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -275,8 +275,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -286,26 +286,26 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= -golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= +golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= +golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= -google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.0 h1:Qo/qEd2RZPCf2nKuorzksSknv0d3ERwp1vFG38gSmH4= +google.golang.org/protobuf v1.34.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/internal/acctest/acctest.go b/internal/acctest/acctest.go index c719af0..bd84b7a 100644 --- a/internal/acctest/acctest.go +++ b/internal/acctest/acctest.go @@ -58,7 +58,7 @@ func GetClientErr() (cdn77.ClientWithResponsesInterface, error) { } if timeout == 0 { - timeout = time.Second * 10 + timeout = time.Second * 30 } client, err := provider.NewClient(endpoint, token, timeout) diff --git a/internal/provider/cdn_data_reader.go b/internal/provider/cdn_data_reader.go index aef7503..c6ea04e 100644 --- a/internal/provider/cdn_data_reader.go +++ b/internal/provider/cdn_data_reader.go @@ -26,7 +26,6 @@ type CdnModel struct { Headers *CdnModelHeaders `tfsdk:"headers"` HttpsRedirect *CdnModelHttpsRedirect `tfsdk:"https_redirect"` Mp4PseudoStreamingEnabled types.Bool `tfsdk:"mp4_pseudo_streaming_enabled"` - QuicEnabled types.Bool `tfsdk:"quic_enabled"` WafEnabled types.Bool `tfsdk:"waf_enabled"` Ssl *CdnModelSsl `tfsdk:"ssl"` Stream *CdnModelStream `tfsdk:"stream"` @@ -245,7 +244,6 @@ func (d *CdnDataReader) Read(provider StateProvider, diags *diag.Diagnostics, st Enabled: types.BoolValue(cdn.HttpsRedirect.Enabled), }, Mp4PseudoStreamingEnabled: types.BoolPointerValue(cdn.Mp4PseudoStreaming.Enabled), - QuicEnabled: types.BoolValue(cdn.Quic.Enabled), WafEnabled: types.BoolValue(cdn.Waf.Enabled), Ssl: &CdnModelSsl{ Type: types.StringValue(string(cdn.Ssl.Type)), diff --git a/internal/provider/cdn_data_source_test.go b/internal/provider/cdn_data_source_test.go index 75a26b2..556346d 100644 --- a/internal/provider/cdn_data_source_test.go +++ b/internal/provider/cdn_data_source_test.go @@ -88,7 +88,6 @@ func TestAccCdnDataSource_OnlyRequiredFields(t *testing.T) { attrEq("headers.content_disposition_type", string(cdn77.ContentDispositionTypeNone)), attrEq("https_redirect.enabled", "false"), attrEq("mp4_pseudo_streaming_enabled", "false"), - attrEq("quic_enabled", "false"), attrEq("waf_enabled", "false"), attrEq("ssl.type", string(cdn77.InstantSsl)), attrEq("hotlink_protection.type", string(cdn77.Disabled)), @@ -187,7 +186,6 @@ func TestAccCdnDataSource_AllFields(t *testing.T) { IgnoreType: cdn77.QueryStringIgnoreTypeList, Parameters: util.Pointer([]string{"param"}), }, - Quic: &cdn77.Quic{Enabled: true}, RateLimit: &cdn77.RateLimit{Enabled: true}, SecureToken: &cdn77.SecureToken{Token: util.Pointer("abcd1234"), Type: cdn77.SecureTokenTypePath}, Ssl: &cdn77.CdnSsl{SslId: util.Pointer(sslId), Type: cdn77.SNI}, @@ -232,7 +230,6 @@ func TestAccCdnDataSource_AllFields(t *testing.T) { attrEq("https_redirect.enabled", "true"), attrEq("https_redirect.code", fmt.Sprintf("%d", cdn77.N301)), attrEq("mp4_pseudo_streaming_enabled", "false"), - attrEq("quic_enabled", "true"), attrEq("waf_enabled", "true"), attrEq("ssl.type", string(cdn77.SNI)), attrEq("ssl.ssl_id", sslId), diff --git a/internal/provider/cdn_resource.go b/internal/provider/cdn_resource.go index d2257bb..c544c79 100644 --- a/internal/provider/cdn_resource.go +++ b/internal/provider/cdn_resource.go @@ -203,7 +203,6 @@ func (*CdnResource) createDefaultEditRequest() cdn77.CdnEditJSONRequestBody { Note: nullable.NewNullNullable[string](), OriginHeaders: &cdn77.OriginHeaders{Custom: nullable.NewNullNullable[map[string]string]()}, QueryString: &cdn77.QueryString{IgnoreType: cdn77.QueryStringIgnoreTypeNone}, - Quic: &cdn77.Quic{}, RateLimit: &cdn77.RateLimit{}, SecureToken: &cdn77.SecureToken{Type: cdn77.SecureTokenTypeNone}, Ssl: &cdn77.CdnSsl{Type: cdn77.InstantSsl}, @@ -311,7 +310,6 @@ func (r *CdnResource) createEditRequest( //nolint:cyclop request.QueryString.IgnoreType = cdn77.QueryStringIgnoreType(data.QueryString.IgnoreType.ValueString()) - request.Quic.Enabled = data.QuicEnabled.ValueBool() request.RateLimit.Enabled = data.RateLimitEnabled.ValueBool() if !data.SecureToken.Token.IsNull() { diff --git a/internal/provider/cdn_resource_schema.go b/internal/provider/cdn_resource_schema.go index 2a1245b..8b25b88 100644 --- a/internal/provider/cdn_resource_schema.go +++ b/internal/provider/cdn_resource_schema.go @@ -300,14 +300,6 @@ func CreateCdnResourceSchema() schema.Schema { `When enabled the "query_string" option must be set to ignore all parameters.`, Default: booldefault.StaticBool(false), }, - "quic_enabled": schema.BoolAttribute{ - Optional: true, - Computed: true, - Description: `gQUIC is a protocol created by Google. It works with chromium-based browsers ` + - `and was originally designed for the transmission of HTTP/2 frames. ` + - `It incentivised a new standardised transport protocol called QUIC.`, - Default: booldefault.StaticBool(false), - }, "waf_enabled": schema.BoolAttribute{ Optional: true, Computed: true, diff --git a/internal/provider/cdn_resource_test.go b/internal/provider/cdn_resource_test.go index be1a67a..fe48a1a 100644 --- a/internal/provider/cdn_resource_test.go +++ b/internal/provider/cdn_resource_test.go @@ -84,7 +84,6 @@ func TestAccCdnResource(t *testing.T) { attrEq("headers.content_disposition_type", string(cdn77.ContentDispositionTypeNone)), attrEq("https_redirect.enabled", "false"), attrEq("mp4_pseudo_streaming_enabled", "false"), - attrEq("quic_enabled", "false"), attrEq("waf_enabled", "false"), attrEq("ssl.type", string(cdn77.InstantSsl)), attrEq("hotlink_protection.type", string(cdn77.Disabled)), @@ -179,7 +178,6 @@ func TestAccCdnResource(t *testing.T) { attrEq("https_redirect.enabled", "true"), attrEq("https_redirect.code", fmt.Sprintf("%d", cdn77.N301)), attrEq("mp4_pseudo_streaming_enabled", "false"), - attrEq("quic_enabled", "false"), attrEq("waf_enabled", "false"), attrEq("ssl.type", string(cdn77.InstantSsl)), attrEq("hotlink_protection.type", string(cdn77.Disabled)), @@ -271,7 +269,6 @@ func TestAccCdnResource(t *testing.T) { code = 301 } mp4_pseudo_streaming_enabled = true - quic_enabled = true waf_enabled = true ssl = { type = "SNI" @@ -337,7 +334,6 @@ func TestAccCdnResource(t *testing.T) { attrEq("https_redirect.enabled", "true"), attrEq("https_redirect.code", fmt.Sprintf("%d", cdn77.N301)), attrEq("mp4_pseudo_streaming_enabled", "true"), - attrEq("quic_enabled", "true"), attrEq("waf_enabled", "true"), attrEq("ssl.type", string(cdn77.SNI)), attrEq("ssl.ssl_id", sslId), @@ -405,8 +401,7 @@ func TestAccCdnResource(t *testing.T) { acctest.EqualField("https_redirect.enabled", c.HttpsRedirect.Enabled, true), acctest.EqualField("https_redirect.code", *c.HttpsRedirect.Code, cdn77.N301), acctest.EqualField("mp4_pseudo_streaming_enabled", *c.Mp4PseudoStreaming.Enabled, true), - acctest.EqualField("quic_enabled", c.Quic.Enabled, true), - acctest.EqualField("waf_enabled", c.Quic.Enabled, true), + acctest.EqualField("waf_enabled", c.Waf.Enabled, true), acctest.EqualField("ssl.type", c.Ssl.Type, cdn77.SNI), acctest.EqualField("ssl.ssl_id", *c.Ssl.SslId, sslId), acctest.EqualField("hotlink_protection.type", c.HotlinkProtection.Type, cdn77.Blocklist), @@ -492,7 +487,6 @@ func TestAccCdnResource(t *testing.T) { attrEq("headers.content_disposition_type", string(cdn77.ContentDispositionTypeNone)), attrEq("https_redirect.enabled", "false"), attrEq("mp4_pseudo_streaming_enabled", "false"), - attrEq("quic_enabled", "false"), attrEq("waf_enabled", "false"), attrEq("ssl.type", string(cdn77.InstantSsl)), attrEq("hotlink_protection.type", string(cdn77.Disabled)), @@ -585,7 +579,6 @@ func checkCdnDefaults( acctest.EqualField("https_redirect.code", c.HttpsRedirect.Code, nil), acctest.EqualField("mp4_pseudo_streaming_enabled", *c.Mp4PseudoStreaming.Enabled, false), - acctest.EqualField("quic_enabled", c.Quic.Enabled, false), acctest.EqualField("waf_enabled", c.Waf.Enabled, false), acctest.EqualField("ssl.type", c.Ssl.Type, cdn77.InstantSsl), acctest.EqualField("ssl.ssl_id", c.Ssl.SslId, nil), diff --git a/internal/provider/origin_data_source_test.go b/internal/provider/origin_data_source_test.go index 04961ba..58632f7 100644 --- a/internal/provider/origin_data_source_test.go +++ b/internal/provider/origin_data_source_test.go @@ -10,6 +10,7 @@ import ( "github.com/cdn77/cdn77-client-go" "github.com/cdn77/terraform-provider-cdn77/internal/acctest" "github.com/cdn77/terraform-provider-cdn77/internal/provider" + "github.com/google/uuid" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/oapi-codegen/nullable" @@ -23,15 +24,15 @@ func TestAccOriginDataSource_NonExistingOrigin(t *testing.T) { Steps: []resource.TestStep{ { Config: acctest.Config(originDataSourceConfigAws, "id", originId), - ExpectError: regexp.MustCompile(fmt.Sprintf(`Storage with id:\W+"%s" could not be found`, originId)), + ExpectError: regexp.MustCompile(fmt.Sprintf(`.*?"%s".*?not found.*?`, originId)), }, { Config: acctest.Config(originDataSourceConfigObjectStorage, "id", originId), - ExpectError: regexp.MustCompile(fmt.Sprintf(`Storage with id:\W+"%s" could not be found`, originId)), + ExpectError: regexp.MustCompile(fmt.Sprintf(`.*?"%s".*?not found.*?`, originId)), }, { Config: acctest.Config(originDataSourceConfigUrl, "id", originId), - ExpectError: regexp.MustCompile(fmt.Sprintf(`Storage with id:\W+"%s" could not be found`, originId)), + ExpectError: regexp.MustCompile(fmt.Sprintf(`.*?"%s".*?not found.*?`, originId)), }, }, }) @@ -151,7 +152,7 @@ func TestAccOriginDataSource_ObjectStorage_OnlyRequiredFields(t *testing.T) { client := acctest.GetClient(t) const rsc = "data.cdn77_origin.os" - const originBucketName = "my-bucket" + var originBucketName = "my-bucket-" + uuid.New().String() const originLabel = "random origin" request := cdn77.OriginAddObjectStorageJSONRequestBody{ @@ -210,7 +211,7 @@ func TestAccOriginDataSource_ObjectStorage_AllFields(t *testing.T) { client := acctest.GetClient(t) const rsc = "data.cdn77_origin.os" - const originBucketName = "my-bucket" + var originBucketName = "my-bucket-" + uuid.New().String() const originLabel = "random origin" const originNote = "some note" diff --git a/internal/provider/origin_resource_test.go b/internal/provider/origin_resource_test.go index f326152..ea9b6ef 100644 --- a/internal/provider/origin_resource_test.go +++ b/internal/provider/origin_resource_test.go @@ -9,6 +9,7 @@ import ( "github.com/cdn77/cdn77-client-go" "github.com/cdn77/terraform-provider-cdn77/internal/acctest" "github.com/cdn77/terraform-provider-cdn77/internal/provider" + "github.com/google/uuid" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -245,6 +246,8 @@ func TestAccOriginResource_Aws(t *testing.T) { func TestAccOriginResource_ObjectStorage(t *testing.T) { client := acctest.GetClient(t) + bucketName := "my-bucket-" + uuid.New().String() + anotherBucketName := "my-bucket-" + uuid.New().String() var originId string var clusterId string @@ -263,13 +266,13 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { CheckDestroy: checkOriginsDestroyed(client), Steps: []resource.TestStep{ { - Config: objectStoragesDataSourceConfig + `resource "cdn77_origin" "os" { + Config: acctest.Config(objectStoragesDataSourceConfig+`resource "cdn77_origin" "os" { type = "object-storage" label = "some label" acl = "private" cluster_id = local.eu_cluster_id - bucket_name = "my-bucket" - }`, + bucket_name = "{bucketName}" + }`, "bucketName", bucketName), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction("cdn77_origin.os", plancheck.ResourceActionCreate), @@ -289,7 +292,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { return acctest.NotEqual(value, "") }), - resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", "my-bucket"), + resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", bucketName), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_id"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_secret"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "scheme"), @@ -302,7 +305,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { resource.TestCheckNoResourceAttr("cdn77_origin.os", "base_dir"), checkObjectStorageOrigin(client, &originId, func(o *cdn77.ObjectStorageOriginDetail) error { return errors.Join( - acctest.EqualField("bucket_name", o.BucketName, "my-bucket"), + acctest.EqualField("bucket_name", o.BucketName, bucketName), acctest.EqualField("label", o.Label, "some label"), acctest.NullField("note", o.Note), acctest.EqualField("type", o.Type, provider.OriginTypeObjectStorage), @@ -311,14 +314,14 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { ), }, { - Config: objectStoragesDataSourceConfig + `resource "cdn77_origin" "os" { + Config: acctest.Config(objectStoragesDataSourceConfig+`resource "cdn77_origin" "os" { type = "object-storage" label = "another label" note = "some note" acl = "private" cluster_id = local.eu_cluster_id - bucket_name = "my-bucket" - }`, + bucket_name = "{bucketName}" + }`, "bucketName", bucketName), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction("cdn77_origin.os", plancheck.ResourceActionUpdate), @@ -335,7 +338,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { resource.TestCheckResourceAttrWith("cdn77_origin.os", "cluster_id", func(value string) error { return acctest.Equal(value, clusterId) }), - resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", "my-bucket"), + resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", bucketName), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_id"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_secret"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "scheme"), @@ -347,7 +350,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { resource.TestCheckNoResourceAttr("cdn77_origin.os", "base_dir"), checkObjectStorageOrigin(client, &originId, func(o *cdn77.ObjectStorageOriginDetail) error { return errors.Join( - acctest.EqualField("bucket_name", o.BucketName, "my-bucket"), + acctest.EqualField("bucket_name", o.BucketName, bucketName), acctest.EqualField("label", o.Label, "another label"), acctest.NullFieldEqual("note", o.Note, "some note"), acctest.EqualField("type", o.Type, provider.OriginTypeObjectStorage), @@ -356,13 +359,13 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { ), }, { - Config: objectStoragesDataSourceConfig + `resource "cdn77_origin" "os" { + Config: acctest.Config(objectStoragesDataSourceConfig+`resource "cdn77_origin" "os" { type = "object-storage" label = "another label" acl = "private" cluster_id = local.eu_cluster_id - bucket_name = "my-bucket" - }`, + bucket_name = "{bucketName}" + }`, "bucketName", bucketName), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction("cdn77_origin.os", plancheck.ResourceActionUpdate), @@ -378,7 +381,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { resource.TestCheckResourceAttrWith("cdn77_origin.os", "cluster_id", func(value string) error { return acctest.Equal(value, clusterId) }), - resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", "my-bucket"), + resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", bucketName), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_id"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_secret"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "scheme"), @@ -391,7 +394,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { resource.TestCheckNoResourceAttr("cdn77_origin.os", "base_dir"), checkObjectStorageOrigin(client, &originId, func(o *cdn77.ObjectStorageOriginDetail) error { return errors.Join( - acctest.EqualField("bucket_name", o.BucketName, "my-bucket"), + acctest.EqualField("bucket_name", o.BucketName, bucketName), acctest.EqualField("label", o.Label, "another label"), acctest.NullField("note", o.Note), acctest.EqualField("type", o.Type, provider.OriginTypeObjectStorage), @@ -400,13 +403,13 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { ), }, { - Config: objectStoragesDataSourceConfig + `resource "cdn77_origin" "os" { + Config: acctest.Config(objectStoragesDataSourceConfig+`resource "cdn77_origin" "os" { type = "object-storage" label = "another label" acl = "authenticated-read" cluster_id = local.eu_cluster_id - bucket_name = "my-bucket" - }`, + bucket_name = "{bucketName}" + }`, "bucketName", bucketName), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction("cdn77_origin.os", plancheck.ResourceActionDestroyBeforeCreate), @@ -425,7 +428,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { resource.TestCheckResourceAttrWith("cdn77_origin.os", "cluster_id", func(value string) error { return acctest.Equal(value, clusterId) }), - resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", "my-bucket"), + resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", bucketName), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_id"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_secret"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "scheme"), @@ -438,7 +441,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { resource.TestCheckNoResourceAttr("cdn77_origin.os", "base_dir"), checkObjectStorageOrigin(client, &originId, func(o *cdn77.ObjectStorageOriginDetail) error { return errors.Join( - acctest.EqualField("bucket_name", o.BucketName, "my-bucket"), + acctest.EqualField("bucket_name", o.BucketName, bucketName), acctest.EqualField("label", o.Label, "another label"), acctest.NullField("note", o.Note), acctest.EqualField("type", o.Type, provider.OriginTypeObjectStorage), @@ -447,13 +450,13 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { ), }, { - Config: objectStoragesDataSourceConfig + `resource "cdn77_origin" "os" { + Config: acctest.Config(objectStoragesDataSourceConfig+`resource "cdn77_origin" "os" { type = "object-storage" label = "another label" acl = "authenticated-read" cluster_id = local.us_cluster_id - bucket_name = "my-bucket" - }`, + bucket_name = "{bucketName}" + }`, "bucketName", bucketName), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction("cdn77_origin.os", plancheck.ResourceActionDestroyBeforeCreate), @@ -475,7 +478,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { return err }), - resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", "my-bucket"), + resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", bucketName), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_id"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_secret"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "scheme"), @@ -488,7 +491,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { resource.TestCheckNoResourceAttr("cdn77_origin.os", "base_dir"), checkObjectStorageOrigin(client, &originId, func(o *cdn77.ObjectStorageOriginDetail) error { return errors.Join( - acctest.EqualField("bucket_name", o.BucketName, "my-bucket"), + acctest.EqualField("bucket_name", o.BucketName, bucketName), acctest.EqualField("label", o.Label, "another label"), acctest.NullField("note", o.Note), acctest.EqualField("type", o.Type, provider.OriginTypeObjectStorage), @@ -497,13 +500,13 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { ), }, { - Config: objectStoragesDataSourceConfig + `resource "cdn77_origin" "os" { + Config: acctest.Config(objectStoragesDataSourceConfig+`resource "cdn77_origin" "os" { type = "object-storage" label = "another label" acl = "authenticated-read" cluster_id = local.us_cluster_id - bucket_name = "lorem" - }`, + bucket_name = "{bucketName}" + }`, "bucketName", anotherBucketName), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ plancheck.ExpectResourceAction("cdn77_origin.os", plancheck.ResourceActionDestroyBeforeCreate), @@ -522,7 +525,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { resource.TestCheckResourceAttrWith("cdn77_origin.os", "cluster_id", func(value string) error { return acctest.Equal(value, clusterId) }), - resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", "lorem"), + resource.TestCheckResourceAttr("cdn77_origin.os", "bucket_name", anotherBucketName), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_id"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "access_key_secret"), resource.TestCheckResourceAttrSet("cdn77_origin.os", "scheme"), @@ -535,7 +538,7 @@ func TestAccOriginResource_ObjectStorage(t *testing.T) { resource.TestCheckNoResourceAttr("cdn77_origin.os", "base_dir"), checkObjectStorageOrigin(client, &originId, func(o *cdn77.ObjectStorageOriginDetail) error { return errors.Join( - acctest.EqualField("bucket_name", o.BucketName, "lorem"), + acctest.EqualField("bucket_name", o.BucketName, anotherBucketName), acctest.EqualField("label", o.Label, "another label"), acctest.NullField("note", o.Note), acctest.EqualField("type", o.Type, provider.OriginTypeObjectStorage), diff --git a/internal/provider/origins_data_source_test.go b/internal/provider/origins_data_source_test.go index f7f8c02..9b29abf 100644 --- a/internal/provider/origins_data_source_test.go +++ b/internal/provider/origins_data_source_test.go @@ -10,6 +10,7 @@ import ( "github.com/cdn77/cdn77-client-go" "github.com/cdn77/terraform-provider-cdn77/internal/acctest" "github.com/cdn77/terraform-provider-cdn77/internal/provider" + "github.com/google/uuid" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/oapi-codegen/nullable" @@ -64,7 +65,7 @@ func TestAccOriginsDataSource_All(t *testing.T) { acctest.MustDeleteOrigin(t, client, provider.OriginTypeAws, origin2Id) }) - const origin3BucketName = "my-bucket" + var origin3BucketName = "my-bucket-" + uuid.New().String() const origin3Label = "yet another origin" const origin3Note = "just a note"