MCPcopy Create free account
hub / github.com/beelit94/python-terraform / init

Method init

python_terraform/terraform.py:179–212  ·  view source on GitHub ↗

Refer to https://www.terraform.io/docs/commands/init.html By default, this assumes you want to use backend config, and tries to init fresh. The flags -reconfigure and -backend=true are default. :param dir_or_plan: relative path to the folder want to init :param back

(
        self,
        dir_or_plan: Optional[str] = None,
        backend_config: Optional[Dict[str, str]] = None,
        reconfigure: Type[TerraformFlag] = IsFlagged,
        backend: bool = True,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

177 return self.cmd("plan", *args, **options)
178
179 def init(
180 self,
181 dir_or_plan: Optional[str] = None,
182 backend_config: Optional[Dict[str, str]] = None,
183 reconfigure: Type[TerraformFlag] = IsFlagged,
184 backend: bool = True,
185 **kwargs,
186 ) -> CommandOutput:
187 """Refer to https://www.terraform.io/docs/commands/init.html
188
189 By default, this assumes you want to use backend config, and tries to
190 init fresh. The flags -reconfigure and -backend=true are default.
191
192 :param dir_or_plan: relative path to the folder want to init
193 :param backend_config: a dictionary of backend config options. eg.
194 t = Terraform()
195 t.init(backend_config={'access_key': 'myaccesskey',
196 'secret_key': 'mysecretkey', 'bucket': 'mybucketname'})
197 :param reconfigure: whether or not to force reconfiguration of backend
198 :param backend: whether or not to use backend settings for init
199 :param kwargs: options
200 :return: ret_code, stdout, stderr
201 """
202 options = kwargs.copy()
203 options.update(
204 {
205 "backend_config": backend_config,
206 "reconfigure": reconfigure,
207 "backend": backend,
208 }
209 )
210 options = self._generate_default_options(options)
211 args = self._generate_default_args(dir_or_plan)
212 return self.cmd("init", *args, **options)
213
214 def generate_cmd_string(self, cmd: str, *args, **kwargs) -> List[str]:
215 """For any generate_cmd_string doesn't written as public method of Terraform

Callers 8

wrapperFunction · 0.95
test_cmdMethod · 0.95
test_applyMethod · 0.95
test_override_defaultMethod · 0.95
test_outputMethod · 0.95
test_destroyMethod · 0.95
test_planMethod · 0.95

Calls 3

cmdMethod · 0.95

Tested by 8

wrapperFunction · 0.76
test_cmdMethod · 0.76
test_applyMethod · 0.76
test_override_defaultMethod · 0.76
test_outputMethod · 0.76
test_destroyMethod · 0.76
test_planMethod · 0.76