-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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/Data Source: azurerm_nat_gateway
and azurerm_subnet_nat_gateway_association
#4449
Conversation
azurerm_nat_gateway
and expose in azurerm_subnet
azurerm_nat_gateway
and azurerm_subnet_nat_gateway_association
79ac450
to
5cc4a0b
Compare
c1a79fd
to
0e30cb4
Compare
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.
@ArcturusZhang , Thanks for the PR and it's looking really good. I left some comments asking a few questions and requesting a few, mostly minor, changes. Thanks for the PR again, this is great! 🐯
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.
@ArcturusZhang thanks for the updates, looking really good! Very close, left a few more comments, mostly around documentation. 🚀
azurerm/resource_arm_nat_gateway.go
Outdated
func validateNameForNatGateway(i interface{}, k string) ([]string, []error) { | ||
v, ok := i.(string) | ||
if !ok { | ||
return nil, []error{fmt.Errorf("expected type of %q to be string", k)} | ||
} | ||
// test length | ||
if l := len(v); l < 1 || l > 80 { | ||
return nil, []error{fmt.Errorf("length of field name must be between 1 and 80 characters")} | ||
} | ||
// regex test: | ||
// The name must begin with a letter or number, end with a letter, number or underscore, | ||
// and may contain only letters, numbers, underscores, periods, or hyphens. | ||
regex := regexp.MustCompile(`^[a-zA-Z0-9](([\w-.]*)\w)?$`) | ||
if ok := regex.MatchString(v); !ok { | ||
return nil, []error{fmt.Errorf("the name must begin with a letter or number, end with a letter, number or underscore, and may contain only letters, numbers, underscores, periods, or hyphens")} | ||
} | ||
return nil, 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.
I too have implemented this validation function in my GenericRFC3986Compliance PR... While it's fine to put the validation code in the resource itself, I find it a bit nicer to create a validation.go
file in the .\services\network
directory. That way we keep all the package specific stuff in the same spot in the source tree. I would also pick another var for the length test as l
and 1
look almost identical and makes it hard from a code readability point of view, maybe us a t
for test instead? Maybe if the PR gets merged we can use the GenericRFC3986Compliance
function?
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.
I could rebase this pr to your branch, and then use the validation function there. Does this make sense?
I made some changes, please have a look again |
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.
Thanks for the revisions @ArcturusZhang,
I've left some comments inline, nothing to major. I would like to see more whitespace and newlines in functions as when there is none it is much harder to read, review, and maintain. Thanks!
|
||
* `public_ip_prefix_ids` - (Optional) A list of existing `azurerm_public_ip_prefix` resource IDs. | ||
|
||
* `resource_guid` - (Optional) The resource GUID property of the Nat Gateway. |
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.
Could we add a little more details here what the property does, not just what it is?
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.
This field is computed, maybe I should remove this from this doc?
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.
you have it as optional/computed?
then it should be moved down to attributes exported
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.
Moved to Attributes Reference
section
Hi @WodansSon @katbyte I made some changes and left some comments, please have a look again. |
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 @ArcturusZhang,
Thank you for making those changes. I've re-reviewed and left some more comments inline. I also ran the tests which are failing with:
------- Stdout: -------
=== RUN TestAccAzureRMNatGateway_basic
=== PAUSE TestAccAzureRMNatGateway_basic
=== CONT TestAccAzureRMNatGateway_basic
------- Stderr: -------
2019/11/01 00:52:36 [DEBUG] Registering Data Sources for "Compute"..
2019/11/01 00:52:36 [DEBUG] Registering Resources for "Compute"..
panic: interface conversion: interface {} is *schema.Set, not []interface {}
|
||
* `public_ip_prefix_ids` - (Optional) A list of existing `azurerm_public_ip_prefix` resource IDs. | ||
|
||
* `resource_guid` - (Optional) The resource GUID property of the Nat Gateway. |
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.
you have it as optional/computed?
then it should be moved down to attributes exported
9d66799
to
1092e85
Compare
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.
I have made a few changes to the code, this LGTM now! Thanks! 🚀
hooray! thanks! |
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.
Thanks for the updates @ArcturusZhang & @WodansSon. I've given this one final review and noticed a couple things left. It also appears there are no docs for the association resource?
|
||
Manages an Azure NAT Gateway instance. | ||
|
||
-> **NOTE:** The Azure NAT Gateway service is currently in private preview. Your subscription must be on the NAT Gateway private preview whitelist for this resource to be provisioned correctly. If you attempt to provision this resource and receive an `InvalidResourceType` error that means that your subscription is not part of the NAT Gateway private preview whitelist and you will not be able to use this resource. The NAT Gateway private preview service is currently only available in the `East US 2` and `West Central US` regions. |
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.
Could we include warnings about possible breaking changes & a note to contact azure support if a user wants to participate?
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.
Added some more information, please have a look
56c9b8d
to
dc970e5
Compare
Hi @katbyte I have made some changes, please have a look 🚀 |
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.
Thanks for the revisions all, LGTM 👍
This has been released in version 1.38.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 1.38.0"
}
# ... other configuration ... |
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. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Added new resource and data source of nat-gateway.