-
Notifications
You must be signed in to change notification settings - Fork 160
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 ability to upload Policies in a PolicySet resource #333
Conversation
Add test Update go-tfe
Co-authored-by: Ryan Hall <[email protected]>
Co-authored-by: Ryan Hall <[email protected]>
Will squash and clean the commit message before merging. |
@@ -49,6 +49,27 @@ resource "tfe_policy_set" "test" { | |||
} | |||
``` | |||
|
|||
Local policies (non-VCS based usage, relies on Policy Set Version upload). |
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.
@@ -0,0 +1,35 @@ | |||
--- |
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.
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.
Looks awesome! I really like how this turned out.
if err != nil { | ||
t.Fatalf("Error removing file %v", err) | ||
} | ||
} |
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 is true of any test in this suite, no? If so, I'd say this is unnecessary but also harmless to leave!
I think the way to 'solve' these potential leftovers is via the use of sweepers, but that's not within our scope here of course.
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.
Not sure I follow. Do you mean that having the extra removeFile
function call below as a precaution isn't that useful because this would happen to any test fatal?
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.
Basically, yeah. It's a fix for this particular test but is something inherent to any of them. Harmless to leave, just figured I'd say I wouldn't expect it as that's a bigger issue with the whole suite 😩
Description
This PR augments the
tfe_policy_set
resource to allow uploading of local policies. This is done primarily through the use of PolicySetVersions.Example usage
This functionality only works when there is no VCS repo attached to a PolicySet. The usage is:
Behind the scenes, this creates a new PolicySetVersion and then Uploads the contents of the
source_path
in thetfe_slug
data source.Testing plan
make build
the provider. Make sure to enable development override for the provider.terraform init
tfe/test-fixtures/policy-set-version
directory to your local working directory underpolicies/my-policy-set
terraform apply
status
isready
. You can also curl to get the PolicySetVersion and confirm the status.policies/my-policy-set
directory and runterraform apply
and notice an PolicySet update taking place (terraform outputs 1 changed).Documentation
Images of the new documentation is put as a PR comment near the file.
External links
Closes #279
Output from acceptance tests