-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: PC-14787 Enable specifying project in the command for importing #354
base: main
Are you sure you want to change the base?
feat: PC-14787 Enable specifying project in the command for importing #354
Conversation
5b8ac3c
to
3f56a22
Compare
3b8ec5a
to
6193c13
Compare
4d4356e
to
9ac41cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 minor comments, otherwise - LGTM.
Co-authored-by: Tomek Labuk <89924840+labtom@users.noreply.github.com>
Co-authored-by: Tomek Labuk <89924840+labtom@users.noreply.github.com>
…' of ssh://github.com/nobl9/terraform-provider-nobl9 into PC-14787-enable-specifying-project-in-tf-import-command
@@ -213,6 +213,17 @@ func resourceAgentDelete(ctx context.Context, d *schema.ResourceData, meta inter | |||
return nil | |||
} | |||
|
|||
func resourceAgentImport(_ context.Context, d *schema.ResourceData, _ interface{}) ([]*schema.ResourceData, error) { | |||
project, resourceID := parseImportID(d.Id()) | |||
if project != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what If project is empty? will it eventually use the default project? just asking
templates/index.md.tmpl
Outdated
@@ -27,6 +27,8 @@ The Nobl9 Terraform Provider does not support the configuration of the following | |||
- [SLO Annotations](https://docs.nobl9.com/features/slo-annotations/) | |||
- [Alert Silence](https://docs.nobl9.com/alerting/alert-silence/) | |||
|
|||
The Nobl9 Terraform Provider supports `terraform import` command. For project-bound resources, use `project_name/service_name` format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tend to use project-scoped, I think I've never seen project-bound phrasing before.
In addition, it seems we're not supporting all objects in this iteration, for instance Alert Policy, we should inform users about that (you can opt to list them here or just mention that selected ones are supported).
The Nobl9 Terraform Provider supports `terraform import` command. For project-bound resources, use `project_name/service_name` format. | |
The Nobl9 Terraform Provider supports `terraform import` command for selected objects. For project-scoped resources, use `project_name/object_name` format, for non-project-scoped resources simply provide the object's name. |
d.SetId(resourceID) | ||
return []*schema.ResourceData{d}, nil | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
placeholder comment: why we're not adding acceptance tests for import?
Release Notes
It's now possible to pass resource's project in the
terraform import
command, e.g.terraform import nobl9_agent.agent project_name/object_name
.