Skip to content

Commit

Permalink
feat(PDNS): update custom resolver profile and views. (#5625)
Browse files Browse the repository at this point in the history
* feat(PDNS): update custom resolver profile and views

* fix minor warnigns

* add example

* add documentation

* change variable names

* fix styling

* add validator for profile

* modify example

* improve error message

* modified docs

* fix error message

* incorporate review comments for documentation

* add order in views and fix minor bugs

* change the variable instance

* changing update logic for views

* modified test for linked zone

* add test for custom resolver profile

* add test for forwarding rule views

* fix acceptance test FR

* change message format

* change fields to computed in data source file

* incorporated doc review changes

* fix go mod issues
  • Loading branch information
arjunchauhanibm authored Jan 17, 2025
1 parent a3d1506 commit d8d4052
Show file tree
Hide file tree
Showing 23 changed files with 564 additions and 292 deletions.
10 changes: 10 additions & 0 deletions examples/ibm-private-dns/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ resource "ibm_dns_custom_resolver" "test" {
name = "testCR-TF"
instance_id = ibm_resource_instance.test-pdns-instance.guid
description = "testdescription-CR"
profile = "essential"
allow_disruptive_updates = false
locations {
subnet_crn = "crn:v1:staging:public:is:us-south-1:a/01652b251c3ae2787110a995d8db0135::subnet:0716-6c3a997d-72b2-47f6-8788-6bd95e1bdb03"
enabled = false
Expand All @@ -203,6 +205,8 @@ resource "ibm_dns_custom_resolver" "test" {
description = "new test CR TF-1"
high_availability = true
enabled = true
profile = "essential"
allow_disruptive_updates = false
locations {
subnet_crn = "crn:v1:staging:public:is:us-south-1:a/01652b251c3ae2787110a995d8db0135::subnet:0716-a094c4e8-02cd-4b04-858d-3432"
enabled = false
Expand Down Expand Up @@ -236,6 +240,12 @@ resource "ibm_dns_custom_resolver_forwarding_rule" "test" {
type = "zone"
match = "test.example.com"
forward_to = ["168.20.22.122"]
views {
name = "view-example-name"
description = "view description"
expression = "ipInRange(source.ip, '10.240.0.0/24') || ipInRange(source.ip, '10.240.1.0/24')"
forward_to = ["10.240.2.6","10.240.2.7"]
}
}

data "ibm_dns_custom_resolver_forwarding_rules" "test-fr" {
Expand Down
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module github.com/IBM-Cloud/terraform-provider-ibm

go 1.22.5
go 1.23.3

toolchain go1.23.2
toolchain go1.23.4

require (
github.com/IBM-Cloud/bluemix-go v0.0.0-20241117121028-a3be206688b3
Expand All @@ -22,7 +22,7 @@ require (
github.com/IBM/eventstreams-go-sdk v1.4.0
github.com/IBM/go-sdk-core v1.1.0
github.com/IBM/go-sdk-core/v3 v3.2.4
github.com/IBM/go-sdk-core/v5 v5.18.3
github.com/IBM/go-sdk-core/v5 v5.18.5
github.com/IBM/ibm-backup-recovery-sdk-go v1.0.1
github.com/IBM/ibm-cos-sdk-go v1.12.0
github.com/IBM/ibm-cos-sdk-go-config/v2 v2.2.0
Expand All @@ -32,7 +32,7 @@ require (
github.com/IBM/logs-go-sdk v0.4.0
github.com/IBM/logs-router-go-sdk v1.0.5
github.com/IBM/mqcloud-go-sdk v0.2.0
github.com/IBM/networking-go-sdk v0.49.0
github.com/IBM/networking-go-sdk v0.50.0
github.com/IBM/platform-services-go-sdk v0.72.0
github.com/IBM/project-go-sdk v0.3.5
github.com/IBM/push-notifications-go-sdk v0.0.0-20210310100607-5790b96c47f5
Expand Down Expand Up @@ -66,7 +66,7 @@ require (
github.com/rook/rook/pkg/apis v0.0.0-20231204200402-5287527732f7
github.com/softlayer/softlayer-go v1.0.3
github.com/stretchr/testify v1.10.0
golang.org/x/crypto v0.31.0
golang.org/x/crypto v0.32.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools v2.2.0+incompatible
k8s.io/api v0.31.1
Expand Down Expand Up @@ -102,7 +102,7 @@ require (
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.6 // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/go-jose/go-jose/v4 v4.0.1 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
Expand All @@ -118,7 +118,7 @@ require (
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.22.1 // indirect
github.com/go-playground/validator/v10 v10.23.0 // indirect
github.com/go-test/deep v1.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
Expand Down Expand Up @@ -201,19 +201,19 @@ require (
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/zclconf/go-cty v1.15.0 // indirect
go.mongodb.org/mongo-driver v1.17.1 // indirect
go.mongodb.org/mongo-driver v1.17.2 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/ratelimit v0.2.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.32.0 // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.26.0 // indirect
Expand Down
36 changes: 18 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ github.com/IBM/go-sdk-core/v5 v5.6.3/go.mod h1:tt/B9rxLkRtglE7pvqLuYikgCXaZFL3bt
github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE=
github.com/IBM/go-sdk-core/v5 v5.10.2/go.mod h1:WZPFasUzsKab/2mzt29xPcfruSk5js2ywAPwW4VJjdI=
github.com/IBM/go-sdk-core/v5 v5.17.4/go.mod h1:KsAAI7eStAWwQa4F96MLy+whYSh39JzNjklZRbN/8ns=
github.com/IBM/go-sdk-core/v5 v5.18.3 h1:q6IDU3N2bHGwijK9pMnzKC5gqdaRII56NzB4ZNdSFvY=
github.com/IBM/go-sdk-core/v5 v5.18.3/go.mod h1:5kILxqEWOrwMhoD2b7J6Xv9Z2M6YIdT/6Oy+XRSsCGQ=
github.com/IBM/go-sdk-core/v5 v5.18.5 h1:g0JRl3sYXJczB/yuDlrN6x22LJ6jIxhp0Sa4ARNW60c=
github.com/IBM/go-sdk-core/v5 v5.18.5/go.mod h1:KonTFRR+8ZSgw5cxBSYo6E4WZoY1+7n1kfHM82VcjFU=
github.com/IBM/ibm-backup-recovery-sdk-go v1.0.1 h1:JSdt2WuiRCSKok+Jvv+x0eQP6duR1dUg6utKH0bI734=
github.com/IBM/ibm-backup-recovery-sdk-go v1.0.1/go.mod h1:ezUFoHQn8MvZI5vNd3H/ds4BCDYOXDodGFrTUgsU33k=
github.com/IBM/ibm-cos-sdk-go v1.12.0 h1:Wrk3ve4JS3euhl7XjNFd3RlvPT56199G2/rKaPWpRKU=
Expand All @@ -154,8 +154,8 @@ github.com/IBM/logs-router-go-sdk v1.0.5 h1:r0kC1+HfmSeQCD6zQTUp4PDI/zp4Ueo1Zo19
github.com/IBM/logs-router-go-sdk v1.0.5/go.mod h1:tCN2vFgu5xG0ob9iJcxi5M4bJ6mWmu3nhmRPnvlwev0=
github.com/IBM/mqcloud-go-sdk v0.2.0 h1:QOWk8ZGk0QfIL0MOGTKzNdM3Qe0Hk+ifAFtNSFQo5HU=
github.com/IBM/mqcloud-go-sdk v0.2.0/go.mod h1:VZQKMtqmcdXKhmLhLiPuS/UHMs/5yo2tA/nD83cQt9E=
github.com/IBM/networking-go-sdk v0.49.0 h1:lPS34u3C0JVrbxH+Ulua76Nwl6Frv8BEfq6LRkyvOv0=
github.com/IBM/networking-go-sdk v0.49.0/go.mod h1:G9CKbmPE8gSLjN+ABh4hIZ1bMx076enl5Eekvj6zQnA=
github.com/IBM/networking-go-sdk v0.50.0 h1:3BHO1GrFnkkZ4mYyn2nQc+Djw48/g3znJe3k4a4p1Yk=
github.com/IBM/networking-go-sdk v0.50.0/go.mod h1:aDKmbdfJG+JnoV9RvxOPg7nmgTKReyBgX8aAZHolcm8=
github.com/IBM/platform-services-go-sdk v0.72.0 h1:AfJe6bgqmTQU4ff/2URu3wkRLZD0XIzojn7SLf2yIns=
github.com/IBM/platform-services-go-sdk v0.72.0/go.mod h1:ApFkvqw7NaluWJ5Uq+afdM/2jQqo5ILc0SzKSVobYNw=
github.com/IBM/project-go-sdk v0.3.5 h1:L+YClFUa14foS0B/hOOY9n7sIdsT5/XQicnXOyJSpyM=
Expand Down Expand Up @@ -370,8 +370,8 @@ github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gabriel-vasile/mimetype v1.4.6 h1:3+PzJTKLkvgjeTbts6msPJt4DixhT4YtFNf1gtGe3zc=
github.com/gabriel-vasile/mimetype v1.4.6/go.mod h1:JX1qVKqZd40hUPpAfiNTe0Sne7hdfKSbOqqmkq8GCXc=
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
Expand Down Expand Up @@ -502,8 +502,8 @@ github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA=
github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-playground/validator/v10 v10.23.0 h1:/PwmTwZhS0dPkav3cdK9kV1FsAmrL8sThn8IHr/sO+o=
github.com/go-playground/validator/v10 v10.23.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
Expand Down Expand Up @@ -1270,8 +1270,8 @@ go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4x
go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8=
go.mongodb.org/mongo-driver v1.11.3/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=
go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM=
go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4=
go.mongodb.org/mongo-driver v1.17.2 h1:gvZyk8352qSfzyZ2UMWcpDpMSGEr1eqE4T793SqyhzM=
go.mongodb.org/mongo-driver v1.17.2/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
Expand Down Expand Up @@ -1343,8 +1343,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -1474,8 +1474,8 @@ golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -1638,8 +1638,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand All @@ -1660,8 +1660,8 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
1 change: 1 addition & 0 deletions ibm/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2034,6 +2034,7 @@ func Validator() validate.ValidatorDict {
"ibm_is_reservation": vpc.ResourceIBMISReservationValidator(),
"ibm_kms_key_rings": kms.ResourceIBMKeyRingValidator(),
"ibm_dns_glb_monitor": dnsservices.ResourceIBMPrivateDNSGLBMonitorValidator(),
"ibm_dns_custom_resolver": dnsservices.ResourceIBMPrivateDNSCustomResolverValidator(),
"ibm_dns_custom_resolver_forwarding_rule": dnsservices.ResourceIBMPrivateDNSForwardingRuleValidator(),
"ibm_schematics_action": schematics.ResourceIBMSchematicsActionValidator(),
"ibm_schematics_job": schematics.ResourceIBMSchematicsJobValidator(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ func DataSourceIBMPrivateDNSCustomResolver() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
pdnsCRProfile: {
Type: schema.TypeString,
Computed: true,
Description: "The profile name of the custom resolver.",
},
pdnsCRAllowDisruptiveUpdates: {
Type: schema.TypeBool,
Computed: true,
Description: "Whether a disruptive update is allowed for the custom resolver",
},
pdnsCustomResolverLocations: {
Type: schema.TypeList,
Description: "Locations on which the custom resolver will be running",
Expand Down Expand Up @@ -109,17 +119,19 @@ func dataSourceIBMDNSCustomResolverRead(context context.Context, d *schema.Resou
customResolver[pdnsCRDescription] = *instance.Description
customResolver[pdnsCRHealth] = *instance.Health
customResolver[pdnsCREnabled] = *instance.Enabled
customResolver[pdnsCRProfile] = *instance.Profile
customResolver[pdnsCRAllowDisruptiveUpdates] = *instance.AllowDisruptiveUpdates
customResolver[pdnsCustomResolverLocations] = flattenPdnsCRLocations(instance.Locations)

customResolvers = append(customResolvers, customResolver)
}
d.SetId(dataSourceIBMPrivateDNSCustomResolverID(d))
d.SetId(dataSourceIBMPrivateDNSCustomResolverID())
d.Set(pdnsInstanceID, instanceID)
d.Set(pdnsCustomResolvers, customResolvers)
return nil
}

// dataSourceIBMPrivateDNSCustomResolverID returns a reasonable ID for dns custom resolver list.
func dataSourceIBMPrivateDNSCustomResolverID(d *schema.ResourceData) string {
func dataSourceIBMPrivateDNSCustomResolverID() string {
return time.Now().UTC().String()
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,36 @@ func DataSourceIBMPrivateDNSForwardingRules() *schema.Resource {
Type: schema.TypeString,
},
},
pdnsCRFRViews: {
Type: schema.TypeList,
Description: "An array of views used by forwarding rules.",
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
pdnsCRFRVName: {
Type: schema.TypeString,
Computed: true,
Description: "Unique name of the view.",
},
pdnsCRFRVDescription: {
Type: schema.TypeString,
Computed: true,
Description: "Description of the view.",
},
pdnsCRFRVExpression: {
Type: schema.TypeString,
Computed: true,
Description: "Expression of the view.",
},
pdnsCRFRVForwardTo: {
Type: schema.TypeList,
Computed: true,
Description: "The upstream DNS servers that the matching DNS queries will be forwarded to.",
Elem: &schema.Schema{Type: schema.TypeString},
},
},
},
},
},
},
},
Expand All @@ -84,23 +114,24 @@ func dataSourceIbmDnsCrForwardingRulesRead(context context.Context, d *schema.Re
}

forwardRules := make([]interface{}, 0)
for _, instance := range result.ForwardingRules {
for _, rule := range result.ForwardingRules {
forwardRule := map[string]interface{}{}
forwardRule[pdnsCRFRRuleID] = *instance.ID
forwardRule[pdnsCRFRDesctiption] = *instance.Description
forwardRule[pdnsCRFRType] = *instance.Type
forwardRule[pdnsCRFRMatch] = *instance.Match
forwardRule[pdnsCRFRForwardTo] = instance.ForwardTo
forwardRule[pdnsCRFRRuleID] = *rule.ID
forwardRule[pdnsCRFRDesctiption] = *rule.Description
forwardRule[pdnsCRFRType] = *rule.Type
forwardRule[pdnsCRFRMatch] = *rule.Match
forwardRule[pdnsCRFRForwardTo] = rule.ForwardTo
forwardRule[pdnsCRFRViews] = flattenPDNSFRViews(rule.Views)

forwardRules = append(forwardRules, forwardRule)
}
d.SetId(dataSourceIBMPrivateDNSForwardrulesID(d))
d.SetId(dataSourceIBMPrivateDNSForwardrulesID())
d.Set(pdnsInstanceID, instanceID)
d.Set(pdnsCRFRResolverID, resolverID)
d.Set(pdnsCRForwardRules, forwardRules)
return nil
}

func dataSourceIBMPrivateDNSForwardrulesID(d *schema.ResourceData) string {
func dataSourceIBMPrivateDNSForwardrulesID() string {
return time.Now().UTC().String()
}
4 changes: 1 addition & 3 deletions ibm/service/dnsservices/resource_ibm_dns_linked_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,10 @@ func resourceIBMDNSLinkedZoneCreate(ctx context.Context, d *schema.ResourceData,
}
ownerInstanceID := d.Get(DnsLinkedZoneOwnerInstanceID).(string)
ownerZoneID := d.Get(DnsLinkedZoneOwnerZoneID).(string)
createLinkedZoneOptions := sess.NewCreateLinkedZoneOptions(instanceID)
createLinkedZoneOptions := sess.NewCreateLinkedZoneOptions(instanceID, ownerInstanceID, ownerZoneID)

createLinkedZoneOptions.SetDescription(description)
createLinkedZoneOptions.SetLabel(label)
createLinkedZoneOptions.SetOwnerInstanceID(ownerInstanceID)
createLinkedZoneOptions.SetOwnerZoneID(ownerZoneID)
mk := "dns_linked_zone_" + instanceID
conns.IbmMutexKV.Lock(mk)
defer conns.IbmMutexKV.Unlock(mk)
Expand Down
Loading

0 comments on commit d8d4052

Please sign in to comment.