Skip to content

Commit

Permalink
r/aws_licensemanager: Final tweaks to aws_licensemanager_license_conf…
Browse files Browse the repository at this point in the history
…iguration
  • Loading branch information
gazoakley committed Dec 14, 2018
1 parent 8ce85f7 commit b32e414
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
10 changes: 2 additions & 8 deletions aws/resource_aws_licensemanager_license_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,14 @@ func resourceAwsLicenseManagerLicenseConfigurationUpdate(d *schema.ResourceData,
opts := &licensemanager.UpdateLicenseConfigurationInput{
LicenseConfigurationArn: aws.String(d.Id()),
Name: aws.String(d.Get("name").(string)),
}

if v, ok := d.GetOk("description"); ok {
opts.Description = aws.String(v.(string))
Description: aws.String(d.Get("description").(string)),
LicenseCountHardLimit: aws.Bool(d.Get("license_count_hard_limit").(bool)),
}

if v, ok := d.GetOk("license_count"); ok {
opts.LicenseCount = aws.Int64(int64(v.(int)))
}

if v, ok := d.GetOk("license_count_hard_limit"); ok {
opts.LicenseCountHardLimit = aws.Bool(v.(bool))
}

log.Printf("[DEBUG] License Manager license configuration: %s", opts)

_, err := conn.UpdateLicenseConfiguration(opts)
Expand Down
8 changes: 3 additions & 5 deletions aws/resource_aws_licensemanager_license_configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func TestAccAWSLicenseManagerLicenseConfiguration_update(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckLicenseManagerLicenseConfigurationExists(resourceName, &licenseConfiguration),
resource.TestCheckResourceAttr(resourceName, "name", "NewName"),
resource.TestCheckResourceAttr(resourceName, "description", "NewDescription"),
resource.TestCheckResourceAttr(resourceName, "license_count", ""),
resource.TestCheckResourceAttr(resourceName, "description", ""),
resource.TestCheckResourceAttr(resourceName, "license_count", "123"),
resource.TestCheckResourceAttr(resourceName, "license_count_hard_limit", "false"),
resource.TestCheckResourceAttr(resourceName, "tags.%", "2"),
resource.TestCheckResourceAttr(resourceName, "tags.test", "test"),
Expand Down Expand Up @@ -204,9 +204,7 @@ resource "aws_licensemanager_license_configuration" "example" {
const testAccLicenseManagerLicenseConfigurationConfig_update = `
resource "aws_licensemanager_license_configuration" "example" {
name = "NewName"
description = "NewDescription"
# license_count = 99
license_count_hard_limit = false
license_count = 123
license_counting_type = "Socket"
license_rules = [
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/licensemanager_license_configuration.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ description: |-

Provides a License Manager license configuration resource.

~> **Note:** Removing the `license_count` attribute is not supported by the License Manager API - use `terraform taint aws_licensemanager_license_configuration.<id>` to recreate the resource instead.

## Example Usage

```hcl
Expand Down

0 comments on commit b32e414

Please sign in to comment.