-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Resource: Service Discovery Service #2613
New Resource: Service Discovery Service #2613
Conversation
13efd67
to
542cf85
Compare
@radeksimko Ok👍 I have rebased and added some tests. |
This looks really cool. Any ETA on a review/merge to master? |
@radeksimko Please review this 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @atsushi-ishibashi
thanks for this PR.
I left you mostly lower prio comments. None of them are blockers, perhaps except the WARN
log message and "not found" checks. Let me know what you think.
Type: schema.TypeString, | ||
Required: true, | ||
ForceNew: true, | ||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Do you mind extracting this function into validators.go
? This block of code is already deeply nested, so we can save 1 indentation at least.
Type: schema.TypeString, | ||
Optional: true, | ||
ForceNew: true, | ||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: likewise - do you mind extracting it?
resp, err := conn.GetService(input) | ||
if err != nil { | ||
if isAWSErr(err, servicediscovery.ErrCodeServiceNotFound, "") { | ||
d.SetId("") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind logging a WARN
message here, like we do in other resources? e.g. https://github.com/terraform-providers/terraform-provider-aws/blob/5ac70da792a986665f60530f6ea8b5135d325f76/aws/resource_aws_api_gateway_api_key.go#L115
d.Set("name", resp.Service.Name) | ||
d.Set("description", resp.Service.Description) | ||
d.Set("dns_config", flattenServiceDiscoveryDnsConfig(resp.Service.DnsConfig)) | ||
d.Set("health_check_config", flattenServiceDiscoveryHealthCheckConfig(resp.Service.HealthCheckConfig)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: We could simplify the block by something like service := resp.Service
😉
if isAWSErr(err, servicediscovery.ErrCodeServiceNotFound, "") { | ||
d.SetId("") | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the motivation behind this check here? Every apply
/plan
will by default run Read()
which has that check already, so it seems redundant.
if isAWSErr(err, servicediscovery.ErrCodeServiceNotFound, "") { | ||
d.SetId("") | ||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the motivation behind this check here? Every apply
/plan
will by default run Read()
which has that check already, so it seems redundant.
return err | ||
} | ||
|
||
d.SetId("") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: This is redundant (yes, I know many resources still have it... 🤷♂️ ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I missed this workflow😅
ttl = 10 | ||
type = "A" | ||
} | ||
dns_records { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Indentation
type = "A" | ||
} | ||
} | ||
health_check_config { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: indentation
b5fdb02
to
da4395d
Compare
@radeksimko Thank you for review! Ok👍 |
This has been released in terraform-provider-aws version 1.7.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Depend: #2569 #2589
So
dns_records.type
andhealth_check_config.type
areForceNew
.