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

Cam stitt/policy set params nested vars #123

Merged
merged 7 commits into from
Feb 9, 2020

Conversation

cam-stitt
Copy link
Member

@cam-stitt cam-stitt commented Feb 6, 2020

Description

This PR adds support for policy set parameters, but also updates the workspace variable resource to utilize the "nested" routes that are now preferred.

The change made in workspace variables is not a breaking change and is backwards compatible with the existing setup.

Testing plan

An example of how to use policy set params:

resource "tfe_organization" "foobar" {
  name  = "tst-terraform"
  email = "admin@company.com"
}
resource "tfe_policy_set" "foobar" {
  name         = "policy-set-test"
  organization = "${tfe_organization.foobar.id}"
}
resource "tfe_policy_set_parameter" "foobar" {
  key          = "key_updated"
  value        = "value_updated"
  sensitive    = true
  policy_set_id = "${tfe_policy_set.foobar.id}"
}

External links

Output from acceptance tests

Note: I've had a few issues getting them to run locally, still trying to get this part done.

@ghost ghost added size/XXL and removed size/XL labels Feb 7, 2020
Copy link
Contributor

@lafentres lafentres left a comment

Choose a reason for hiding this comment

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

this is a little bit of a nit, but would it be possible to rename the policy parameter files to have the full name of the resource instead of an abbreviation? resource_tfe_policy_set_parameter.go?

other than that and a couple of questions/comments i had, i think this looks good. i created a few different variables and policy set params, and went through updating different attributes while testing and that all went well.

i'm excited that this PR will fix some of the tests as well 🎉 😀

Comment on lines +418 to 421
// No workspaces are returned for global policy sets
if len(policySet.Workspaces) != 0 {
return fmt.Errorf("Wrong number of workspaces: %v", len(policySet.Workspaces))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nice fix! 👏
was this something where we changed the api but didn't update the provider?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct! The API had been updated a while ago, but this seemed to have slipped through.

@cam-stitt cam-stitt merged commit dce9bfa into master Feb 9, 2020
@cam-stitt cam-stitt deleted the cam-stitt/policy-set-params-nested-vars branch February 9, 2020 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants