Transcription
Composable Infrastructure withACI and TerraformHow to share network knowledge in a DRYfashionNicolas Vermande, Technical Marketing Engineer - IBNG@nvermande#CiscoLive #DevNetDay
5 years at CiscoBig focus on Cloud NativeAll things OSS and ACIAutomation junkieAbout MeLove codingDouble VMware VCDXCCIEGroove Metal addict
Agenda Introduction to Terraform Optimize ACI Operations Practical code example Call to Actions#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public3
Immutable InfrastructureCloud Instance or VMOSCloud Instance or VMUpdatePackage v1OSPackage v2#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public4
Immutable InfrastructureCloud Instance or VMOSPackage v1Cloud Instance or VMUpdateapt-get updateapt-get upgradeOSPackage v2reboot if necessary#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public5
Immutable InfrastructureCloud Instance or VMOSDestroy Create newPackage v1OSapt-get updateapt-get upgradePackage v2#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public6
Immutable InfrastructureNo CustomizationStateless SystemData needs to be externalized#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public7
Composable Infrastructure Re-usable modules Import of existing components Dependency management Sharing of knowledge Versions linked to environment#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public8
Terraform TerminologyResource “class”Project folderResource “instance”main.tfname is an attribute ofthe instancevariables.tfterraform.tfvars#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public9
Main CommandsExecute ActionsExecution PlanDisplay actions to beperformed to reach thedesired stateplanapplyCurrent StateCurrent output from thestate fileModify state of resources inaccordance to the planRemove Resourcesshowdestroy#CiscoLive #DevNetDayDelete infrastructure resourcespresent in the state file 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public10
Where is the state file?Project .tfstatemanaged resources state what is thecurrent state of the real infrastructureterraform.tfstate.backup#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public11
ACI Operations with Terraform Use Remote Backend (Terraform Cloud has it by default) Use Git or any other VCS to managed configuration files Few resources per TF file is better Use Data Sources to avoid unexpected ACI construct deletion Create outputs for other teams to reference global ACI networkconstructs (e.g.: Tenant, VRF, etc)#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public12
Keep it DRY Modules are like functions and provide reusable components Modules are Terraform configuration files within a folder (nothingmore), but variables are not usable in main TF file outside of themodule stanza Modules only take inputs, return outputs and contain resources.#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public13
Practical ExampleNetwork TeamApp TeamNetwork modulemain.tfApp module calloutput: list of EPGs#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public
Practical ExampleModule instanceLocation of the module calledModule inputs#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public15
Practical Examplereference to previousmodule output#CiscoLive #DevNetDaySession ID 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public16
Practical Example Output defined in the network module:#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public17
Call to Actions Start using Terraform to create basic ACI objects Create you first module that can be re-used for repetitive tasks Explore Terraform Cloud and workspaces Think about ACI services you can provide to other teams asmodules Think about ACI outputs that other teams will need Code can be found here: g#CiscoLive #DevNetDay 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public18
Thank you#CiscoLive #DevNetDay
#CiscoLive #DevNetDay
Composable Infrastructure with ACI and Terraform. About Me Sess2 5 years at Cisco All things OSS and ACI Big focus on Cloud Native Automation junkie Love coding Double VMware VCDX CCIE Groove