-
Notifications
You must be signed in to change notification settings - Fork 156
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
Add resource and data sources for private registry GPG keys #1160
Conversation
} | ||
|
||
var organization string | ||
resp.Diagnostics.Append(r.config.dataOrDefaultOrganization(ctx, req.State, &organization)...) |
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.
This suffers from #1152, but there seems to be no good solution to it. I tried using ModifyPlan()
, but it will cause Provider produced inconsistent result after apply
errors for the updated_at
attribute unless it is marked as "unknown". That would be fine for one resource, but doesn't scale.
Sorry, the PR is big. But it can be reviewed a commit at a time. Or I can split it into three PRs if requested, although the data source commits depend on the first one. |
@tmatilai Thanks again for the contribution! I especially appreciate that you used the provider framework. I will be reviewing and testing this sometimes this week. |
Manages a public key of the GPG key pair used to sign releases of private providers in the private registry.
Retrieves a private registry GPG key.
Retrieves all private registry GPG keys of an organization.
087c92a
to
d53886b
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.
Great! I'm moving these commits to a repo branch in #1164
"organization": schema.StringAttribute{ | ||
Description: "Name of the organization. If omitted, organization must be defined in the provider config.", | ||
Optional: true, | ||
Computed: true, |
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.
This one will need a couple of plan modifiers: RequiresReplace
as well as another to detect when the provider organization changes (Thanks for the bug report!) as you pointed out. I accomplished this in d53886b by implementing ResourceWithModifyPlan
interface
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.
Ah, fine. I tried to do the organization change without replacing the whole resource, as the API supports it. And then I got into issues with the updated_at
attribute being changed only after apply (as those attributes seem hard to set to unset in a generic way).
You are free to do what ever you want with this branch, too. 🙂 |
Prefer local branch #1164 |
Description
Add
tfe_registry_gpg_key
resource and data source, andtfe_registry_gpg_keys
data source, for managing and retrieving private registry GPG keys.Related to #584.
Testing plan
Create and retrieve GPG keys with the new resource and data sources.
Example configuration
External links
Output from acceptance tests