Skip to content

Commit

Permalink
Update DNS Providers
Browse files Browse the repository at this point in the history
  • Loading branch information
vanbroup authored May 31, 2023
1 parent 225f39b commit 9dc36be
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/dnsimple/dnsimple-go v0.71.1
github.com/entrustcorporation/entrust v0.0.0-20230314134457-b6b1cf0dd3bb
github.com/exoscale/egoscale v0.90.0
github.com/go-acme/lego/v4 v4.11.0
github.com/go-acme/lego/v4 v4.12.0
github.com/go-jose/go-jose/v3 v3.0.0
github.com/google/go-querystring v1.1.0
github.com/gophercloud/gophercloud v1.0.0
Expand Down Expand Up @@ -49,7 +49,7 @@ require (
github.com/sacloud/iaas-api-go v1.3.2
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.9
github.com/simplesurance/bunny-go v0.0.0-20221115111006-e11d9dc91f04
github.com/sirupsen/logrus v1.9.0
github.com/sirupsen/logrus v1.9.2
github.com/softlayer/softlayer-go v1.0.6
github.com/stretchr/testify v1.8.1
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.490
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/go-acme/lego/v4 v4.11.0 h1:oIPoU7zBJoTfoVrbqk62+/2NsGCSgCVK1JtZSZZ28SU=
github.com/go-acme/lego/v4 v4.11.0/go.mod h1:dENL0J3/WughN2NLy0T35otK5k1EWCmXTwCw0+X5ZaE=
github.com/go-acme/lego/v4 v4.12.0 h1:jox3II6YRjt1EXvrymSQuSNgEUOcbUkF2je0kyuv6YM=
github.com/go-acme/lego/v4 v4.12.0/go.mod h1:UZoOlhVmUYP/N0z4tEbfUjoCNHRZNObzqWZtT76DIsc=
github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs=
github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s=
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
Expand Down Expand Up @@ -486,6 +486,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w=
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9 h1:hp2CYQUINdZMHdvTdXtPOY2ainKl4IoMcpAXEf2xj3Q=
Expand Down
6 changes: 2 additions & 4 deletions providers/autodns/autodns.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
Value: info.Value,
}}

// TODO(ldez) replace domain by FQDN to follow CNAME.
_, err := d.client.AddTxtRecords(context.Background(), domain, records)
_, err := d.client.AddTxtRecords(context.Background(), info.EffectiveFQDN, records)
if err != nil {
return fmt.Errorf("autodns: %w", err)
}
Expand All @@ -142,8 +141,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
Value: info.Value,
}}

// TODO(ldez) replace domain by FQDN to follow CNAME.
if err := d.client.RemoveTXTRecords(context.Background(), domain, records); err != nil {
if err := d.client.RemoveTXTRecords(context.Background(), info.EffectiveFQDN, records); err != nil {
return fmt.Errorf("autodns: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion providers/designate/designate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ For more information, you can read about the different methods of authentication

[Links]
API = "https://docs.openstack.org/designate/latest/"
GoClient = "https://godoc.org/github.com/gophercloud/gophercloud/openstack/dns/v2"
GoClient = "https://pkg.go.dev/github.com/gophercloud/gophercloud/openstack/dns/v2"
11 changes: 9 additions & 2 deletions providers/route53/route53.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (
EnvHostedZoneID = envNamespace + "HOSTED_ZONE_ID"
EnvMaxRetries = envNamespace + "MAX_RETRIES"
EnvAssumeRoleArn = envNamespace + "ASSUME_ROLE_ARN"
EnvExternalID = envNamespace + "EXTERNAL_ID"

EnvTTL = envNamespace + "TTL"
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
Expand All @@ -48,6 +49,7 @@ type Config struct {
HostedZoneID string
MaxRetries int
AssumeRoleArn string
ExternalID string

TTL int
PropagationTimeout time.Duration
Expand All @@ -62,6 +64,7 @@ func NewDefaultConfig() *Config {
HostedZoneID: env.GetOrFile(EnvHostedZoneID),
MaxRetries: env.GetOrDefaultInt(EnvMaxRetries, 5),
AssumeRoleArn: env.GetOrDefaultString(EnvAssumeRoleArn, ""),
ExternalID: env.GetOrDefaultString(EnvExternalID, ""),

TTL: env.GetOrDefaultInt(EnvTTL, 10),
PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, 2*time.Minute),
Expand Down Expand Up @@ -337,8 +340,12 @@ func createSession(config *Config) (*session.Session, error) {
}

return session.NewSession(&aws.Config{
Region: sess.Config.Region,
Credentials: stscreds.NewCredentials(sess, config.AssumeRoleArn),
Region: sess.Config.Region,
Credentials: stscreds.NewCredentials(sess, config.AssumeRoleArn, func(arp *stscreds.AssumeRoleProvider) {
if config.ExternalID != "" {
arp.ExternalID = &config.ExternalID
}
}),
})
}

Expand Down
3 changes: 2 additions & 1 deletion providers/route53/route53.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ Replace `Z11111112222222333333` with your hosted zone ID and `example.com` with
AWS_HOSTED_ZONE_ID = "Override the hosted zone ID."
AWS_PROFILE = "Managed by the AWS client (`AWS_PROFILE_FILE` is not supported)"
AWS_SDK_LOAD_CONFIG = "Managed by the AWS client. Retrieve the region from the CLI config file (`AWS_SDK_LOAD_CONFIG_FILE` is not supported)"
AWS_ASSUME_ROLE_ARN = "Managed by the AWS Role ARN (`AWS_ASSUME_ROLE_ARN` is not supported)"
AWS_ASSUME_ROLE_ARN = "Managed by the AWS Role ARN (`AWS_ASSUME_ROLE_ARN_FILE` is not supported)"
AWS_EXTERNAL_ID = "Managed by STS AssumeRole API operation (`AWS_EXTERNAL_ID_FILE` is not supported)"
[Configuration.Additional]
AWS_SHARED_CREDENTIALS_FILE = "Managed by the AWS client. Shared credentials file."
AWS_MAX_RETRIES = "The number of maximum returns the service will use to make an individual API request"
Expand Down
14 changes: 2 additions & 12 deletions providers/websupport/websupport.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
return nil
}

err = internal.ParseError(resp)
if err != nil {
return fmt.Errorf("websupport: %w", err)
}

return nil
return fmt.Errorf("websupport: %w", internal.ParseError(resp))
}

// CleanUp removes the TXT record matching the specified parameters.
Expand Down Expand Up @@ -172,12 +167,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
return nil
}

err = internal.ParseError(resp)
if err != nil {
return fmt.Errorf("websupport: %w", err)
}

return nil
return fmt.Errorf("websupport: %w", internal.ParseError(resp))
}

// Timeout returns the timeout and interval to use when checking for DNS propagation.
Expand Down

0 comments on commit 9dc36be

Please sign in to comment.