-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix build examples #114
Fix build examples #114
Conversation
5e1c775
to
29adb29
Compare
@@ -68,6 +68,7 @@ resource "unleash_project_access" "sample_project_access" { | |||
} | |||
|
|||
resource "unleash_project_access" "default_project_access" { | |||
project = "default" |
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 required by the resource definition
@@ -14,8 +14,8 @@ ProjectAccess schema | |||
|
|||
```terraform | |||
import { | |||
project = "default" | |||
to = unleash_project_access.default_project_access | |||
id = "default" |
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 property has to be id
import { | ||
id = 5 | ||
to = unleash_role.project_member_role | ||
} | ||
|
||
resource "unleash_role" "project_member_role" { | ||
permissions = [{ | ||
name = "CREATE_PROJECT" | ||
}, { | ||
name = "UPDATE_PROJECT" | ||
}, { | ||
name = "DELETE_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.
Removed cause we can't modify existing roles, import might work but in other circumstances such as running through the CLI. For predefined roles data should be used
@@ -0,0 +1,42 @@ | |||
import { |
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.
Added to the automated test
// validate if project was found | ||
if project.Id == "" { | ||
resp.Diagnostics.AddError(fmt.Sprintf("Project with id %s not found", state.Id.ValueString()), "NotFound") | ||
return | ||
} |
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 validation was missing
{ | ||
Config: `resource "unleash_project" "newly_imported" {}`, | ||
ImportStateId: "TestId2", | ||
ResourceName: "unleash_project.newly_imported", | ||
ImportState: true, | ||
ImportStateVerify: 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.
if state.SendEmail.IsNull() || state.SendEmail.IsUnknown() { | ||
state.SendEmail = types.BoolValue(false) | ||
} |
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.
When not defined should default to false
@@ -74,6 +74,34 @@ func TestAccUserResource(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func TestAccUserResourceImport(t *testing.T) { |
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.
Add import test as a different test suite because in the other one we run with CheckDestroy
which somehow messes up with the test import. I didn't dig too much on it, because this works
29adb29
to
8ec09b9
Compare
* chore: define import examples for resources * chore: define import examples for resources * chore: define import examples for resources * chore: define import examples for resources * Fix build examples (#114) --------- Co-authored-by: Gastón Fournier <[email protected]>
About the changes
Amends to original PR