atlas-init 0.8.0__py3-none-any.whl → 0.8.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
atlas_init/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from pathlib import Path
2
2
 
3
- VERSION = "0.8.0"
3
+ VERSION = "0.8.1"
4
4
 
5
5
 
6
6
  def running_in_repo() -> bool:
@@ -128,9 +128,11 @@ def generate_resource_variables(
128
128
  resource: type[ResourceAbs] | None, resource_config: ResourceGenConfig, extra_skipped: set[str] | None = None
129
129
  ) -> str:
130
130
  extra_skipped = extra_skipped or set()
131
- required_variables = resource_config.required_variables
132
131
  if resource is None:
133
132
  return ""
133
+ required_variables = set(resource_config.required_variables)
134
+ if not resource_config.use_opt_in_required_variables:
135
+ required_variables |= getattr(resource, ResourceAbs.REQUIRED_ATTRIBUTES_NAME, set())
134
136
  out = []
135
137
  hints = get_type_hints(resource)
136
138
  ignored_names = (
@@ -145,7 +147,8 @@ def generate_resource_variables(
145
147
  return format_tf_content(f'''variable "{resource_config.name}" {{
146
148
  type = {tf_type}
147
149
  }}\n''')
148
- for f in fields(resource): # type: ignore
150
+ fields_sorted = sorted(fields(resource), key=lambda f: (0 if f.name in required_variables else 1, f.name))
151
+ for f in fields_sorted: # type: ignore
149
152
  field_name = f.name
150
153
  if field_name.isupper() or field_name in ignored_names:
151
154
  continue
@@ -74,6 +74,7 @@ def as_import_line(name: str) -> str:
74
74
  class ResourceGenConfig(Entity):
75
75
  name: str
76
76
  use_single_variable: bool = False
77
+ use_opt_in_required_variables: bool = False
77
78
  required_variables: set[str] = PydanticField(default_factory=set)
78
79
  skip_variables_extra: set[str] = PydanticField(default_factory=set)
79
80
  attribute_default_hcl_strings: dict[str, str] = PydanticField(default_factory=dict)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atlas-init
3
- Version: 0.8.0
3
+ Version: 0.8.1
4
4
  Project-URL: Documentation, https://github.com/EspenAlbert/atlas-init#readme
5
5
  Project-URL: Issues, https://github.com/EspenAlbert/atlas-init/issues
6
6
  Project-URL: Source, https://github.com/EspenAlbert/atlas-init
@@ -1,4 +1,4 @@
1
- atlas_init/__init__.py,sha256=HszEP86pa4V8Bem1Xhq0i_TtYub_SoFcTi_pWmwwq0I,213
1
+ atlas_init/__init__.py,sha256=bE8OXKBhQOEYQBlOStpyAixc8Il2l2NRdaFMFXjCLq4,213
2
2
  atlas_init/__main__.py,sha256=dY1dWWvwxRZMmnOFla6RSfti-hMeLeKdoXP7SVYqMUc,52
3
3
  atlas_init/atlas_init.yaml,sha256=aCCg6PJgLcqh75v3tdEEG4UPrcJlbmbRaLj0c7PCumE,2373
4
4
  atlas_init/cli.py,sha256=0b4_osi67Oj-hZnrtK70IbSKQDREjwUFv1_30_A03Zg,9447
@@ -128,10 +128,10 @@ atlas_init/tf_ext/gen_examples.py,sha256=nN-KhPFs3PnW4PWgEop4fXFTQf1jP6A3pGdKFRW
128
128
  atlas_init/tf_ext/gen_module_readme.py,sha256=04Lu9dYRMnYeKoQrIclpxUCT5YZctNzK71mzhFr_07E,4421
129
129
  atlas_init/tf_ext/gen_resource_main.py,sha256=C-aqkOFXH5ffT51igPtNW7szIH-MkY3HnMcSZ0Q4OdE,7263
130
130
  atlas_init/tf_ext/gen_resource_output.py,sha256=_LM3mKMVmcqm2uWokvIfMxOnyCD4aCDUNGUp5DujF7E,3518
131
- atlas_init/tf_ext/gen_resource_variables.py,sha256=sykS9tpp1YZLXLx6kQanCwGj7XtHGoVpqGmPQYvsOB8,6690
131
+ atlas_init/tf_ext/gen_resource_variables.py,sha256=hgaHJlgnk1bNCV46TlvUIVZ5PVUQvxxnfo-hKN05SEU,6954
132
132
  atlas_init/tf_ext/gen_versions.py,sha256=yYX4jIgQfAZuG2wfu6OsIbDAqt9g8btiLcgKm7DvNqM,469
133
133
  atlas_init/tf_ext/models.py,sha256=8tJmLtwzzuNp_waG2eZ9bFmqRx6dJeYivu-ygvJUiLM,3631
134
- atlas_init/tf_ext/models_module.py,sha256=mgl8zX7EyszMjVdKb8g9IfoBK7BNeNXaT3zDcPGgJSs,18065
134
+ atlas_init/tf_ext/models_module.py,sha256=JpMGSdjgS6D8NlTJNcSIOdq0dDagKyIfSeoFI_-eVMM,18113
135
135
  atlas_init/tf_ext/newres.py,sha256=quMSLlkJRuvA3attTvJ-DQNSwRPFyT_XJ32ucmEhA-s,3104
136
136
  atlas_init/tf_ext/paths.py,sha256=3VQri_VKS5sVKdkHu2XKgHziB1uQpB8hBGBY7GwiAwU,4917
137
137
  atlas_init/tf_ext/plan_diffs.py,sha256=Sc-VFrq2k7p01ZZzgtAfqRXCog2h6bbFlonGfaxSzog,5237
@@ -147,8 +147,8 @@ atlas_init/tf_ext/tf_mod_gen_provider.py,sha256=M7jJeH0VR1uN440d2H5-9lnj0s0d9Qta
147
147
  atlas_init/tf_ext/tf_modules.py,sha256=_JokgP-i1iS-iEXVI0MMNorrBHjFG6XcJRKiUe6JbvY,16200
148
148
  atlas_init/tf_ext/tf_vars.py,sha256=A__zcIBNvJ5y0l5F5G7KMQsYCuyr3iBZtRzXm4e6DQU,7875
149
149
  atlas_init/tf_ext/typer_app.py,sha256=gGVdttrSzUX2uzTAeXzvCF4BQnMxrkltAAc3_BCsiGc,968
150
- atlas_init-0.8.0.dist-info/METADATA,sha256=EcUiqi9up4csGk08KKIOV3qjrifcra3qYJynHoIq6Hs,5863
151
- atlas_init-0.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
152
- atlas_init-0.8.0.dist-info/entry_points.txt,sha256=l38KdfCjY2v5q8Ves1qkWNvPTPND6Tp2EKX-RL-MN3c,200
153
- atlas_init-0.8.0.dist-info/licenses/LICENSE,sha256=aKnucPyXnK1A-aXn4vac71zRpcB5BXjDyl4PDyi_hZg,1069
154
- atlas_init-0.8.0.dist-info/RECORD,,
150
+ atlas_init-0.8.1.dist-info/METADATA,sha256=s0HRa9fecuwCA269e3NhIF-DkyTJtPGGK5Ddgfy0Lk0,5863
151
+ atlas_init-0.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
152
+ atlas_init-0.8.1.dist-info/entry_points.txt,sha256=l38KdfCjY2v5q8Ves1qkWNvPTPND6Tp2EKX-RL-MN3c,200
153
+ atlas_init-0.8.1.dist-info/licenses/LICENSE,sha256=aKnucPyXnK1A-aXn4vac71zRpcB5BXjDyl4PDyi_hZg,1069
154
+ atlas_init-0.8.1.dist-info/RECORD,,