Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXCDT-539: Miscellaneous tf generate cleanup ahead of release #845

Merged
merged 11 commits into from
Sep 15, 2023

Conversation

willvedd
Copy link
Contributor

@willvedd willvedd commented Sep 13, 2023

🔧 Changes

Tying-up some loose ends ahead of the auth0 tf generate functionality release. Added context inline with the changes.

🔬 Testing

Relevant changes to unit tests when applicable.

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

@willvedd willvedd requested a review from a team as a code owner September 13, 2023 19:55

It automatically scans your Auth0 Tenant and compiles a set of Terraform configuration files based on the existing resources and configurations.

Refer to the [instructional guide](https://registry.terraform.io/providers/auth0/auth0/latest/docs/guides/generate_terraform_config) for specific details on how to use this command.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Link isn't live yet but will be once auth0/terraform-provider-auth0#825 is merged and published.

@@ -28,7 +32,7 @@ auth0 terraform generate [flags]
```
--force Skip confirmation.
-o, --output-dir string Output directory for the generated Terraform config files. If not provided, the files will be saved in the current working directory. (default "./")
-r, --resources strings Resource types to generate Terraform config for. If not provided, config files for all available resources will be generated. (default [auth0_action,auth0_attack_protection,auth0_branding,auth0_client,auth0_client_grant,auth0_connection,auth0_custom_domain,auth0_email_provider,auth0_guardian,auth0_log_stream,auth0_organization,auth0_pages,auth0_prompt,auth0_prompt_custom_text,auth0_resource_server,auth0_role,auth0_tenant,auth0_trigger_actions])
-r, --resources strings Resource types to generate Terraform config for. If not provided, config files for all available resources will be generated. (default [auth0_action,auth0_attack_protection,auth0_branding,auth0_client,auth0_client_grant,auth0_connection,auth0_custom_domain,auth0_email_provider,auth0_guardian,auth0_organization,auth0_pages,auth0_prompt,auth0_prompt_custom_text,auth0_resource_server,auth0_role,auth0_tenant,auth0_trigger_actions])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auth0_log_stream had some issues during initial testing. Notably, the configuration that gets generated violates the TF provider validation. Removing it from the default list enables a better developer experience overall while we investigate how to generate valid config.

@@ -68,7 +68,7 @@ func (i *terraformInputs) parseResourceFetchers(api *auth0.API) ([]resourceDataF
fetchers = append(fetchers, &clientResourceFetcher{api})
case "auth0_client_grant":
fetchers = append(fetchers, &clientGrantResourceFetcher{api})
case "auth0_connection":
case "auth0_connection", "auth0_connection_clients":
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auth0_connection_clients resource, along with other relationship resources, is outputted along with the auth0_connection resource. The user does not have the option to specify one or the other, simply all or nothing. However, it may be confusing for users which want to specify these resources in the --resources argument. This change simply prevents any error that could occur.

@@ -264,7 +268,7 @@ func createMainFile(outputDIR string) error {
required_providers {
auth0 = {
source = "auth0/auth0"
version = "1.0.0-beta.1"
version = "1.0.0-beta.4"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet released but anticipating this release. It includes necessary fixes for this feature.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 96.77% and project coverage change: +0.17% 🎉

Comparison is base (c39fabf) 72.47% compared to head (e455268) 72.65%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #845      +/-   ##
==========================================
+ Coverage   72.47%   72.65%   +0.17%     
==========================================
  Files          91       92       +1     
  Lines       11773    11846      +73     
==========================================
+ Hits         8533     8607      +74     
+ Misses       2734     2733       -1     
  Partials      506      506              
Files Changed Coverage Δ
internal/cli/terraform_fetcher.go 98.03% <ø> (ø)
internal/cli/terraform.go 61.41% <75.00%> (+1.09%) ⬆️
internal/cli/actions.go 81.40% <100.00%> (ø)
internal/cli/cli.go 40.78% <100.00%> (-5.64%) ⬇️
internal/cli/management.go 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -233,7 +233,7 @@ func TestActionsInputSecretsToActionSecrets(t *testing.T) {
},
}
assert.Len(t, *res, 3)
assert.Equal(t, res, &expected)
assert.Equal(t, *res, expected)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing a flaky test.

@willvedd willvedd merged commit b160718 into main Sep 15, 2023
@willvedd willvedd deleted the DXCDT-539-final-tf-generate-cleanup branch September 15, 2023 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants