akamai / terraform-provider-akamai

Terraform Akamai provider

Home Page:https://www.terraform.io/docs/providers/akamai/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

State file is large when using rule builder and contains empty array data not being used.

jgdev522 opened this issue · comments

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

"terraform_version": "1.5.3",
"platform": "linux_amd64",

Affected Resource(s)

Please list the resources as a list, for example:
-Rule builder
-Terraform remote state is 20Mb for only 20 properties with 1 datastream.

Terraform Configuration Files

I will forward this to my Akamai Technical account manager if required


### Debug Output

### Panic Output


### Expected Behavior
When I review the state file I see multiple entries as follow, these are all rule options we are not using.

"module": "module.prp-default[\"admin\"].module.allowed_methods",
      "mode": "data",
      "type": "akamai_property_rules_builder",
      "name": "rules_builder",
      "provider": "provider[\"registry.terraform.io/akamai/akamai\"]",
    "instances": [


"advanced_override": "",
                "behavior": [
                  {
                    "ad_scaler_circuit_breaker": [],
                    "adaptive_acceleration": [
                      {
                        "ab_logic": "DISABLED",
                        "ab_testing": "",
                        "compression": "",
                        "cookie_name": "",
                        "enable_brotli_compression": false,
                        "enable_for_noncacheable": false,
                        "enable_preconnect": true,
                        "enable_push": true,
                        "enable_ro": false,
                        "locked": false,
                        "preload_enable": true,
                        "source": "mPulse",
                        "template_uuid": "",
                        "title_brotli": "",
                        "title_http2_server_push": "",
                        "title_preconnect": "",
                        "title_preload": "",
                        "title_ro": "",
                        "uuid": ""
                      }
                    ],
                    "adaptive_image_compression": [],
                    "advanced": [],
                    "aggregated_reporting": [],
                    "akamaizer": [],
                    "akamaizer_tag": [],
                    "all_http_in_cache_hierarchy": [],
                    "allow_cloudlets_origins": [],
                    "allow_delete": [],
                    "allow_https_cache_key_sharing": [],
                    "allow_https_downgrade": [],
                    "allow_options": [],
                    "allow_patch": [],
                    "allow_post": [],
                    "allow_put": [],
                    "allow_transfer_encoding": [],
                    "alt_svc_header": [],
                    "api_prioritization": [],
                    "application_load_balancer": [],

### Actual Behavior
State file is saving unused rule information. This is compounded for every property in the state file.

### Steps to Reproduce
Using the rule builder to create rule tree

### Important Factoids
Using remote backed on s3 with dynamo DB for state lock.

Is it possible to not store the empty array informatiuon

### References

Hi, @jgdev522

As far as I'm concerned, this is not possible. We, as provider developers, are not responsible for, nor do we have any influence over, how Terraform represents its state. The large state file you're seeing is partially a result of the data source schema. When we designed the data source, a simpler schema would not have allowed us to represent some possible configurations. Consequently, we ended up with a more complex schema. I understand how this could quickly inflate the size of the state file, but I'm not certain there's anything we can do about it.

PS. I've come across this Terraform request: Add possibility to compress state file when using s3 remote state. You might find it interesting. However, given that it's been open for a few years with minimal engagement, I doubt it will be included in upcoming Terraform releases.