You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-11Lines changed: 36 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -24,23 +24,27 @@ Usage:
24
24
cf-terraforming [command]
25
25
26
26
Available Commands:
27
+
completion Generate the autocompletion script for the specified shell
27
28
generate Fetch resources from the Cloudflare API and generate the respective Terraform stanzas
28
29
help Help about any command
29
30
import Output `terraform import` compatible commands in order to import resources into state
30
31
version Print the version number of cf-terraforming
31
32
32
33
Flags:
33
-
-a, --account string Use specific account ID for commands
34
-
-c, --config string Path to configuration file (default is $HOME/.cf-terraforming.yaml)
35
-
-e, --email string API Email address associated with your account
36
-
-h, --help Help for cf-terraforming
37
-
-k, --key string API Key generated on the 'My Profile' page. See: https://dash.cloudflare.com/profile
38
-
--resource-type string Which resource you wish to generate
39
-
--terraform-binary-path string Path to an existing Terraform binary (otherwise, one will be downloaded)
40
-
--terraform-install-path string Path to an initialized Terraform working directory (default ".")
41
-
-t, --token string API Token
42
-
-v, --verbose Specify verbose output (same as setting log level to debug)
43
-
-z, --zone string Limit the export to a single zone ID
34
+
-a, --account string Use specific account ID for commands
35
+
-c, --config string Path to config file (default "/Users/jacob/.cf-terraforming.yaml")
36
+
-e, --email string API Email address associated with your account
37
+
-h, --help help for cf-terraforming
38
+
--hostname string Hostname to use to query the API
39
+
-k, --key string API Key generated on the 'My Profile' page. See: https://dash.cloudflare.com/profile
40
+
--modern-import-block terraform import Whether to generate HCL import blocks for generated resources instead of terraform import compatible CLI commands. This is only compatible with Terraform 1.5+
41
+
--provider-registry-hostname string Hostname to use for provider registry lookups (default "registry.terraform.io")
42
+
--resource-type string Which resource you wish to generate
43
+
--terraform-binary-path string Path to an existing Terraform binary (otherwise, one will be downloaded)
44
+
--terraform-install-path string Path to an initialized Terraform working directory (default ".")
45
+
-t, --token string API Token
46
+
-v, --verbose Specify verbose output (same as setting log level to debug)
47
+
-z, --zone string Limit the export to a single zone ID
44
48
45
49
Use "cf-terraforming [command] --help" for more information about a command.
46
50
```
@@ -164,6 +168,27 @@ $ cf-terraforming import \
164
168
--zone $CLOUDFLARE_ZONE_ID
165
169
```
166
170
171
+
## Using non-standard registries
172
+
173
+
By default, we use the Hashicorp registry (registry.terraform.io) for looking up
174
+
the provider to introspect the schema. If you are attempting to use another
175
+
registry, you will need to provide the `--provider-registry-hostname` flag or
176
+
`CLOUDFLARE_PROVIDER_REGISTRY_HOSTNAME` environment variable to query the correct
177
+
registry.
178
+
179
+
## Using non-standard Terraform binaries
180
+
181
+
Internally, we use [`terraform-exec`](https://github.com/hashicorp/terraform-exec)
182
+
library to run Terraform operations in the same way that the CLI tooling would.
183
+
If a `terraform` binary is not available on your system path, we will attempt
184
+
to download the latest to use it.
185
+
186
+
Should you have the binary stored in a non-standard location, want to use an
187
+
existing binary, or you wish to provide a Terraform compatible binary (such as
188
+
`tofu`), you need to provide the `--terraform-binary-path` flag or
189
+
`CLOUDFLARE_TERRAFORM_BINARY_PATH` environment variable to instruct
190
+
`cf-terraforming` which you expect to use.
191
+
167
192
## Supported Resources
168
193
169
194
Any resources not listed are currently not supported.
// Here you will define your flags and configuration settings.
46
-
// Cobra supports persistent flags, which, if defined here,
47
-
// will be global for your application.
48
45
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", home+"/.cf-terraforming.yaml", "Path to config file")
46
+
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Specify verbose output (same as setting log level to debug)")
47
+
rootCmd.PersistentFlags().StringVar(&resourceType, "resource-type", "", "Which resource you wish to generate")
48
+
rootCmd.PersistentFlags().BoolVarP(&useModernImportBlock, "modern-import-block", "", false, "Whether to generate HCL import blocks for generated resources instead of `terraform import` compatible CLI commands. This is only compatible with Terraform 1.5+")
49
49
50
-
// Zone selection
51
50
rootCmd.PersistentFlags().StringVarP(&zoneID, "zone", "z", "", "Limit the export to a single zone ID")
rootCmd.PersistentFlags().StringVar(&terraformBinaryPath, "terraform-binary-path", "", "Path to an existing Terraform binary (otherwise, one will be downloaded)")
rootCmd.PersistentFlags().BoolVarP(&useModernImportBlock, "modern-import-block", "", false, "Whether to generate HCL import blocks for generated resources instead of `terraform import` compatible CLI commands. This is only compatible with Terraform 1.5+")
114
+
rootCmd.PersistentFlags().StringVarP(&providerRegistryHostname, "provider-registry-hostname", "", "registry.terraform.io", "Hostname to use for provider registry lookups")
0 commit comments