diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3651fbb..2304ed8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -124,6 +124,11 @@ jobs: run: | sed -i 's/test-func/test-func-action-003/g' func-tests/main.tf + - name: destroy before run func tests + if: ${{ always() }} + run: | + make func-init && make func-destroy + - name: run func tests run: | make func-init && make func-plan && make func-apply diff --git a/docs/data-sources/edge_application_main_settings.md b/docs/data-sources/edge_application_main_settings.md index a612796..d68d373 100644 --- a/docs/data-sources/edge_application_main_settings.md +++ b/docs/data-sources/edge_application_main_settings.md @@ -42,7 +42,6 @@ Read-Only: - `debug_rules` (Boolean) Indicates whether debug rules are enabled for the Edge Application. - `delivery_protocol` (String) The delivery protocol of the Edge Application. - `device_detection` (Boolean) Indicates whether device detection is enabled for the Edge Application. -- `edge_firewall` (Boolean) Indicates whether the Edge Application has an edge firewall enabled. - `edge_functions` (Boolean) Indicates whether edge functions are enabled for the Edge Application. - `http3` (Boolean) Indicates whether HTTP/3 is enabled for the Edge Application. - `http_port` (List of Number) The HTTP port(s) for the Edge Application. @@ -54,4 +53,3 @@ Read-Only: - `name` (String) The name of the Edge Application. - `raw_logs` (Boolean) Indicates whether raw logs are enabled for the Edge Application. - `supported_ciphers` (String) The supported ciphers for the Edge Application. -- `web_application_firewall` (Boolean) Indicates whether a web application firewall is enabled for the Edge Application. diff --git a/docs/resources/edge_application_main_setting.md b/docs/resources/edge_application_main_setting.md index 4fcff71..392b424 100644 --- a/docs/resources/edge_application_main_setting.md +++ b/docs/resources/edge_application_main_setting.md @@ -23,7 +23,6 @@ resource "azion_edge_application_main_setting" "example" { minimum_tls_version = "" debug_rules = false caching = true - edge_firewall = false edge_functions = false image_optimization = false http3 = false @@ -32,7 +31,6 @@ resource "azion_edge_application_main_setting" "example" { load_balancer = false raw_logs = true device_detection = false - web_application_firewall = false } } @@ -104,7 +102,6 @@ Optional: - `caching` (Boolean) Indicates whether caching is enabled for the Edge Application. - `debug_rules` (Boolean) Indicates whether debug rules are enabled for the Edge Application. - `device_detection` (Boolean) Indicates whether device detection is enabled for the Edge Application. -- `edge_firewall` (Boolean) Indicates whether the Edge Application has an edge firewall enabled. - `edge_functions` (Boolean) Indicates whether edge functions are enabled for the Edge Application. - `http3` (Boolean) Indicates whether HTTP/3 is enabled for the Edge Application. - `image_optimization` (Boolean) Indicates whether image optimization is enabled for the Edge Application. @@ -112,7 +109,6 @@ Optional: - `load_balancer` (Boolean) Indicates whether load balancing is enabled for the Edge Application. - `minimum_tls_version` (String) The minimum TLS version supported by the Edge Application. - `raw_logs` (Boolean) Indicates whether raw logs are enabled for the Edge Application. -- `web_application_firewall` (Boolean) Indicates whether a web application firewall is enabled for the Edge Application. Read-Only: diff --git a/examples/resources/azion_edge_application_main_setting/resource.tf b/examples/resources/azion_edge_application_main_setting/resource.tf index 0246fbf..b794c8e 100644 --- a/examples/resources/azion_edge_application_main_setting/resource.tf +++ b/examples/resources/azion_edge_application_main_setting/resource.tf @@ -8,7 +8,6 @@ resource "azion_edge_application_main_setting" "example" { minimum_tls_version = "" debug_rules = false caching = true - edge_firewall = false edge_functions = false image_optimization = false http3 = false @@ -17,7 +16,6 @@ resource "azion_edge_application_main_setting" "example" { load_balancer = false raw_logs = true device_detection = false - web_application_firewall = false } } diff --git a/func-tests/main.tf b/func-tests/main.tf index ff41ec7..05e5181 100644 --- a/func-tests/main.tf +++ b/func-tests/main.tf @@ -24,7 +24,6 @@ resource "azion_edge_application_main_setting" "testfunc" { https_port : [443] minimum_tls_version : "" debug_rules : false - edge_firewall : false edge_functions : var.edge_functions_module image_optimization : false http3 : false @@ -33,7 +32,6 @@ resource "azion_edge_application_main_setting" "testfunc" { load_balancer : false raw_logs : true device_detection : false - web_application_firewall : false raw_logs : false } } diff --git a/internal/data_source_edge_application_main_settings.go b/internal/data_source_edge_application_main_settings.go index 46f5d97..4ff0dd5 100644 --- a/internal/data_source_edge_application_main_settings.go +++ b/internal/data_source_edge_application_main_settings.go @@ -44,13 +44,11 @@ type EdgeApplicationResult struct { ApplicationAcceleration types.Bool `tfsdk:"application_acceleration"` Caching types.Bool `tfsdk:"caching"` DeviceDetection types.Bool `tfsdk:"device_detection"` - EdgeFirewall types.Bool `tfsdk:"edge_firewall"` EdgeFunctions types.Bool `tfsdk:"edge_functions"` ImageOptimization types.Bool `tfsdk:"image_optimization"` LoadBalancer types.Bool `tfsdk:"load_balancer"` L2Caching types.Bool `tfsdk:"l2_caching"` RawLogs types.Bool `tfsdk:"raw_logs"` - WebApplicationFirewall types.Bool `tfsdk:"web_application_firewall"` } func (e *EdgeApplicationDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) { @@ -132,10 +130,6 @@ func (e *EdgeApplicationDataSource) Schema(_ context.Context, _ datasource.Schem Computed: true, Description: "Indicates whether device detection is enabled for the Edge Application.", }, - "edge_firewall": schema.BoolAttribute{ - Computed: true, - Description: "Indicates whether the Edge Application has an edge firewall enabled.", - }, "edge_functions": schema.BoolAttribute{ Computed: true, Description: "Indicates whether edge functions are enabled for the Edge Application.", @@ -156,10 +150,6 @@ func (e *EdgeApplicationDataSource) Schema(_ context.Context, _ datasource.Schem Computed: true, Description: "Indicates whether raw logs are enabled for the Edge Application.", }, - "web_application_firewall": schema.BoolAttribute{ - Computed: true, - Description: "Indicates whether a web application firewall is enabled for the Edge Application.", - }, }, }, }, @@ -215,13 +205,11 @@ func (e *EdgeApplicationDataSource) Read(ctx context.Context, req datasource.Rea ApplicationAcceleration: types.BoolValue(edgeApplicationsResponse.Results.GetApplicationAcceleration()), Caching: types.BoolValue(edgeApplicationsResponse.Results.GetCaching()), DeviceDetection: types.BoolValue(edgeApplicationsResponse.Results.GetDeviceDetection()), - EdgeFirewall: types.BoolValue(edgeApplicationsResponse.Results.GetEdgeFirewall()), EdgeFunctions: types.BoolValue(edgeApplicationsResponse.Results.GetEdgeFunctions()), ImageOptimization: types.BoolValue(edgeApplicationsResponse.Results.GetImageOptimization()), LoadBalancer: types.BoolValue(edgeApplicationsResponse.Results.GetLoadBalancer()), L2Caching: types.BoolValue(edgeApplicationsResponse.Results.GetL2Caching()), RawLogs: types.BoolValue(edgeApplicationsResponse.Results.GetRawLogs()), - WebApplicationFirewall: types.BoolValue(edgeApplicationsResponse.Results.GetWebApplicationFirewall()), }, } diff --git a/internal/resource_domain.go b/internal/resource_domain.go index b7e63d3..cfc8bf9 100644 --- a/internal/resource_domain.go +++ b/internal/resource_domain.go @@ -168,7 +168,7 @@ func (r *domainResource) Create(ctx context.Context, req resource.CreateRequest, } plan.SchemaVersion = types.Int64Value(createDomain.SchemaVersion) - var slice []types.String + var slice []types.String = []types.String{} for _, Cnames := range createDomain.Results.Cnames { slice = append(slice, types.StringValue(Cnames)) } @@ -179,7 +179,7 @@ func (r *domainResource) Create(ctx context.Context, req resource.CreateRequest, IsActive: types.BoolValue(createDomain.Results.GetIsActive()), EdgeApplicationId: types.Int64Value(createDomain.Results.GetEdgeApplicationId()), DomainName: types.StringValue(createDomain.Results.GetDomainName()), - Cnames: utils.SliceStringTypeToSet(slice), + Cnames: utils.SliceStringTypeToSetOrNull(slice), } if createDomain.Results.Environment != nil { @@ -310,7 +310,7 @@ func (r *domainResource) Update(ctx context.Context, req resource.UpdateRequest, } plan.SchemaVersion = types.Int64Value(updateDomain.SchemaVersion) - var slice []types.String + var slice []types.String = []types.String{} for _, Cnames := range updateDomain.Results.Cnames { slice = append(slice, types.StringValue(Cnames)) } @@ -321,7 +321,7 @@ func (r *domainResource) Update(ctx context.Context, req resource.UpdateRequest, IsActive: types.BoolValue(updateDomain.Results.GetIsActive()), EdgeApplicationId: types.Int64Value(updateDomain.Results.GetEdgeApplicationId()), DomainName: types.StringValue(updateDomain.Results.GetDomainName()), - Cnames: utils.SliceStringTypeToSet(slice), + Cnames: utils.SliceStringTypeToSetOrNull(slice), } if updateDomain.Results.Environment != nil { diff --git a/internal/resource_edge_application_main_setting.go b/internal/resource_edge_application_main_setting.go index 3d743c8..84c3c00 100644 --- a/internal/resource_edge_application_main_setting.go +++ b/internal/resource_edge_application_main_setting.go @@ -54,13 +54,11 @@ type EdgeApplicationResults struct { ApplicationAcceleration types.Bool `tfsdk:"application_acceleration"` Caching types.Bool `tfsdk:"caching"` DeviceDetection types.Bool `tfsdk:"device_detection"` - EdgeFirewall types.Bool `tfsdk:"edge_firewall"` EdgeFunctions types.Bool `tfsdk:"edge_functions"` ImageOptimization types.Bool `tfsdk:"image_optimization"` LoadBalancer types.Bool `tfsdk:"load_balancer"` L2Caching types.Bool `tfsdk:"l2_caching"` RawLogs types.Bool `tfsdk:"raw_logs"` - WebApplicationFirewall types.Bool `tfsdk:"web_application_firewall"` } func (r *edgeApplicationResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { @@ -146,11 +144,6 @@ func (r *edgeApplicationResource) Schema(_ context.Context, _ resource.SchemaReq Computed: true, Description: "Indicates whether device detection is enabled for the Edge Application.", }, - "edge_firewall": schema.BoolAttribute{ - Optional: true, - Computed: true, - Description: "Indicates whether the Edge Application has an edge firewall enabled.", - }, "edge_functions": schema.BoolAttribute{ Optional: true, Computed: true, @@ -176,11 +169,6 @@ func (r *edgeApplicationResource) Schema(_ context.Context, _ resource.SchemaReq Computed: true, Description: "Indicates whether raw logs are enabled for the Edge Application.", }, - "web_application_firewall": schema.BoolAttribute{ - Optional: true, - Computed: true, - Description: "Indicates whether a web application firewall is enabled for the Edge Application.", - }, }, }, }, @@ -278,6 +266,10 @@ func (r *edgeApplicationResource) Create(ctx context.Context, req resource.Creat requestUpdate.ImageOptimization = plan.EdgeApplication.ImageOptimization.ValueBoolPointer() } + if plan.EdgeApplication.RawLogs.ValueBool() { + requestUpdate.RawLogs = plan.EdgeApplication.RawLogs.ValueBoolPointer() + } + ID := strconv.Itoa(int(createEdgeApplication.Results.GetId())) updateEdgeApplication, response, err := r.client.edgeApplicationsApi. @@ -301,20 +293,17 @@ func (r *edgeApplicationResource) Create(ctx context.Context, req resource.Creat } edgeAppResults := &EdgeApplicationResults{ - ApplicationID: types.Int64Value(createEdgeApplication.Results.GetId()), - Name: types.StringValue(createEdgeApplication.Results.GetName()), - DeliveryProtocol: types.StringValue(createEdgeApplication.Results.GetDeliveryProtocol()), - HTTPPort: utils.ConvertInterfaceToFloat64List(createEdgeApplication.Results.HttpPort), - HTTPSPort: utils.ConvertInterfaceToFloat64List(createEdgeApplication.Results.HttpsPort), - MinimumTLSVersion: types.StringValue(createEdgeApplication.Results.GetMinimumTlsVersion()), - Active: types.BoolValue(createEdgeApplication.Results.GetActive()), - DebugRules: types.BoolValue(createEdgeApplication.Results.GetDebugRules()), - HTTP3: types.BoolValue(createEdgeApplication.Results.GetHttp3()), - SupportedCiphers: types.StringValue(createEdgeApplication.Results.GetSupportedCiphers()), - Caching: types.BoolValue(createEdgeApplication.Results.GetCaching()), - EdgeFirewall: types.BoolValue(createEdgeApplication.Results.GetEdgeFirewall()), - RawLogs: types.BoolValue(createEdgeApplication.Results.GetRawLogs()), - WebApplicationFirewall: types.BoolValue(createEdgeApplication.Results.GetWebApplicationFirewall()), + ApplicationID: types.Int64Value(createEdgeApplication.Results.GetId()), + Name: types.StringValue(createEdgeApplication.Results.GetName()), + DeliveryProtocol: types.StringValue(createEdgeApplication.Results.GetDeliveryProtocol()), + HTTPPort: utils.ConvertInterfaceToFloat64List(createEdgeApplication.Results.HttpPort), + HTTPSPort: utils.ConvertInterfaceToFloat64List(createEdgeApplication.Results.HttpsPort), + MinimumTLSVersion: types.StringValue(createEdgeApplication.Results.GetMinimumTlsVersion()), + Active: types.BoolValue(createEdgeApplication.Results.GetActive()), + DebugRules: types.BoolValue(createEdgeApplication.Results.GetDebugRules()), + HTTP3: types.BoolValue(createEdgeApplication.Results.GetHttp3()), + SupportedCiphers: types.StringValue(createEdgeApplication.Results.GetSupportedCiphers()), + Caching: types.BoolValue(createEdgeApplication.Results.GetCaching()), } if requestUpdate.L2Caching == nil { @@ -353,6 +342,12 @@ func (r *edgeApplicationResource) Create(ctx context.Context, req resource.Creat edgeAppResults.ImageOptimization = types.BoolValue(updateEdgeApplication.Results.GetImageOptimization()) } + if requestUpdate.RawLogs == nil { + edgeAppResults.RawLogs = types.BoolValue(createEdgeApplication.Results.GetRawLogs()) + } else { + edgeAppResults.RawLogs = types.BoolValue(updateEdgeApplication.Results.GetRawLogs()) + } + plan.EdgeApplication = edgeAppResults plan.SchemaVersion = types.Int64Value(createEdgeApplication.SchemaVersion) plan.ID = types.StringValue(strconv.FormatInt(createEdgeApplication.Results.Id, 10)) @@ -414,13 +409,11 @@ func (r *edgeApplicationResource) Read(ctx context.Context, req resource.ReadReq ApplicationAcceleration: types.BoolValue(stateEdgeApplication.Results.GetApplicationAcceleration()), Caching: types.BoolValue(stateEdgeApplication.Results.GetCaching()), DeviceDetection: types.BoolValue(stateEdgeApplication.Results.GetDeviceDetection()), - EdgeFirewall: types.BoolValue(stateEdgeApplication.Results.GetEdgeFirewall()), EdgeFunctions: types.BoolValue(stateEdgeApplication.Results.GetEdgeFunctions()), ImageOptimization: types.BoolValue(stateEdgeApplication.Results.GetImageOptimization()), LoadBalancer: types.BoolValue(stateEdgeApplication.Results.GetLoadBalancer()), RawLogs: types.BoolValue(stateEdgeApplication.Results.GetRawLogs()), L2Caching: types.BoolValue(stateEdgeApplication.Results.GetL2Caching()), - WebApplicationFirewall: types.BoolValue(stateEdgeApplication.Results.GetWebApplicationFirewall()), } state.ID = types.StringValue(strconv.FormatInt(stateEdgeApplication.Results.GetId(), 10)) state.SchemaVersion = types.Int64Value(stateEdgeApplication.SchemaVersion) @@ -465,12 +458,10 @@ func (r *edgeApplicationResource) Update(ctx context.Context, req resource.Updat SupportedCiphers: edgeapplications.PtrString(plan.EdgeApplication.SupportedCiphers.ValueString()), ApplicationAcceleration: edgeapplications.PtrBool(plan.EdgeApplication.ApplicationAcceleration.ValueBool()), DeviceDetection: edgeapplications.PtrBool(plan.EdgeApplication.DeviceDetection.ValueBool()), - EdgeFirewall: edgeapplications.PtrBool(plan.EdgeApplication.EdgeFirewall.ValueBool()), EdgeFunctions: edgeapplications.PtrBool(plan.EdgeApplication.EdgeFunctions.ValueBool()), ImageOptimization: edgeapplications.PtrBool(plan.EdgeApplication.ImageOptimization.ValueBool()), LoadBalancer: edgeapplications.PtrBool(plan.EdgeApplication.LoadBalancer.ValueBool()), RawLogs: edgeapplications.PtrBool(plan.EdgeApplication.RawLogs.ValueBool()), - WebApplicationFirewall: edgeapplications.PtrBool(plan.EdgeApplication.WebApplicationFirewall.ValueBool()), DeliveryProtocol: edgeapplications.PtrString(plan.EdgeApplication.DeliveryProtocol.ValueString()), L2Caching: edgeapplications.PtrBool(plan.EdgeApplication.L2Caching.ValueBool()), } @@ -513,13 +504,11 @@ func (r *edgeApplicationResource) Update(ctx context.Context, req resource.Updat ApplicationAcceleration: types.BoolValue(updateEdgeApplication.Results.GetApplicationAcceleration()), Caching: types.BoolValue(updateEdgeApplication.Results.GetCaching()), DeviceDetection: types.BoolValue(updateEdgeApplication.Results.GetDeviceDetection()), - EdgeFirewall: types.BoolValue(updateEdgeApplication.Results.GetEdgeFirewall()), EdgeFunctions: types.BoolValue(updateEdgeApplication.Results.GetEdgeFunctions()), ImageOptimization: types.BoolValue(updateEdgeApplication.Results.GetImageOptimization()), LoadBalancer: types.BoolValue(updateEdgeApplication.Results.GetLoadBalancer()), RawLogs: types.BoolValue(updateEdgeApplication.Results.GetRawLogs()), L2Caching: types.BoolValue(updateEdgeApplication.Results.GetL2Caching()), - WebApplicationFirewall: types.BoolValue(updateEdgeApplication.Results.GetWebApplicationFirewall()), } plan.SchemaVersion = types.Int64Value(updateEdgeApplication.SchemaVersion)