# ----------------------------------------------------------------------------
#
#     ***     AUTO GENERATED CODE    ***    Type: MMv1     ***
#
# ----------------------------------------------------------------------------
#
#     This file is automatically generated by Magic Modules and manual
#     changes will be clobbered when the file is regenerated.
#
#     Please read more about how to change this file in README.md and
#     CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------

title 'Test GCP google_compute_service_attachment resource.'

gcp_project_id = input(:gcp_project_id, value: 'gcp_project_id', description: 'The GCP project identifier.')

service_attachment = input('service_attachment', value: {
  "project": "ppradhan",
  "region": "us-central1",
  "service_attachment": "my-psc-ilb",
  "service_attachment_2": "my-psc-ilb-2",
  "kind": "compute#serviceAttachment",
  "name": "my-psc-ilb",
  "description": "my-psc-ilb is a private service connection for the internal load balancer",
  "self_link": "https://www.googleapis.com/compute/v1/projects/ppradhan/regions/us-central1/serviceAttachments/my-psc-ilb",
  "target_service": "https://www.googleapis.com/compute/v1/projects/ppradhan/regions/us-central1/forwardingRules/producer-forwarding-rule",
  "connection_preference": "ACCEPT_AUTOMATIC",
}, description: 'service_attachment description')

control 'google_compute_service_attachment-1.0' do
  impact 1.0
  title 'google_compute_service_attachment resource test'

  describe google_compute_service_attachment(project: gcp_project_id, region: service_attachment['region'], service_attachment: service_attachment['service_attachment']) do
  	it { should exist }
  	its('kind') { should cmp service_attachment['kind'] }
  	its('name') { should cmp service_attachment['name'] }
  	its('description') { should cmp service_attachment['description'] }
  	its('self_link') { should cmp service_attachment['self_link'] }
  	its('region') { should include service_attachment['region'] }
  	its('producer_forwarding_rule') { should cmp service_attachment['producer_forwarding_rule'] }
  	its('target_service') { should cmp service_attachment['target_service'] }
  	its('connection_preference') { should cmp service_attachment['connection_preference'] }
  end

  describe google_compute_service_attachment(project: gcp_project_id, region: service_attachment['region'], service_attachment: service_attachment['service_attachment_2']) do
  	it { should_not exist }
  end
end
