-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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 aws_quicksight_group resource #8233
Add aws_quicksight_group resource #8233
Conversation
677ed94
to
d29ac40
Compare
@bflad |
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.
Hey @kterada0509 👋 Good job as usual. Left some feedback below, please reach out with any questions or if you do not have time to implement the items.
"namespace": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Default: "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.
While there are currently no other valid values for this attribute, it also doesn't support in-place updates either so we should include ForceNew: true
for now. This can prevent potential issues in the future when other values are supported. 👍
Default: "default", | |
ForceNew: true, | |
Default: "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.
fixed.
aws/resource_aws_quicksight_group.go
Outdated
|
||
func resourceAwsQuickSightGroupParseID(id string) (string, string, string, error) { | ||
parts := strings.SplitN(id, "/", 3) | ||
if parts[0] == "" || parts[1] == "" || parts[2] == "" { |
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 parts[0] == "" || parts[1] == "" || parts[2] == "" { | |
if len(parts) < 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" { |
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.
fixed.
return err | ||
} | ||
|
||
if output.Group == 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.
if output.Group == nil { | |
if output == nil || output.Group == 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.
fixed.
Namespace: aws.String(namespace), | ||
GroupName: aws.String(groupName), | ||
}) | ||
if !isAWSErr(err, quicksight.ErrCodeResourceNotFoundException, "") { |
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 generally prefer to split this out so we can display any API errors 👍
if isAWSErr(err, quicksight.ErrCodeResourceNotFoundException, "") {
continue
}
if err != nil {
return err
}
return fmt.Errorf("Quick Sight Group '%s' was not deleted properly", rs.Primary.ID)
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.
fixed.
|
||
func testAccAWSQuickSightGroupConfig(rName string) string { | ||
return fmt.Sprintf(` | ||
provider "aws" { |
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.
removed.
aws/resource_aws_quicksight_group.go
Outdated
|
||
"aws_account_id": { | ||
Type: schema.TypeString, | ||
Required: 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 argument can be made optional by reading the AWS Account ID information from the provider itself, e.g.
awsAccountID := meta.(*AWSClient).accountid
namespace := d.Get("namespace").(string)
if v, ok := d.GetOk("aws_account_id"); ok {
awsAccountID = v.(string)
}
createOpts := &quicksight.CreateGroupInput{
AwsAccountId: aws.String(awsAccountID),
Namespace: aws.String(namespace),
GroupName: aws.String(d.Get("group_name").(string)),
}
Then the testing can/should omit the aws_caller_identity
data source. 👍
Required: true, | |
Optional: 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.
fixed.
Manages a Resource Quick Sight Group. | ||
--- | ||
|
||
# aws_quicksight_group |
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 likely added this to the other resource pages after this PR was submitted
# aws_quicksight_group | |
# Resource: aws_quicksight_group |
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.
fixed
|
||
```hcl | ||
resource "aws_quicksight_group" "example" { | ||
aws_account_id = "123456789123" |
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 this argument is made optional, let's omit this here as well. 👍
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.
fixed.
```hcl | ||
resource "aws_quicksight_group" "example" { | ||
aws_account_id = "123456789123" | ||
group_name = "tf-example" |
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.
Nit: formatting
group_name = "tf-example" | |
group_name = "tf-example" |
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.
fixed.
|
||
* `aws_account_id` - (Required) The ID for the AWS account that the group is in. Currently, you use the ID for the AWS account that contains your Amazon QuickSight account. | ||
* `group_name` - (Required) A name for the group. | ||
given by `source_ami_region`. |
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 looks extraneous 😉
given by `source_ami_region`. |
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. 😅
d29ac40
to
ee54c16
Compare
Re-run acctest
|
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.
LGTM, thanks for the updates, @kterada0509 🚀 (One minor note: after activating the subscription it looks like operators choose where the directory is located, so I removed the AWS_DEFAULT_REGION handling in the testing so it can be adjusted by anyone running the testing)
--- PASS: TestAccAWSQuickSightGroup_disappears (10.96s)
--- PASS: TestAccAWSQuickSightGroup_basic (22.27s)
--- PASS: TestAccAWSQuickSightGroup_withDescription (22.77s)
The new For further feature requests or bug reports with this resource, please create a new GitHub issue following the template for triage. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Reference #8146
Changes proposed in this pull request:
aws_quicksight_group
resourceOutput from acceptance testing: