Skip to content
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

azurerm_api_management.security.disable_triple_des_chipers has incorrect spelling #3539

Merged
merged 4 commits into from
Jun 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions azurerm/resource_arm_api_management.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ var apimBackendProtocolTls11 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Sec
var apimFrontendProtocolSsl3 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30"
var apimFrontendProtocolTls10 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10"
var apimFrontendProtocolTls11 = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11"
var apimTripleDesChipers = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168"
var apimTripleDesCiphers = "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168"

func resourceArmApiManagementService() *schema.Resource {
return &schema.Resource{
Create: resourceArmApiManagementServiceCreateUpdate,
Read: resourceArmApiManagementServiceRead,
Update: resourceArmApiManagementServiceCreateUpdate,
Delete: resourceArmApiManagementServiceDelete,

Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Expand Down Expand Up @@ -123,7 +124,7 @@ func resourceArmApiManagementService() *schema.Resource {
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"location": locationSchema(),
"location": azure.SchemaLocation(),

"gateway_regional_url": {
Type: schema.TypeString,
Expand Down Expand Up @@ -174,7 +175,7 @@ func resourceArmApiManagementService() *schema.Resource {
"security": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Computed: true, // todo remove in 2.0 ?
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand All @@ -194,9 +195,18 @@ func resourceArmApiManagementService() *schema.Resource {
Default: false,
},
"disable_triple_des_chipers": {
Type: schema.TypeBool,
Optional: true,
Computed: true, // todo remove in 2.0
Deprecated: "This field has been deprecated in favour of the `disable_triple_des_ciphers` property to correct the spelling. it will be removed in version 2.0 of the provider",
ConflictsWith: []string{"security.0.disable_triple_des_ciphers"},
},
"disable_triple_des_ciphers": {
Type: schema.TypeBool,
Optional: true,
Default: false,
// Default: false, // todo remove in 2.0
Computed: true, // todo remove in 2.0
ConflictsWith: []string{"security.0.disable_triple_des_chipers"},
},
"disable_frontend_ssl30": {
Type: schema.TypeBool,
Expand Down Expand Up @@ -891,7 +901,7 @@ func expandApiManagementCustomProperties(d *schema.ResourceData) map[string]*str
frontendProtocolSsl3 := false
frontendProtocolTls10 := false
frontendProtocolTls11 := false
tripleDesChipers := false
tripleDesCiphers := false

if len(vs) > 0 {
v := vs[0].(map[string]interface{})
Expand All @@ -901,7 +911,13 @@ func expandApiManagementCustomProperties(d *schema.ResourceData) map[string]*str
frontendProtocolSsl3 = v["disable_frontend_ssl30"].(bool)
frontendProtocolTls10 = v["disable_frontend_tls10"].(bool)
frontendProtocolTls11 = v["disable_frontend_tls11"].(bool)
tripleDesChipers = v["disable_triple_des_chipers"].(bool)
//tripleDesCiphers = v["disable_triple_des_ciphers"].(bool) //restore in 2.0
}

if c, ok := d.GetOkExists("security.0.disable_triple_des_ciphers"); ok {
tripleDesCiphers = c.(bool)
} else if c, ok := d.GetOkExists("security.0.disable_triple_des_chipers"); ok {
tripleDesCiphers = c.(bool)
}

return map[string]*string{
Expand All @@ -911,7 +927,7 @@ func expandApiManagementCustomProperties(d *schema.ResourceData) map[string]*str
apimFrontendProtocolSsl3: utils.String(strconv.FormatBool(frontendProtocolSsl3)),
apimFrontendProtocolTls10: utils.String(strconv.FormatBool(frontendProtocolTls10)),
apimFrontendProtocolTls11: utils.String(strconv.FormatBool(frontendProtocolTls11)),
apimTripleDesChipers: utils.String(strconv.FormatBool(tripleDesChipers)),
apimTripleDesCiphers: utils.String(strconv.FormatBool(tripleDesCiphers)),
}
}

Expand All @@ -924,7 +940,8 @@ func flattenApiManagementCustomProperties(input map[string]*string) []interface{
output["disable_frontend_ssl30"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolSsl3)
output["disable_frontend_tls10"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolTls10)
output["disable_frontend_tls11"] = parseApiManagementNilableDictionary(input, apimFrontendProtocolTls11)
output["disable_triple_des_chipers"] = parseApiManagementNilableDictionary(input, apimTripleDesChipers)
output["disable_triple_des_chipers"] = parseApiManagementNilableDictionary(input, apimTripleDesCiphers) // todo remove in 2.0
output["disable_triple_des_ciphers"] = parseApiManagementNilableDictionary(input, apimTripleDesCiphers)

return []interface{}{output}
}
Expand Down
5 changes: 3 additions & 2 deletions azurerm/resource_arm_api_management_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ resource "azurerm_api_management" "test" {

security {
disable_frontend_tls10 = true
disable_triple_des_chipers = true
disable_triple_des_ciphers = true
}
}
`, rInt, location, rInt)
Expand Down Expand Up @@ -476,7 +476,8 @@ resource "azurerm_api_management" "test" {
}

security {
disable_backend_tls11 = true
disable_backend_tls11 = true
disable_triple_des_ciphers = true
}

hostname_configuration {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/api_management.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ A `security` block supports the following:

-> **info:** This maps to the `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` field

* `disable_triple_des_chipers` - (Optional) Should the `TLS_RSA_WITH_3DES_EDE_CBC_SHA` cipher be disabled for alL TLS versions (1.0, 1.1 and 1.2)? Defaults to `false`.
* `disable_triple_des_ciphers` - (Optional) Should the `TLS_RSA_WITH_3DES_EDE_CBC_SHA` cipher be disabled for alL TLS versions (1.0, 1.1 and 1.2)? Defaults to `false`.

-> **info:** This maps to the `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` field

Expand Down