-
Notifications
You must be signed in to change notification settings - Fork 673
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
Subnet nwacl changes #1941
Subnet nwacl changes #1941
Conversation
}, | ||
|
||
isNetworkACLVPC: { | ||
Type: schema.TypeString, |
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 should be only computed field
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.
Corrected this change.
|
||
isNetworkACLRules: { | ||
Type: schema.TypeList, | ||
Optional: true, |
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 also should be computed only
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.
Corrected this change.
}, | ||
|
||
isNetworkACLRuleTCP: { | ||
Type: schema.TypeList, |
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.
same as above
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.
Corrected this change.
}, | ||
}, | ||
|
||
isNetworkACLRuleUDP: { |
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.
same as above comment
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.
Corrected this change.
}, | ||
|
||
isNetworkACLName: { | ||
Type: schema.TypeString, |
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.
only computed
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.
Corrected this change.
|
||
func resourceIBMISSubnetNetworkACLAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { | ||
hasChanged := false | ||
if d.HasChange(isSubnetID) || d.HasChange(isNetworkACLID) { |
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.
subnet_id cann't be updated it forces anew resource
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.
Corrected this change.
|
||
isNetworkACLName: { | ||
Type: schema.TypeString, | ||
Optional: true, |
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 should be only computed field
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.
Corrected this change.
|
||
isNetworkACLResourceGroup: { | ||
Type: schema.TypeString, | ||
Optional: true, |
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 should be only computed field
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.
Corrected this change.
494793f
to
c3d6f91
Compare
|
||
func resourceIBMISSubnetNetworkACLAttachmentUpdate(d *schema.ResourceData, meta interface{}) error { | ||
hasChanged := false | ||
if d.HasChange(isNetworkACLID) { |
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.
No need of hasChanged variables since we have only one argument
d.HasChange(isNetworkACLID){
subnet := d.Get(isSubnetID).(string)
networkACL := d.Get(isNetworkACLID).(string)
// Construct an instance of the NetworkACLIdentityByID model
networkACLIdentityModel := new(vpcv1.NetworkACLIdentityByID)
networkACLIdentityModel.ID = &networkACL
// Construct an instance of the ReplaceSubnetNetworkACLOptions model
replaceSubnetNetworkACLOptionsModel := new(vpcv1.ReplaceSubnetNetworkACLOptions)
replaceSubnetNetworkACLOptionsModel.ID = &subnet
replaceSubnetNetworkACLOptionsModel.NetworkACLIdentity = networkACLIdentityModel
resultACL, response, err := sess.ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptionsModel)
if err != nil {
log.Printf("[DEBUG] Error while attaching a network ACL to a subnet %s\n%s", err, response)
return fmt.Errorf("Error while attaching a network ACL to a subnet %s\n%s", err, response)
}
log.Printf("[INFO] Updated subnet %s with Network ACL : %s", subnet, *resultACL.ID)
}
return resourceIBMISSubnetNetworkACLAttachmentRead(d, meta)
}
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.
Corrected this change.
2dc66ee
to
36eb635
Compare
Resource ibm subnet network acl attachment