Skip to content

Commit

Permalink
Merge pull request #537 from akshith-gunasheelan/Automation_changes
Browse files Browse the repository at this point in the history
Automation changes for terraform SDK
  • Loading branch information
akshith-gunasheelan authored Jun 16, 2023
2 parents 68326a6 + d081872 commit a407d92
Show file tree
Hide file tree
Showing 72 changed files with 278 additions and 307 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ provider "oneview" {
}

data "oneview_appliance_snmp_v1_trap_destinations" "snmp_v1" {
destination_id = "4"
destination_id = "<destination_id>"
}

output "oneview_snmp_v1_trap_destinations_value" {
Expand Down
6 changes: 3 additions & 3 deletions examples/appliance_snmp_v1_trap_destinations/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ provider "oneview" {
# Creates SNMPv1 Trap Destination with id 5

resource "oneview_appliance_snmp_v1_trap_destinations" "snmp_v1" {
destination_id = "5"
community_string = "Test2"
destination = "192.0.16.4"
destination_id = "<destination_id>"
community_string = "<community_string>"
destination = "<destination_address>"
port = 162
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ provider "oneview" {

# Updates port to 172 and Community String to "Test5"
resource "oneview_appliance_snmp_v1_trap_destinations" "snmp_v1" {
destination_id = "81"
community_string = "Test5"
destination = "192.0.16.4"
destination_id = "<destination_id>"
community_string = "<community_string_rename>"
destination = "<destination_address>"
port = 172
}
6 changes: 1 addition & 5 deletions examples/appliance_snmpv3_trap_destinations/data_source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@ provider "oneview" {

# Testing data source
data "oneview_appliance_snmpv3_trap_destinations" "snmptrap" {
id_field = "67003649-af34-4a92-a46a-137855ddc8f7"
}

output "oneview_snmpv3_trap_destinations" {
value = data.oneview_appliance_snmpv3_trap_destinations.snmptrap
id_field = ""
}
8 changes: 6 additions & 2 deletions examples/appliance_snmpv3_trap_destinations/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ provider "oneview" {
ov_ifmatch = "*"
}

data "oneview_appliance_snmpv3_user" "snmptrap" {
user_name = "user"
}

# Creates SNMPv3 Trap Destination
resource "oneview_appliance_snmpv3_trap_destinations" "snmptrap" {
destination_address = "1.1.1.1"
destination_address = "<destination_address>"
port = 162
user_id = "41b96bbb-8f31-44e1-a3aa-8681e3d7c56c"
user_id = data.oneview_appliance_snmpv3_user.snmptrap.user_id
}
11 changes: 8 additions & 3 deletions examples/appliance_snmpv3_trap_destinations/update_resource.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

provider "oneview" {
ov_username = var.username
ov_password = var.password
Expand All @@ -7,9 +8,13 @@ provider "oneview" {
ov_ifmatch = "*"
}

data "oneview_appliance_snmpv3_user" "snmptrap" {
user_name = "<user_name_terra>"
}

# Update SNMPv3 Trap Destination - changing port 162 to 190
resource "oneview_appliance_snmpv3_trap_destinations" "snmptrap" {
destination_address = "1.1.1.1"
destination_address = "<destination_address>"
port = 190
user_id = "41b96bbb-8f31-44e1-a3aa-8681e3d7c56c"
}
user_id = data.oneview_appliance_snmpv3_user.snmptrap.user_id
}
2 changes: 1 addition & 1 deletion examples/appliance_snmpv3_user/data_source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ provider "oneview" {
ov_ifmatch = "*"
}
data "oneview_appliance_snmpv3_user" "snmpv3user" {
user_name="user"
user_name = "<user_name_terra>"
}
output "oneview_appliance_snmpv3_user_uri" {
value = data.oneview_appliance_snmpv3_user.snmpv3user.uri
Expand Down
10 changes: 5 additions & 5 deletions examples/appliance_snmpv3_user/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ provider "oneview" {
}
# Create SNMPv3 User
resource "oneview_appliance_snmpv3_user" "snmpvuser" {
user_name = "user"
security_level = "Authentication and privacy"
authentication_protocol = "SHA1"
authentication_passphrase = "authPass"
user_name = "<user_name_terra>"
security_level = "<security_level_terra>"
authentication_protocol = "<authentication_protocol_terra>"
authentication_passphrase = "<authentication_passphrase_terra>"
privacy_protocol = "AES-128"
privacy_passphrase = "1234567812345678"
}
}
8 changes: 4 additions & 4 deletions examples/appliance_snmpv3_user/update_resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ provider "oneview" {
}
# Update SNMPv3 User
resource "oneview_appliance_snmpv3_user" "snmpvuser" {
user_name = "user"
security_level = "Authentication and privacy"
authentication_protocol = "SHA1"
authentication_passphrase = "authPas121s"
user_name = "<user_name_terra>"
security_level = "<security_level_terra>"
authentication_protocol = "<authentication_protocol_terra>"
authentication_passphrase = "<authentication_passphrase_terra2>"
privacy_protocol = "AES-128"
privacy_passphrase = "1234567812345600"
}
2 changes: 1 addition & 1 deletion examples/appliance_time_and_locale_configuration/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ provider "oneview" {
resource "oneview_appliance_time_and_locale" "timelocale" {
locale = "en_US.UTF-8"
timezone = "UTC"
ntp_servers = ["16.110.135.123", "16.85.40.52"]
ntp_servers = [ "<ntp_server>" , "<ntp_server2>" ]
}
2 changes: 1 addition & 1 deletion examples/certificates_server/data_source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ provider "oneview" {
# Any one of the these fields can used to get data source
data "oneview_server_certificate" "sc" {
# alias_name = "hm_cert"
remote_ip = "<Server_IP>"
remote_ip = "<remote_server_terra>"
}

output "oneview_server_certificate_value" {
Expand Down
2 changes: 1 addition & 1 deletion examples/certificates_server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ provider "oneview" {

data "oneview_server_certificate" "sc" {
# alias_name = "hm_cert"
remote_ip = "<Server_IP>"
remote_ip = "<remote_server_terra>"
}

output "oneview_server_certificate_value" {
Expand Down
11 changes: 1 addition & 10 deletions examples/connection_templates/data_source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,9 @@ provider "oneview" {
# Testing data source
# Gets connection template data from name
data "oneview_connection_templates" "connectionTemplates" {
name = "defaultConnectionTemplate"
name = "renamed-connection-template"
}

output "oneview_connection_template_value" {
value = data.oneview_connection_templates.connectionTemplates
}

# Gets connection template data from uri
data "oneview_connection_templates" "connectionTemplatesURI" {
uri = data.oneview_connection_templates.connectionTemplates.uri
}

output "oneview_connection_template_valueURI" {
value = data.oneview_connection_templates.connectionTemplatesURI.name
}
17 changes: 8 additions & 9 deletions examples/connection_templates/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@ provider "oneview" {
ov_ifmatch = "*"
}

# To update typical and maximum bandwidth values of any network, you will need to fetch the respective connection template uri from a network as below:
/*
data "oneview_ethernet_network" "network" {
name = "test-network"
name = "Auto_Ethernet_1"
}
output "connection_template_uri" {
value = data.oneview_ethernet_network.network.connection_template_uri
}

/*Then you will need to import the connection template and update typical and maximum bandwidth values.
To import an existing connection template, retain this configuration and run below command.
$ terraform import oneview_connection_templates.connectionTemplates #connection-template-uri#
Then just update the update_resource.tf with your desired values and execute it.
*/
# Then you will need to import the connection template and update typical and maximum bandwidth values.
# To import an existing connection template, retain this configuration and run below command.
# $ terraform import oneview_connection_templates.connectionTemplates <connection-template-uri>
# Then just update the update_resource.tf with your desired values and execute it.

resource "oneview_connection_templates" "connectionTemplates" {
}
#resource "oneview_connection_templates" "connectionTemplates" {
#}
3 changes: 1 addition & 2 deletions examples/enclosure_groups/data_source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ data "oneview_enclosure_group" "enclosure_group" {

output "oneview_enclosure_group_value" {
value = data.oneview_enclosure_group.enclosure_group.uri
}

}
3 changes: 1 addition & 2 deletions examples/enclosure_groups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ variable "LIG_name" {
variable "enc_grp" {
type = string
description = "Name of the Enclosure Group"
default = "EG"
default = "Auto-EG"
}

variable "scope_name_1" {
Expand All @@ -40,4 +40,3 @@ resource "oneview_enclosure_group" "eg_inst" {
logical_interconnect_group_name = "${var.LIG_name}"
}
}

5 changes: 2 additions & 3 deletions examples/enclosure_groups/update_resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ resource "oneview_enclosure_group" "eg_inst" {
interconnect_bay = 6
logical_interconnect_group_name = "${var.LIG_name}"
}
interconnect_bay_mapping_count = 2
type = "EnclosureGroupV8"
# interconnect_bay_mapping_count = 2
# type = "EnclosureGroupV8"
stacking_mode = "Enclosure"
}

8 changes: 1 addition & 7 deletions examples/enclosures/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,27 @@ provider "oneview" {
description = "Enclosure IP Address"
default = "https://x.x.x.x"
}
variable "enc_username" {
type = "string"
description = "Enclosure Username"
default = "username"
}
variable "enc_password" {
type = "string"
description = "Enclosure Password"
default = "password"
}
variable "enc_name" {
type = "string"
description = "Enclosure name"
default = "Enc-1"
}
data "oneview_enclosure_group" "enclosure_group" {
name = "TestEnclosureGroup_Renamed"
}
data "oneview_scope" "scope" {
name = "test"
}
resource "oneview_enclosure" "enclosure_inst" {
enclosure_group_uri = "${data.oneview_enclosure_group.enclosure_group.uri}"
host_name = "${var.en_hostname}"
Expand All @@ -53,7 +47,7 @@ resource "oneview_enclosure" "enclosure_inst" {
*/

#Importing Existing Enclosure
#terraform import oneview_enclosure.enclosure_inst <your_enclosure_name>
#terraform import oneview_enclosure.enclosure_inst your_enclosure_name

resource "oneview_enclosure" "import_enc" {
}
Expand Down
5 changes: 2 additions & 3 deletions examples/enclosures/update_resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ resource "oneview_enclosure" "import_enc" {
op = "replace"
path = "/name"
value = "0000A66101 Renamed"
name = "0000A66101"
name = "0000A66101 Renamed"
enclosure_group_uri = data.oneview_enclosure.enclosure.enclosure_group_uri
}

}
18 changes: 9 additions & 9 deletions examples/ethernet_networks/data_source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ provider "oneview" {

# Testing data source
data "oneview_ethernet_network" "ethernetnetworks" {
name = "TestEthNetwork_terraform_Rename"
name = "<ethernet_rename>"
}

resource "oneview_ethernet_network" "ethernetnetwork_1" {
name = "Auto-Ethernet-1"
ethernet_network_type = "Tagged"
type = "ethernet-networkV4"
vlan_id = 101
name = "<data_source_terraform1>"
ethernet_network_type = "<ethernet_network_type>"
type = "<type>"
vlan_id = 200
}

resource "oneview_ethernet_network" "ethernetnetwork_2" {
name = "Auto-Ethernet-2"
ethernet_network_type = "Tagged"
type = "ethernet-networkV4"
vlan_id = 102
name = "<data_source_terraform2>"
ethernet_network_type = "<ethernet_network_type>"
type = "<type>"
vlan_id = 2001
}

#Importing Existing resource
Expand Down
13 changes: 7 additions & 6 deletions examples/ethernet_networks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ provider "oneview" {
}

data "oneview_scope" "scope" {
name = "Auto-Scope"
name = "<scope>"
}

# Creates Ethernet Network Resource with required bandwidth
resource "oneview_ethernet_network" "ethernetnetwork" {
name = "TestEthNetwork_terraform"
ethernet_network_type = "Tagged"
type = "ethernet-networkV4"
vlan_id = 100
name = "<ethernet_name>"
ethernet_network_type = "<ethernet_network_type>"
type = "<type>"
vlan_id = 200
initial_scope_uris = [data.oneview_scope.scope.uri]
bandwidth {
maximum_bandwidth = 10000
typical_bandwidth = 1500
}
}

/*
# Creates 2 Ethernet Network Resource
resource "oneview_ethernet_network" "ethernetnetwork_1" {
Expand Down Expand Up @@ -53,4 +54,4 @@ resource "oneview_ethernet_network" "ethernetnetwork_2" {
# type = "ethernet-networkV4"
# }
*/
*/
11 changes: 6 additions & 5 deletions examples/ethernet_networks/update_resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ provider "oneview" {
}

data "oneview_scope" "scope" {
name = "Scope Test"
name = "<scope>"
}

# Updates initial scope uris and name of the resource created from main.tf
resource "oneview_ethernet_network" "ethernetnetwork" {
name = "TestEthNetwork_terraform_Rename"
ethernet_network_type = "Tagged"
name = "<ethernet_rename>"
ethernet_network_type = "<ethernet_network_type>"
initial_scope_uris = [data.oneview_scope.scope.uri]
type = "ethernet-networkV4"
vlan_id = 100
type = "<type>"
vlan_id = 200
}
/*
resource "oneview_ethernet_network" "ethernetnetwork_1" {
Expand All @@ -34,3 +34,4 @@ resource "oneview_ethernet_network" "ethernetnetwork_2" {
vlan_id = 102
}
*/

2 changes: 1 addition & 1 deletion examples/fc_networks/data_source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ provider "oneview" {

# Testing data source
data "oneview_fc_network" "fc_network" {
name = "TestFCNetwork_Renamed"
name = "<fcn_rename>"
}

output "oneview_fc_network_value" {
Expand Down
Loading

0 comments on commit a407d92

Please sign in to comment.