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

New resource: dedicated_host_group (compute) #5048

Closed
wants to merge 2 commits into from

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Dec 3, 2019

Add new resource dedicated_host_group, which belongs to Compute Provider.

A host group is a resource that represents a collection of dedicated hosts. You create a host group in a region and an availability zone, and add hosts to it.

Please refer to this link for more info.

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @magodo, i've left some comments inline to address before merge

Comment on lines +29 to +61
## Argument Reference

The following arguments are supported:

* `name` - (Required) The name of the dedicated host group.

* `resource_group_name` - (Required) The name of the resource group.


## Attributes Reference

The following attributes are exported:

* `id` - Resource Id

* `location` - Resource location

* `hosts` - A list of references to all dedicated `host`s in the dedicated host group. The definition of `host` is defined below.

* `platform_fault_domain_count` - Number of fault domains that the host group can span.

* `type` - Resource type

* `zones` - Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone.

* `tags` - Resource tags


---

The `host` block contains the following:

* `id` - Resource Id
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we flush out the docs here to be more consistent with the rest of the provider?

Comment on lines +53 to +55
* `id` - Resource Id

* `type` - Resource type
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we use full sentences here?


The `host` block contains the following:

* `id` - Resource Id
Copy link
Collaborator

Choose a reason for hiding this comment

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

And here?

func testAccAzureRMDedicatedHostGroup_complete(rInt int, location string, rName string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
name = "acctestRG-%d"
name = "acctestRG-compute-%d"

Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.NoEmptyStrings,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we properly validate this with regex?

if err := d.Set("hosts", flattenArmDedicatedHostGroupSubResourceReadOnly(dedicatedHostGroupProperties.Hosts)); err != nil {
return fmt.Errorf("Error setting `hosts`: %+v", err)
}
d.Set("platform_fault_domain_count", int(*dedicatedHostGroupProperties.PlatformFaultDomainCount))
Copy link
Collaborator

Choose a reason for hiding this comment

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

we don't need to deref and convert for top level properties

Suggested change
d.Set("platform_fault_domain_count", int(*dedicatedHostGroupProperties.PlatformFaultDomainCount))
d.Set("platform_fault_domain_count", dedicatedHostGroupProperties.PlatformFaultDomainCount)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why is that? I assume a schema.TypeInt corresponds to int, not int32.

d.Set("platform_fault_domain_count", int(*dedicatedHostGroupProperties.PlatformFaultDomainCount))
}
d.Set("type", resp.Type)
if resp.Zones != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the flatten function does this check?

}
d.Set("type", resp.Type)
if resp.Zones != nil {
d.Set("zones", utils.FlattenStringSlice(resp.Zones))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we check for an error here?

@@ -0,0 +1,61 @@
---
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we add this to the index.erb

@@ -0,0 +1,70 @@
---
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we add this file to the index.erb

@magodo
Copy link
Collaborator Author

magodo commented Jan 2, 2020

@katbyte, this PR is filed before the refactor you've made. Now I think I'd better to reflect the refactoring to this resource with your comment applied and raise another PR.

@magodo
Copy link
Collaborator Author

magodo commented Jan 4, 2020

Replaced by #5307

@ghost ghost removed the waiting-response label Jan 4, 2020
@ghost
Copy link

ghost commented Mar 29, 2020

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. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants