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 & DataSource: azurerm_healthcare_service #4221

Merged
merged 105 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
d2700d6
Initial creation of FHIR API Sertvice components. All CRUD operations
MedalLance Jul 29, 2019
927edaf
add tests for fhir services
kutsovmqs Sep 2, 2019
17a9656
add tests for fhir services
kutsovmqs Sep 3, 2019
d49f636
rename fhir service to healthcare service
kutsovmqs Sep 4, 2019
0402ef1
minor fixes
kutsovmqs Sep 5, 2019
07400ae
resolve conflicts
kutsovmqs Sep 10, 2019
4418873
resolve conflicts
kutsovmqs Sep 11, 2019
2cfa2dd
resolve conflicts
kutsovmqs Sep 11, 2019
84ef840
Merge branch 'master' into fhir-api-rm-tests
kutsovmqs Sep 11, 2019
65e19c8
resolve conflicts
kutsovmqs Sep 11, 2019
fa9df1c
Merge branch 'fhir-api-rm-tests' of github.com:medal-labs/terraform-p…
kutsovmqs Sep 11, 2019
0438ae3
resolve conflicts
kutsovmqs Sep 11, 2019
a0523eb
make lint fixes
kutsovmqs Sep 12, 2019
f423b20
Merge branch 'master' into fhir-api-rm-tests
MedalLance Sep 12, 2019
051775d
Update azurerm/resource_arm_healthcare_service_test.go
MedalLance Sep 12, 2019
35effb5
Update azurerm/resource_arm_healthcare_service.go
MedalLance Sep 12, 2019
c5a3b52
implemented reviewer requests
MedalLance Sep 12, 2019
45d299c
fix for lint check
kutsovmqs Sep 13, 2019
faa823b
fix for lint check
kutsovmqs Sep 13, 2019
97736e6
fix for lint check
kutsovmqs Sep 13, 2019
0b0d097
fix for lint check
kutsovmqs Sep 13, 2019
6a57550
fix for lint check
kutsovmqs Sep 13, 2019
235942c
fix for lint check
kutsovmqs Sep 13, 2019
7f95a3a
fix for lint check
kutsovmqs Sep 13, 2019
8d37405
fix for lint check
kutsovmqs Sep 13, 2019
11b7f15
Update azurerm/resource_arm_healthcare_service_test.go
MedalLance Sep 13, 2019
2172800
Update azurerm/resource_arm_healthcare_service.go
MedalLance Sep 13, 2019
44ffd58
Update azurerm/resource_arm_healthcare_service.go
MedalLance Sep 13, 2019
19a1098
Update azurerm/resource_arm_healthcare_service.go
MedalLance Sep 13, 2019
9746a36
Update azurerm/resource_arm_healthcare_service.go
MedalLance Sep 13, 2019
7120c5e
Update azurerm/data_source_healthcare_service.go
MedalLance Sep 13, 2019
f29b31a
Some PR change requests addressed.
MedalLance Sep 13, 2019
19546b3
lint fix
MedalLance Sep 13, 2019
b4e3f11
update required resource provider list
kutsovmqs Sep 16, 2019
7590eaf
minor fixes
kutsovmqs Sep 16, 2019
c9f37a6
minor fixes
kutsovmqs Sep 16, 2019
7e08fb5
Some PR change requests addressed
kutsovmqs Sep 17, 2019
71a9f12
Some PR change requests addressed
kutsovmqs Sep 17, 2019
b078fe3
Some PR change requests addressed
kutsovmqs Sep 18, 2019
7ed5454
add cors_configuration and authentication_configuration in resource_a…
kutsovmqs Sep 19, 2019
1d65afa
add cors_configuration and authentication_configuration in resource_a…
kutsovmqs Sep 19, 2019
3c4f424
add cors_configuration and authentication_configuration in resource_a…
kutsovmqs Sep 24, 2019
b7f5224
Merge branch 'master' into fhir-api-rm-tests
kutsovmqs Sep 24, 2019
71fa8b1
add cors_configuration and authentication_configuration in resource_a…
kutsovmqs Sep 24, 2019
7e2a01b
Merge branch 'fhir-api-rm-tests' of github.com:medal-labs/terraform-p…
kutsovmqs Sep 24, 2019
eaecd2e
lint fixed
kutsovmqs Sep 25, 2019
552e652
lint fixed
kutsovmqs Sep 25, 2019
a6e0e12
lint fixes
kutsovmqs Sep 25, 2019
865bcb0
lint fixes
kutsovmqs Sep 25, 2019
1eb2bfe
lint fixes
kutsovmqs Sep 25, 2019
b132f31
lint fixes
kutsovmqs Sep 25, 2019
c6e1646
small fixes
kutsovmqs Sep 26, 2019
c97ae7d
Adding documentation for Healthcare Service
MedalLance Sep 26, 2019
24f129b
add files to vendor
kutsovmqs Oct 1, 2019
41879fe
Merge branch 'master' into fhir-api-rm-tests
kutsovmqs Oct 7, 2019
669c3a5
Merge branch 'master' into fhir-api-rm-tests
kutsovmqs Oct 7, 2019
6b7f4ca
Merge branch 'fhir-api-rm-tests' of github.com:medal-labs/terraform-p…
kutsovmqs Oct 7, 2019
e8cfa7d
Update website/docs/r/healthcare_service.html.markdown
kutsovmqs Oct 7, 2019
8b8ec17
Update website/docs/r/healthcare_service.html.markdown
kutsovmqs Oct 7, 2019
6d3d9a0
Update website/docs/r/healthcare_service.html.markdown
kutsovmqs Oct 7, 2019
770a93d
Update website/docs/d/healthcare_service.html.markdown
kutsovmqs Oct 7, 2019
40b1fbd
Update website/docs/r/healthcare_service.html.markdown
kutsovmqs Oct 7, 2019
f1b1bc1
Update azurerm/resource_arm_healthcare_service_test.go
kutsovmqs Oct 7, 2019
cd8eff3
Update azurerm/resource_arm_healthcare_service_test.go
kutsovmqs Oct 7, 2019
79baa98
Update azurerm/resource_arm_healthcare_service_test.go
kutsovmqs Oct 7, 2019
7de3019
small fixes
kutsovmqs Oct 7, 2019
7534a31
Merge branch 'fhir-api-rm-tests' of github.com:medal-labs/terraform-p…
kutsovmqs Oct 7, 2019
8ca4b5f
small fixes
kutsovmqs Oct 7, 2019
71e62e0
Merge branch 'master' into fhir-api-rm-tests
kutsovmqs Oct 7, 2019
76df71c
mod vendor
kutsovmqs Oct 7, 2019
ec9d6ef
mod vendor
kutsovmqs Oct 7, 2019
95b6998
small fixes
kutsovmqs Oct 8, 2019
b7fad2b
Merge branch 'master' into fhir-api-rm-tests
kutsovmqs Oct 8, 2019
a248102
small fixes
kutsovmqs Oct 8, 2019
4ddd542
Update azurerm/data_source_healthcare_service.go
kutsovmqs Oct 10, 2019
c653764
Update website/docs/r/healthcare_service.html.markdown
kutsovmqs Oct 10, 2019
a23ef9c
Update azurerm/resource_arm_healthcare_service_test.go
kutsovmqs Oct 10, 2019
b1960df
Update website/docs/d/healthcare_service.html.markdown
kutsovmqs Oct 10, 2019
f508354
Update azurerm/data_source_healthcare_service.go
kutsovmqs Oct 10, 2019
98dbc76
small fixes
kutsovmqs Oct 10, 2019
f9366b4
small fixes
kutsovmqs Oct 10, 2019
a7b425f
small fixes
kutsovmqs Oct 10, 2019
7d651af
small fixes
kutsovmqs Oct 10, 2019
307c1bb
Merge branch 'master' into fhir-api-rm-tests
kutsovmqs Oct 15, 2019
a6fdaa1
updated to azure-sdk-for-go v34.1.0
kutsovmqs Oct 15, 2019
112ca18
updated to azure-sdk-for-go v34.1.0
kutsovmqs Oct 15, 2019
bafab0f
add healthcareapi package to vendor
kutsovmqs Oct 15, 2019
44f9314
Documentation updates
MedalLance Oct 15, 2019
facef7f
Update website/docs/r/healthcare_service.html.markdown
MedalLance Oct 23, 2019
551e420
Update azurerm/data_source_healthcare_service_test.go
MedalLance Oct 23, 2019
edbff2f
Update website/docs/d/healthcare_service.html.markdown
MedalLance Oct 23, 2019
1077607
Update azurerm/data_source_healthcare_service.go
MedalLance Oct 23, 2019
fead4ab
Update azurerm/data_source_healthcare_service.go
MedalLance Oct 23, 2019
451e47d
Update azurerm/data_source_healthcare_service.go
MedalLance Oct 23, 2019
e3ba590
Update azurerm/resource_arm_healthcare_service.go
MedalLance Oct 23, 2019
a7adf26
Update azurerm/resource_arm_healthcare_service.go
MedalLance Oct 23, 2019
9be88eb
Update website/docs/d/healthcare_service.html.markdown
MedalLance Oct 23, 2019
66680a6
Update azurerm/resource_arm_healthcare_service_test.go
MedalLance Oct 23, 2019
d462baf
Update azurerm/resource_arm_healthcare_service_test.go
MedalLance Oct 23, 2019
ae378fd
Update website/docs/d/healthcare_service.html.markdown
MedalLance Oct 23, 2019
8525a48
Requested changes for PR 4221 - 10-23-19
MedalLance Oct 24, 2019
b3ad585
change for tflint error
MedalLance Oct 24, 2019
a7a838f
Docuemntation and test name generation requested changes
MedalLance Oct 24, 2019
603572b
Update healthcare_service.html.markdown
katbyte Oct 25, 2019
516037e
Update healthcare_service.html.markdown
katbyte Oct 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/frontdoor"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/graph"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/hdinsight"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/healthcare"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/iothub"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/keyvault"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/kusto"
Expand Down Expand Up @@ -111,6 +112,7 @@ type ArmClient struct {
Frontdoor *frontdoor.Client
Graph *graph.Client
HDInsight *hdinsight.Client
Healthcare *healthcare.Client
IoTHub *iothub.Client
KeyVault *keyvault.Client
Kusto *kusto.Client
Expand Down Expand Up @@ -245,6 +247,7 @@ func getArmClient(authConfig *authentication.Config, skipProviderRegistration bo
client.Frontdoor = frontdoor.BuildClient(o)
client.Graph = graph.BuildClient(o)
client.HDInsight = hdinsight.BuildClient(o)
client.Healthcare = healthcare.BuildClient(o)
client.IoTHub = iothub.BuildClient(o)
client.KeyVault = keyvault.BuildClient(o)
client.Kusto = kusto.BuildClient(o)
Expand Down
157 changes: 157 additions & 0 deletions azurerm/data_source_healthcare_service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
package azurerm

import (
"fmt"
"log"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

func dataSourceArmHealthcareService() *schema.Resource {
katbyte marked this conversation as resolved.
Show resolved Hide resolved
return &schema.Resource{
Read: dataSourceArmHealthcareServiceRead,

Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validate.NoEmptyStrings,
},
katbyte marked this conversation as resolved.
Show resolved Hide resolved

"location": azure.SchemaLocation(),

"resource_group_name": azure.SchemaResourceGroupName(),

"kind": {
Type: schema.TypeString,
Computed: true,
},

"cosmosdb_throughput": {
Type: schema.TypeInt,
Computed: true,
},

"access_policy_object_ids": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},

"authentication_configuration": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"authority": {
Type: schema.TypeString,
Computed: true,
},
"audience": {
Type: schema.TypeString,
Computed: true,
},
"smart_proxy_enabled": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},

"cors_configuration": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"allowed_origins": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"allowed_headers": {
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"allowed_methods": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"max_age_in_seconds": {
Type: schema.TypeInt,
Computed: true,
},
"allow_credentials": {
Type: schema.TypeBool,
Computed: true,
},
},
},
},

"tags": tagsSchema(),
},
}
}

func dataSourceArmHealthcareServiceRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*ArmClient).Healthcare.HealthcareServiceClient
ctx := meta.(*ArmClient).StopContext

name := d.Get("name").(string)
resourceGroup := d.Get("resource_group_name").(string)

resp, err := client.Get(ctx, resourceGroup, name)
if err != nil {
if utils.ResponseWasNotFound(resp.Response) {
log.Printf("[WARN] Healthcare Service %q was not found (Resource Group %q)", name, resourceGroup)
d.SetId("")
return fmt.Errorf("HealthCare Service %q was not found in Resource Group %q", name, resourceGroup)
}
return fmt.Errorf("Error making Read request on Azure Healthcare Service %q (Resource Group %q): %+v", name, resourceGroup, err)
}

d.SetId(*resp.ID)
if kind := resp.Kind; string(kind) != "" {
d.Set("kind", kind)
}

if properties := resp.Properties; properties != nil {
if accessPolicies := properties.AccessPolicies; accessPolicies != nil {
d.Set("access_policy_object_ids", flattenHealthcareAccessPolicies(accessPolicies))
}

katbyte marked this conversation as resolved.
Show resolved Hide resolved
if config := properties.CosmosDbConfiguration; config != nil {
d.Set("cosmosdb_throughput", config.OfferThroughput)
}

if authConfig := properties.AuthenticationConfiguration; authConfig != nil {
if err := d.Set("authentication_configuration", flattenHealthcareAuthConfig(authConfig)); err != nil {
return fmt.Errorf("Error setting `authentication_configuration`: %+v", flattenHealthcareAuthConfig(authConfig))
}
}

if corsConfig := properties.CorsConfiguration; corsConfig != nil {
if err := d.Set("cors_configuration", flattenHealthcareCorsConfig(corsConfig)); err != nil {
return fmt.Errorf("Error setting `cors_configuration`: %+v", flattenHealthcareCorsConfig(corsConfig))
}
}
}

return tags.FlattenAndSet(d, resp.Tags)
}
46 changes: 46 additions & 0 deletions azurerm/data_source_healthcare_service_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package azurerm

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
)

func TestAccAzureRMDataSourceHealthcareService_basic(t *testing.T) {
dataSourceName := "data.azurerm_healthcare_service.test"
ri := tf.AccRandTimeInt() / 10
location := testLocation()
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMHealthcareServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMDataSourceHealthcareService_basic(ri, location),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(dataSourceName, "name"),
resource.TestCheckResourceAttrSet(dataSourceName, "location"),
resource.TestCheckResourceAttrSet(dataSourceName, "resource_group_name"),
resource.TestCheckResourceAttrSet(dataSourceName, "kind"),
resource.TestCheckResourceAttrSet(dataSourceName, "cosmosdb_throughput"),
resource.TestCheckResourceAttr(dataSourceName, "tags.%", "2"),
),
},
},
})
}

func testAccAzureRMDataSourceHealthcareService_basic(rInt int, location string) string {
resource := testAccAzureRMHealthcareService_basic(rInt)
return fmt.Sprintf(`
%s

data "azurerm_healthcare_service" "test" {
name = "${azurerm_healthcare_service.test.name}"
resource_group_name = "${azurerm_healthcare_service.test.resource_group_name}"
location = "${azurerm_resource_group.test.location}"
}
`, resource)
}
19 changes: 19 additions & 0 deletions azurerm/internal/services/healthcare/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package healthcare

import (
healthcare "github.com/Azure/azure-sdk-for-go/services/healthcareapis/mgmt/2019-09-16/healthcareapis"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/common"
)

type Client struct {
HealthcareServiceClient *healthcare.ServicesClient
}

func BuildClient(o *common.ClientOptions) *Client {
HealthcareServiceClient := healthcare.NewServicesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId)
o.ConfigureClient(&HealthcareServiceClient.Client, o.ResourceManagerAuthorizer)

return &Client{
HealthcareServiceClient: &HealthcareServiceClient,
}
}
2 changes: 2 additions & 0 deletions azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_firewall": dataSourceArmFirewall(),
"azurerm_image": dataSourceArmImage(),
"azurerm_hdinsight_cluster": dataSourceArmHDInsightSparkCluster(),
"azurerm_healthcare_service": dataSourceArmHealthcareService(),
"azurerm_maps_account": dataSourceArmMapsAccount(),
"azurerm_key_vault_access_policy": dataSourceArmKeyVaultAccessPolicy(),
"azurerm_key_vault_key": dataSourceArmKeyVaultKey(),
Expand Down Expand Up @@ -286,6 +287,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_hdinsight_rserver_cluster": resourceArmHDInsightRServerCluster(),
"azurerm_hdinsight_spark_cluster": resourceArmHDInsightSparkCluster(),
"azurerm_hdinsight_storm_cluster": resourceArmHDInsightStormCluster(),
"azurerm_healthcare_service": resourceArmHealthcareService(),
"azurerm_image": resourceArmImage(),
"azurerm_iot_dps": resourceArmIotDPS(),
"azurerm_iot_dps_certificate": resourceArmIotDPSCertificate(),
Expand Down
1 change: 1 addition & 0 deletions azurerm/required_resource_providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func requiredResourceProviders() map[string]struct{} {
"Microsoft.EventGrid": {},
"Microsoft.EventHub": {},
"Microsoft.HDInsight": {},
"Microsoft.Healthcare": {},
"Microsoft.KeyVault": {},
"Microsoft.Kusto": {},
"microsoft.insights": {},
Expand Down
Loading